标签组新增标签组名不可重复

This commit is contained in:
feng.li
2023-08-10 16:21:33 +08:00
parent f84e9e6e27
commit 3c4909b8a5
6 changed files with 34 additions and 7 deletions

View File

@@ -25,7 +25,7 @@ public interface LabelGroupService {
* 添加标签组
* @param dto 新增标签组信息
*/
void addLabelGroup(LabelGroupAddDTO dto);
void addLabelGroup(LabelGroupAddDTO dto) throws ApiException;
/**
* 修改标签组信息

View File

@@ -47,10 +47,14 @@ public class LabelGroupServiceImpl implements LabelGroupService {
* @param dto 新增标签组信息
*/
@Override
public void addLabelGroup(LabelGroupAddDTO dto) {
public void addLabelGroup(LabelGroupAddDTO dto) throws ApiException {
HyPartnerLabelGroupDO labelGroupDO = new HyPartnerLabelGroupDO();
String userId = CurrentUserHolder.getUserId();
labelGroupDO.setLabelGroupName(dto.getLabelGroupName());
List<HyPartnerLabelGroupDO> existLabelGroup = labelGroupMapper.selectSelective(labelGroupDO);
if (existLabelGroup != null && existLabelGroup.size() > 0) {
throw new ApiException(ErrorCodeEnum.LABEL_GROUP_EXIST);
}
String userId = CurrentUserHolder.getUserId();
labelGroupDO.setEditUserId(userId);
labelGroupDO.setEditDate(new Date());
labelGroupDO.setCreateUserId(userId);