|
@@ -0,0 +1,99 @@
|
|
|
+<!DOCTYPE mapper
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+
|
|
|
+<mapper namespace="com.bosshand.virgo.dao.AnnouncementDao">
|
|
|
+
|
|
|
+ <resultMap type="com.bosshand.virgo.model.Announcement" id="result" >
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="organizationId" property="organizationId"/>
|
|
|
+ <result column="projectId" property="projectId"/>
|
|
|
+ <result column="title" property="title"/>
|
|
|
+ <result column="content" property="content"/>
|
|
|
+ <result column="publiSherId" property="publiSherId"/>
|
|
|
+ <result column="category" property="category"/>
|
|
|
+ <result column="status" property="status"/>
|
|
|
+ <result column="priority" property="priority"/>
|
|
|
+ <result column="publishTime" property="publishTime"/>
|
|
|
+ <result column="startTime" property="startTime"/>
|
|
|
+ <result column="endTime" property="endTime"/>
|
|
|
+ <result column="platform" property="platform"/>
|
|
|
+ <result column="createTime" property="createTime"/>
|
|
|
+ <result column="updateTime" property="updateTime"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="get" resultMap="result">
|
|
|
+ select * from announcement where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="save" parameterType="com.bosshand.virgo.model.Announcement" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ INSERT into announcement(`organizationId`, `projectId`, `title`, `content`, `publiSherId`, `category`, `priority`, `publishTime`, `startTime`, `endTime`, `platform`, `createTime`)
|
|
|
+ values(#{organizationId}, #{projectId}, #{title}, #{content}, #{publiSherId}, #{category}, #{priority}, #{publishTime}, #{startTime}, #{endTime}, #{platform}, now())
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.bosshand.virgo.model.Announcement">
|
|
|
+ UPDATE announcement
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
+ <if test="organizationId!=0">organizationId=#{organizationId},</if>
|
|
|
+ <if test="projectId!=0">projectId=#{projectId},</if>
|
|
|
+ <if test="title!=null">title=#{title},</if>
|
|
|
+ <if test="content!=null">content=#{content},</if>
|
|
|
+ <if test="publiSherId!=0">publiSherId=#{publiSherId},</if>
|
|
|
+ <if test="category!=null">category=#{category},</if>
|
|
|
+ <if test="status!=null">status=#{status},</if>
|
|
|
+ <if test="priority!=null">priority=#{priority},</if>
|
|
|
+ <if test="status==1">publishTime=now(),</if>
|
|
|
+ <if test="startTime!=null">startTime=#{startTime},</if>
|
|
|
+ <if test="status==2">endTime=now(),</if>
|
|
|
+ <if test="platform!=null">platform=#{platform},</if>
|
|
|
+ updateTime=now(),
|
|
|
+ </trim>
|
|
|
+ WHERE id=#{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="delete">
|
|
|
+ UPDATE announcement SET isDeleted = 1 WHERE id=#{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="getTotalCount" parameterType="com.bosshand.virgo.model.Announcement" resultType="Integer">
|
|
|
+ SELECT count(*) FROM announcement
|
|
|
+ <where>
|
|
|
+ <if test="organizationId!=0">and organizationId=#{organizationId}</if>
|
|
|
+ <if test="projectId!=0">and projectId=#{projectId}</if>
|
|
|
+ <if test="title!=null">and title=#{title}</if>
|
|
|
+ <if test="content!=null">and content=#{content}</if>
|
|
|
+ <if test="publiSherId!=0">and publiSherId=#{publiSherId}</if>
|
|
|
+ <if test="category!=null">and category=#{category}</if>
|
|
|
+ <if test="status!=null">and status=#{status}</if>
|
|
|
+ <if test="priority!=null">and priority=#{priority}</if>
|
|
|
+ <if test="publishTime!=null">and publishTime=#{publishTime}</if>
|
|
|
+ <if test="startTime!=null">and startTime=#{startTime}</if>
|
|
|
+ <if test="endTime!=null">and endTime=#{endTime}</if>
|
|
|
+ <if test="platform!=null">and platform=#{platform}</if>
|
|
|
+ <if test="createTime!=null">and createTime=#{createTime}</if>
|
|
|
+ and isDeleted != 1
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getLimit" resultMap="result">
|
|
|
+ select * from announcement
|
|
|
+ <where>
|
|
|
+ <if test="p.organizationId!=0">and organizationId=#{p.organizationId}</if>
|
|
|
+ <if test="p.projectId!=0">and projectId=#{p.projectId}</if>
|
|
|
+ <if test="p.title!=null">and title=#{p.title}</if>
|
|
|
+ <if test="p.content!=null">and content=#{p.content}</if>
|
|
|
+ <if test="p.publiSherId!=0">and publiSherId=#{p.publiSherId}</if>
|
|
|
+ <if test="p.category!=null">and category=#{p.category}</if>
|
|
|
+ <if test="p.status!=null">and status=#{p.status}</if>
|
|
|
+ <if test="p.priority!=null">and priority=#{p.priority}</if>
|
|
|
+ <if test="p.publishTime!=null">and publishTime=#{p.publishTime}</if>
|
|
|
+ <if test="p.startTime!=null">and startTime=#{p.startTime}</if>
|
|
|
+ <if test="p.endTime!=null">and endTime=#{p.endTime}</if>
|
|
|
+ <if test="p.platform!=null">and platform=#{p.platform}</if>
|
|
|
+ <if test="p.createTime!=null">and createTime=#{p.createTime}</if>
|
|
|
+ and isDeleted != 1
|
|
|
+ </where>
|
|
|
+ order by createTime desc limit #{currIndex} , #{pageSize}
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|