单位仓库

This commit is contained in:
sxu 2025-06-19 17:17:24 +08:00
parent 5e7e3490ef
commit 0234ca086f
7 changed files with 32 additions and 22 deletions

View File

@ -5,11 +5,10 @@ import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.bonus.canteen.core.basic.mapper.BasicCanteenMapper;
import com.bonus.canteen.core.common.domain.TreeSelect;
import com.bonus.canteen.core.iws.mapper.ImsWarehouseInfoMapper;
import com.bonus.canteen.core.supermarket.mapper.SupermarketInfoMapper;
import com.bonus.canteen.core.supply.mapper.SupplyWarehouseInfoMapper;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
@ -34,7 +33,7 @@ public class BasicAreaServiceImpl implements IBasicAreaService {
@Autowired
private SupermarketInfoMapper supermarketInfoMapper;
@Autowired
SupplyWarehouseInfoMapper supplyWarehouseInfoMapper;
ImsWarehouseInfoMapper imsWarehouseInfoMapper;
/**
* 查询区域
@ -118,12 +117,12 @@ public class BasicAreaServiceImpl implements IBasicAreaService {
if (count1 > 0) {
throw new ServiceException("该区域含有食堂信息,不能删除");
}
int coun2 = supermarketInfoMapper.getSupermarketCountByAreaIds(areaIds);
if (coun2 > 0) {
int count2 = supermarketInfoMapper.getSupermarketCountByAreaIds(areaIds);
if (count2 > 0) {
throw new ServiceException("该区域含有超市信息,不能删除");
}
int coun3 = supplyWarehouseInfoMapper.getSupplyWarehouseCountByAreaIds(areaIds);
if (coun3 > 0) {
int count3 = imsWarehouseInfoMapper.getImsWarehouseCountByAreaIds(areaIds);
if (count3 > 0) {
throw new ServiceException("该区域含有仓库信息,不能删除");
}
return basicAreaMapper.deleteBasicAreaByAreaIds(areaIds);

View File

@ -18,6 +18,8 @@ public interface ImsWarehouseInfoMapper {
*/
public ImsWarehouseInfo selectImsWarehouseInfoByWarehouseId(Long warehouseId);
public int getImsWarehouseCountByAreaIds(Long[] areaIds);
/**
* 查询仓库信息列表
*

View File

@ -45,12 +45,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
cmt.material_type_id, cmt.material_type_name,
a.area_id, a.area_name,
cm.nutrition_type_id, cnt.nutrition_type_name,
spu.unit_name,cm.unit_id
iu.unit_name,cm.unit_id
from cook_material cm
left join cook_material_type cmt on cm.material_type_id = cmt.material_type_id
left join cook_nutrition_type cnt on cm.nutrition_type_id = cnt.nutrition_type_id
left join cook_nutrition cn on cm.nutrition_id = cn.nutrition_id
left join supply_product_unit spu on cm.unit_id = spu.unit_id
left join ims_unit iu on cm.unit_id = iu.unit_id
left join basic_area a on cm.area_id = a.area_id
</sql>

View File

@ -59,6 +59,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where warehouse_id = #{warehouseId}
</select>
<select id="getImsWarehouseCountByAreaIds" resultType="Integer">
select count(1)
from ims_warehouse_info
where area_id in
<foreach item="areaId" collection="array" open="(" separator="," close=")">
#{areaId}
</foreach>
</select>
<insert id="insertImsWarehouseInfo" parameterType="com.bonus.canteen.core.iws.domain.ImsWarehouseInfo" useGeneratedKeys="true" keyProperty="warehouseId">
insert into ims_warehouse_info
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -39,10 +39,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
si.min_delivery_time, si.select_time_interval, si.delivery_cost, si.auto_verify_day,
si.delivery_way, si.refund_limit_time, si.if_relate_drp, si.meal_code, si.if_enable_pay_code,
si.pay_code_url, si.del_flag, si.create_by, si.create_time, si.update_by, si.update_time,
ba.area_name, swi.warehouse_name
ba.area_name, iwi.warehouse_name
from supermarket_info si
left join basic_area ba on si.area_id = ba.area_id
left join supply_warehouse_info swi on swi.warehouse_id = si.warehouse_id
left join ims_warehouse_info iwi on iwi.warehouse_id = si.warehouse_id
</sql>
<select id="selectSupermarketInfoList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketInfo" resultMap="SupermarketInfoResult">

View File

@ -35,11 +35,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sm.bar_code, sm.unit_id, sm.sale_price, sm.unit_price, sm.sales_mode, sm.shelf_life_type,
sm.shelf_life_days, sm.pur_price_ceiling, sm.big_category_id, sm.`size`, sm.description,
sm.create_by, sm.create_time, sm.update_by, sm.update_time,
ba.area_name, smt.material_type_name, spu.unit_name
ba.area_name, smt.material_type_name, iu.unit_name
from supermarket_material sm
left join basic_area ba on ba.area_id = sm.area_id
left join supermarket_material_type smt on smt.material_type_id = sm.material_type_id
left join supply_product_unit spu on spu.unit_id = sm.unit_id
left join ims_unit iu on iu.unit_id = sm.unit_id
</sql>
<select id="selectSupermarketMaterialList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketMaterial" resultMap="SupermarketMaterialResult">

View File

@ -26,10 +26,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectSupermarketProductVo">
select sp.product_id, sp.supermarket_id, sp.material_id, sp.putaway_state, sp.if_online, sp.sale_price,
sp.pref_price, sp.person_limit, sp.one_day_limit, sp.img_url, sp.inventory_num, sp.create_by,
sp.create_time, sp.update_by, sp.update_time, sm.material_name,smt.material_type_name, spu.unit_name
sp.create_time, sp.update_by, sp.update_time, sm.material_name,smt.material_type_name, iu.unit_name
from supermarket_product sp
left join supermarket_material sm on sm.material_id = sp.material_id
left join supply_product_unit spu on spu.unit_id = sm.unit_id
left join ims_unit iu on iu.unit_id = sm.unit_id
left join supermarket_material_type smt on smt.material_type_id = sm.material_type_id
</sql>
@ -58,11 +58,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sm.bar_code, sm.unit_id, sm.sale_price, sm.unit_price, sm.sales_mode, sm.shelf_life_type,
sm.shelf_life_days, sm.pur_price_ceiling, sm.big_category_id, sm.`size`, sm.description,
sm.create_by, sm.create_time, sm.update_by, sm.update_time,
ba.area_name, smt.material_type_name, spu.unit_name
ba.area_name, smt.material_type_name, iu.unit_name
from supermarket_material sm
left join basic_area ba on ba.area_id = sm.area_id
left join supermarket_material_type smt on smt.material_type_id = sm.material_type_id
left join supply_product_unit spu on spu.unit_id = sm.unit_id
left join ims_unit iu on iu.unit_id = sm.unit_id
left join supermarket_product sp on sm.material_id=sp.material_id
where sp.material_id is null
<if test="areaId != null and areaId != ''"> and sm.area_id = #{areaId}</if>