<?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.dg.core.db.gen.mapper.AutomessagePolicyDocumentsMapper">
|
<resultMap type="com.dg.core.db.gen.entity.AutomessagePolicyDocuments" id="AutomessagePolicyDocumentsResult">
|
<id property="id" column="id" />
|
<id property="departmentId" column="department_id" />
|
<id property="name" column="name" />
|
<id property="linkType" column="link_type" />
|
<id property="articleLink" column="article_link" />
|
<id property="richText" column="rich_text" />
|
<id property="type" column="type" />
|
<id property="createTime" column="create_time" />
|
<id property="createUserId" column="create_user_id" />
|
<id property="updateTime" column="update_time" />
|
<id property="updateUserId" column="update_user_id" />
|
</resultMap>
|
|
<sql id="selectAutomessagePolicyDocumentsResult">
|
SELECT
|
id,
|
(select organization_name from automessage_organization_chart where id=a.department_id )departmentName,
|
department_id,
|
name,
|
link_type,
|
type,
|
article_link,
|
rich_text,
|
create_time,
|
update_time,
|
(select user_name from automessage_sys_user where user_id=a.update_user_id)updateUserName,
|
update_user_id,
|
(select user_name from automessage_sys_user where user_id=a.create_user_id)createUserName,
|
create_user_id
|
FROM
|
automessage_policy_documents a
|
</sql>
|
|
<select id="selectConfigList" resultMap="AutomessagePolicyDocumentsResult">
|
<include refid="selectAutomessagePolicyDocumentsResult" />
|
<where>
|
<if test="name!=null and name!=''">
|
and name like concat('%', #{name}, '%')
|
</if>
|
<if test="type!=null">
|
and type = #{type}
|
</if>
|
<if test="departmentId != null">
|
and department_id in (SELECT id from automessage_organization_chart where id=#{departmentId} or parent_id = #{departmentId})
|
</if>
|
<if test="ids != null">
|
and department_id IN
|
<foreach collection="ids" item="param" open="(" close=")" separator=",">
|
#{param}
|
</foreach>
|
</if>
|
</where>
|
order by create_time desc
|
</select>
|
|
<select id="selectCountList" resultType="integer">
|
select count(*) from automessage_policy_documents
|
<where>
|
<if test="name!=null and name!=''">
|
and name like concat('%', #{name}, '%')
|
</if>
|
<if test="type!=null">
|
and type = #{type}
|
</if>
|
<if test="departmentId != null">
|
and department_id in (SELECT id from automessage_organization_chart where id=#{departmentId} or parent_id = #{departmentId})
|
</if>
|
<if test="ids != null">
|
and department_id IN
|
<foreach collection="ids" item="param" open="(" close=")" separator=",">
|
#{param}
|
</foreach>
|
</if>
|
</where>
|
</select>
|
|
<select id="selectAutomessagePolicyDocumentById" resultMap="AutomessagePolicyDocumentsResult">
|
<include refid="selectAutomessagePolicyDocumentsResult" />
|
<where>
|
id = #{id}
|
</where>
|
|
</select>
|
|
</mapper>
|