44323
2024-05-21 781b5fea46cd55220b5ffca17aa6bb1b83551410
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
40
41
42
43
44
45
46
47
<?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.management.mapper.TOrderMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.goods.api.domain.TOrder">
        <id column="id" property="id" />
        <result column="orderNumber" property="orderNumber" />
        <result column="userId" property="userId" />
        <result column="insertTime" property="insertTime" />
        <result column="goodsId" property="goodsId" />
        <result column="count" property="count" />
        <result column="state" property="state" />
        <result column="express" property="express" />
        <result column="expressNumber" property="expressNumber" />
        <result column="expressTime" property="expressTime" />
        <result column="integral" property="integral" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, orderNumber, userId, insertTime, goodsId, count, state, express, expressNumber, expressTime, integral
    </sql>
    <select id="listAll" resultType="com.ruoyi.management.vo.TOrderVO">
        select t1.*,t2.`name` as userName,t2.phone as phone
        from t_order t1
        left join t_user t2 on t1.userId = t2.id
        where 1=1
        <if test="null != req.state">
            and t1.state = #{req.state}
        </if>
        <if test="null != req.orderNumber and '' != req.orderNumber">
            and t1.orderNumber like CONCAT('%', #{req.orderNumber}, '%')
        </if>
        <if test="null != req.userName and '' != req.userName">
            and t2.`name` like CONCAT('%', #{req.userName}, '%')
        </if>
        <if test="null != req.phone and '' != req.phone">
            and t2.phone like CONCAT('%', #{req.phone}, '%')
        </if>
        <if test="null != req.startTime">
            and t1.insertTime between #{req.startTime} and #{req.endTime}
        </if>
        order by t1.insertTime desc
    </select>
 
</mapper>