Browse Source

Merge remote-tracking branch 'origin/dev_bugfix_ljj' into dev

release
yinzuomei 4 years ago
parent
commit
15f169f19b
  1. 5
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java
  2. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml

5
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcResiDemandDictServiceImpl.java

@ -81,6 +81,7 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
@Override
@Transactional(rollbackFor = Exception.class)
public void addFirstCategory(AddFirstCategoryFormDTO formDTO) {
formDTO.setCategoryName(formDTO.getCategoryName().trim());
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.ONE, NumConstant.ZERO_STR,null) > NumConstant.ZERO) {
// 名称唯一
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("【%s】已存在", formDTO.getCategoryName()), "分类名称已存在");
@ -105,6 +106,7 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
@Transactional(rollbackFor = Exception.class)
@Override
public void addChild(AddCategoryFormDTO formDTO) {
formDTO.setCategoryName(formDTO.getCategoryName().trim());
if(NumConstant.ZERO_STR.equals(formDTO.getParentCategoryCode())){
throw new RenException("添加一级分类,调用接口/heart/icresidemanddict/addfirst");
}
@ -160,8 +162,9 @@ public class IcResiDemandDictServiceImpl extends BaseServiceImpl<IcResiDemandDic
@Override
@Transactional(rollbackFor = Exception.class)
public void update(UpdateFormDTO formDTO) {
formDTO.setCategoryName(formDTO.getCategoryName().trim());
IcResiDemandDictEntity origin = baseDao.selectById(formDTO.getCategoryId());
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), NumConstant.TWO, origin.getParentCode(), formDTO.getCategoryId()) > NumConstant.ZERO) {
if (checkCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), formDTO.getLevel(), origin.getParentCode(), formDTO.getCategoryId()) > NumConstant.ZERO) {
// 名称唯一
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), String.format("【%s】已存在", formDTO.getCategoryName()), "分类名称已存在");
}

4
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcResiDemandDictDao.xml

@ -192,9 +192,7 @@
CONVERT ( m.CATEGORY_CODE, UNSIGNED )) AS maxFirstCategoryCode
FROM
ic_resi_demand_dict m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID = #{customerId}
WHERE m.CUSTOMER_ID = #{customerId}
AND m.`LEVEL` = #{level}
and m.parent_code=#{parentCode}
</select>

Loading…
Cancel
Save