标签管理文件同步推送

This commit is contained in:
feng.li
2023-08-10 16:09:10 +08:00
parent a853bfb149
commit f84e9e6e27
10 changed files with 495 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -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>