zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
commit | author | age
a18bfa 1 <?xml version="1.0" encoding="UTF-8" ?>
Z 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 <!-- Table:epc_master_element_mapping -->
4 <mapper namespace="com.changhong.epc.admin.mapper.centen.site.MasterElementMappingMapper">
5     
6     <resultMap type="com.changhong.epc.bean.admin.MasterElementMapping" id="resultMap">
7         <result property="meCode" column="me_code"/>
8         <result property="tableField" column="table_field"/>
9     </resultMap>
10     
11     <select id="getField" resultMap="resultMap">
12         
13         SELECT
14         
15                <choose>
16                 <when test="params != null">
17                 (    
18                     CASE
19                     <foreach collection="params" item="item" index="index">
20                         WHEN me_code = #{item.code}
21                             THEN #{item.alias}
22                     </foreach>
23                     END
24                 ) me_code,
25                 
26                 </when>
27                 <otherwise>
28                  me_code,
29                 </otherwise>
30             </choose>
31             table_field,
32             m_id
33         FROM
34             epc_master_element_mapping
35         WHERE
36             m_id = #{id}
37             <if test="params != null">
38                 AND me_code in
39                 <foreach collection="params" item="item" index="index" open="(" close=")" separator=",">
40                      #{item.code}
41             
42              </foreach>
43             </if>
44         
45     </select>
46     
47     <select id="getFieldOne" resultType="java.lang.String">
48         SELECT
49             table_field
50         FROM
51             epc_master_element_mapping
52         WHERE
53         m_id = #{id} and me_code = #{code}
54     
55     
56     </select>
57
58     <update id="updateMasterElementMapping" parameterType="com.changhong.epc.bean.admin.MasterElementMapping">
59         update  epc_master_element_mapping
60         <trim prefix="set" suffix=" where id = #{id} " suffixOverrides=",">
61             <if test="mId != null">
62                 m_id=#{mId},
63             </if>
64             <if test="meCode!=null and meCode.length()>0">
65                 me_code=#{meCode},
66             </if>
67             <if test="tableField != null and tableField.length()>0">
68                 table_field=#{tableField},
69             </if>
70             <!--<if test="updT != null">
71                 upd_t=#{updT},
72             </if>
73             <if test="updP != null and updP.length()>0">
74                 upd_p=#{updP},
75             </if>-->
76
77         </trim>
78
79     </update>
80
81     <select id="getFieldByMid" resultMap="resultMap">
82           select
83           me_code,table_field
84           from
85               epc_master_element_mapping
86           where
87               m_id=#{mid}
88     </select>
89
90
91
92
93     
94 </mapper>