103 lines
4.7 KiB
XML
103 lines
4.7 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.microservices.cms.checkin.mapper.CmsDocCheckinMapper">
|
|
|
|
<resultMap type="com.microservices.cms.checkin.domain.CmsDocCheckin" id="CmsDocCheckinResult">
|
|
<id property="id" column="id"/>
|
|
<result property="docId" column="doc_id"/>
|
|
<result property="userId" column="user_id"/>
|
|
<result property="fileIdentifier" column="file_identifier"/>
|
|
<result property="notes" column="notes"/>
|
|
<result property="checkinTime" column="checkin_time"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
</resultMap>
|
|
|
|
<resultMap type="com.microservices.cms.checkin.domain.vo.CmsDocCheckinVo" id="CmsDocCheckinVoResult">
|
|
<id property="id" column="id"/>
|
|
<result property="docId" column="doc_id"/>
|
|
<result property="docName" column="doc_name"/>
|
|
<result property="publishTime" column="publish_time"/>
|
|
<result property="fileIdentifier" column="file_identifier"/>
|
|
<result property="notes" column="notes"/>
|
|
<result property="checkinTime" column="checkin_time"/>
|
|
<result property="createTime" column="create_time"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectCmsDocCheckinVo">
|
|
select id, doc_id, user_id, file_identifier, notes, checkin_time,
|
|
create_by, create_time, update_by, update_time
|
|
from cms_doc_checkin
|
|
</sql>
|
|
|
|
<select id="selectByDocIdAndUserId" resultMap="CmsDocCheckinResult">
|
|
<include refid="selectCmsDocCheckinVo"/>
|
|
where doc_id = #{docId} and user_id = #{userId}
|
|
</select>
|
|
|
|
<insert id="insertCmsDocCheckin"
|
|
parameterType="com.microservices.cms.checkin.domain.CmsDocCheckin"
|
|
useGeneratedKeys="true"
|
|
keyProperty="id">
|
|
insert into cms_doc_checkin
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="docId != null">doc_id,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="fileIdentifier != null and fileIdentifier != ''">file_identifier,</if>
|
|
<if test="notes != null and notes != ''">notes,</if>
|
|
<if test="checkinTime != null">checkin_time,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="docId != null">#{docId},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="fileIdentifier != null and fileIdentifier != ''">#{fileIdentifier},</if>
|
|
<if test="notes != null and notes != ''">#{notes},</if>
|
|
<if test="checkinTime != null">#{checkinTime},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<select id="selectMyList" resultMap="CmsDocCheckinVoResult">
|
|
select c.id, c.doc_id, d.name as doc_name, d.publish_time, c.file_identifier, c.notes, c.checkin_time, c.create_time
|
|
from cms_doc_checkin c
|
|
left join cms_doc d on c.doc_id = d.id
|
|
where c.user_id = #{userId}
|
|
<if test="query != null and query.docName != null and query.docName != ''">
|
|
and d.name like concat('%', #{query.docName}, '%')
|
|
</if>
|
|
<if test="query != null and query.notes != null and query.notes != ''">
|
|
and c.notes like concat('%', #{query.notes}, '%')
|
|
</if>
|
|
<if test="docIds != null and docIds.size() > 0">
|
|
and c.doc_id in
|
|
<foreach collection="docIds" item="docId" open="(" separator="," close=")">
|
|
#{docId}
|
|
</foreach>
|
|
</if>
|
|
order by c.checkin_time desc
|
|
</select>
|
|
|
|
<select id="selectByDocIdsAndUserId" resultMap="CmsDocCheckinVoResult">
|
|
select c.id, c.doc_id, d.name as doc_name, c.file_identifier, c.notes, c.checkin_time, c.create_time
|
|
from cms_doc_checkin c
|
|
left join cms_doc d on c.doc_id = d.id
|
|
where c.user_id = #{userId}
|
|
and c.doc_id in
|
|
<foreach collection="docIds" item="docId" open="(" separator="," close=")">
|
|
#{docId}
|
|
</foreach>
|
|
</select>
|
|
|
|
</mapper>
|