123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <?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">
- <!-- namespace必须指向DAO接口 -->
- <mapper namespace="com.jpsoft.employment.modules.base.dao.MessageNoticeDAO">
- <resultMap id="MessageNoticeMap" type="com.jpsoft.employment.modules.base.entity.MessageNotice">
- <id property="id" column="id_" />
- <result property="title" column="title_" />
- <result property="content" column="content_" />
- <result property="recipientId" column="recipient_id" />
- <result property="status" column="status_" />
- <result property="delFlag" column="del_flag" />
- <result property="createBy" column="create_by" />
- <result property="createByN" column="create_by_name" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="classify" column="classify_" />
- <result property="type" column="type_" />
- <result property="noticeLink" column="notice_link" />
- <result property="sendWechat" column="send_wechat" />
- <result property="wechatCode" column="wechat_code" />
- <result property="isNeedAgree" column="is_need_agree" />
- <result property="deliverId" column="deliver_id" />
- </resultMap>
- <insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.MessageNotice">
- <!--
- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
- select sys_guid() from dual
- </selectKey>
- -->
- <![CDATA[
- insert into base_message_notice
- (id_,title_,content_,recipient_id,status_,del_flag,create_by,create_time,update_by,update_time,classify_,type_,notice_link,send_wechat,wechat_code,
- is_need_agree,deliver_id)
- values
- (
- #{id,jdbcType=VARCHAR}
- ,#{title,jdbcType=VARCHAR}
- ,#{content,jdbcType= NUMERIC }
- ,#{recipientId,jdbcType= NUMERIC }
- ,#{status,jdbcType= NUMERIC }
- ,#{delFlag,jdbcType= NUMERIC }
- ,#{createBy,jdbcType=VARCHAR}
- ,#{createTime,jdbcType= TIMESTAMP }
- ,#{updateBy,jdbcType=VARCHAR}
- ,#{updateTime,jdbcType= TIMESTAMP }
- ,#{classify,jdbcType=VARCHAR}
- ,#{type,jdbcType=VARCHAR}
- ,#{noticeLink,jdbcType=VARCHAR}
- ,#{sendWechat,jdbcType= NUMERIC }
- ,#{wechatCode,jdbcType=VARCHAR}
- ,#{isNeedAgree,jdbcType=NUMERIC}
- ,#{deliverId,jdbcType=VARCHAR}
- )
- ]]>
- </insert>
- <delete id="delete" parameterType="string">
- delete from base_message_notice where id_=#{id,jdbcType=VARCHAR}
- </delete>
- <update id="update" parameterType="com.jpsoft.employment.modules.base.entity.MessageNotice">
- update base_message_notice
- <set>
- <if test="title!=null">
- title_=#{title,jdbcType=VARCHAR},
- </if>
- <if test="content!=null">
- content_=#{content,jdbcType= NUMERIC },
- </if>
- <if test="recipientId!=null">
- recipient_id=#{recipientId,jdbcType= NUMERIC },
- </if>
- <if test="status!=null">
- status_=#{status,jdbcType= NUMERIC },
- </if>
- <if test="delFlag!=null">
- del_flag=#{delFlag,jdbcType= NUMERIC },
- </if>
- <if test="createBy!=null">
- create_by=#{createBy,jdbcType=VARCHAR},
- </if>
- <if test="createTime!=null">
- create_time=#{createTime,jdbcType= TIMESTAMP },
- </if>
- <if test="updateBy!=null">
- update_by=#{updateBy,jdbcType=VARCHAR},
- </if>
- <if test="updateTime!=null">
- update_time=#{updateTime,jdbcType= TIMESTAMP },
- </if>
- <if test="classify!=null">
- classify_=#{classify,jdbcType=VARCHAR},
- </if>
- <if test="type!=null">
- type_=#{type,jdbcType=VARCHAR},
- </if>
- <if test="noticeLink!=null">
- notice_link=#{noticeLink,jdbcType=VARCHAR},
- </if>
- <if test="sendWechat!=null">
- send_wechat=#{sendWechat,jdbcType= NUMERIC },
- </if>
- <if test="wechatCode!=null">
- wechat_code=#{wechatCode,jdbcType=VARCHAR},
- </if>
- <if test="isNeedAgree!=null">
- is_need_agree=#{isNeedAgree,jdbcType=NUMERIC},
- </if>
- <if test="jobResumeId!=null">
- job_resume_id=#{jobResumeId,jdbcType=VARCHAR},
- </if>
- <if test="jobRecruitmentId!=null">
- job_recruitment_id=#{jobRecruitmentId,jdbcType=VARCHAR},
- </if>
- <if test="deliverId!=null">
- deliver_id=#{deliverId,jdbcType=VARCHAR},
- </if>
- </set>
- where id_=#{id}
- </update>
- <select id="get" parameterType="string" resultMap="MessageNoticeMap">
- select * from base_message_notice where id_=#{0}
- </select>
- <select id="exist" parameterType="string" resultType="int">
- select count(*) from base_message_notice where id_=#{0}
- </select>
- <select id="list" resultMap="MessageNoticeMap">
- select * from base_message_notice
- </select>
- <select id="search" parameterType="hashmap" resultMap="MessageNoticeMap">
- <![CDATA[
- select
- a.*,
- b.real_name AS create_by_name
- from base_message_notice a
- LEFT JOIN sys_user b ON a.create_by = b.id_
- ]]>
- <where>
- a.del_flag=0
- <if test="searchParams.id != null">
- and a.ID_ like #{searchParams.id}
- </if>
- <if test="searchParams.recipientId != null">
- and a.recipient_id = #{searchParams.recipientId}
- </if>
- <if test="searchParams.recipientIdAndNull != null">
- and (a.recipient_id = #{searchParams.recipientIdAndNull}
- or a.recipient_id is null)
- </if>
- <if test="searchParams.classify != null">
- and a.classify_ = #{searchParams.classify}
- </if>
- <if test="searchParams.type != null">
- and a.type_ = #{searchParams.type}
- </if>
- <if test="searchParams.status != null">
- and a.status_ = #{searchParams.status}
- </if>
- <if test="searchParams.title != null">
- and a.title_ like #{searchParams.title}
- </if>
- </where>
- <foreach item="sort" collection="sortList" open="order by" separator=",">
- ${sort.name} ${sort.order}
- </foreach>
- </select>
- <select id="findByUserIdAndClassify" resultMap="MessageNoticeMap">
- SELECT
- *
- FROM
- base_message_notice
- WHERE
- del_flag = 0
- AND classify_ = #{classify}
- AND ( recipient_id = #{userId} OR recipient_id IS NULL )
- AND status_ = '1'
- AND type_ = '1'
- </select>
- <select id="findByUserId" resultMap="MessageNoticeMap">
- SELECT
- *
- FROM
- base_message_notice
- WHERE
- del_flag = 0
- AND recipient_id = #{userId}
- AND status_ = '1'
- AND type_ = '1'
- </select>
- <select id="findTopByUserIdAndClassify" resultMap="MessageNoticeMap">
- SELECT
- *
- FROM
- base_message_notice
- WHERE
- del_flag = 0
- AND classify_ = #{classify}
- AND ( recipient_id = #{userId} OR recipient_id IS NULL )
- AND status_ = '1'
- AND type_ = '1'
- ORDER BY
- create_time
- LIMIT 1
- </select>
- <select id="findNotRead" resultType="int">
- SELECT
- count(a.id_)
- FROM
- base_message_notice a
- LEFT JOIN base_message_read b ON a.id_ = b.message_id
- WHERE
- a.del_flag = 0
- <if test="classify != null">
- AND a.classify_ = #{classify}
- </if>
- AND ( recipient_id = #{userId} OR recipient_id IS NULL )
- AND a.status_ = '1'
- AND a.type_ = '1'
- AND ( b.is_read IS NULL OR b.is_read = FALSE )
- ORDER BY
- a.create_time
- </select>
- </mapper>
|