| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <?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="INTEGER" />
- <result column="content" property="content" jdbcType="VARCHAR" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="readed" property="readed" jdbcType="INTEGER" />
- <result column="uid" property="uid" jdbcType="VARCHAR" />
- <result column="pid" property="pid" jdbcType="VARCHAR" />
- <result column="rid" property="rid" jdbcType="VARCHAR" />
- <result column="year" property="year" jdbcType="INTEGER" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, aid, notice_type, content, create_time, readed, uid, pid, rid, year
- </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, uid, pid, rid, year
- )
- values (#{id,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{noticeType,jdbcType=INTEGER},
- #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{readed,jdbcType=INTEGER},
- #{uid,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, #{rid,jdbcType=VARCHAR}, #{year,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>
-
- <if test="uid != null" >
- uid,
- </if>
- <if test="pid != null" >
- pid,
- </if>
-
- <if test="rid != null" >
- rid,
- </if>
-
- <if test="year != null" >
- year,
- </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=INTEGER},
- </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>
-
- <if test="uid != null" >
- #{uid,jdbcType=VARCHAR},
- </if>
- <if test="pid != null" >
- #{pid,jdbcType=VARCHAR},
- </if>
-
- <if test="rid != null" >
- #{rid,jdbcType=VARCHAR},
- </if>
-
- <if test="year != null" >
- #{year,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=INTEGER},
- </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>
-
- <if test="uid != null" >
- uid = #{uid,jdbcType=VARCHAR},
- </if>
- <if test="pid != null" >
- pid = #{pid,jdbcType=VARCHAR},
- </if>
-
- <if test="rid != null" >
- rid = #{rid,jdbcType=VARCHAR},
- </if>
-
- <if test="year != null" >
- year = #{year,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=INTEGER},
- content = #{content,jdbcType=VARCHAR},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- readed = #{readed,jdbcType=INTEGER},
-
- uid = #{uid,jdbcType=VARCHAR},
- pid = #{pid,jdbcType=VARCHAR},
-
- rid = #{rid,jdbcType=VARCHAR},
-
- year = #{year,jdbcType=INTEGER}
- where id = #{id,jdbcType=VARCHAR}
- </update>
-
- <select id="findUnreadNoticeListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.NoticeBo">
- select n.id, n.aid, n.uid, n.notice_type as noticeType, n.content, n.create_time as createTime,
- oi.unit_name as unitName, n.rid, a.name as principle, n.readed, n.year
- from notice n
- LEFT JOIN organization_identity oi on n.uid = oi.uid
- LEFT JOIN admin a on a.id = n.pid
- where n.readed = 0
- <if test="aid != null">
- and n.aid = #{aid,jdbcType=VARCHAR}
- </if>
- order by n.create_time desc
- <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 n
- where n.readed = 0
- <if test="aid != null">
- and n.aid = #{aid,jdbcType=VARCHAR}
- </if>
- </select>
-
- <select id="findReadedNoticeListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.NoticeBo">
- select n.id, n.uid, n.aid, n.notice_type as noticeType, n.content, n.create_time as createTime,
- oi.unit_name as unitName, n.rid, a.name as principle, n.readed, n.year
- from notice n
- LEFT JOIN organization_identity oi on n.uid = oi.uid
- LEFT JOIN admin a on a.id = n.pid
- where n.readed = 1
- <if test="aid != null">
- and n.aid = #{aid,jdbcType=VARCHAR}
- </if>
- order by n.create_time desc
- <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 n
- where n.readed = 1
- <if test="aid != null">
- and n.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>
-
- <update id="batchUpdateUnreaded" parameterType="java.util.List">
- update notice set readed = 1
- where id in
- <foreach item="item" index="index" collection="list" open="("
- separator="," close=")">
- #{item}
- </foreach>
- </update>
-
- <insert id="insertBatch" parameterType="com.goafanti.common.model.Notice">
- insert into notice (id, aid, notice_type, content, create_time, readed, uid, pid, rid, year)
- values
- <foreach item="item" index="index" collection="list" separator=",">
- (
- #{item.id,jdbcType=VARCHAR}, #{item.aid,jdbcType=VARCHAR}, #{item.noticeType,jdbcType=INTEGER},
- #{item.content,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.readed,jdbcType=INTEGER},
- #{item.uid,jdbcType=VARCHAR}, #{item.pid,jdbcType=VARCHAR}, #{item.rid,jdbcType=VARCHAR},
- #{item.year,jdbcType=INTEGER}
- )
- </foreach>
- </insert>
- </mapper>
|