jsk 原料查重添加类别

This commit is contained in:
jiask 2025-09-25 08:46:54 +08:00
parent b8cdc9d125
commit 0876c3b840
3 changed files with 4 additions and 3 deletions

View File

@ -74,7 +74,7 @@ public interface CookMaterialMapper {
* @param materialId 其他参数如原料ID等用于更新时的校验
* @return 结果
*/
public int checkIsExistByName(@Param("materialName") String materialName,@Param("materialId") Long materialId, @Param("type") Long type);
public int checkIsExistByName(@Param("materialName") String materialName,@Param("materialId") Long materialId,@Param("materialTypeId") Long materialTypeId, @Param("type") Long type);
/**
* 校验是否被使用

View File

@ -93,7 +93,7 @@ public class CookMaterialServiceImpl implements ICookMaterialService {
String name = cookMaterial.getGoodsType() == 1 ? "原料" : "商品";
throw new ServiceException("" + name + "编码已存在");
}
if (cookMaterialMapper.checkIsExistByName(cookMaterial.getMaterialName(), null, cookMaterial.getGoodsType()) > 0) {
if (cookMaterialMapper.checkIsExistByName(cookMaterial.getMaterialName(), null,cookMaterial.getMaterialTypeId(), cookMaterial.getGoodsType()) > 0) {
String name = cookMaterial.getGoodsType() == 1 ? "原料" : "商品";
throw new ServiceException("" + name + "名称已存在");
}
@ -134,7 +134,7 @@ public class CookMaterialServiceImpl implements ICookMaterialService {
String name = cookMaterial.getGoodsType() == 1 ? "原料" : "商品";
throw new ServiceException("" + name + "编码已存在");
}
if (cookMaterialMapper.checkIsExistByName(cookMaterial.getMaterialName(), cookMaterial.getMaterialId(), cookMaterial.getGoodsType()) > 0) {
if (cookMaterialMapper.checkIsExistByName(cookMaterial.getMaterialName(), cookMaterial.getMaterialId(), cookMaterial.getMaterialTypeId(), cookMaterial.getGoodsType()) > 0) {
String name = cookMaterial.getGoodsType() == 1 ? "原料" : "商品";
throw new ServiceException("" + name + "名称已存在");
}

View File

@ -137,6 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
material_name = #{materialName}
<if test="materialId != null and materialId != ''"> and material_id != #{materialId}</if>
<if test="type != null and type != ''"> and goods_type = #{type}</if>
<if test="materialTypeId != null and materialTypeId != ''"> and material_type_id = #{materialTypeId}</if>
</where>
</select>