jsk 原料查重添加类别
This commit is contained in:
parent
b8cdc9d125
commit
0876c3b840
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* 校验是否被使用
|
||||
|
|
|
|||
|
|
@ -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 + "名称已存在");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue