123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <?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.zhyc.xps.aqpt.mapper.CheckRecordAttachMapper">
- <resultMap id="CheckRecordAttachDtoMap" type="com.zhyc.xps.aqpt.dto.CheckRecordAttachDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--OC ID-->
- <result column="task_id" property="taskId" jdbcType="BIGINT" /><!--TASK ID-->
- <result column="check_record_id" property="checkRecordId" jdbcType="BIGINT" /><!--RECORD ID-->
- <result column="file_id" property="fileId" jdbcType="BIGINT" />
- <result column="file_title" property="fileTitle" jdbcType="VARCHAR" />
- <result column="dir_id" property="dirId" jdbcType="BIGINT" /><!--ID-->
- <result column="file_url" property="fileUrl" jdbcType="VARCHAR" />
- <result column="file_ext" property="fileExt" jdbcType="VARCHAR" />
- <result column="file_size" property="fileSize" jdbcType="BIGINT" />
- <result column="file_author" property="fileAuthor" jdbcType="VARCHAR" />
- <result column="file_desc" property="fileDesc" jdbcType="VARCHAR" />
- <result column="uploader_id" property="uploaderId" jdbcType="BIGINT" />
- <result column="uploader_name" property="uploaderName" jdbcType="VARCHAR" />
- <result column="uploaded_at" property="uploadedAt" jdbcType="TIMESTAMP"/>
- </resultMap>
- <sql id="CheckRecordAttachDto_Cols">
- A.oc_id,
- A.task_id,
- A.check_record_id,
- A.file_id,
- B.file_title,
- B.dir_id,
- B.file_url,
- B.file_ext,
- B.file_size,
- B.file_author,
- B.file_desc,
- B.uploaded_by AS uploader_id,
- C.account_name AS uploader_name,
- B.uploaded_at
- </sql>
- <!--分页查询角色信息-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="CheckRecordAttachDtoMap">
- SELECT
- <include refid="CheckRecordAttachDto_Cols"/>
- FROM check_record_attach AS A
- LEFT JOIN doc_file AS B ON(A.oc_id = B.oc_id AND A.file_id = B.file_id )
- LEFT JOIN account AS C ON(B.oc_id = C.oc_id AND B.uploaded_by = C.account_id)
- WHERE 1 = 1
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="taskId != null">
- AND A.task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- <if test="checkRecordId != null">
- AND A.check_record_id = #{checkRecordId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND B.file_title like "%"#{keywords}"%"
- </if>
- ORDER BY A.file_id ASC
- </select>
- <select id="getByList" parameterType="java.util.Map" resultMap="CheckRecordAttachDtoMap">
- SELECT
- <include refid="CheckRecordAttachDto_Cols"/>
- FROM check_record_attach AS A
- LEFT JOIN doc_file AS B ON(A.oc_id = B.oc_id AND A.file_id = B.file_id )
- LEFT JOIN account AS C ON(B.oc_id = C.oc_id AND B.uploaded_by = C.account_id)
- WHERE 1 = 1
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="taskId != null">
- AND A.task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- <if test="checkRecordId != null">
- AND A.check_record_id = #{checkRecordId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- AND B.file_title like "%"#{keywords}"%"
- </if>
- ORDER BY A.file_id ASC
- </select>
- <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.CheckRecordAttach">
- INSERT INTO check_record_attach
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="taskId != null">
- task_id,
- </if>
- <if test="checkRecordId != null">
- check_record_id,
- </if>
- <if test="fileId != null">
- file_id,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="taskId != null">
- #{taskId ,jdbcType=BIGINT},
- </if>
- <if test="checkRecordId != null">
- #{checkRecordId ,jdbcType=BIGINT},
- </if>
- <if test="fileId != null">
- #{fileId ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- </trim>
- </insert>
- <!--删除-->
- <delete id="delete" parameterType="java.util.Map">
- DELETE FROM check_record_attach
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="taskId != null">
- AND task_id = #{taskId ,jdbcType=BIGINT}
- </if>
- <if test="checkRecordId != null">
- AND check_record_id = #{checkRecordId ,jdbcType=BIGINT}
- </if>
- <if test="fileId != null">
- AND file_id = #{fileId ,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|