Browse Source

修改sql

dev_power_axis
YUJT 3 years ago
parent
commit
b223f8cee5
  1. 2
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java
  2. 5
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java
  3. 17
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml

2
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java

@ -60,7 +60,7 @@ public interface PowerAxisStructDao extends BaseDao<PowerAxisStructEntity> {
List<PowerAxisStructPartyCommResultDTO> getPartyCommList();
int queryName(PowerAxisStructEntity form);
int countByRepeatStruct(PowerAxisStructEntity form);
int queryCategory(PowerAxisStructEntity form);

5
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java

@ -9,7 +9,6 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -151,14 +150,14 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl<PowerAxisStructD
// 验证表单字段
private void verifyStructField(PowerAxisStructEntity struct){
private void verifyStructField(PowerAxisStructEntity struct) {
int structLevel = powerAxisTagService.selectStructLevelByCode(loginUserUtil.getLoginUserCustomerId(), PowerTagCategoryEnum.STRUCT.category(), struct.getCategoryCode());
if (PowerTagLevelEnum.ROOT.level() == structLevel) {
if (baseDao.queryCategory(struct) > NumConstant.ZERO) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "同一组织下只允许存在一个顶级节点");
}
}
if (baseDao.queryName(struct) > NumConstant.ZERO) {
if (baseDao.countByRepeatStruct(struct) > NumConstant.ZERO) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "同一组织下不允许存在重名的节点");
}
}

17
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml

@ -129,15 +129,22 @@
AND
del_flag = 0
</select>
<select id="queryName" resultType="java.lang.Integer">
<select id="countByRepeatStruct" resultType="java.lang.Integer">
SELECT
count(*)
FROM
pli_power_axis_struct
pli_power_axis_struct s
WHERE
NAME = #{name}
AND
agency_id = #{agencyId}
s.CUSTOMER_ID = #{customerId}
AND s.`NAME` = #{name}
<choose>
<when test="agencyId != null and agencyId != ''">AND s.AGENCY_ID = #{agencyId}</when>
<otherwise>
<if test="pid != null and pid != '' and pid != '0'">
AND s.AGENCY_ID = (SELECT t.agency_id FROM pli_power_axis_struct t WHERE t.ID = '1517392376018866178')
</if>
</otherwise>
</choose>
</select>
<select id="queryCategory" resultType="java.lang.Integer">
SELECT

Loading…
Cancel
Save