“mitao”
2025-12-23 ae7063f5e4a49e2ed55f240440246bdbae3fcc13
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?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.system.mapper.TOrderTransferMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.model.TOrderTransfer">
        <id column="id" property="id" />
        <result column="big_gift_package_order_id" property="bigGiftPackageOrderId" />
        <result column="old_company_id" property="oldCompanyId" />
        <result column="old_app_user_id" property="oldAppUserId" />
        <result column="old_user_id" property="oldUserId" />
        <result column="new_company_id" property="newCompanyId" />
        <result column="new_app_user_id" property="newAppUserId" />
        <result column="new_user_id" property="newUserId" />
        <result column="create_time" property="createTime" />
        <result column="del_flag" property="delFlag" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, big_gift_package_order_id, old_company_id, old_app_user_id, old_user_id, new_company_id, new_app_user_id, new_user_id, create_time, del_flag
    </sql>
 
    <select id="pageList" resultType="com.ruoyi.system.vo.TOrderTransferVo">
        select t1.id,t2.code,t1.old_user_id oldUserId,t1.new_user_id newUserId,t3.name oldUser,t4.name newUser,
               t3.code oldUserCode,t4.code newUserCode,t3.phone oldUserPhone,t4.phone newUserPhone,t3.company_id oldCompanyId,
               t4.company_id newCompanyId
        from  t_order_transfer t1
        left join t_big_gift_package_order t2 on t1.big_gift_package_order_id = t2.id
        left join t_app_user t3 on t1.old_app_user_id = t3.id
        left join t_app_user t4 on t1.new_app_user_id = t4.id
        where t1.del_flag = 0
        <if test="query.code != null and query.code != ''">
            and t2.code like concat('%',#{query.code},'%')
        </if>
        <if test="query.oldUserCode != null and query.oldUserCode != ''">
            and t3.code like concat('%',#{query.oldUserCode},'%')
        </if>
        <if test="query.newUserCode != null and query.newUserCode != ''">
            and t4.code like concat('%',#{query.newUserCode},'%')
        </if>
        order by t1.create_time desc
 
    </select>
    <select id="pageListExport" resultType="com.ruoyi.system.vo.TOrderTransferVo"
            parameterType="com.ruoyi.system.query.OrderTransferQuery">
        select t1.id,t2.code,t1.old_user_id oldUserId,t1.new_user_id newUserId,t3.name oldUser,t4.name newUser,
        t3.code oldUserCode,t4.code newUserCode,t3.phone oldUserPhone,t4.phone newUserPhone,t3.company_id oldCompanyId,
        t4.company_id newCompanyId
        from  t_order_transfer t1
        left join t_big_gift_package_order t2 on t1.big_gift_package_order_id = t2.id
        left join t_app_user t3 on t1.old_app_user_id = t3.id
        left join t_app_user t4 on t1.new_app_user_id = t4.id
        where t1.del_flag = 0
        <if test="query.code != null and query.code != ''">
            and t2.code like concat('%',#{query.code},'%')
        </if>
        <if test="query.oldUserCode != null and query.oldUserCode != ''">
            and t3.code like concat('%',#{query.oldUserCode},'%')
        </if>
        <if test="query.newUserCode != null and query.newUserCode != ''">
            and t4.code like concat('%',#{query.newUserCode},'%')
        </if>
        order by t1.create_time desc
    </select>
 
</mapper>