<?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.stylefeng.guns.modular.system.dao.TbCommentMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TbComment">
|
<id column="id" property="id" />
|
<result column="userType" property="userType" />
|
<result column="userId" property="userId" />
|
<result column="type" property="type" />
|
<result column="orderId" property="orderId" />
|
<result column="replyUserType" property="replyUserType" />
|
<result column="replyUserId" property="replyUserId" />
|
<result column="content" property="content" />
|
<result column="createTime" property="createTime" />
|
<result column="orderInfo" property="orderInfo" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, userType, userId, type, orderId, replyUserType, replyUserId, content, createTime, orderInfo
|
</sql>
|
|
<select id="getList" resultType="com.stylefeng.guns.modular.system.model.TbComment">
|
SELECT *
|
,CASE WHEN userType=1 THEN (SELECT nickName FROM t_user WHERE userId=id)
|
ELSE (SELECT `name` FROM t_driver WHERE userId=id) END userName
|
,CASE WHEN userType=1 THEN (SELECT avatar FROM t_user WHERE userId=id)
|
ELSE (SELECT headImgUrl FROM t_driver WHERE userId=id) END userAvatar
|
|
,CASE WHEN replyUserType=1 THEN (SELECT nickName FROM t_user WHERE replyUserId=id)
|
ELSE (SELECT `name` FROM t_driver WHERE replyUserId=id) END replyUserName
|
,CASE WHEN replyUserType=1 THEN (SELECT avatar FROM t_user WHERE replyUserId=id)
|
ELSE (SELECT headImgUrl FROM t_driver WHERE replyUserId=id) END replyUserAvatar
|
FROM tb_comment
|
<where>
|
1=1 and isDetele=1
|
<if test="type!=null">
|
and type=#{type}
|
</if>
|
<if test="orderId!=null">
|
and orderId=#{orderId}
|
</if>
|
<if test="pid!=null">
|
and pid=#{pid}
|
order by id asc
|
</if>
|
<if test="pid==null">
|
and pid is null
|
order by id desc
|
limit #{pageNum}, #{size}
|
</if>
|
</where>
|
</select>
|
</mapper>
|