Commit b498609e857f09b90f895fd2a8638235a4150d2b
1 parent
75dda45a
feat:防止注册多个相同客户注册邮件
Showing
2 changed files
with
11 additions
and
0 deletions
src/main/java/com/order/erp/mapper/order/ReceiveEmailMappingMapper.java
... | ... | @@ -21,5 +21,7 @@ public interface ReceiveEmailMappingMapper extends BaseMapper<ReceiveEmailMappin |
21 | 21 | ReceiveEmailMappingDO getReceiveEmailMappingDO(@Param("id") Long id); |
22 | 22 | @Select("select * from receive_email_mapping where enable_flag in (#{10},#{30})") |
23 | 23 | List<ReceiveEmailMappingDO> listGetAll(@Param("10")int enableFlag,@Param("30") int enableFlag1); |
24 | + @Select("select * from receive_email_mapping where type_value = #{typeValue}") | |
25 | + List<ReceiveEmailMappingDO> byTypeValueReceiveEmailMappingDO(@Param("typeValue") String typeValue); | |
24 | 26 | } |
25 | 27 | ... | ... |
src/main/java/com/order/erp/service/order/impl/ReceiveEmailMappingServiceImpl.java
... | ... | @@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
12 | 12 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
13 | 13 | import com.order.erp.common.constant.Constant; |
14 | 14 | import com.order.erp.common.constant.ServerResult; |
15 | +import com.order.erp.domain.dto.BaseDO; | |
15 | 16 | import com.order.erp.domain.dto.order.ReceiveEmailMappingDO; |
16 | 17 | import com.order.erp.domain.vo.order.ReceiveEmailMappingQueryVO; |
17 | 18 | import com.order.erp.domain.vo.order.ReceiveEmailMappingVO; |
... | ... | @@ -73,6 +74,10 @@ public class ReceiveEmailMappingServiceImpl extends ServiceImpl<ReceiveEmailMapp |
73 | 74 | */ |
74 | 75 | @Override |
75 | 76 | public ServerResult add(ReceiveEmailMappingVO receiveEmailMappingVO) { |
77 | + List<ReceiveEmailMappingDO> ReceiveEmailMappingDoList = baseMapper.byTypeValueReceiveEmailMappingDO(receiveEmailMappingVO.getTypeValue()); | |
78 | + if(CollectionUtils.isNotEmpty(ReceiveEmailMappingDoList)){ | |
79 | + return ServerResult.fail("已存在"+receiveEmailMappingVO.getTypeValue()+"客户"); | |
80 | + } | |
76 | 81 | //todo 校验 |
77 | 82 | if (Objects.nonNull(receiveEmailMappingVO.getId())) { |
78 | 83 | receiveEmailMappingVO.setId(null); |
... | ... | @@ -95,6 +100,10 @@ public class ReceiveEmailMappingServiceImpl extends ServiceImpl<ReceiveEmailMapp |
95 | 100 | if (Objects.isNull(receiveEmailMappingVO.getId())) { |
96 | 101 | return ServerResult.fail("id 不能为空"); |
97 | 102 | } |
103 | + List<ReceiveEmailMappingDO> ReceiveEmailMappingDoList = baseMapper.byTypeValueReceiveEmailMappingDO(receiveEmailMappingVO.getTypeValue()); | |
104 | + if(CollectionUtils.isNotEmpty(ReceiveEmailMappingDoList)){ | |
105 | + return ServerResult.fail("已存在"+receiveEmailMappingVO.getTypeValue()+"客户"); | |
106 | + } | |
98 | 107 | ReceiveEmailMappingDO receiveEmailMappingDo = BeanUtil.copyProperties(receiveEmailMappingVO, ReceiveEmailMappingDO.class); |
99 | 108 | receiveEmailMappingDo.setConfigInfos(JSONObject.toJSONString(receiveEmailMappingVO.getConfigInfos())); |
100 | 109 | updateById(receiveEmailMappingDo); | ... | ... |