90 lines
3.3 KiB
XML
90 lines
3.3 KiB
XML
<?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.bonus.system.mapper.SysLabelMapper">
|
|
|
|
<resultMap type="SysLabel" id="SysLabelResult">
|
|
<id property="id" column="id"/>
|
|
<result property="parentId" column="parent_id"/>
|
|
<result property="tagName" column="tag_name"/>
|
|
<result property="tagType" column="tag_type"/>
|
|
<result property="tagHeat" column="tag_heat"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="isActive" column="is_active"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="orderNum" column="order_num"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectLabelVo">
|
|
select pkt.id,
|
|
pkt.parent_id,
|
|
pkt.tag_name,
|
|
pkt.tag_type,
|
|
pkt.tag_heat,
|
|
pkt.create_time,
|
|
pkt.update_time,
|
|
pkt.create_by,
|
|
pkt.remark,
|
|
pkt.order_num
|
|
from pm_know_tag pkt
|
|
</sql>
|
|
<insert id="insertLabel">
|
|
INSERT INTO pm_know_tag (tag_name, tag_type, tag_heat, is_active, parent_id,
|
|
create_by, remark, order_num)
|
|
VALUES (#{tagName}, #{tagType}, #{tagHeat}, '0', #{parentId}, #{createBy}, #{remark}, #{orderNum});
|
|
</insert>
|
|
<update id="updateDept">
|
|
update pm_know_tag
|
|
<set>
|
|
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
|
<if test="tagName != null and tagName != ''">tag_name = #{tagName},</if>
|
|
<if test="orderNum != null">order_num = #{orderNum},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
update_time = sysdate()
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
<update id="deleteLabelById">
|
|
update pm_know_tag
|
|
<set>
|
|
is_active ='1'
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<select id="selectLabelList" parameterType="SysDept" resultMap="SysLabelResult">
|
|
<include refid="selectLabelVo"/>
|
|
where pkt.is_active = '0'
|
|
<if test="tagName != null and tagName != ''">
|
|
AND pkt.tag_name like concat('%', #{tagName}, '%')
|
|
</if>
|
|
order by pkt.parent_id, pkt.order_num
|
|
</select>
|
|
|
|
<select id="checkLabelNameUnique" resultMap="SysLabelResult">
|
|
<include refid="selectLabelVo"/>
|
|
where pkt.tag_name=#{tagName} and pkt.parent_id = #{parentId} and pkt.is_active = '0' limit 1
|
|
</select>
|
|
<select id="selectLabelById" resultMap="SysLabelResult">
|
|
select d.id,
|
|
d.parent_id,
|
|
d.tag_name,
|
|
d.order_num,
|
|
d.remark,
|
|
(select tag_name from pm_know_tag where id = d.parent_id) parent_name
|
|
from pm_know_tag d
|
|
where d.id = #{id}
|
|
</select>
|
|
<select id="hasChildByLabelId" resultType="java.lang.Integer">
|
|
select count(1)
|
|
from pm_know_tag
|
|
where is_active = '0'
|
|
and parent_id = #{id}
|
|
limit 1
|
|
</select>
|
|
|
|
|
|
</mapper> |