| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?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.sckw.message.dao.KwmMessageMapper">
- <select id="findPage" resultType="com.sckw.message.model.dto.MessageListDTO" >
- select m.id,
- mu.ent_id entId,
- mu.user_id userId,
- mu.status,
- mu.remark,
- mu.create_by createBy,
- mu.create_time createTime,
- mu.update_by updateBy,
- mu.update_time updateTime,
- mu.msg_id as msgId,
- m.category,
- m.type,
- m.title,
- m.content,
- m.url,
- m.params,
- m.client_type clientType,
- m.remark as msgRemark
- from kwm_message_user mu
- left join kwm_message m
- on mu.msg_id = m.id
- <where>
- m.del_flag = 0
- and mu.del_flag = 0
- <if test="item.entId != null">
- and mu.ent_id = #{item.entId}
- </if>
- <if test="item.query != null and item.query != ''">
- and (m.title like concat('%', #{item.query}, '%') or m.content like concat(#{item.query}, '%'))
- </if>
- <if test="item.userId != null">
- and mu.user_id = #{item.userId}
- </if>
- <if test="item.status != null">
- and mu.status = #{item.status}
- </if>
- <if test="item.category != null and item.category != ''">
- and m.category = #{item.category}
- </if>
- <if test="item.startCreateTime != null">
- and mu.create_time >= #{item.startCreateTime,jdbcType=TIMESTAMP}
- </if>
- <if test="item.endCreateTime != null">
- and mu.create_time <= #{item.endCreateTime,jdbcType=TIMESTAMP}
- </if>
- </where>
- ORDER BY mu.status, mu.create_time DESC
- </select>
- <select id="statistics" resultType="com.sckw.core.model.vo.TableTop">
- select
- mu.status as value,count(*) as total
- from kwm_message_user mu
- left join kwm_message m
- on mu.msg_id = m.id
- <where>
- m.del_flag = 0 and mu.del_flag = 0
- <if test="item.entId != null">
- and mu.ent_id = #{item.entId}
- </if>
- <if test="item.userId != null">
- and mu.user_id = #{item.userId}
- </if>
- <if test="item.category != null and item.category != ''">
- and m.category = #{item.category}
- </if>
- <if test="item.startCreateTime != null">
- and mu.create_time >= #{item.startCreateTime,jdbcType=TIMESTAMP}
- </if>
- <if test="item.endCreateTime != null">
- and mu.create_time <= #{item.endCreateTime,jdbcType=TIMESTAMP}
- </if>
- </where>
- group by mu.status
- </select>
- <select id="joinCount" resultType="java.lang.Long">
- select count(1)
- from kwm_message km
- inner join kwm_message_user kmu on km.id = kmu.msg_id and kmu.del_flag = 0
- <where>
- km.del_flag = 0
- <if test="para.entId != null">
- and kmu.ent_id = #{para.entId}
- </if>
- <if test="para.query != null and para.query != ''">
- and (km.title like concat('%', #{para.query}, '%') or km.content like concat(#{para.query}, '%'))
- </if>
- <if test="para.userId != null">
- and kmu.user_id = #{para.userId}
- </if>
- <if test="para.category != null and para.category != ''">
- and km.category = #{param1.category}
- </if>
- <if test="para.status != null">
- and km.status = #{para.status}
- </if>
- </where>
- </select>
- </mapper>
|