shane
2021-08-20 ab6a423cf604b83f06b5768dbc162ece744a32d9
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
68
69
70
71
72
73
74
75
<?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="corderServiceDaoImpl">
 
    <resultMap type="com.java110.vo.api.corder.ApiCorderDataVo" id="orderMap">
        <id column="oId"  property="oId"/>
        <result column="appId"  property="appId"/>
        <result column="extTransactionId"  property="extTransactionId"/>
        <result column="userId"  property="userId"/>
        <result column="requestTime"  property="requestTime"/>
        <result column="createTime"  property="createTime"/>
        <result column="orderTypeCd"  property="orderTypeCd"/>
        <result column="finishTime"  property="finishTime"/>
        <result column="remark" property="remark"/>
        <result column="orderTypeCdName" property="orderTypeCdName"/>
        <!-- 一对多关系 -->
        <collection property="cBusiness" ofType="com.java110.vo.api.corder.CbusinessVo"  javaType="java.util.ArrayList">
            <id property="bId" column="bId"/>
            <result property="oId" column="oId"/>
            <result property="createTime" column="createTime"/>
            <result property="businessTypeCd" column="businessTypeCd"/>
            <result property="finishTime" column="finishTime"/>
            <result property="remark" column="remark"/>
            <result property="businessTypeCdName" column="businessTypeCdName"/>
        </collection>
    </resultMap>
 
 
    <select id="getCorderInfo" parameterType="Map" resultType="Map">
        select ca.`name` appName,t.create_time createTime,cbt.`name`,t.user_id,u.name userName,t.ext_transaction_id extTransactionId,t.status_cd statusCd,t.o_id oId
        from c_orders t
        left join c_business cb on t.o_id = cb.o_id
        left join c_business_type cbt on cb.business_type_cd = cbt.business_type_cd
        left join u_user u on t.user_id = u.user_id
        left join c_app ca on t.app_id = ca.app_id
        where 1 =1
        <if test="oId !=null and oId != ''">
            and t.o_id= #{oId}
        </if>
        <if test="extTransactionId !=null and extTransactionId != ''">
            and t.ext_transaction_id= #{extTransactionId}
        </if>
        <if test="orderTypeCd !=null and orderTypeCd != ''">
            and t.order_type_cd= #{orderTypeCd}
        </if>
        <if test="appId !=null and appId != ''">
            and t.app_id= #{appId}
        </if>
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
 
    </select>
 
    <select id="queryCordersCount" parameterType="Map" resultType="Map">
        select count(1) count
        from c_orders t
        left join c_business cb on t.o_id = cb.o_id
        left join c_business_type cbt on cb.business_type_cd = cbt.business_type_cd
        left join u_user u on t.user_id = u.user_id
        left join c_app ca on t.app_id = ca.app_id
        where 1 =1
        <if test="oId !=null and oId != ''">
            and t.o_id= #{oId}
        </if>
        <if test="appId !=null and appId != ''">
            and t.app_id= #{appId}
        </if>
 
    </select>
 
</mapper>