mirror of https://github.com/qiurunze123/miaosha
25 lines
939 B
Java
25 lines
939 B
Java
package com.geekq.miaosha.dao;
|
|
|
|
import com.geekq.miaosha.domain.MiaoshaGoods;
|
|
import com.geekq.miaosha.vo.GoodsVo;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Select;
|
|
import org.apache.ibatis.annotations.Update;
|
|
|
|
import java.util.List;
|
|
|
|
@Mapper
|
|
public interface GoodsDao {
|
|
|
|
@Select("select g.*,mg.stock_count, mg.start_date, mg.end_date,mg.miaosha_price from miaosha_goods mg left join goods g on mg.goods_id = g.id")
|
|
public List<GoodsVo> listGoodsVo();
|
|
|
|
@Select("select g.*,mg.stock_count, mg.start_date, mg.end_date,mg.miaosha_price from miaosha_goods mg left join goods g on mg.goods_id = g.id where g.id = #{goodsId}")
|
|
public GoodsVo getGoodsVoByGoodsId(@Param("goodsId") long goodsId);
|
|
|
|
@Update("update miaosha_goods set stock_count = stock_count - 1 where goods_id = #{goodsId} and stock_count > 0")
|
|
public int reduceStock(MiaoshaGoods g);
|
|
|
|
}
|