|
@@ -0,0 +1,113 @@
|
|
|
+<!DOCTYPE mapper
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+
|
|
|
+<mapper namespace="com.bosshand.virgo.api.dao.RemoteReminderDao">
|
|
|
+
|
|
|
+ <resultMap type="com.bosshand.virgo.api.model.RemoteReminder" id="result">
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="code" property="code"/>
|
|
|
+ <result column="organizationId" property="organizationId"/>
|
|
|
+ <result column="projectId" property="projectId"/>
|
|
|
+ <result column="type" property="type"/>
|
|
|
+ <result column="date" property="date"/>
|
|
|
+ <result column="userList" property="userList"/>
|
|
|
+ <result column="deviceIds" property="deviceIds"/>
|
|
|
+ <result column="data" property="data"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="get" resultMap="result">
|
|
|
+ SELECT * FROM remote_reminder where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getList" resultMap="result">
|
|
|
+ select * from remote_reminder
|
|
|
+ <where>
|
|
|
+ <if test="id != 0">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="organizationId != 0">
|
|
|
+ and organizationId = #{organizationId}
|
|
|
+ </if>
|
|
|
+ <if test="projectId != 0">
|
|
|
+ and projectId = #{projectId}
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ and type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="date != null">
|
|
|
+ and date = #{date}
|
|
|
+ </if>
|
|
|
+ <if test="deviceIds != null">
|
|
|
+ and deviceIds = #{deviceIds}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ INSERT INTO remote_reminder (`code`, `organizationId`, `projectId`, `type`, `date`, `userList`, `deviceIds`, `data`)
|
|
|
+ VALUES (#{code}, #{organizationId}, #{projectId}, #{type}, #{date}, #{userList}, #{deviceIds}, #{data})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="delete">
|
|
|
+ DELETE FROM remote_reminder WHERE id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.bosshand.virgo.api.model.RemoteReminder">
|
|
|
+ UPDATE remote_reminder
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
+ <if test="organizationId!=0">organizationId=#{organizationId},</if>
|
|
|
+ <if test="projectId!=0">projectId=#{projectId},</if>
|
|
|
+ <if test="type!=null">type=#{type},</if>
|
|
|
+ <if test="date!=null">date=#{date},</if>
|
|
|
+ <if test="userList!=null">userList=#{userList},</if>
|
|
|
+ <if test="deviceIds!=null">deviceIds=#{deviceIds},</if>
|
|
|
+ <if test="data!=null">data=#{data},</if>
|
|
|
+ </trim>
|
|
|
+ WHERE id=#{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="getTotalCount" parameterType="com.bosshand.virgo.api.model.RemoteReminder" resultType="Integer">
|
|
|
+ SELECT count(*) FROM remote_reminder
|
|
|
+ <where>
|
|
|
+ <if test="id != 0">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="organizationId != 0">
|
|
|
+ and organizationId = #{organizationId}
|
|
|
+ </if>
|
|
|
+ <if test="projectId != 0">
|
|
|
+ and projectId = #{projectId}
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ and type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="date != null">
|
|
|
+ and date = #{date}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getLimit" resultMap="result">
|
|
|
+ SELECT a.* FROM remote_reminder a
|
|
|
+ <where>
|
|
|
+ <if test="p.id != 0">
|
|
|
+ and a.id = #{p.id}
|
|
|
+ </if>
|
|
|
+ <if test="p.organizationId != 0">
|
|
|
+ and a.organizationId = #{p.organizationId}
|
|
|
+ </if>
|
|
|
+ <if test="p.projectId != 0">
|
|
|
+ and a.projectId = #{p.projectId}
|
|
|
+ </if>
|
|
|
+ <if test="p.type != null">
|
|
|
+ and a.type = #{p.type}
|
|
|
+ </if>
|
|
|
+ <if test="p.date != null">
|
|
|
+ and a.date = #{p.date}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ limit #{currIndex} , #{pageSize}
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|