This commit is contained in:
shuo.wang
2025-06-24 17:36:13 +08:00
parent 88b6cefffb
commit 5c851b3d8e
2 changed files with 6 additions and 3 deletions

View File

@@ -38,12 +38,11 @@
</select>
<select id="queryByProductCode" resultMap="BaseResultMap">
SELECT * FROM xfsg_pre_fried_products and deleted = 0
<where>
SELECT * FROM xfsg_pre_fried_products
where deleted = 0
<if test="productCode != null and productCode != ''">
AND product_code = #{productCode}
</if>
</where>
</select>
<delete id="batchDelete">

View File

@@ -51,6 +51,10 @@ public class PreFriedProductsServiceImpl implements PreFriedProductsService {
if (dto==null||dto.getId() == null){
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
PreFriedProductsDO preFriedProductsDO = preFriedProductsDAO.queryByProductCode(dto.getProductCode());
if (preFriedProductsDO!=null && !preFriedProductsDO.getId().equals(dto.getId())){
throw new ServiceException(ErrorCodeEnum.PRODUCTS_CODE_EXIST);
}
PreFriedProductsDO product = convertToDO(dto);
product.setUpdatedTime(new Date());
product.setUpdatedUserId(userId);