标签管理文件同步推送
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.label.LabelListDTO;
|
||||
import com.cool.store.entity.HyPartnerLabelDO;
|
||||
import com.cool.store.vo.LabelListVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Fun Li
|
||||
* @date 2023-08-10
|
||||
*/
|
||||
public interface HyPartnerLabelMapper {
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(HyPartnerLabelDO record);
|
||||
|
||||
int insertSelective(HyPartnerLabelDO record);
|
||||
|
||||
HyPartnerLabelDO selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(HyPartnerLabelDO record);
|
||||
|
||||
int updateByPrimaryKey(HyPartnerLabelDO record);
|
||||
|
||||
List<LabelListVo> getLabelList(LabelListDTO dto);
|
||||
|
||||
/**
|
||||
* 某个标签组内是否有未删除的标签
|
||||
* @param labelGroupId 标签组 id
|
||||
*/
|
||||
Boolean whetherGroupInUse(@Param("labelGroupId") Long labelGroupId);
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyPartnerLabelDO">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="label_group_id" jdbcType="BIGINT" property="labelGroupId" />
|
||||
<result column="label_name" jdbcType="VARCHAR" property="labelName" />
|
||||
<result column="edit_user_id" jdbcType="VARCHAR" property="editUserId" />
|
||||
<result column="edit_date" jdbcType="TIMESTAMP" property="editDate" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
|
||||
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, label_group_id, label_name, edit_user_id, edit_date, deleted, create_time, update_time,
|
||||
create_user_id, update_user_id, remark
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from hy_partner_label
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from hy_partner_label
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.cool.store.entity.HyPartnerLabelDO">
|
||||
insert into hy_partner_label (id, label_group_id, label_name,
|
||||
edit_user_id, edit_date, deleted,
|
||||
create_time, update_time, create_user_id,
|
||||
update_user_id, remark)
|
||||
values (#{id,jdbcType=BIGINT}, #{labelGroupId,jdbcType=BIGINT}, #{labelName,jdbcType=VARCHAR},
|
||||
#{editUserId,jdbcType=VARCHAR}, #{editDate,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=VARCHAR},
|
||||
#{updateUserId,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.cool.store.entity.HyPartnerLabelDO">
|
||||
insert into hy_partner_label
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="labelGroupId != null">
|
||||
label_group_id,
|
||||
</if>
|
||||
<if test="labelName != null">
|
||||
label_name,
|
||||
</if>
|
||||
<if test="editUserId != null">
|
||||
edit_user_id,
|
||||
</if>
|
||||
<if test="editDate != null">
|
||||
edit_date,
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="createUserId != null">
|
||||
create_user_id,
|
||||
</if>
|
||||
<if test="updateUserId != null">
|
||||
update_user_id,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="labelGroupId != null">
|
||||
#{labelGroupId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="labelName != null">
|
||||
#{labelName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="editUserId != null">
|
||||
#{editUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="editDate != null">
|
||||
#{editDate,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
#{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="createUserId != null">
|
||||
#{createUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateUserId != null">
|
||||
#{updateUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.HyPartnerLabelDO">
|
||||
update hy_partner_label
|
||||
<set>
|
||||
<if test="labelGroupId != null">
|
||||
label_group_id = #{labelGroupId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="labelName != null">
|
||||
label_name = #{labelName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="editUserId != null">
|
||||
edit_user_id = #{editUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="editDate != null">
|
||||
edit_date = #{editDate,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="createUserId != null">
|
||||
create_user_id = #{createUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateUserId != null">
|
||||
update_user_id = #{updateUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.cool.store.entity.HyPartnerLabelDO">
|
||||
update hy_partner_label
|
||||
set label_group_id = #{labelGroupId,jdbcType=BIGINT},
|
||||
label_name = #{labelName,jdbcType=VARCHAR},
|
||||
edit_user_id = #{editUserId,jdbcType=VARCHAR},
|
||||
edit_date = #{editDate,jdbcType=TIMESTAMP},
|
||||
deleted = #{deleted,jdbcType=BIT},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
create_user_id = #{createUserId,jdbcType=VARCHAR},
|
||||
update_user_id = #{updateUserId,jdbcType=VARCHAR},
|
||||
remark = #{remark,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<select id="getLabelList" resultType="com.cool.store.vo.LabelListVo">
|
||||
SELECT t1.id, t2.id AS labelGroupId, t1.label_name, t2.label_group_name, t3.`name` AS editName, t3.mobile AS editMobile, t1.edit_date
|
||||
FROM hy_partner_label t1
|
||||
LEFT JOIN hy_partner_label_group t2 ON t1.label_group_id = t2.id
|
||||
LEFT JOIN enterprise_user t3 ON t1.edit_user_id = t3.user_id
|
||||
WHERE t1.deleted = 0 AND t2.deleted = 0
|
||||
<if test="labelName != null and labelName != ''">
|
||||
AND t1.label_name LIKE CONCAT('%', #{labelName} ,'%')
|
||||
</if>
|
||||
<if test="labelGroupId != null">
|
||||
AND t2.id = #{labelGroupId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="whetherGroupInUse" resultType="java.lang.Boolean">
|
||||
SELECT COUNT(*)
|
||||
FROM hy_partner_label
|
||||
WHERE deleted = 0
|
||||
AND label_group_id = #{labelGroupId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.cool.store.dto.label;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/10 15:55
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class LabelAddDTO {
|
||||
|
||||
@ApiModelProperty(value = "标签名称", required = true)
|
||||
private String labelName;
|
||||
|
||||
@ApiModelProperty(value = "标签组id", required = true)
|
||||
private Long labelGroupId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cool.store.dto.label;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/10 14:46
|
||||
* @version 1.0
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class LabelListDTO extends PageBasicInfo {
|
||||
|
||||
@ApiModelProperty(value = "标签名称")
|
||||
private String labelName;
|
||||
|
||||
@ApiModelProperty(value = "标签组id")
|
||||
private Long labelGroupId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.cool.store.dto.label;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/10 16:03
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class LabelUpdateDTO {
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.cool.store.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* @author Fun Li
|
||||
* @date 2023/08/10
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HyPartnerLabelDO {
|
||||
@ApiModelProperty("")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("标签组id hy_partner_label_group.id")
|
||||
private Long labelGroupId;
|
||||
|
||||
@ApiModelProperty("标签名")
|
||||
private String labelName;
|
||||
|
||||
@ApiModelProperty("编辑人user_id(enterprise_user.user_id)")
|
||||
private String editUserId;
|
||||
|
||||
@ApiModelProperty("编辑时间")
|
||||
private Date editDate;
|
||||
|
||||
@ApiModelProperty("删除标识")
|
||||
private Boolean deleted;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
private String createUserId;
|
||||
|
||||
@ApiModelProperty("更新人")
|
||||
private String updateUserId;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.cool.store.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/10 14:42
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class LabelListVo {
|
||||
|
||||
@ApiModelProperty(value = "标签名称")
|
||||
private String labelName;
|
||||
|
||||
@ApiModelProperty(value = "标签组名称")
|
||||
private String labelGroupName;
|
||||
|
||||
@ApiModelProperty(value = "编辑人姓名")
|
||||
private String editName;
|
||||
|
||||
@ApiModelProperty(value = "编辑人电话")
|
||||
private String editMobile;
|
||||
|
||||
@ApiModelProperty(value = "编辑时间")
|
||||
private Date editDate;
|
||||
|
||||
@ApiModelProperty(value = "标签id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "标签分组id")
|
||||
private Long labelGroupId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.label.LabelAddDTO;
|
||||
import com.cool.store.dto.label.LabelListDTO;
|
||||
import com.cool.store.vo.LabelListVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/10 14:23
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface LabelService {
|
||||
|
||||
/**
|
||||
* 获取数组列表
|
||||
*
|
||||
* @param dto 查询条件
|
||||
*/
|
||||
List<LabelListVo> getLabelList(LabelListDTO dto);
|
||||
|
||||
/**
|
||||
* 添加标签组
|
||||
* @param dto 新增标签组信息
|
||||
*/
|
||||
void addLabel(LabelAddDTO dto);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.dto.label.LabelAddDTO;
|
||||
import com.cool.store.dto.label.LabelListDTO;
|
||||
import com.cool.store.entity.HyPartnerLabelDO;
|
||||
import com.cool.store.mapper.HyPartnerLabelMapper;
|
||||
import com.cool.store.service.LabelService;
|
||||
import com.cool.store.vo.LabelListVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/10 14:24
|
||||
* @version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class LabelServiceImpl implements LabelService {
|
||||
|
||||
@Autowired
|
||||
private HyPartnerLabelMapper labelMapper;
|
||||
|
||||
/**
|
||||
* 获取数组列表
|
||||
*
|
||||
* @param dto 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<LabelListVo> getLabelList(LabelListDTO dto) {
|
||||
return labelMapper.getLabelList(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加标签组
|
||||
* @param dto 新增标签组信息
|
||||
*/
|
||||
@Override
|
||||
public void addLabel(LabelAddDTO dto) {
|
||||
HyPartnerLabelDO labelDO = new HyPartnerLabelDO();
|
||||
String userId = CurrentUserHolder.getUserId();
|
||||
labelDO.setLabelGroupId(dto.getLabelGroupId());
|
||||
labelDO.setLabelName(dto.getLabelName());
|
||||
labelDO.setEditUserId(userId);
|
||||
labelDO.setEditDate(new Date());
|
||||
labelDO.setCreateUserId(userId);
|
||||
labelDO.setUpdateUserId(userId);
|
||||
labelMapper.insertSelective(labelDO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.cool.store.controller;
|
||||
|
||||
import com.cool.store.dto.label.LabelAddDTO;
|
||||
import com.cool.store.dto.label.LabelListDTO;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.LabelService;
|
||||
import com.cool.store.vo.LabelListVo;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Fun Li 2023/8/10 14:20
|
||||
* @version 1.0
|
||||
*/
|
||||
@Api(tags = "标签管理")
|
||||
@RestController
|
||||
@RequestMapping("/label")
|
||||
public class LabelController {
|
||||
|
||||
@Autowired
|
||||
private LabelService labelService;
|
||||
|
||||
@ApiOperation("标签列表查询")
|
||||
@PostMapping("/list")
|
||||
public ResponseResult<PageInfo<LabelListVo>> getLabelList(@RequestBody LabelListDTO dto) {
|
||||
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
|
||||
List<LabelListVo> result = labelService.getLabelList(dto);
|
||||
return ResponseResult.success(new PageInfo<>(result));
|
||||
}
|
||||
|
||||
@ApiOperation("新增标签")
|
||||
@PostMapping("/add")
|
||||
public ResponseResult addLabel(@RequestBody LabelAddDTO dto) {
|
||||
labelService.addLabel(dto);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
// @ApiOperation("修改标签")
|
||||
// @PostMapping("/edit")
|
||||
// public ResponseResult updateLabel() {
|
||||
// labelService.updateLabel();
|
||||
// return ResponseResult.success();
|
||||
// }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user