This commit is contained in:
parent
2c43e80e1e
commit
bb2d95709c
|
|
@ -57,4 +57,6 @@ public interface SupermarketProductMapper {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteSupermarketProductByProductIds(Long[] productIds);
|
public int deleteSupermarketProductByProductIds(Long[] productIds);
|
||||||
|
|
||||||
|
public int getProductCountOfSupermarket(Long[] supermarketIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.bonus.canteen.core.supermarket.service.impl;
|
package com.bonus.canteen.core.supermarket.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.canteen.core.supermarket.mapper.SupermarketProductMapper;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
|
@ -20,6 +22,8 @@ import com.bonus.canteen.core.supermarket.service.ISupermarketInfoService;
|
||||||
public class SupermarketInfoServiceImpl implements ISupermarketInfoService {
|
public class SupermarketInfoServiceImpl implements ISupermarketInfoService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SupermarketInfoMapper supermarketInfoMapper;
|
private SupermarketInfoMapper supermarketInfoMapper;
|
||||||
|
@Autowired
|
||||||
|
SupermarketProductMapper supermarketProductMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询超市
|
* 查询超市
|
||||||
|
|
@ -85,6 +89,10 @@ public class SupermarketInfoServiceImpl implements ISupermarketInfoService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSupermarketInfoBySupermarketIds(Long[] supermarketIds) {
|
public int deleteSupermarketInfoBySupermarketIds(Long[] supermarketIds) {
|
||||||
|
int count = supermarketProductMapper.getProductCountOfSupermarket(supermarketIds);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException("该超市含有商品,不能删除");
|
||||||
|
}
|
||||||
return supermarketInfoMapper.deleteSupermarketInfoBySupermarketIds(supermarketIds);
|
return supermarketInfoMapper.deleteSupermarketInfoBySupermarketIds(supermarketIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,4 +173,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{productId}
|
#{productId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="getProductCountOfSupermarket" parameterType="String">
|
||||||
|
select count(1) from supermarket_product where supermarket_id in
|
||||||
|
<foreach item="supermarketId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{supermarketId}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue