123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <?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.SnapshotAttachMapper">
- <resultMap id="ExtDtoMap" type="com.zhyc.xps.aqpt.dto.SnapshotAttachDto">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" />
- <result column="snapshot_id" property="snapshotId" jdbcType="BIGINT" />
- <result column="event_id" property="eventId" 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" />
- <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="AttachDto_Cols">
- A.oc_id,
- A.snapshot_id,
- A.event_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="ExtDtoMap">
- SELECT
- <include refid="AttachDto_Cols"/>
- FROM snapshot_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 )
- WHERE B.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="snapshotId != null">
- AND A.snapshot_id = #{snapshotId ,jdbcType=BIGINT}
- </if>
- <if test="keyword != null and keyword != ''">
- AND B.file_title like "%"#{keyword}"%"
- </if>
- ORDER BY file_id ASC
- </select>
- <select id="getByList" resultMap="ExtDtoMap">
- SELECT
- <include refid="AttachDto_Cols"/>
- FROM snapshot_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 )
- WHERE A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="snapshotId != null">
- AND A.snapshot_id = #{snapshotId ,jdbcType=BIGINT}
- </if>
- ORDER BY A.file_id ASC
- </select>
- <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.SnapshotAttach">
- INSERT INTO snapshot_attach
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="snapshotId != null">
- snapshot_id,
- </if>
- <if test="eventId != null">
- event_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="snapshotId != null">
- #{snapshotId ,jdbcType=BIGINT},
- </if>
- <if test="eventId != null">
- #{eventId ,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 snapshot_attach
- WHERE 1 = 1
- <if test="ocId != null">
- AND oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="snapshotId != null">
- AND snapshot_id = #{snapshotId ,jdbcType=BIGINT}
- </if>
- <if test="eventId != null">
- AND event_id = #{eventId ,jdbcType=BIGINT}
- </if>
- <if test="fileId != null">
- AND file_id = #{fileId ,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|