Pu Zhibing
2025-03-28 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?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.OrderEvaluateMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.OrderEvaluate">
        <id column="id" property="id" />
        <result column="orderId" property="orderId" />
        <result column="driverId" property="driverId" />
        <result column="orderType" property="orderType" />
        <result column="fraction" property="fraction" />
        <result column="content" property="content" />
        <result column="insertTime" property="insertTime" />
        <result column="userId" property="userId" />
    </resultMap>
 
 
    <select id="queryEvaluate" resultType="map">
        select
        DATE_FORMAT(insertTime, '%Y-%m-%d') as insertTime,
        content as content,
        fraction as fraction
        from t_order_evaluate where driverId = #{uid} and unix_timestamp(insertTime) &lt; unix_timestamp(now()) - 86400 order by insertTime desc limit #{pageNum}, #{size}
    </select>
 
 
    <select id="queryCount" resultType="double">
        select (
        (select sum(fraction) from t_order_evaluate where driverId = #{uid}) / (select count(fraction) from t_order_evaluate where driverId = #{uid})
        )
    </select>
 
 
    <select id="queryDriverScore" resultType="double">
        select ifnull(max(fraction), 0) as fraction from (
        select ROUND(ifnull(sum(fraction), 0) / count(1), 1) as fraction from t_order_evaluate where driverId = #{driverId} group by driverId
        ) as aa
    </select>
</mapper>