| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714 |
- <?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.MessageFromSystemMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.MessageFromSystem">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- <id column="id" jdbcType="VARCHAR" property="id" />
- <result column="creater" jdbcType="VARCHAR" property="creater" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="producer_id" jdbcType="VARCHAR" property="producerId" />
- <result column="consumer_type" jdbcType="INTEGER" property="consumerType" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="body" jdbcType="VARCHAR" property="body" />
- <result column="subject" jdbcType="INTEGER" property="subject" />
- <result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
- <result column="resource_type" jdbcType="INTEGER" property="resourceType" />
- <result column="delete_sign" jdbcType="BIT" property="deleteSign" />
- <result column="is_draft" jdbcType="INTEGER" property="isDraft" />
- </resultMap>
- <sql id="Example_Where_Clause">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- <where>
- <foreach collection="oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Update_By_Example_Where_Clause">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- <where>
- <foreach collection="example.oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Base_Column_List">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- id, creater, create_time, update_time, producer_id, consumer_type, title, body, subject,
- resource_id, resource_type, delete_sign, is_draft
- </sql>
- <select id="selectByExample" parameterType="com.goafanti.common.model.MessageFromSystemExample" resultMap="BaseResultMap">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- select
- <if test="distinct">
- distinct
- </if>
- <include refid="Base_Column_List" />
- from message_from_system
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null">
- order by ${orderByClause}
- </if>
- </select>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- select
- <include refid="Base_Column_List" />
- from message_from_system
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- delete from message_from_system
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <delete id="deleteByExample" parameterType="com.goafanti.common.model.MessageFromSystemExample">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- delete from message_from_system
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.MessageFromSystem">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- insert into message_from_system (id, creater, create_time,
- update_time, producer_id, consumer_type,
- title, body, subject,
- resource_id, resource_type, delete_sign,
- is_draft)
- values (#{id,jdbcType=VARCHAR}, #{creater,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
- #{updateTime,jdbcType=TIMESTAMP}, #{producerId,jdbcType=VARCHAR}, #{consumerType,jdbcType=INTEGER},
- #{title,jdbcType=VARCHAR}, #{body,jdbcType=VARCHAR}, #{subject,jdbcType=INTEGER},
- #{resourceId,jdbcType=VARCHAR}, #{resourceType,jdbcType=INTEGER}, #{deleteSign,jdbcType=BIT},
- #{isDraft,jdbcType=INTEGER})
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.MessageFromSystem">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- insert into message_from_system
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="creater != null">
- creater,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="updateTime != null">
- update_time,
- </if>
- <if test="producerId != null">
- producer_id,
- </if>
- <if test="consumerType != null">
- consumer_type,
- </if>
- <if test="title != null">
- title,
- </if>
- <if test="body != null">
- body,
- </if>
- <if test="subject != null">
- subject,
- </if>
- <if test="resourceId != null">
- resource_id,
- </if>
- <if test="resourceType != null">
- resource_type,
- </if>
- <if test="deleteSign != null">
- delete_sign,
- </if>
- <if test="isDraft != null">
- is_draft,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="creater != null">
- #{creater,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="producerId != null">
- #{producerId,jdbcType=VARCHAR},
- </if>
- <if test="consumerType != null">
- #{consumerType,jdbcType=INTEGER},
- </if>
- <if test="title != null">
- #{title,jdbcType=VARCHAR},
- </if>
- <if test="body != null">
- #{body,jdbcType=VARCHAR},
- </if>
- <if test="subject != null">
- #{subject,jdbcType=INTEGER},
- </if>
- <if test="resourceId != null">
- #{resourceId,jdbcType=VARCHAR},
- </if>
- <if test="resourceType != null">
- #{resourceType,jdbcType=INTEGER},
- </if>
- <if test="deleteSign != null">
- #{deleteSign,jdbcType=BIT},
- </if>
- <if test="isDraft != null">
- #{isDraft,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.goafanti.common.model.MessageFromSystemExample" resultType="java.lang.Long">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- select count(*) from message_from_system
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- update message_from_system
- <set>
- <if test="record.id != null">
- id = #{record.id,jdbcType=VARCHAR},
- </if>
- <if test="record.creater != null">
- creater = #{record.creater,jdbcType=VARCHAR},
- </if>
- <if test="record.createTime != null">
- create_time = #{record.createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="record.updateTime != null">
- update_time = #{record.updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="record.producerId != null">
- producer_id = #{record.producerId,jdbcType=VARCHAR},
- </if>
- <if test="record.consumerType != null">
- consumer_type = #{record.consumerType,jdbcType=INTEGER},
- </if>
- <if test="record.title != null">
- title = #{record.title,jdbcType=VARCHAR},
- </if>
- <if test="record.body != null">
- body = #{record.body,jdbcType=VARCHAR},
- </if>
- <if test="record.subject != null">
- subject = #{record.subject,jdbcType=INTEGER},
- </if>
- <if test="record.resourceId != null">
- resource_id = #{record.resourceId,jdbcType=VARCHAR},
- </if>
- <if test="record.resourceType != null">
- resource_type = #{record.resourceType,jdbcType=INTEGER},
- </if>
- <if test="record.deleteSign != null">
- delete_sign = #{record.deleteSign,jdbcType=BIT},
- </if>
- <if test="record.isDraft != null">
- is_draft = #{record.isDraft,jdbcType=INTEGER},
- </if>
- </set>
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExample" parameterType="map">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- update message_from_system
- set id = #{record.id,jdbcType=VARCHAR},
- creater = #{record.creater,jdbcType=VARCHAR},
- create_time = #{record.createTime,jdbcType=TIMESTAMP},
- update_time = #{record.updateTime,jdbcType=TIMESTAMP},
- producer_id = #{record.producerId,jdbcType=VARCHAR},
- consumer_type = #{record.consumerType,jdbcType=INTEGER},
- title = #{record.title,jdbcType=VARCHAR},
- body = #{record.body,jdbcType=VARCHAR},
- subject = #{record.subject,jdbcType=INTEGER},
- resource_id = #{record.resourceId,jdbcType=VARCHAR},
- resource_type = #{record.resourceType,jdbcType=INTEGER},
- delete_sign = #{record.deleteSign,jdbcType=BIT},
- is_draft = #{record.isDraft,jdbcType=INTEGER}
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.MessageFromSystem">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- update message_from_system
- <set>
- <if test="creater != null">
- creater = #{creater,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="producerId != null">
- producer_id = #{producerId,jdbcType=VARCHAR},
- </if>
- <if test="consumerType != null">
- consumer_type = #{consumerType,jdbcType=INTEGER},
- </if>
- <if test="title != null">
- title = #{title,jdbcType=VARCHAR},
- </if>
- <if test="body != null">
- body = #{body,jdbcType=VARCHAR},
- </if>
- <if test="subject != null">
- subject = #{subject,jdbcType=INTEGER},
- </if>
- <if test="resourceId != null">
- resource_id = #{resourceId,jdbcType=VARCHAR},
- </if>
- <if test="resourceType != null">
- resource_type = #{resourceType,jdbcType=INTEGER},
- </if>
- <if test="deleteSign != null">
- delete_sign = #{deleteSign,jdbcType=BIT},
- </if>
- <if test="isDraft != null">
- is_draft = #{isDraft,jdbcType=INTEGER},
- </if>
- </set>
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.MessageFromSystem">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Dec 25 18:55:04 CST 2017.
- -->
- update message_from_system
- set creater = #{creater,jdbcType=VARCHAR},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- producer_id = #{producerId,jdbcType=VARCHAR},
- consumer_type = #{consumerType,jdbcType=INTEGER},
- title = #{title,jdbcType=VARCHAR},
- body = #{body,jdbcType=VARCHAR},
- subject = #{subject,jdbcType=INTEGER},
- resource_id = #{resourceId,jdbcType=VARCHAR},
- resource_type = #{resourceType,jdbcType=INTEGER},
- delete_sign = #{deleteSign,jdbcType=BIT},
- is_draft = #{isDraft,jdbcType=INTEGER}
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <insert id="insertBatchMessage" parameterType="com.goafanti.common.model.MessageFromSystem">
- insert into message_from_system (id,creater,producer_id,
- consumer_type,title,body,subject,resource_id,resource_type,delete_sign,is_draft)
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (
- #{item.id,jdbcType=VARCHAR},
- #{item.creater,jdbcType=VARCHAR},
- #{item.producerId,jdbcType=VARCHAR},
- #{item.consumerType,jdbcType=VARCHAR},
- #{item.title,jdbcType=VARCHAR},
- #{item.body,jdbcType=VARCHAR},
- #{item.subject,jdbcType=VARCHAR},
- #{item.resourceId,jdbcType=VARCHAR},
- #{item.resourceType,jdbcType=VARCHAR},
- #{item.deleteSign,jdbcType=VARCHAR},
- #{item.isDraft,jdbcType=VARCHAR}
- )
- </foreach>
- </insert>
- <insert id="insertBatchProducer" parameterType="com.goafanti.common.model.MessageProducer">
- insert into message_producer (id,consumer_id,message_id)
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (
- #{item.id,jdbcType=VARCHAR},#{item.consumerId,jdbcType=VARCHAR},#{item.messageId,jdbcType=VARCHAR}
- )
- </foreach>
- </insert>
- <insert id="insertBatchConsumer" parameterType="com.goafanti.common.model.MessageConsumer">
- insert into message_consumer (id,consumer_id,message_id)
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (
- #{item.id,jdbcType=VARCHAR},#{item.consumerId,jdbcType=VARCHAR},#{item.messageId,jdbcType=VARCHAR}
- )
- </foreach>
- </insert>
- <select id="selectSyncMessage" parameterType="java.lang.String" resultType="com.goafanti.message.bo.MessageBo">
- <!-- 登陆时同步 -->
- select
- x.id,
- x.message_id as messageId
- from
- message_producer x left join message_from_system y on
- x.message_id = y.id
- where x.id
- not in(
- select
- a.id
- from
- message_producer a inner join message_consumer b on
- (
- a.message_id = b.message_id
- and a.consumer_id = b.consumer_id
- )
- )
- and x.consumer_id = #{uid,jdbcType=VARCHAR}
- and y.is_draft = 0 <!-- 非草稿 -->
- and y.delete_sign = 0 <!-- 未删除 -->
- </select>
-
- <select id="selectSendMessage" parameterType="java.lang.String" resultType="com.goafanti.message.bo.MessageBo">
- <!-- 推送消息 -->
- select c.id as messageId,c.title,c.body
- from message_producer a inner join jpush_easemob_account b on
- a.consumer_id = b.uid
- left join message_from_system c on a.message_id = c.id
- where
- b.registration_id is not null
- and a.consumer_id = #{uid,jdbcType=VARCHAR}
- and c.is_draft = 0
- and c.delete_sign = 0
- </select>
-
- <select id="selectJPushAcc" parameterType="java.lang.String" resultType="java.lang.String">
- select registration_id from jpush_easemob_account where uid = #{uid,jdbcType=VARCHAR}
- </select>
-
- <update id="updateJpushEasemobAccount">
- update jpush_easemob_account
- <set>
- <if test="uuid != null and uuid != ''">
- uuid = #{uuid,jdbcType=VARCHAR},
- </if>
- <if test="registrationId != null and registrationId != ''">
- registration_id = #{registrationId,jdbcType=VARCHAR},
- </if>
- <if test="easemobName != null and easemobName != ''">
- easemob_name = #{easemobName,jdbcType=VARCHAR},
- </if>
- <if test="easemobPass != null and easemobPass != ''">
- easemob_pass = #{easemobPass,jdbcType=VARCHAR},
- </if>
- <if test="lastLoginTime != null">
- last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP}
- </if>
- where uid = #{uid,jdbcType=VARCHAR}
- </set>
- </update>
-
- <update id="updateMessageConsumer">
- update message_consumer
- <set>
- read_time = #{readTime,jdbcType=TIMESTAMP} where consumer_id = #{uid,jdbcType=VARCHAR} and message_id = #{messageId,jdbcType=VARCHAR}
- </set>
- </update>
-
- <select id="selectSendTarget" parameterType="java.lang.String" resultType="java.lang.String">
- ${sql}
- </select>
-
- <select id="selectRecommendTarget" parameterType="java.lang.String" resultType="com.goafanti.common.model.MessageFromSystem">
- ${sql}
- </select>
-
- <select id="listSystemMessageByPage" resultType="com.goafanti.message.bo.MessageListBo">
- select
- a.id as messageId,
- date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
- a.creater,
- a.consumer_type as consumerType,
- a.resource_type as resourceType,
- a.title,
- a.body,
- a.is_draft as isDraft,
- a.subject
- from
- message_from_system a
- where 1= 1
- <choose>
- <when test="subject == 2">
- and a.subject = 2
- </when>
- <otherwise>
- and a.subject != 2
- </otherwise>
- </choose>
- <if test="isDraft != null">
- and a.is_draft = #{isDraft,jdbcType=INTEGER}
- </if>
- and a.delete_sign = 0
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
-
- <select id="listSystemMessageCount" resultType="java.lang.Integer">
- select
- count(0)
- from
- message_from_system a
- where 1= 1
- <choose>
- <when test="subject == 2">
- and a.subject = 2
- </when>
- <otherwise>
- and a.subject != 2
- </otherwise>
- </choose>
- <if test="isDraft != null">
- and a.is_draft = #{isDraft,jdbcType=INTEGER}
- </if>
- and a.delete_sign = 0
- </select>
-
- <select id="selectMessageWithGroup" resultType="com.goafanti.app.bo.IndexBo">
- select
- x.*,y.*
- from
- (
- select
- t1.sysMessageTitle,
- t1.sysMessageDate,
- t2.sysMessageUnRead
- from
- (
- select
- title as sysMessageTitle,
- date_format(b.create_time,'%Y-%m-%d %H:%i:%S') as sysMessageDate,
- 1 as nouse
- from
- message_consumer a left join message_from_system b on
- a.message_id = b.id
- where
- consumer_id = #{uid,jdbcType=VARCHAR}
- and a.read_time is null
- and a.delete_sign = 0
- and b.subject = 1
- order by
- a.create_time desc limit 1
- ) t1 right join(
- select
- count(*) as sysMessageUnRead,
- 1 as nouse
- from
- message_consumer a left join message_from_system b on
- a.message_id = b.id
- where
- consumer_id = #{uid,jdbcType=VARCHAR}
- and a.read_time is null
- and a.delete_sign = 0
- and b.subject = 1
- ) t2 on
- t1.nouse = t2.nouse
- ) x,
- (
- select
- t3.recMessageTitle,
- t3.recMessageDate,
- t4.recMessageUnRead
- from
- (
- select
- title as recMessageTitle,
- date_format(b.create_time,'%Y-%m-%d %H:%i:%S') as recMessageDate,
- 1 as nouse
- from
- message_consumer a left join message_from_system b on
- a.message_id = b.id
- where
- consumer_id = #{uid,jdbcType=VARCHAR}
- and a.read_time is null
- and a.delete_sign = 0
- and b.subject = 2
- order by
- a.create_time desc limit 1
- ) t3 right join(
- select
- count(*) as recMessageUnRead,
- 1 as nouse
- from
- message_consumer a left join message_from_system b on
- a.message_id = b.id
- where
- consumer_id = #{uid,jdbcType=VARCHAR}
- and a.read_time is null
- and a.delete_sign = 0
- and b.subject = 2
- ) t4 on
- t3.nouse = t4.nouse
- ) y
- </select>
-
- <select id="listPersonalMessageByPage" resultType="com.goafanti.message.bo.MessageListBo">
- select
- b.id as messageId,b.title,date_format(b.create_time,'%Y-%m-%d %H:%i:%S') as createTime,b.subject,
- b.resource_type as resourceType,b.resource_id as resourceId,if(a.read_time is null,0,1) as isRead,b.body as body
- from
- message_consumer a left join message_from_system b on
- a.message_id = b.id
- where
- a.consumer_id = #{uid,jdbcType=VARCHAR}
- and a.delete_sign = 0
- <if test="subject != null">
- and b.subject = #{subject,jdbcType=INTEGER}
- </if>
- <if test="resourceType != null">
- and b.resource_type = #{resourceType,jdbcType=INTEGER}
- </if>
- order by isRead,b.create_time DESC
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
-
- <select id="listPersonalMessageCount" resultType="java.lang.Integer">
- select
- count(0)
- from
- message_consumer a left join message_from_system b on
- a.message_id = b.id
- where
- a.consumer_id = #{uid,jdbcType=VARCHAR}
- and a.delete_sign = 0
- <if test="subject != null">
- and b.subject = #{subject,jdbcType=INTEGER}
- </if>
- <if test="resourceType != null">
- and b.resource_type = #{resourceType,jdbcType=INTEGER}
- </if>
- </select>
- <select id="appMessageList" resultType="com.goafanti.message.bo.AppMessageBo">
- select a.id ,b.title,b.body,b.send_time as sendTime,b.create_time as createTime,a.is_read as isRead from jt_message_consumer a
- left join jt_message_producer b on a.message_id=b.id
- where a.delete_sign=0 and b.delete_sign=0 and b.is_draft=0 and b.is_send=1
- <if test="uid !=null and uid !=''">
- and a.aid=#{uid,jdbcType=VARCHAR}
- </if>
- order by a.is_read ,b.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="appMessageCount" resultType="java.lang.Integer">
- select count(*) from jt_message_consumer a
- <if test="uid !=null and uid !=''">
- where a.aid=#{uid,jdbcType=VARCHAR}
- </if>
- </select>
- </mapper>
|