You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
test/target/classes/mapper/ChatDao.xml

112 lines
5.5 KiB

<?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.dao.ChatDao">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
a.id as id
,a.yonghu_id as yonghuId
,a.chat_issue as chatIssue
,a.issue_time as issueTime
,a.chat_reply as chatReply
,a.reply_time as replyTime
,a.zhuangtai_types as zhuangtaiTypes
,a.chat_types as chatTypes
,a.insert_time as insertTime
</sql>
<select id="selectListView" parameterType="map" resultType="com.entity.view.ChatView" >
SELECT
<include refid="Base_Column_List" />
-- 级联表的字段
,yonghu.yonghu_name as yonghuName
,yonghu.yonghu_photo as yonghuPhoto
,yonghu.yonghu_phone as yonghuPhone
,yonghu.yonghu_id_number as yonghuIdNumber
,yonghu.yonghu_email as yonghuEmail
,yonghu.new_money as newMoney
,yonghu.yonghu_delete as yonghuDelete
FROM chat a
left JOIN yonghu yonghu ON a.yonghu_id = yonghu.id
<where>
<if test="params.ids != null">
and a.id in
<foreach item="item" index="index" collection="params.ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="params.yonghuId != null and params.yonghuId != ''">
and (
a.yonghu_id = #{params.yonghuId}
)
</if>
<if test=" params.chatIssue != '' and params.chatIssue != null and params.chatIssue != 'null' ">
and a.chat_issue like CONCAT('%',#{params.chatIssue},'%')
</if>
<if test=" params.issueTimeStart != '' and params.issueTimeStart != null ">
<![CDATA[ and UNIX_TIMESTAMP(a.issue_time) >= UNIX_TIMESTAMP(#{params.issueTimeStart}) ]]>
</if>
<if test=" params.issueTimeEnd != '' and params.issueTimeEnd != null ">
<![CDATA[ and UNIX_TIMESTAMP(a.issue_time) <= UNIX_TIMESTAMP(#{params.issueTimeEnd}) ]]>
</if>
<if test=" params.chatReply != '' and params.chatReply != null and params.chatReply != 'null' ">
and a.chat_reply like CONCAT('%',#{params.chatReply},'%')
</if>
<if test=" params.replyTimeStart != '' and params.replyTimeStart != null ">
<![CDATA[ and UNIX_TIMESTAMP(a.reply_time) >= UNIX_TIMESTAMP(#{params.replyTimeStart}) ]]>
</if>
<if test=" params.replyTimeEnd != '' and params.replyTimeEnd != null ">
<![CDATA[ and UNIX_TIMESTAMP(a.reply_time) <= UNIX_TIMESTAMP(#{params.replyTimeEnd}) ]]>
</if>
<if test="params.zhuangtaiTypes != null and params.zhuangtaiTypes != ''">
and a.zhuangtai_types = #{params.zhuangtaiTypes}
</if>
<if test="params.chatTypes != null and params.chatTypes != ''">
and a.chat_types = #{params.chatTypes}
</if>
<if test=" params.insertTimeStart != '' and params.insertTimeStart != null ">
<![CDATA[ and UNIX_TIMESTAMP(a.insert_time) >= UNIX_TIMESTAMP(#{params.insertTimeStart}) ]]>
</if>
<if test=" params.insertTimeEnd != '' and params.insertTimeEnd != null ">
<![CDATA[ and UNIX_TIMESTAMP(a.insert_time) <= UNIX_TIMESTAMP(#{params.insertTimeEnd}) ]]>
</if>
<!-- 判断用户的id不为空 -->
<if test=" params.yonghuIdNotNull != '' and params.yonghuIdNotNull != null and params.yonghuIdNotNull != 'null' ">
and a.yonghu_id IS NOT NULL
</if>
<if test=" params.yonghuName != '' and params.yonghuName != null and params.yonghuName != 'null' ">
and yonghu.yonghu_name like CONCAT('%',#{params.yonghuName},'%')
</if>
<if test=" params.yonghuPhone != '' and params.yonghuPhone != null and params.yonghuPhone != 'null' ">
and yonghu.yonghu_phone like CONCAT('%',#{params.yonghuPhone},'%')
</if>
<if test=" params.yonghuIdNumber != '' and params.yonghuIdNumber != null and params.yonghuIdNumber != 'null' ">
and yonghu.yonghu_id_number like CONCAT('%',#{params.yonghuIdNumber},'%')
</if>
<if test=" params.yonghuEmail != '' and params.yonghuEmail != null and params.yonghuEmail != 'null' ">
and yonghu.yonghu_email like CONCAT('%',#{params.yonghuEmail},'%')
</if>
<if test="params.newMoneyStart != null ">
<![CDATA[ and yonghu.new_money >= #{params.newMoneyStart} ]]>
</if>
<if test="params.newMoneyEnd != null ">
<![CDATA[ and yonghu.new_money <= #{params.newMoneyEnd} ]]>
</if>
<if test="params.yonghuDeleteStart != null and params.yonghuDeleteStart != '' ">
<![CDATA[ and yonghu.yonghu_delete >= #{params.yonghuDeleteStart} ]]>
</if>
<if test="params.yonghuDeleteEnd != null and params.yonghuDeleteEnd != '' ">
<![CDATA[ and yonghu.yonghu_delete <= #{params.yonghuDeleteEnd} ]]>
</if>
<if test="params.yonghuDelete != null and params.yonghuDelete != '' ">
and yonghu.yonghu_delete = #{params.yonghuDelete}
</if>
</where>
order by a.${params.orderBy}
</select>
</mapper>