|
@@ -0,0 +1,88 @@
|
|
|
+<?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.bosshand.virgo.file.dao.DownloadDataDao">
|
|
|
+
|
|
|
+ <resultMap type="com.bosshand.virgo.file.model.DownloadData" id="result">
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="userId" property="userId"/>
|
|
|
+ <result column="organizationId" property="organizationId"/>
|
|
|
+ <result column="projectId" property="projectId"/>
|
|
|
+ <result column="fileName" property="fileName"/>
|
|
|
+ <result column="type" property="type"/>
|
|
|
+ <result column="size" property="size"/>
|
|
|
+ <result column="wxUrl" property="wxUrl"/>
|
|
|
+ <result column="date" property="date"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <insert id="insert" parameterType="com.bosshand.virgo.file.model.DownloadData" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ INSERT INTO download_data(`userId`,`organizationId`,`projectId`,`fileName`,`type`,`size`,`wxUrl`, `date`) VALUES
|
|
|
+ (#{userId},#{organizationId},#{projectId},#{fileName},#{type},#{size},#{wxUrl},now())
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <delete id="delete">
|
|
|
+ DELETE FROM download_data WHERE id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="get" resultMap="result">
|
|
|
+ SELECT * FROM download_data where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getList" resultMap="result">
|
|
|
+ SELECT * FROM download_data
|
|
|
+ <where>
|
|
|
+ <if test="userId != 0">and userId = #{userId}</if>
|
|
|
+ <if test="organizationId != 0">and organizationId = #{organizationId}</if>
|
|
|
+ <if test="projectId != 0">and projectId = #{projectId}</if>
|
|
|
+ <if test="fileName != null">and fileName = #{fileName}</if>
|
|
|
+ <if test="type != null">and type = #{type}</if>
|
|
|
+ <if test="size != 0">and size = #{size}</if>
|
|
|
+ <if test="wxUrl != null">and wxUrl = #{wxUrl}</if>
|
|
|
+ <if test="date != null">and date like #{date}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getTotalCount" parameterType="com.bosshand.virgo.file.model.DownloadData" resultType="Integer">
|
|
|
+ SELECT count(*) FROM download_data
|
|
|
+ <where>
|
|
|
+ <if test="userId != 0">and userId = #{userId}</if>
|
|
|
+ <if test="organizationId != 0">and organizationId = #{organizationId}</if>
|
|
|
+ <if test="projectId != 0">and projectId = #{projectId}</if>
|
|
|
+ <if test="fileName != null">and fileName = #{fileName}</if>
|
|
|
+ <if test="type != null">and type = #{type}</if>
|
|
|
+ <if test="size != 0">and size = #{size}</if>
|
|
|
+ <if test="wxUrl != null">and wxUrl = #{wxUrl}</if>
|
|
|
+ <if test="date != null">and date like #{date}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getLimit" resultMap="result">
|
|
|
+ SELECT * FROM download_data
|
|
|
+ <where>
|
|
|
+ <if test="p.userId != 0">and userId = #{p.userId}</if>
|
|
|
+ <if test="p.organizationId != 0">and organizationId = #{p.organizationId}</if>
|
|
|
+ <if test="p.projectId != 0">and projectId = #{p.projectId}</if>
|
|
|
+ <if test="p.fileName != null">and fileName = #{p.fileName}</if>
|
|
|
+ <if test="p.type != null">and type = #{p.type}</if>
|
|
|
+ <if test="p.size != 0">and size = #{p.size}</if>
|
|
|
+ <if test="p.wxUrl != null">and wxUrl = #{p.wxUrl}</if>
|
|
|
+ <if test="p.date != null">and date like #{p.date}</if>
|
|
|
+ </where>
|
|
|
+ limit #{currIndex} , #{pageSize}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.bosshand.virgo.file.model.DownloadData">
|
|
|
+ UPDATE download_data
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
+ <if test="userId != 0">userId = #{userId},</if>
|
|
|
+ <if test="organizationId != 0">organizationId = #{organizationId},</if>
|
|
|
+ <if test="projectId != 0">projectId = #{projectId},</if>
|
|
|
+ <if test="fileName != null">fileName = #{fileName},</if>
|
|
|
+ <if test="type != null">type = #{type},</if>
|
|
|
+ <if test="size != 0">size = #{size},</if>
|
|
|
+ <if test="wxUrl != null">wxUrl = #{wxUrl},</if>
|
|
|
+ <if test="date == null">date = now(),</if>
|
|
|
+ </trim>
|
|
|
+ WHERE id=#{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+</mapper>
|