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_default_mapping --> |
|
4 |
<mapper namespace="com.changhong.epc.admin.mapper.centen.site.MasterDefaultMappingMapper"> |
|
5 |
|
|
6 |
<resultMap type="com.changhong.epc.bean.admin.MasterDefaultMapping" id="resultMap"> |
|
7 |
|
|
8 |
<id property="id" column="id"/> |
|
9 |
<result property="mdCode" column="md_code"/> |
|
10 |
<result property="tableName" column="table_name"/> |
|
11 |
<result property="type" column="type"/> |
|
12 |
</resultMap> |
|
13 |
<sql id="masterDefaultMappingSql"> |
|
14 |
md_code, table_name |
|
15 |
</sql> |
|
16 |
|
|
17 |
<select id="selectMaster" resultMap="resultMap"> |
|
18 |
|
|
19 |
SELECT |
|
20 |
id,md_code,table_name,type |
|
21 |
FROM |
|
22 |
epc_master_default_mapping |
|
23 |
WHERE |
|
24 |
md_code = #{code} |
|
25 |
|
|
26 |
</select> |
|
27 |
|
|
28 |
<select id="selectMasterById" resultMap="resultMap"> |
|
29 |
|
|
30 |
SELECT |
|
31 |
id,md_code,table_name,type |
|
32 |
FROM |
|
33 |
epc_master_default_mapping |
|
34 |
WHERE |
|
35 |
id = #{id} |
|
36 |
</select> |
|
37 |
|
|
38 |
<select id="selectValue" resultType="java.util.Map"> |
|
39 |
select |
|
40 |
<if test="tableName == 'epc_nationwide_site'"> |
|
41 |
DISTINCT |
|
42 |
</if> |
|
43 |
<foreach collection="list" item="ele" separator=","> |
|
44 |
${ele.tableField} as #{ele.meCode} |
|
45 |
</foreach> |
|
46 |
from ${tableName} |
|
47 |
where data_start = 0 |
|
48 |
and DEL_FLAG = 0 |
|
49 |
<if test="listParam != null and code != null"> |
|
50 |
and ${code} in |
|
51 |
<foreach collection="listParam" item="item" index="index" open="(" close=")" separator=","> |
|
52 |
#{item} |
|
53 |
</foreach> |
|
54 |
</if> |
|
55 |
<if test="value != null and listParam ==null"> |
|
56 |
and ${value} LIKE CONCAT('%',#{value},'%') |
|
57 |
</if> |
|
58 |
<if test="value != null and listParam !=null"> |
|
59 |
or ${value} LIKE CONCAT('%',#{value},'%') |
|
60 |
</if> |
|
61 |
order by ROW_NO asc |
|
62 |
<if test="isAll!=null"> |
|
63 |
limit 100 |
|
64 |
</if> |
|
65 |
</select> |
|
66 |
|
|
67 |
<select id="CodeConValue" resultType="java.lang.String"> |
|
68 |
SELECT |
|
69 |
${con.valueFlied} |
|
70 |
FROM |
|
71 |
${con.tableName} |
|
72 |
WHERE |
|
73 |
${con.codeFlied} = #{con.code} |
|
74 |
LIMIT 1; |
|
75 |
</select> |
|
76 |
|
|
77 |
<select id="ValueConCode" resultType="java.lang.String"> |
|
78 |
SELECT |
|
79 |
${con.codeFlied} |
|
80 |
FROM |
|
81 |
${con.tableName} |
|
82 |
WHERE |
|
83 |
${con.valueFlied} = #{con.value} |
|
84 |
LIMIT 1; |
|
85 |
</select> |
|
86 |
|
|
87 |
<update id="updateMasterDefaultMapping" parameterType="com.changhong.epc.bean.admin.MasterDefaultMapping"> |
|
88 |
update epc_master_default_mapping |
|
89 |
<trim prefix="set" suffix=" where id = #{id} " suffixOverrides=","> |
|
90 |
<if test="mdCode!=null and mdCode.length()>0"> |
|
91 |
md_code=#{mdCode}, |
|
92 |
</if> |
|
93 |
<if test="tableName != null and tableName.length()>0"> |
|
94 |
table_name=#{tableName}, |
|
95 |
</if> |
|
96 |
<if test="type != null and type.length()>0"> |
|
97 |
type=#{type}, |
|
98 |
</if> |
|
99 |
<!-- <if test="updT != null"> |
|
100 |
upd_t=#{updT}, |
|
101 |
</if> |
|
102 |
<if test="updP != null and updP.length()>0"> |
|
103 |
upd_p=#{updP}, |
|
104 |
</if>--> |
|
105 |
</trim> |
|
106 |
|
|
107 |
</update> |
|
108 |
|
|
109 |
<insert id="insertDefaultMappingToId" parameterType="com.changhong.epc.bean.admin.MasterDefaultMapping" |
|
110 |
useGeneratedKeys="true" keyProperty="mdm.id"> |
|
111 |
insert into epc_master_default_mapping(md_code,table_name,ins_p,ins_t,upd_p,upd_t,data_start,type) |
|
112 |
values(#{mdm.mdCode},#{mdm.tableName},#{mdm.insP},#{mdm.insT},#{mdm.updP},#{mdm.updT},#{mdm.dataStart},#{mdm.type}) |
|
113 |
</insert> |
|
114 |
|
|
115 |
<resultMap id="selectAllDefAndEleMap" type="com.changhong.epc.bean.admin.MasterDefaultMapping"> |
|
116 |
<id column="id" property="id"/> |
|
117 |
<result column="md_code" property="mdCode"/> |
|
118 |
<result column="table_name" property="tableName"/> |
|
119 |
<result column="type" property="type"/> |
|
120 |
<collection property="masterElementMappings" ofType="com.changhong.epc.bean.admin.MasterElementMapping" > |
|
121 |
<id column="me_code" property="meCode"/> |
|
122 |
<result column="table_field" property="tableField"/> |
|
123 |
</collection> |
|
124 |
</resultMap> |
|
125 |
|
|
126 |
<select id="selectAllDefAndEle" resultMap="selectAllDefAndEleMap"> |
|
127 |
SELECT |
|
128 |
def.id, |
|
129 |
def.md_code, |
|
130 |
def.table_name, |
|
131 |
def.type, |
|
132 |
ele.me_code, |
|
133 |
ele.table_field |
|
134 |
FROM |
|
135 |
epc_master_default_mapping def |
|
136 |
left join epc_master_element_mapping ele on ele.m_id = def.id |
|
137 |
</select> |
|
138 |
|
|
139 |
</mapper> |