bug 食堂修改

This commit is contained in:
lizhenhua 2025-08-08 15:00:51 +08:00
parent 9cf676d4a9
commit d91d4ad1cd
7 changed files with 83 additions and 36 deletions

View File

@ -6,14 +6,14 @@ import org.apache.ibatis.annotations.Param;
/**
* 原料信息Mapper接口
*
*
* @author xsheng
* @date 2025-05-25
*/
public interface CookMaterialMapper {
/**
* 查询原料信息
*
*
* @param materialId 原料信息主键
* @return 原料信息
*/
@ -21,7 +21,7 @@ public interface CookMaterialMapper {
/**
* 查询原料信息列表
*
*
* @param cookMaterial 原料信息
* @return 原料信息集合
*/
@ -29,7 +29,7 @@ public interface CookMaterialMapper {
/**
* 新增原料信息
*
*
* @param cookMaterial 原料信息
* @return 结果
*/
@ -37,7 +37,7 @@ public interface CookMaterialMapper {
/**
* 修改原料信息
*
*
* @param cookMaterial 原料信息
* @return 结果
*/
@ -45,7 +45,7 @@ public interface CookMaterialMapper {
/**
* 删除原料信息
*
*
* @param materialId 原料信息主键
* @return 结果
*/
@ -53,7 +53,7 @@ public interface CookMaterialMapper {
/**
* 批量删除原料信息
*
*
* @param materialIds 需要删除的数据主键集合
* @return 结果
*/
@ -80,5 +80,8 @@ public interface CookMaterialMapper {
* @param materialIds 原料ID
* @return 存在返回1
*/
public int checkIsUsecMaterial(@Param("materialIds") Long[] materialIds);
public int checkIsUse(@Param("materialIds") Long[] materialIds);
}

View File

@ -3,6 +3,8 @@ package com.bonus.canteen.core.cook.service.impl;
import java.util.List;
import java.util.Objects;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.bonus.canteen.core.utils.SysUtil;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
@ -14,7 +16,7 @@ import com.bonus.canteen.core.cook.service.ICookMaterialService;
/**
* 原料信息Service业务层处理
*
*
* @author xsheng
* @date 2025-05-25
*/
@ -25,7 +27,7 @@ public class CookMaterialServiceImpl implements ICookMaterialService {
/**
* 查询原料信息
*
*
* @param materialId 原料信息主键
* @return 原料信息
*/
@ -36,18 +38,26 @@ public class CookMaterialServiceImpl implements ICookMaterialService {
/**
* 查询原料信息列表
*
*
* @param cookMaterial 原料信息
* @return 原料信息
*/
@Override
public List<CookMaterial> selectCookMaterialList(CookMaterial cookMaterial) {
return cookMaterialMapper.selectCookMaterialList(cookMaterial);
List<CookMaterial> cookMaterials = cookMaterialMapper.selectCookMaterialList(cookMaterial);
cookMaterials.forEach(item -> {
String imgUrl = item.getImgUrl();
if (imgUrl != null && !imgUrl.isEmpty()) {
item.setImgUrl(FileUrlUtil.getFileUrl(imgUrl));
}
});
return cookMaterials;
}
/**
* 新增原料信息
*
*
* @param cookMaterial 原料信息
* @return 结果
*/
@ -83,7 +93,7 @@ public class CookMaterialServiceImpl implements ICookMaterialService {
/**
* 修改原料信息
*
*
* @param cookMaterial 原料信息
* @return 结果
*/
@ -122,7 +132,7 @@ public class CookMaterialServiceImpl implements ICookMaterialService {
/**
* 批量删除原料信息
*
*
* @param materialIds 需要删除的原料信息主键
* @return 结果
*/
@ -137,7 +147,7 @@ public class CookMaterialServiceImpl implements ICookMaterialService {
/**
* 删除原料信息信息
*
*
* @param materialId 原料信息主键
* @return 结果
*/

View File

@ -5,14 +5,14 @@ import com.bonus.canteen.core.ims.domain.WarehouseInfo;
/**
* 仓库信息Mapper接口
*
*
* @author xsheng
* @date 2025-06-19
*/
public interface WarehouseInfoMapper {
/**
* 查询仓库信息
*
*
* @param warehouseId 仓库信息主键
* @return 仓库信息
*/
@ -22,7 +22,7 @@ public interface WarehouseInfoMapper {
/**
* 查询仓库信息列表
*
*
* @param imsWarehouseInfo 仓库信息
* @return 仓库信息集合
*/
@ -30,7 +30,7 @@ public interface WarehouseInfoMapper {
/**
* 新增仓库信息
*
*
* @param imsWarehouseInfo 仓库信息
* @return 结果
*/
@ -38,7 +38,7 @@ public interface WarehouseInfoMapper {
/**
* 修改仓库信息
*
*
* @param imsWarehouseInfo 仓库信息
* @return 结果
*/
@ -46,7 +46,7 @@ public interface WarehouseInfoMapper {
/**
* 删除仓库信息
*
*
* @param warehouseId 仓库信息主键
* @return 结果
*/
@ -54,9 +54,11 @@ public interface WarehouseInfoMapper {
/**
* 批量删除仓库信息
*
*
* @param warehouseIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteImsWarehouseInfoByWarehouseIds(Long[] warehouseIds);
int findWarehouseCode(String warehouseCode);
}

View File

@ -2,6 +2,8 @@ package com.bonus.canteen.core.ims.service.impl;
import java.util.Collections;
import java.util.List;
import com.bonus.canteen.core.cook.mapper.CookMaterialMapper;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -12,7 +14,7 @@ import com.bonus.canteen.core.ims.service.IImsUnitService;
/**
* 计量单位Service业务层处理
*
*
* @author xsheng
* @date 2025-06-19
*/
@ -20,10 +22,12 @@ import com.bonus.canteen.core.ims.service.IImsUnitService;
public class ImsUnitServiceImpl implements IImsUnitService {
@Autowired
private ImsUnitMapper imsUnitMapper;
@Autowired
private CookMaterialMapper cookMaterialMapper;
/**
* 查询计量单位
*
*
* @param unitId 计量单位主键
* @return 计量单位
*/
@ -39,7 +43,7 @@ public class ImsUnitServiceImpl implements IImsUnitService {
/**
* 查询计量单位列表
*
*
* @param imsUnit 计量单位
* @return 计量单位
*/
@ -50,7 +54,7 @@ public class ImsUnitServiceImpl implements IImsUnitService {
/**
* 新增计量单位
*
*
* @param imsUnit 计量单位
* @return 结果
*/
@ -66,7 +70,7 @@ public class ImsUnitServiceImpl implements IImsUnitService {
/**
* 修改计量单位
*
*
* @param imsUnit 计量单位
* @return 结果
*/
@ -82,18 +86,22 @@ public class ImsUnitServiceImpl implements IImsUnitService {
/**
* 批量删除计量单位
*
*
* @param unitIds 需要删除的计量单位主键
* @return 结果
*/
@Override
public int deleteImsUnitByUnitIds(Long[] unitIds) {
//从原料表中去查询如果存在就不能进行删除
if (cookMaterialMapper.checkIsUsecMaterial(unitIds) > 0){
throw new ServiceException("该计量单位被使用,不允许删除!");
}
return imsUnitMapper.deleteImsUnitByUnitIds(unitIds);
}
/**
* 删除计量单位信息
*
*
* @param unitId 计量单位主键
* @return 结果
*/

View File

@ -11,7 +11,7 @@ import com.bonus.canteen.core.ims.service.IWarehouseInfoService;
/**
* 仓库信息Service业务层处理
*
*
* @author xsheng
* @date 2025-06-19
*/
@ -22,7 +22,7 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService {
/**
* 查询仓库信息
*
*
* @param warehouseId 仓库信息主键
* @return 仓库信息
*/
@ -33,7 +33,7 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService {
/**
* 查询仓库信息列表
*
*
* @param imsWarehouseInfo 仓库信息
* @return 仓库信息
*/
@ -44,7 +44,7 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService {
/**
* 新增仓库信息
*
*
* @param imsWarehouseInfo 仓库信息
* @return 结果
*/
@ -52,6 +52,11 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService {
public int insertImsWarehouseInfo(WarehouseInfo imsWarehouseInfo) {
imsWarehouseInfo.setCreateTime(DateUtils.getNowDate());
try {
//检查仓库id是否唯一唯一的话进行下面否在返回进行提示
int warehouseCode = imsWarehouseInfoMapper.findWarehouseCode(imsWarehouseInfo.getWarehouseCode());
if (warehouseCode>0) {
throw new ServiceException("仓库编码已存在");
}
return imsWarehouseInfoMapper.insertImsWarehouseInfo(imsWarehouseInfo);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
@ -60,7 +65,7 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService {
/**
* 修改仓库信息
*
*
* @param imsWarehouseInfo 仓库信息
* @return 结果
*/
@ -68,6 +73,10 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService {
public int updateImsWarehouseInfo(WarehouseInfo imsWarehouseInfo) {
imsWarehouseInfo.setUpdateTime(DateUtils.getNowDate());
try {
int warehouseCode = imsWarehouseInfoMapper.findWarehouseCode(imsWarehouseInfo.getWarehouseCode());
if (warehouseCode>0) {
throw new ServiceException("仓库编码已存在");
}
return imsWarehouseInfoMapper.updateImsWarehouseInfo(imsWarehouseInfo);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
@ -76,7 +85,7 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService {
/**
* 批量删除仓库信息
*
*
* @param warehouseIds 需要删除的仓库信息主键
* @return 结果
*/
@ -87,7 +96,7 @@ public class WarehouseInfoServiceImpl implements IWarehouseInfoService {
/**
* 删除仓库信息信息
*
*
* @param warehouseId 仓库信息主键
* @return 结果
*/

View File

@ -135,6 +135,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="checkIsUsecMaterial" resultType="java.lang.Integer">
select count(1) from cook_material
<where>
unit_id in
<foreach item="materialId" collection="materialIds" open="(" separator="," close=")">
#{materialId}
</foreach>
</where>
</select>
<insert id="insertCookMaterial" parameterType="com.bonus.canteen.core.cook.domain.CookMaterial" useGeneratedKeys="true" keyProperty="materialId">
insert into cook_material
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -76,6 +76,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{areaId}
</foreach>
</select>
<select id="findWarehouseCode" resultType="java.lang.Integer">
select count(1)
from ims_warehouse_info
where warehouse_code = #{warehouseCode}
</select>
<insert id="insertImsWarehouseInfo" parameterType="com.bonus.canteen.core.ims.domain.WarehouseInfo" useGeneratedKeys="true" keyProperty="warehouseId">
insert into ims_warehouse_info