Merge branch 'master' into report
This commit is contained in:
commit
e99d4c94e2
|
|
@ -18,6 +18,8 @@ public interface SupermarketProductMapper {
|
|||
*/
|
||||
public SupermarketProduct selectSupermarketProductByProductId(Long productId);
|
||||
|
||||
public List<SupermarketProduct> selectSupermarketProductByMaterialIds(Long[] materialIds);
|
||||
|
||||
/**
|
||||
* 查询超市商城商品列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.bonus.canteen.core.supermarket.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.canteen.core.supermarket.domain.SupermarketProduct;
|
||||
import com.bonus.canteen.core.supermarket.mapper.SupermarketProductMapper;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -8,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||
import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialMapper;
|
||||
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
|
||||
import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialService;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* 商品信息Service业务层处理
|
||||
|
|
@ -19,6 +23,8 @@ import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialService;
|
|||
public class SupermarketMaterialServiceImpl implements ISupermarketMaterialService {
|
||||
@Autowired
|
||||
private SupermarketMaterialMapper supermarketMaterialMapper;
|
||||
@Autowired
|
||||
private SupermarketProductMapper supermarketProductMapper;
|
||||
|
||||
/**
|
||||
* 查询商品信息
|
||||
|
|
@ -82,6 +88,10 @@ public class SupermarketMaterialServiceImpl implements ISupermarketMaterialServi
|
|||
*/
|
||||
@Override
|
||||
public int deleteSupermarketMaterialByMaterialIds(Long[] materialIds) {
|
||||
List<SupermarketProduct> list = supermarketProductMapper.selectSupermarketProductByMaterialIds(materialIds);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
throw new ServiceException("该原料下含有商品,不能删除");
|
||||
}
|
||||
return supermarketMaterialMapper.deleteSupermarketMaterialByMaterialIds(materialIds);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="glycemicIndex != null "> and cd.glycemic_index = #{glycemicIndex}</if>
|
||||
<if test="sort != null "> and cd.sort = #{sort}</if>
|
||||
<if test="canteenId != null "> and cd.canteen_id = #{canteenId}</if>
|
||||
<if test="stallId != null "> and cd.shopstall_id = #{stallId}</if>
|
||||
<if test="stallId != null "> and (cd.shopstall_id = #{stallId} or cd.shopstall_id is null or cd.shopstall_id = '')</if>
|
||||
<if test="hideFlag != null "> and cd.hide_flag = #{hideFlag}</if>
|
||||
<if test="convertFlag != null "> and cd.convert_flag = #{convertFlag}</if>
|
||||
<if test="materialCost != null "> and cd.material_cost = #{materialCost}</if>
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join basic_canteen ac on mr.canteen_id = ac.canteen_id
|
||||
left join basic_stall ass on mr.stall_id = ass.stall_id
|
||||
where
|
||||
bind_type = 2
|
||||
bind_type = 2 and mr.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectMonthSalesStall" resultType="com.bonus.canteen.core.cook.vo.StallMonthSalesVO">
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectSupermarketProductVo">
|
||||
select product_id, supermarket_id, material_id, putaway_state, if_online, sale_price, pref_price, person_limit, one_day_limit, img_url, inventory_num, create_by, create_time, update_by, update_time from supermarket_product
|
||||
select product_id, supermarket_id, material_id, putaway_state, if_online, sale_price, pref_price,
|
||||
person_limit, one_day_limit, img_url, inventory_num, create_by, create_time, update_by, update_time
|
||||
from supermarket_product
|
||||
</sql>
|
||||
|
||||
<select id="selectSupermarketProductList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketProduct" resultMap="SupermarketProductResult">
|
||||
|
|
@ -45,6 +47,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectSupermarketProductVo"/>
|
||||
where product_id = #{productId}
|
||||
</select>
|
||||
|
||||
<select id="selectSupermarketProductByMaterialIds" parameterType="String" resultMap="SupermarketProductResult">
|
||||
<include refid="selectSupermarketProductVo"/>
|
||||
where material_id in
|
||||
<foreach item="materialId" collection="array" open="(" separator="," close=")">
|
||||
#{materialId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="insertSupermarketProduct" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketProduct" useGeneratedKeys="true" keyProperty="productId">
|
||||
insert into supermarket_product
|
||||
|
|
|
|||
Loading…
Reference in New Issue