标签组新增标签组名不可重复
This commit is contained in:
@@ -88,7 +88,8 @@ public enum ErrorCodeEnum {
|
|||||||
|
|
||||||
OUTBOUND_NUMBER_EXIST(110001, "手机号已存在!", null),
|
OUTBOUND_NUMBER_EXIST(110001, "手机号已存在!", null),
|
||||||
|
|
||||||
LABEL_GROUP_IN_USE(120001, "请勿删除仍在使用的标签组!", null);
|
LABEL_GROUP_IN_USE(120001, "该标签组下存在标签,不可删除;请确保该标签组下标签数量为0后再进行删除", null),
|
||||||
|
LABEL_GROUP_EXIST(120002, "该标签组已存在,请重新输入", null),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,30 @@
|
|||||||
select <include refid="Base_Column_List"></include>
|
select <include refid="Base_Column_List"></include>
|
||||||
from hy_partner_label_group
|
from hy_partner_label_group
|
||||||
where deleted = 0
|
where deleted = 0
|
||||||
|
<if test="labelGroupName != null and labelGroupName != ''">
|
||||||
|
and label_group_name = #{labelGroupName}
|
||||||
|
</if>
|
||||||
|
<if test="editUserId != null">
|
||||||
|
and edit_user_id = #{editUserId}
|
||||||
|
</if>
|
||||||
|
<if test="editDate != null">
|
||||||
|
and edit_date = #{editDate}
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
and create_time = #{createTime}
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
and update_time =#{updateTime}
|
||||||
|
</if>
|
||||||
|
<if test="createUserId != null">
|
||||||
|
and create_user_id = #{createUserId}
|
||||||
|
</if>
|
||||||
|
<if test="updateUserId != null">
|
||||||
|
and update_user_id = #{updateUserId}
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
and remark like concat('%', #{remark}, '%')
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import lombok.NoArgsConstructor;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Fun Li
|
* @author Fun Li
|
||||||
* @date 2023/08/10
|
* @date 2023/08/10
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public interface LabelGroupService {
|
|||||||
* 添加标签组
|
* 添加标签组
|
||||||
* @param dto 新增标签组信息
|
* @param dto 新增标签组信息
|
||||||
*/
|
*/
|
||||||
void addLabelGroup(LabelGroupAddDTO dto);
|
void addLabelGroup(LabelGroupAddDTO dto) throws ApiException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改标签组信息
|
* 修改标签组信息
|
||||||
|
|||||||
@@ -47,10 +47,14 @@ public class LabelGroupServiceImpl implements LabelGroupService {
|
|||||||
* @param dto 新增标签组信息
|
* @param dto 新增标签组信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addLabelGroup(LabelGroupAddDTO dto) {
|
public void addLabelGroup(LabelGroupAddDTO dto) throws ApiException {
|
||||||
HyPartnerLabelGroupDO labelGroupDO = new HyPartnerLabelGroupDO();
|
HyPartnerLabelGroupDO labelGroupDO = new HyPartnerLabelGroupDO();
|
||||||
String userId = CurrentUserHolder.getUserId();
|
|
||||||
labelGroupDO.setLabelGroupName(dto.getLabelGroupName());
|
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.setEditUserId(userId);
|
||||||
labelGroupDO.setEditDate(new Date());
|
labelGroupDO.setEditDate(new Date());
|
||||||
labelGroupDO.setCreateUserId(userId);
|
labelGroupDO.setCreateUserId(userId);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class LabelGroupController {
|
|||||||
|
|
||||||
@ApiOperation("新增标签组")
|
@ApiOperation("新增标签组")
|
||||||
@PostMapping({"/add"})
|
@PostMapping({"/add"})
|
||||||
public ResponseResult addLabelGroup(@RequestBody LabelGroupAddDTO dto) {
|
public ResponseResult addLabelGroup(@RequestBody LabelGroupAddDTO dto) throws ApiException {
|
||||||
labelGroupService.addLabelGroup(dto);
|
labelGroupService.addLabelGroup(dto);
|
||||||
return ResponseResult.success();
|
return ResponseResult.success();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user