Merge remote-tracking branch 'origin/dev/feat/partner1.3_20230828' into dev/feat/partner1.3_20230828

This commit is contained in:
俞扬
2023-08-11 11:41:14 +08:00
9 changed files with 210 additions and 62 deletions

View File

@@ -86,10 +86,11 @@ public enum ErrorCodeEnum {
INSPECTION_INFO_NOT_EXIST(600005, "稽核信息不存在!", null), INSPECTION_INFO_NOT_EXIST(600005, "稽核信息不存在!", null),
OPEN_AREA_NULL(600006,"归属地区不能为空",null), OPEN_AREA_NULL(600006,"归属地区不能为空",null),
OUTBOUND_NUMBER_EXIST(110001, "手机号已存在!", null), OUTBOUND_NUMBER_EXIST(110001, "该呼出号码已被绑定,请更改后重试", null),
LABEL_GROUP_IN_USE(120001, "该标签组下存在标签不可删除请确保该标签组下标签数量为0后再进行删除", null), LABEL_GROUP_IN_USE(120001, "该标签组下存在标签不可删除请确保该标签组下标签数量为0后再进行删除", null),
LABEL_GROUP_EXIST(120002, "该标签组已存在,请重新输入", null), LABEL_GROUP_EXIST(120002, "该标签组已存在,请重新输入", null),
LABEL_EXIST(120003, "该标签已存在,请重新输入", null),
; ;

View File

@@ -20,6 +20,8 @@ public interface HyPartnerLabelMapper {
HyPartnerLabelDO selectByPrimaryKey(Long id); HyPartnerLabelDO selectByPrimaryKey(Long id);
List<HyPartnerLabelDO> selectSelective(HyPartnerLabelDO labelDO);
int updateByPrimaryKeySelective(HyPartnerLabelDO record); int updateByPrimaryKeySelective(HyPartnerLabelDO record);
int updateByPrimaryKey(HyPartnerLabelDO record); int updateByPrimaryKey(HyPartnerLabelDO record);

View File

@@ -22,6 +22,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from hy_partner_label_group from hy_partner_label_group
where id = #{id} where id = #{id}
order by create_time
</select> </select>
<select id="selectSelective" resultType="com.cool.store.entity.HyPartnerLabelGroupDO"> <select id="selectSelective" resultType="com.cool.store.entity.HyPartnerLabelGroupDO">
@@ -52,6 +53,7 @@
<if test="remark != null and remark != ''"> <if test="remark != null and remark != ''">
and remark like concat('%', #{remark}, '%') and remark like concat('%', #{remark}, '%')
</if> </if>
order by create_time
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
@@ -218,6 +220,7 @@
<if test="labelGroupName != null and labelGroupName != ''"> <if test="labelGroupName != null and labelGroupName != ''">
AND t1.label_group_name LIKE CONCAT('%', #{labelGroupName}, '%') AND t1.label_group_name LIKE CONCAT('%', #{labelGroupName}, '%')
</if> </if>
ORDER BY t1.create_time DESC
</select> </select>
</mapper> </mapper>

View File

@@ -2,17 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.HyPartnerLabelMapper"> <mapper namespace="com.cool.store.mapper.HyPartnerLabelMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerLabelDO"> <resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerLabelDO">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" property="id" />
<result column="label_group_id" jdbcType="BIGINT" property="labelGroupId" /> <result column="label_group_id" property="labelGroupId" />
<result column="label_name" jdbcType="VARCHAR" property="labelName" /> <result column="label_name" property="labelName" />
<result column="edit_user_id" jdbcType="VARCHAR" property="editUserId" /> <result column="edit_user_id" property="editUserId" />
<result column="edit_date" jdbcType="TIMESTAMP" property="editDate" /> <result column="edit_date" property="editDate" />
<result column="deleted" jdbcType="BIT" property="deleted" /> <result column="deleted" property="deleted" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" property="updateTime" />
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" /> <result column="create_user_id" property="createUserId" />
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" /> <result column="update_user_id" property="updateUserId" />
<result column="remark" jdbcType="VARCHAR" property="remark" /> <result column="remark" property="remark" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, label_group_id, label_name, edit_user_id, edit_date, deleted, create_time, update_time, id, label_group_id, label_name, edit_user_id, edit_date, deleted, create_time, update_time,
@@ -22,21 +22,58 @@
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from hy_partner_label from hy_partner_label
where id = #{id,jdbcType=BIGINT} where deleted = 0
and id = #{id}
order by create_time desc
</select> </select>
<select id="selectSelective" resultType="com.cool.store.entity.HyPartnerLabelDO">
select <include refid="Base_Column_List"></include>
from hy_partner_label
where deleted = 0
<if test="labelGroupId != null">
and label_group_id = #{labelGroupId}
</if>
<if test="labelName != null and labelName != ''">
and label_name = #{labelName}
</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 = #{remark}
</if>
order by create_time desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from hy_partner_label delete from hy_partner_label
where id = #{id,jdbcType=BIGINT} where id = #{id}
</delete> </delete>
<insert id="insert" parameterType="com.cool.store.entity.HyPartnerLabelDO"> <insert id="insert" parameterType="com.cool.store.entity.HyPartnerLabelDO">
insert into hy_partner_label (id, label_group_id, label_name, insert into hy_partner_label (id, label_group_id, label_name,
edit_user_id, edit_date, deleted, edit_user_id, edit_date, deleted,
create_time, update_time, create_user_id, create_time, update_time, create_user_id,
update_user_id, remark) update_user_id, remark)
values (#{id,jdbcType=BIGINT}, #{labelGroupId,jdbcType=BIGINT}, #{labelName,jdbcType=VARCHAR}, values (#{id}, #{labelGroupId}, #{labelName},
#{editUserId,jdbcType=VARCHAR}, #{editDate,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{editUserId}, #{editDate}, #{deleted},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=VARCHAR}, #{createTime}, #{updateTime}, #{createUserId},
#{updateUserId,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}) #{updateUserId}, #{remark})
</insert> </insert>
<insert id="insertSelective" parameterType="com.cool.store.entity.HyPartnerLabelDO"> <insert id="insertSelective" parameterType="com.cool.store.entity.HyPartnerLabelDO">
insert into hy_partner_label insert into hy_partner_label
@@ -77,37 +114,37 @@
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
#{id,jdbcType=BIGINT}, #{id},
</if> </if>
<if test="labelGroupId != null"> <if test="labelGroupId != null">
#{labelGroupId,jdbcType=BIGINT}, #{labelGroupId},
</if> </if>
<if test="labelName != null"> <if test="labelName != null">
#{labelName,jdbcType=VARCHAR}, #{labelName},
</if> </if>
<if test="editUserId != null"> <if test="editUserId != null">
#{editUserId,jdbcType=VARCHAR}, #{editUserId},
</if> </if>
<if test="editDate != null"> <if test="editDate != null">
#{editDate,jdbcType=TIMESTAMP}, #{editDate},
</if> </if>
<if test="deleted != null"> <if test="deleted != null">
#{deleted,jdbcType=BIT}, #{deleted},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP}, #{createTime},
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP}, #{updateTime},
</if> </if>
<if test="createUserId != null"> <if test="createUserId != null">
#{createUserId,jdbcType=VARCHAR}, #{createUserId},
</if> </if>
<if test="updateUserId != null"> <if test="updateUserId != null">
#{updateUserId,jdbcType=VARCHAR}, #{updateUserId},
</if> </if>
<if test="remark != null"> <if test="remark != null">
#{remark,jdbcType=VARCHAR}, #{remark},
</if> </if>
</trim> </trim>
</insert> </insert>
@@ -115,51 +152,52 @@
update hy_partner_label update hy_partner_label
<set> <set>
<if test="labelGroupId != null"> <if test="labelGroupId != null">
label_group_id = #{labelGroupId,jdbcType=BIGINT}, label_group_id = #{labelGroupId},
</if> </if>
<if test="labelName != null"> <if test="labelName != null and labelName != ''">
label_name = #{labelName,jdbcType=VARCHAR}, label_name = #{labelName},
</if> </if>
<if test="editUserId != null"> <if test="editUserId != null">
edit_user_id = #{editUserId,jdbcType=VARCHAR}, edit_user_id = #{editUserId},
</if> </if>
<if test="editDate != null"> <if test="editDate != null">
edit_date = #{editDate,jdbcType=TIMESTAMP}, edit_date = #{editDate},
</if> </if>
<if test="deleted != null"> <if test="deleted != null">
deleted = #{deleted,jdbcType=BIT}, deleted = #{deleted},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime},
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime},
</if> </if>
<if test="createUserId != null"> <if test="createUserId != null">
create_user_id = #{createUserId,jdbcType=VARCHAR}, create_user_id = #{createUserId},
</if> </if>
<if test="updateUserId != null"> <if test="updateUserId != null">
update_user_id = #{updateUserId,jdbcType=VARCHAR}, update_user_id = #{updateUserId},
</if> </if>
<if test="remark != null"> <if test="remark != null">
remark = #{remark,jdbcType=VARCHAR}, remark = #{remark},
</if> </if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where deleted = 0
and id = #{id}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.cool.store.entity.HyPartnerLabelDO"> <update id="updateByPrimaryKey" parameterType="com.cool.store.entity.HyPartnerLabelDO">
update hy_partner_label update hy_partner_label
set label_group_id = #{labelGroupId,jdbcType=BIGINT}, set label_group_id = #{labelGroupId},
label_name = #{labelName,jdbcType=VARCHAR}, label_name = #{labelName},
edit_user_id = #{editUserId,jdbcType=VARCHAR}, edit_user_id = #{editUserId},
edit_date = #{editDate,jdbcType=TIMESTAMP}, edit_date = #{editDate},
deleted = #{deleted,jdbcType=BIT}, deleted = #{deleted},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime},
create_user_id = #{createUserId,jdbcType=VARCHAR}, create_user_id = #{createUserId},
update_user_id = #{updateUserId,jdbcType=VARCHAR}, update_user_id = #{updateUserId},
remark = #{remark,jdbcType=VARCHAR} remark = #{remark}
where id = #{id,jdbcType=BIGINT} where id = #{id}
</update> </update>
<select id="getLabelList" resultType="com.cool.store.vo.LabelListVo"> <select id="getLabelList" resultType="com.cool.store.vo.LabelListVo">
@@ -174,6 +212,7 @@
<if test="labelGroupId != null"> <if test="labelGroupId != null">
AND t2.id = #{labelGroupId} AND t2.id = #{labelGroupId}
</if> </if>
ORDER BY t1.create_time DESC
</select> </select>
<select id="whetherGroupInUse" resultType="java.lang.Boolean"> <select id="whetherGroupInUse" resultType="java.lang.Boolean">

View File

@@ -0,0 +1,16 @@
package com.cool.store.dto.label;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Fun Li 2023/8/10 16:43
* @version 1.0
*/
@Data
public class LabelDeleteDTO {
@ApiModelProperty(value = "标签id", required = true)
private Long id;
}

View File

@@ -1,5 +1,6 @@
package com.cool.store.dto.label; package com.cool.store.dto.label;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
@@ -8,4 +9,14 @@ import lombok.Data;
*/ */
@Data @Data
public class LabelUpdateDTO { public class LabelUpdateDTO {
@ApiModelProperty(value = "标签id", required = true)
private Long id;
@ApiModelProperty(value = "标签名称", required = true)
private String labelName;
@ApiModelProperty(value = "标签组id", required = true)
private Long labelGroupId;
} }

View File

@@ -1,7 +1,10 @@
package com.cool.store.service; package com.cool.store.service;
import com.cool.store.dto.label.LabelAddDTO; import com.cool.store.dto.label.LabelAddDTO;
import com.cool.store.dto.label.LabelDeleteDTO;
import com.cool.store.dto.label.LabelListDTO; import com.cool.store.dto.label.LabelListDTO;
import com.cool.store.dto.label.LabelUpdateDTO;
import com.cool.store.exception.ApiException;
import com.cool.store.vo.LabelListVo; import com.cool.store.vo.LabelListVo;
import java.util.List; import java.util.List;
@@ -23,5 +26,17 @@ public interface LabelService {
* 添加标签组 * 添加标签组
* @param dto 新增标签组信息 * @param dto 新增标签组信息
*/ */
void addLabel(LabelAddDTO dto); void addLabel(LabelAddDTO dto) throws ApiException;
/**
* 修改标签信息
* @param dto 新标签信息
*/
void updateLabel(LabelUpdateDTO dto) throws ApiException;
/**
* 删除标签
* @param dto
*/
void deleteLabel(LabelDeleteDTO dto);
} }

View File

@@ -2,8 +2,12 @@ package com.cool.store.service.impl;
import com.cool.store.context.CurrentUserHolder; import com.cool.store.context.CurrentUserHolder;
import com.cool.store.dto.label.LabelAddDTO; import com.cool.store.dto.label.LabelAddDTO;
import com.cool.store.dto.label.LabelDeleteDTO;
import com.cool.store.dto.label.LabelListDTO; import com.cool.store.dto.label.LabelListDTO;
import com.cool.store.dto.label.LabelUpdateDTO;
import com.cool.store.entity.HyPartnerLabelDO; import com.cool.store.entity.HyPartnerLabelDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ApiException;
import com.cool.store.mapper.HyPartnerLabelMapper; import com.cool.store.mapper.HyPartnerLabelMapper;
import com.cool.store.service.LabelService; import com.cool.store.service.LabelService;
import com.cool.store.vo.LabelListVo; import com.cool.store.vo.LabelListVo;
@@ -38,15 +42,62 @@ public class LabelServiceImpl implements LabelService {
* @param dto 新增标签组信息 * @param dto 新增标签组信息
*/ */
@Override @Override
public void addLabel(LabelAddDTO dto) { public void addLabel(LabelAddDTO dto) throws ApiException {
HyPartnerLabelDO labelDO = new HyPartnerLabelDO(); HyPartnerLabelDO labelDO = new HyPartnerLabelDO();
labelDO.setLabelName(dto.getLabelName());
if (whetherLabelRepeat(labelDO)) {
throw new ApiException(ErrorCodeEnum.LABEL_EXIST);
}
String userId = CurrentUserHolder.getUserId(); String userId = CurrentUserHolder.getUserId();
labelDO.setLabelGroupId(dto.getLabelGroupId()); labelDO.setLabelGroupId(dto.getLabelGroupId());
labelDO.setLabelName(dto.getLabelName());
labelDO.setEditUserId(userId); labelDO.setEditUserId(userId);
labelDO.setEditDate(new Date()); labelDO.setEditDate(new Date());
labelDO.setCreateUserId(userId); labelDO.setCreateUserId(userId);
labelDO.setUpdateUserId(userId); labelDO.setUpdateUserId(userId);
labelMapper.insertSelective(labelDO); labelMapper.insertSelective(labelDO);
} }
/**
* 修改标签信息
* @param dto 新标签信息
*/
@Override
public void updateLabel(LabelUpdateDTO dto) throws ApiException {
HyPartnerLabelDO labelDO = new HyPartnerLabelDO();
labelDO.setLabelName(dto.getLabelName());
if (whetherLabelRepeat(labelDO)) {
throw new ApiException(ErrorCodeEnum.LABEL_EXIST);
}
String userId = CurrentUserHolder.getUserId();
labelDO.setId(dto.getId());
labelDO.setLabelGroupId(dto.getLabelGroupId());
labelDO.setEditUserId(userId);
labelDO.setEditDate(new Date());
labelDO.setUpdateUserId(userId);
labelMapper.updateByPrimaryKeySelective(labelDO);
}
/**
* 删除标签
* @param dto
*/
@Override
public void deleteLabel(LabelDeleteDTO dto) {
HyPartnerLabelDO labelDO = new HyPartnerLabelDO();
String userId = CurrentUserHolder.getUserId();
labelDO.setId(dto.getId());
labelDO.setEditUserId(userId);
labelDO.setEditDate(new Date());
labelDO.setUpdateUserId(userId);
labelDO.setDeleted(Boolean.TRUE);
labelMapper.updateByPrimaryKeySelective(labelDO);
}
private Boolean whetherLabelRepeat(HyPartnerLabelDO label) throws ApiException {
List<HyPartnerLabelDO> hyPartnerLabelDOS = labelMapper.selectSelective(label);
if (hyPartnerLabelDOS != null && hyPartnerLabelDOS.size() > 0) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
} }

View File

@@ -1,7 +1,10 @@
package com.cool.store.controller; package com.cool.store.controller;
import com.cool.store.dto.label.LabelAddDTO; import com.cool.store.dto.label.LabelAddDTO;
import com.cool.store.dto.label.LabelDeleteDTO;
import com.cool.store.dto.label.LabelListDTO; import com.cool.store.dto.label.LabelListDTO;
import com.cool.store.dto.label.LabelUpdateDTO;
import com.cool.store.exception.ApiException;
import com.cool.store.response.ResponseResult; import com.cool.store.response.ResponseResult;
import com.cool.store.service.LabelService; import com.cool.store.service.LabelService;
import com.cool.store.vo.LabelListVo; import com.cool.store.vo.LabelListVo;
@@ -39,16 +42,23 @@ public class LabelController {
@ApiOperation("新增标签") @ApiOperation("新增标签")
@PostMapping("/add") @PostMapping("/add")
public ResponseResult addLabel(@RequestBody LabelAddDTO dto) { public ResponseResult addLabel(@RequestBody LabelAddDTO dto) throws ApiException {
labelService.addLabel(dto); labelService.addLabel(dto);
return ResponseResult.success(); return ResponseResult.success();
} }
// @ApiOperation("修改标签") @ApiOperation("修改标签")
// @PostMapping("/edit") @PostMapping("/edit")
// public ResponseResult updateLabel() { public ResponseResult updateLabel(@RequestBody LabelUpdateDTO dto) throws ApiException {
// labelService.updateLabel(); labelService.updateLabel(dto);
// return ResponseResult.success(); return ResponseResult.success();
// } }
@ApiOperation("删除标签")
@PostMapping("/delete")
public ResponseResult deleteLabel(@RequestBody LabelDeleteDTO dto) {
labelService.deleteLabel(dto);
return ResponseResult.success();
}
} }