| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- <?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="cn.tr.module.smart.common.repository.BizMissionDocRepository">
- <resultMap id="MissionDoc" type="cn.tr.module.smart.common.po.BizMissionDocPO">
- <result property="id" column="id"/>
- <result property="type" column="type"/>
- <result property="title" column="title"/>
- <result property="source" column="source"/>
- <result property="image" column="image"/>
- <result property="imageId" column="image_id"/>
- <result property="content" column="content"/>
- <result property="phase" column="phase"/>
- <result property="intervalMinDay" column="interval_min_day"/>
- <result property="intervalMaxDay" column="interval_max_day"/>
- <result property="tenantId" column="tenant_id"/>
- <result property="createTime" column="create_time"/>
- <result property="createBy" column="create_by"/>
- <result property="updateTime" column="update_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="version" column="version"/>
- <result property="md5" column="md5"/>
- <result property="contentMd5" column="content_md5"/>
- <result property="deleted" column="deleted"/>
- <result property="squareDocId" column="square_doc_id"/>
- </resultMap>
- <sql id="baseColumn">
- id, type, title, source, image,image_id, content, phase, interval_min_day, interval_max_day, tenant_id, create_time, create_by, update_time, update_by, version, md5, content_md5, deleted, square_doc_id
- </sql>
- <select id="selectBizMissionDocById" resultMap="MissionDoc">
- SELECT
- <include refid="baseColumn"/>
- FROM biz_mission_doc
- where id = #{id ,jdbcType=VARCHAR} and deleted = 0
- </select>
- <select id="selectOneBySquareId" resultMap="MissionDoc">
- SELECT
- <include refid="baseColumn"/>
- FROM biz_mission_doc
- where
- square_doc_id = #{squareId ,jdbcType=VARCHAR}
- and deleted = 0
- order by create_time desc
- limit 1
- </select>
- <update id="updateBizMissionDocById">
- UPDATE biz_mission_doc
- <set>
- <if test="type != null">
- type = #{type ,jdbcType=VARCHAR},
- </if>
- <if test="title != null">
- title = #{title ,jdbcType=VARCHAR},
- </if>
- <if test="source != null">
- source = #{source ,jdbcType=VARCHAR},
- </if>
- <if test="image != null">
- image = #{image ,jdbcType=VARCHAR},
- </if>
- <if test="imageId != null">
- image_id = #{imageId ,jdbcType=VARCHAR},
- </if>
- <if test="content != null">
- content = #{content ,jdbcType=VARCHAR},
- </if>
- <if test="phase != null">
- phase = #{phase ,jdbcType=VARCHAR},
- </if>
- <if test="intervalMinDay != null">
- interval_min_day = #{intervalMinDay ,jdbcType=BIGINT},
- </if>
- <if test="intervalMaxDay != null">
- interval_max_day = #{intervalMaxDay ,jdbcType=BIGINT},
- </if>
- <if test="tenantId != null">
- tenant_id = #{tenantId ,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime ,jdbcType=TIMESTAMP},
- </if>
- <if test="updateBy != null">
- update_by = #{updateBy ,jdbcType=VARCHAR},
- </if>
- <if test="version != null">
- version = #{version ,jdbcType=BIGINT},
- </if>
- <if test="md5 != null">
- md5 = #{md5 ,jdbcType=VARCHAR},
- </if>
- <if test="contentMd5 != null">
- content_md5 = #{contentMd5 ,jdbcType=VARCHAR},
- </if>
- <if test="deleted != null">
- deleted = #{deleted ,jdbcType=BIT},
- </if>
- <if test="squareDocId != null">
- square_doc_id = #{squareDocId ,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id ,jdbcType=VARCHAR}
- </update>
- <update id="updateDeletedById">
- UPDATE biz_mission_doc
- SET deleted = 1
- WHERE id IN
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <select id="selectBizDeptAndDocByDeptIdList" resultType="cn.tr.module.smart.wx.controller.vo.BizDeptAndDocVO">
- select bdd.dept_id as deptId,
- bd.name as deptName,
- bmd.id as docId,
- bmd.type as type,
- bmd.title as title,
- bmd.source as source,
- bmd.image as image,
- bmd.content as content,
- bmd.image_id as imageId,
- bmd.phase as phase,
- bmd.interval_min_day as intervalMinDay,
- bmd.interval_max_day as intervalMaxDay,
- bmd.create_time as create_time,
- bmd.create_by as create_by,
- bmd.update_time as update_time,
- bmd.update_by as update_by,
- bmd.is_share as isShare,
- bmd.square_doc_id as squareDocId
- from biz_doc_dept bdd
- join biz_mission_doc bmd on
- bdd.doc_id = bmd.id
- join biz_dept bd on
- bd.id = bdd.dept_id
- <where>
- and deleted = 0
- <if test="query.deptId != null and query.deptId != ''">
- and bdd.dept_id = #{query.deptId ,jdbcType=VARCHAR}
- </if>
- <if test="query.time != null">
- and #{query.time} BETWEEN bmd.interval_min_day AND bmd.interval_max_day
- </if>
- <if test="query.phase != null and query.phase != ''">
- and bmd.phase = #{query.phase,jdbcType=VARCHAR}
- </if>
- <if test="query.title != null and query.title != ''">
- and bmd.title like concat('%',#{query.title,jdbcType=VARCHAR},'%')
- </if>
- </where>
- </select>
- <select id="queryAllUnlink" resultType="cn.tr.module.smart.web.vo.BizDeptUnlinkDocVO">
- SELECT
- bmd.ID AS docId,
- bmd.TYPE,
- bmd.title,
- bmd.SOURCE,
- bmd.CONTENT,
- bmd.phase,
- bmd.create_time,
- bmd.update_time,
- bmd.create_by,
- bmd.update_by
- FROM
- biz_mission_doc bmd
- <where>
- and bmd.deleted = 0
- and bmd.title is not null
- <if test="query.condition != null and query.condition != ''">
- and bmd.title like concat('%',#{query.condition,jdbcType=VARCHAR},'%')
- </if>
- <if test="!query.isLink">
- <if test="query.deptId != null and query.deptId != ''">
- AND NOT EXISTS ( SELECT 1 FROM biz_doc_dept bdd WHERE bdd.doc_id = bmd.ID AND bdd.dept_id = #{query.deptId})
- </if>
- </if>
- <if test="query.isLink">
- <if test="query.deptId != null and query.deptId != ''">
- AND EXISTS ( SELECT 1 FROM biz_doc_dept bdd WHERE bdd.doc_id = bmd.ID AND bdd.dept_id = #{query.deptId} )
- </if>
- </if>
- </where>
- </select>
- </mapper>
|