zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
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
<?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.changhong.epc.parsing.mapper.tenant.BillInfoMapper">
 
<resultMap id="billInfoMapperResultMap" type="com.changhong.epc.bean.parsing.BillInfo">
        <result property="orderCode" column="order_code"/>
        <result property="formId" column="form_id"/><!-- 表单Id -->
        <result property="formDataId" column="form_data_id"/><!-- 表单数据Id -->
        <result property="info" column="info"/><!-- 原始数据 -->
        <result property="infoLast" column="info_last"/><!-- 转换后数据 -->
        <result property="verify" column="verify"/><!-- 主数据是否缺失 2:不缺失 1:缺失 -->
        <result property="msg" column="msg"/>
        <result property="ctId" column="ct_id"/>
        <result property="info" column="info"/>
        <result property="infoLast" column="info_last"/>
    </resultMap>
 
     <select id="selectStartZero" parameterType="int" resultMap="billInfoMapperResultMap">
        SELECT ins_t,upd_t,ins_p,upd_p,data_start,id,order_code,info,info_last,form_id,form_data_id,if(verify = '', null, verify) verify,msg,ct_id FROM epc_bill_info_{rule}
            WHERE data_start = #{start}
    </select>
    
       <update id="updateBillState">
        UPDATE epc_bill_info_{rule}
          set data_start =0
        WHERE
          order_code = #{orderCode} and data_start = 2;
    </update>    
        
       <update id="updateBill" parameterType="com.changhong.epc.bean.parsing.BillInfo">
        UPDATE epc_bill_info_{rule}
        <!-- SET form_id = #{formId},
         form_data_id = #{formDataId} -->
          SET info = #{info},
          data_start = #{dataStart}
        WHERE
            order_code = #{orderCode}
    </update>
    
    <insert id="addBill" parameterType="com.changhong.epc.bean.parsing.BillInfo">
            INSERT INTO
                 epc_bill_info_{rule}
                     (
                     data_start
                     ,order_code
                     ,info
                     ,info_last
                     )
            VALUES        (
                        #{dataStart}
                        ,#{orderCode}
                        ,#{info}
                        ,#{infoLast}
                        ) 
    </insert>
    
    <select id="selectByOrderCode" resultType="com.changhong.epc.bean.parsing.BillInfo">
        select form_id as formId,
        form_data_id as formDataId,
        info
        from
        epc_bill_info_{rule}
        where
        order_code =#{orderCode} 
    </select>
   
</mapper>