<?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.ruoyi.order.mapper.TOrderEvaluateMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ruoyi.order.api.model.TOrderEvaluate">
|
<id column="id" property="id" />
|
<result column="order_type" property="orderType" />
|
<result column="order_id" property="orderId" />
|
<result column="app_user_id" property="appUserId" />
|
<result column="app_user_car_id" property="appUserCarId" />
|
<result column="mark" property="mark" />
|
<result column="content" property="content" />
|
<result column="img_url" property="imgUrl" />
|
<result column="evaluation_response" property="evaluationResponse" />
|
<result column="create_time" property="createTime" />
|
<result column="response_time" property="responseTime" />
|
<result column="del_flag" property="delFlag" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response, create_time, response_time, del_flag
|
</sql>
|
<select id="pageList" resultType="com.ruoyi.order.api.vo.TOrderEvaluateVO">
|
select id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response,
|
create_time, response_time, del_flag
|
from t_order_evaluate where id in
|
(select toe.id
|
from t_order_evaluate toe
|
left join t_order_evaluate_tag toet on toe.id = toet.order_evaluate_id
|
<where>
|
<if test="query.orderIds != null and query.orderIds.size()>0">
|
and toe.order_id in
|
<foreach collection="query.orderIds" item="orderId" open="(" separator="," close=")">
|
#{orderId}
|
</foreach>
|
</if>
|
<if test="query.tagType != null">
|
<choose>
|
<when test="query.tagType == 2">
|
AND toe.img_url IS NOT NULL
|
</when>
|
<when test="query.tagType == 3">
|
AND toe.mark >= 4
|
</when>
|
<when test="query.tagType == 4">
|
AND toe.mark <= 3
|
</when>
|
<when test="query.tagType == 5">
|
AND toet.evaluation_tag_id = #{query.tagId}
|
</when>
|
</choose>
|
</if>
|
AND toe.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
|
</where>
|
GROUP BY toe.id)
|
<if test="query.tagType != null">
|
<choose>
|
<when test="query.tagType == 1">
|
ORDER BY create_time DESC
|
</when>
|
<otherwise>
|
ORDER BY
|
CASE
|
WHEN img_url IS NOT NULL THEN 0
|
ELSE 1
|
END ASC,
|
create_time DESC;
|
</otherwise>
|
</choose>
|
</if>
|
<if test="query.tagType == null">
|
ORDER BY
|
CASE
|
WHEN img_url IS NOT NULL THEN 0
|
ELSE 1
|
END ASC,
|
create_time DESC;
|
</if>
|
</select>
|
<select id="getOrderEvaluateBySiteId" resultType="com.ruoyi.order.api.vo.TOrderEvaluateVO">
|
select id, order_type, order_id, app_user_id,app_user_car_id, mark, content, img_url, evaluation_response,
|
create_time, response_time, del_flag
|
from t_order_evaluate
|
where order_id in
|
(select order_id
|
from t_charging_order
|
where site_id = #{siteId}
|
and del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()})
|
</select>
|
|
|
|
<select id="getPageList" resultType="com.ruoyi.order.dto.GetOrderEvaluatePageListDTO">
|
select
|
a.id,
|
b.`code`,
|
a.mark,
|
b.site_id as siteId,
|
b.app_user_id as appUserId,
|
a.content,
|
a.img_url as imgUrl,
|
DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%i:%s') as createTime,
|
a.evaluation_response as `recover`
|
from t_order_evaluate a
|
left join t_charging_order b on (a.order_id = b.id)
|
where a.order_type = 1 and a.del_flag = 0
|
<if test="null != query.code and '' != query.code">
|
and b.`code` like CONCAT('%', #{query.code}, '%')
|
</if>
|
<if test="null != query.content and '' != query.content">
|
and a.content like CONCAT('%', #{query.content}, '%')
|
</if>
|
<if test="null != query.evaluateType">
|
and a.id in (select order_evaluate_id from t_order_evaluate_tag where evaluation_tag_id in
|
<foreach collection="evaluationTagIds" item="item" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
)
|
</if>
|
<if test="null != query.siteId">
|
and b.site_id = #{query.siteId}
|
</if>
|
order by a.create_time desc
|
</select>
|
<select id="goodTop" resultType="java.util.Map">
|
SELECT
|
count( 1 ) AS counts,
|
|
tt.`name`
|
FROM
|
t_order_evaluate_tag ot
|
LEFT JOIN t_order_evaluate te ON ot.order_evaluate_id = te.id
|
LEFT JOIN t_charging_order co ON te.order_id = co.id
|
LEFT JOIN `charging_pile_other`.`t_evaluation_tag` tt on ot.evaluation_tag_id = tt.id
|
WHERE ot.evaluation_tag_id in (
|
SELECT id from `charging_pile_other`.`t_evaluation_tag` WHERE type = 1
|
) <if test="null != siteIds">
|
and co.site_id in
|
<foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
GROUP BY
|
tt.`name`
|
ORDER BY
|
counts DESC
|
LIMIT 5
|
|
|
|
</select>
|
<select id="badTop" resultType="java.util.Map">
|
SELECT
|
count( 1 ) AS counts,
|
|
tt.`name`
|
FROM
|
t_order_evaluate_tag ot
|
LEFT JOIN t_order_evaluate te ON ot.order_evaluate_id = te.id
|
LEFT JOIN t_charging_order co ON te.order_id = co.id
|
LEFT JOIN `charging_pile_other`.`t_evaluation_tag` tt on ot.evaluation_tag_id = tt.id
|
WHERE ot.evaluation_tag_id in (
|
SELECT id from `charging_pile_other`.`t_evaluation_tag` WHERE type = 3
|
) <if test="null != siteIds">
|
and co.site_id in
|
<foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
GROUP BY
|
tt.`name`
|
ORDER BY
|
counts DESC
|
LIMIT 5
|
</select>
|
</mapper>
|