|
|
@@ -0,0 +1,157 @@
|
|
|
+<?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.goafanti.common.dao.NoticeMapper" >
|
|
|
+ <resultMap id="BaseResultMap" type="com.goafanti.common.model.Notice" >
|
|
|
+ <id column="id" property="id" jdbcType="VARCHAR" />
|
|
|
+ <result column="aid" property="aid" jdbcType="VARCHAR" />
|
|
|
+ <result column="notice_type" property="noticeType" jdbcType="VARCHAR" />
|
|
|
+ <result column="content" property="content" jdbcType="VARCHAR" />
|
|
|
+ <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="readed" property="readed" jdbcType="INTEGER" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List" >
|
|
|
+ id, aid, notice_type, content, create_time, readed
|
|
|
+ </sql>
|
|
|
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from notice
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </select>
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
|
|
|
+ delete from notice
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" parameterType="com.goafanti.common.model.Notice" >
|
|
|
+ insert into notice (id, aid, notice_type,
|
|
|
+ content, create_time, readed
|
|
|
+ )
|
|
|
+ values (#{id,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{noticeType,jdbcType=VARCHAR},
|
|
|
+ #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{readed,jdbcType=INTEGER}
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+ <insert id="insertSelective" parameterType="com.goafanti.common.model.Notice" >
|
|
|
+ insert into notice
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="id != null" >
|
|
|
+ id,
|
|
|
+ </if>
|
|
|
+ <if test="aid != null" >
|
|
|
+ aid,
|
|
|
+ </if>
|
|
|
+ <if test="noticeType != null" >
|
|
|
+ notice_type,
|
|
|
+ </if>
|
|
|
+ <if test="content != null" >
|
|
|
+ content,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ create_time,
|
|
|
+ </if>
|
|
|
+ <if test="readed != null" >
|
|
|
+ readed,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="id != null" >
|
|
|
+ #{id,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="aid != null" >
|
|
|
+ #{aid,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="noticeType != null" >
|
|
|
+ #{noticeType,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="content != null" >
|
|
|
+ #{content,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="readed != null" >
|
|
|
+ #{readed,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Notice" >
|
|
|
+ update notice
|
|
|
+ <set >
|
|
|
+ <if test="aid != null" >
|
|
|
+ aid = #{aid,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="noticeType != null" >
|
|
|
+ notice_type = #{noticeType,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="content != null" >
|
|
|
+ content = #{content,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="readed != null" >
|
|
|
+ readed = #{readed,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Notice" >
|
|
|
+ update notice
|
|
|
+ set aid = #{aid,jdbcType=VARCHAR},
|
|
|
+ notice_type = #{noticeType,jdbcType=VARCHAR},
|
|
|
+ content = #{content,jdbcType=VARCHAR},
|
|
|
+ create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ readed = #{readed,jdbcType=INTEGER}
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="findUnreadNoticeListByPage" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from notice
|
|
|
+ where readed = 0
|
|
|
+ <if test="aid != null">
|
|
|
+ and aid = #{aid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="page_sql!=null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findUnreadNoticeCount" resultType="java.lang.Integer" parameterType="java.lang.String">
|
|
|
+ select count(1)
|
|
|
+ from notice
|
|
|
+ where readed = 0
|
|
|
+ <if test="aid != null">
|
|
|
+ and aid = #{aid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findReadedNoticeListByPage" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from notice
|
|
|
+ where readed = 1
|
|
|
+ <if test="aid != null">
|
|
|
+ and aid = #{aid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="page_sql!=null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findReadedNoticeCount" resultType="java.lang.Integer" parameterType="java.lang.String">
|
|
|
+ select count(1)
|
|
|
+ from notice
|
|
|
+ where readed = 1
|
|
|
+ <if test="aid != null">
|
|
|
+ and aid = #{aid,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectUnreadedCount" resultType="java.lang.Integer" parameterType="java.lang.String">
|
|
|
+ select count(1) from notice where readed = 0
|
|
|
+ <if test="_parameter">
|
|
|
+ and aid = #{_parameter,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+</mapper>
|