123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <?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.lylc.mapper.AssessRecordAttachMapper">
- <resultMap id="AssessRecordAttachDtoMap" type="com.zhyc.xps.lylc.dto.AssessRecordAttachDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" />
- <result column="story_id" property="recordId" jdbcType="BIGINT" />
- <result column="item_id" property="itemId" jdbcType="BIGINT" />
- <result column="record_id" property="recordId" jdbcType="BIGINT" />
- <result column="file_id" property="fileId" jdbcType="BIGINT" />
- <result column="file_title" property="fileTitle" jdbcType="VARCHAR" />
- <result column="dir_id" property="dirId" jdbcType="BIGINT" /><!--Dir 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="AssessRecordAttachDto_Cols">
- A.oc_id,
- A.story_id,
- A.item_id,
- A.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="AssessRecordAttachDtoMap">
- SELECT
- <include refid="AssessRecordAttachDto_Cols"/>
- FROM hos_assess_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="storyId != null">
- AND A.story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- <if test="itemId != null">
- AND A.item_id = #{itemId ,jdbcType=BIGINT}
- </if>
- <if test="recordId != null">
- AND A.record_id = #{recordId ,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="AssessRecordAttachDtoMap">
- SELECT
- <include refid="AssessRecordAttachDto_Cols"/>
- FROM hos_assess_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="storyId != null">
- AND A.story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- <if test="itemId != null">
- AND A.item_id = #{itemId ,jdbcType=BIGINT}
- </if>
- <if test="recordId != null">
- AND A.record_id = #{recordId ,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.lylc.entity.AssessRecordAttach">
- INSERT INTO hos_assess_record_attach
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="storyId != null">
- story_id,
- </if>
- <if test="itemId != null">
- item_id,
- </if>
- <if test="recordId != null">
- record_id,
- </if>
- <if test="fileId != null">
- file_id,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="storyId != null">
- #{storyId ,jdbcType=BIGINT},
- </if>
- <if test="itemId != null">
- #{itemId ,jdbcType=BIGINT},
- </if>
- <if test="recordId != null">
- #{recordId ,jdbcType=BIGINT},
- </if>
- <if test="fileId != null">
- #{fileId ,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--删除-->
- <delete id="delete" parameterType="java.util.Map">
- DELETE FROM hos_assess_record_attach
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="recordId != null">
- AND record_id = #{recordId ,jdbcType=BIGINT}
- </if>
- <if test="fileId != null">
- AND file_id = #{fileId ,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|