曾成
2020-03-22 ca236e9df91a3bc24115b7ee2212507ddbd28854
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
76
<?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" resultMap="orderMap">
        select
            t.o_id oId,t.app_id appId,t.ext_transaction_id extTransactionId,
            t.user_id userId,
            t.request_time requestTime,t.create_time createtime,
            t.order_type_cd orderTypeCd,t.finish_time finishTime,
            t.remark,b.b_id bId,b.o_id oId,b.create_time createTime,
            b.business_type_cd businessTypecd,b.finish_time finishTime,
            b.remark remark,
            t1.name orderTypeCdName,t2.name businessTypeCdName
        from c_orders t left join c_business b on t.o_id = b.o_id
        left join c_business_type t2 on b.business_type_cd = t2.business_type_cd
        inner join c_order_type t1 on t.order_type_cd = t1.order_type_cd
        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>
        <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
        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>