mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
禅道#782、#890问题修复
This commit is contained in:
BIN
Binary file not shown.
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
FROM report_template
|
FROM report_template
|
||||||
WHERE name = #{reqVO.name}
|
WHERE name = #{reqVO.name}
|
||||||
<if test="reqVO.id != null">
|
<if test="reqVO.id != null">
|
||||||
id != #{reqVO.id}
|
AND id != #{reqVO.id}
|
||||||
</if>
|
</if>
|
||||||
<if test="isSuperAdmin">
|
<if test="isSuperAdmin">
|
||||||
AND type = #{type}
|
AND type = #{type}
|
||||||
|
|||||||
+1
@@ -92,6 +92,7 @@ public class ErrorCodeConstants {
|
|||||||
|
|
||||||
// ========== 通知公告 1-002-008-000 ==========
|
// ========== 通知公告 1-002-008-000 ==========
|
||||||
public static final ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1_002_008_001, "当前通知公告不存在");
|
public static final ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1_002_008_001, "当前通知公告不存在");
|
||||||
|
public static final ErrorCode NOTICE_NAME_UNIQE_ERROR = new ErrorCode(1_002_008_002, "公告标题已存在,请编辑后重试");
|
||||||
|
|
||||||
// ========== 短信渠道 1-002-011-000 ==========
|
// ========== 短信渠道 1-002-011-000 ==========
|
||||||
public static final ErrorCode SMS_CHANNEL_NOT_EXISTS = new ErrorCode(1_002_011_000, "短信渠道不存在");
|
public static final ErrorCode SMS_CHANNEL_NOT_EXISTS = new ErrorCode(1_002_011_000, "短信渠道不存在");
|
||||||
|
|||||||
+22
-1
@@ -1,10 +1,11 @@
|
|||||||
package com.cf.imes.module.system.service.notice;
|
package com.cf.imes.module.system.service.notice;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.cf.imes.module.system.controller.admin.notice.vo.NoticePageReqVO;
|
import com.cf.imes.module.system.controller.admin.notice.vo.NoticePageReqVO;
|
||||||
import com.cf.imes.module.system.controller.admin.notice.vo.NoticeSaveReqVO;
|
import com.cf.imes.module.system.controller.admin.notice.vo.NoticeSaveReqVO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.notice.NoticeDO;
|
import com.cf.imes.module.system.dal.dataobject.notice.NoticeDO;
|
||||||
@@ -16,6 +17,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.cf.imes.module.system.enums.ErrorCodeConstants.NOTICE_NAME_UNIQE_ERROR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告 Service 实现类
|
* 通知公告 Service 实现类
|
||||||
@@ -30,6 +32,8 @@ public class NoticeServiceImpl implements NoticeService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createNotice(NoticeSaveReqVO createReqVO) {
|
public Long createNotice(NoticeSaveReqVO createReqVO) {
|
||||||
|
// 标题唯一性校验
|
||||||
|
validateNameExists(createReqVO);
|
||||||
NoticeDO notice = BeanUtils.toBean(createReqVO, NoticeDO.class);
|
NoticeDO notice = BeanUtils.toBean(createReqVO, NoticeDO.class);
|
||||||
noticeMapper.insert(notice);
|
noticeMapper.insert(notice);
|
||||||
return notice.getId();
|
return notice.getId();
|
||||||
@@ -39,6 +43,8 @@ public class NoticeServiceImpl implements NoticeService {
|
|||||||
public void updateNotice(NoticeSaveReqVO updateReqVO) {
|
public void updateNotice(NoticeSaveReqVO updateReqVO) {
|
||||||
// 校验是否存在
|
// 校验是否存在
|
||||||
validateNoticeExists(updateReqVO.getId());
|
validateNoticeExists(updateReqVO.getId());
|
||||||
|
// 标题唯一性校验
|
||||||
|
validateNameExists(updateReqVO);
|
||||||
// 更新通知公告
|
// 更新通知公告
|
||||||
NoticeDO updateObj = BeanUtils.toBean(updateReqVO, NoticeDO.class);
|
NoticeDO updateObj = BeanUtils.toBean(updateReqVO, NoticeDO.class);
|
||||||
noticeMapper.updateById(updateObj);
|
noticeMapper.updateById(updateObj);
|
||||||
@@ -73,4 +79,19 @@ public class NoticeServiceImpl implements NoticeService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验公告标题唯一性
|
||||||
|
*
|
||||||
|
* @param reqVO
|
||||||
|
*/
|
||||||
|
public void validateNameExists(NoticeSaveReqVO reqVO) {
|
||||||
|
Long noticeId = reqVO.getId();
|
||||||
|
LambdaQueryWrapper<NoticeDO> wrapper = new LambdaQueryWrapperX<NoticeDO>().eq(NoticeDO::getTitle, reqVO.getTitle());
|
||||||
|
if (ObjectUtil.isNotNull(noticeId)) {
|
||||||
|
wrapper.ne(NoticeDO::getId, noticeId);
|
||||||
|
}
|
||||||
|
if (noticeMapper.exists(wrapper)) {
|
||||||
|
throw exception(NOTICE_NAME_UNIQE_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user