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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?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.tenant.mapper.tenant.system.ErrSystemMsgMapper">
    <resultMap type="com.changhong.epc.bean.tenant.system.ErrSystemMsg" id="errSystemMsgTYPE">
        <result property="mdName" column="md_name"/>
        <result property="errType" column="err_type"/>
    </resultMap>
    
    <resultMap type="com.changhong.epc.bean.tenant.system.ErrSystemMsg" id="errSystemPageSql">
        <result property="id" column="id"/>
        <result property="mdName" column="md_name"/>
        <result property="mdCode" column="md_code"/>
        <result property="viewMsg" column="view_msg"/>
        <result property="errType" column="err_type"/>
        <result property="errFlag" column="err_flag"/>
        <result property="mvVal" column="mv_val"/>
        <result property="Def1" column="def1"/>
        <result property="Def2" column="def2"/>
        <result property="Def3" column="def3"/>
        <result property="Def4" column="def4"/>
        <result property="Def5" column="def5"/>
        <result property="insP" column="ins_p"/>
        <result property="insT" column="ins_t"/>
        <result property="updP" column="upd_p"/>
        <result property="updT" column="upd_t"/>
        <result property="dataStart" column="data_start"/>
        <result property="orderCode" column="orderCode"/>
        <result property="formId" column="formId"/>
        <result property="dataRowNum" column="dataRowNum"/>
        <result property="formName" column="formName"/>
    </resultMap>
    <sql id="errSystemMsgSql">
        id,md_name,md_code,
        view_msg,err_type,err_flag,
        mv_val,def1,def2,
        def3,def4,def5,
        ins_p,ins_t,upd_p,
        upd_t,data_start
    </sql>
    <select id="selectType" resultMap="errSystemMsgTYPE">
        SELECT
            md_name,
            err_type
        FROM
            epc_err_system_msg_{rule}
        WHERE
            epc_err_system_msg_{rule} .md_name != 'null'
        AND epc_err_system_msg_{rule} .err_type != 'null'
        GROUP BY
            md_name,
            err_type
    </select>
        
    <select id="selectByTypePage" resultMap="errSystemPageSql">
        SELECT
        id,md_name,md_code,
        view_msg,err_type,err_flag,
        mv_val,def1,def2,
        def3,def4,def5,
        ins_p,ins_t,upd_p,
        upd_t,data_start,orderCode,dataRowNum,formId,
        (select f_name from epc_cost_from_mapping_{rule} where f_id = formId LIMIT 1) formName
        FROM
        epc_err_system_msg_{rule}
        <trim prefix="WHERE" prefixOverrides="AND | OR">
            <if test="err.errType!=null">
                AND err_type = #{err.errType}
            </if>    
            <if test="err.errFlag!=null" >
                AND err_flag = #{err.errFlag}
            </if>
 
        </trim>
        ORDER BY  ins_t desc,formId DESC
    </select>
    
    <update id="updateFlag">
        update epc_err_system_msg_{rule}  SET err_flag=10
        WHERE id=#{id}
    </update>
    
</mapper>