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_supp_stander_{rule} --> |
|
4 |
<mapper namespace="com.changhong.epc.tenant.mapper.tenant.norm.SuppStanderMapper"> |
|
5 |
<resultMap id="suppAndapp" type="com.changhong.epc.bean.tenant.norm.extend.SuppStanderExtend"> |
|
6 |
<id property="id" column="id"/><!-- 主键id --> |
|
7 |
<result property="name" column="name"/> |
|
8 |
<result property="type" column="type"/> |
|
9 |
<result property="typeName" column="type_name"/> |
|
10 |
<result property="subType" column="sub_type"/> |
|
11 |
<result property="rule" column="rule"/> |
|
12 |
<result property="ctId" column="ct_id"/> |
|
13 |
<result property="overlookExpendType" column="overlook_expend_type"/> |
|
14 |
<result property="dataStart" column="data_start"/> |
|
15 |
<result property="insP" column="ins_p"/> |
|
16 |
<result property="insT" column="ins_t"/> |
|
17 |
<result property="updP" column="upd_p"/> |
|
18 |
<result property="updT" column="upd_t"/> |
|
19 |
<collection property="appStanderDefs" javaType="java.util.List" ofType="com.changhong.epc.bean.tenant.norm.extend.AppStanderExtend"> |
|
20 |
<id property="id" column="appId"/> |
|
21 |
<result property="elIden" column="el_iden"/> |
|
22 |
<result property="masDefineCode" column="mas_define_code"/> |
|
23 |
<result property="type" column="aType"/> |
|
24 |
<result property="defType" column="def_type"/> |
|
25 |
<result property="defName" column="def_name"/> |
|
26 |
<result property="asDefValue" column="def_value"/> |
|
27 |
<result property="defValue" column="def_value"/> |
|
28 |
<result property="rowNo" column="row_no"/> |
|
29 |
<result property="colNo" column="col_no"/> |
|
30 |
<result property="squ" column="squ"/> |
|
31 |
<result property="showFlag" column="show_flag"/> |
|
32 |
<result property="relation" column="relation"/> |
|
33 |
<result property="inverse" column="inverse"/> |
|
34 |
<result property="showCount" column="show_count"/> |
|
35 |
<result property="count" column="count"/> |
|
36 |
<result property="insP" column="ins_p"/> |
|
37 |
<result property="insT" column="ins_t"/> |
|
38 |
<result property="updP" column="upd_p"/> |
|
39 |
<result property="updT" column="upd_t"/> |
|
40 |
<result property="dataStart" column="data_start"/> |
|
41 |
</collection> |
|
42 |
</resultMap> |
|
43 |
|
|
44 |
<sql id="normTypeSql"> |
|
45 |
t1.id,t1.NAME,t1.type,t1.type_name, |
|
46 |
t1.sub_type,t1.rule,t1.ct_id, |
|
47 |
t1.data_start,t1.ins_p,t1.ins_t, |
|
48 |
t1.upd_p,t1.upd_t,t2.id as appId, |
|
49 |
t2.el_iden,t2.mas_define_code, |
|
50 |
t2.type as atype,t2.def_type, |
|
51 |
t2.def_name,t2.def_value, |
|
52 |
t2.row_no,t2.col_no, |
|
53 |
t2.squ,t2.show_flag, |
|
54 |
t2.relation,t2.inverse, |
|
55 |
t2.show_count,t2.count, |
|
56 |
t2.ss_id,t2.ins_p, |
|
57 |
t2.ins_t,t2.upd_p, |
|
58 |
t2.upd_t,t2.data_start |
|
59 |
</sql> |
|
60 |
<insert id="SuppStanderSave" parameterType="com.changhong.epc.bean.tenant.norm.extend.SuppStanderExtend" |
|
61 |
useGeneratedKeys="true" keyProperty="supp.id" > |
|
62 |
insert into epc_supp_stander_{rule} (id,name,type,type_name,sub_type,rule,ct_id,data_start,ins_p,ins_t,upd_p,upd_t) |
|
63 |
values |
|
64 |
(null,#{supp.name},#{supp.type},#{supp.typeName},#{supp.subType},#{supp.rule},#{supp.ctId},#{supp.dataStart},#{supp.insP},#{supp.insT},#{supp.updP},#{supp.updT}) |
|
65 |
</insert> |
|
66 |
|
|
67 |
<select id="selectByid" resultMap="suppAndapp" parameterType="java.lang.Integer"> |
|
68 |
SELECT |
|
69 |
t1.id, |
|
70 |
t1.NAME, |
|
71 |
t1.type, |
|
72 |
t1.type_name, |
|
73 |
t1.sub_type, |
|
74 |
t1.rule, |
|
75 |
t1.ct_id, |
|
76 |
t1.data_start, |
|
77 |
t1.ins_p, |
|
78 |
t1.ins_t, |
|
79 |
t1.upd_p, |
|
80 |
t1.upd_t, |
|
81 |
t2.el_iden, |
|
82 |
t2.mas_define_code, |
|
83 |
t2.type as aType, |
|
84 |
t2.def_type, |
|
85 |
t2.def_name, |
|
86 |
t2.def_value, |
|
87 |
t2.row_no, |
|
88 |
t2.col_no, |
|
89 |
t2.squ, |
|
90 |
t2.show_flag, |
|
91 |
t2.relation, |
|
92 |
t2.inverse, |
|
93 |
t2.show_count, |
|
94 |
t2.count, |
|
95 |
t2.ss_id, |
|
96 |
t2.ins_p, |
|
97 |
t2.ins_t, |
|
98 |
t2.upd_p, |
|
99 |
t2.upd_t, |
|
100 |
t2.data_start, |
|
101 |
ct.overlook_expend_type |
|
102 |
FROM |
|
103 |
epc_supp_stander_{rule} t1 |
|
104 |
left join epc_cost_type_{rule} ct on t1.ct_id = ct.id and ct.data_start = 0 |
|
105 |
LEFT JOIN epc_app_stander_def_{rule} t2 ON t1.id = t2.ss_id |
|
106 |
<trim prefix="WHERE" prefixOverrides="AND | OR"> |
|
107 |
t1.data_start = 0 |
|
108 |
<if test="ctId!=null" > |
|
109 |
and t1.ct_id=#{ctId} |
|
110 |
</if> |
|
111 |
</trim> |
|
112 |
group by t2.ss_id,t2.row_no,t2.col_no |
|
113 |
</select> |
|
114 |
|
|
115 |
<update id="SuppStanderUpdate" parameterType="com.changhong.epc.bean.tenant.norm.extend.SuppStanderExtend"> |
|
116 |
update epc_supp_stander_{rule} SET data_start=99 |
|
117 |
where ct_id |
|
118 |
<foreach collection="supp" item="sup" open="in(" close=")" separator=","> |
|
119 |
#{sup.ctId} |
|
120 |
</foreach> |
|
121 |
</update> |
|
122 |
|
|
123 |
<select id="selectCostTypeIds" resultType="com.changhong.epc.bean.tenant.cost.CostType"> |
|
124 |
select |
|
125 |
DISTINCT |
|
126 |
ct_id id |
|
127 |
from epc_supp_stander_{rule} |
|
128 |
where data_start = 0 |
|
129 |
</select> |
|
130 |
|
|
131 |
<insert id="copySuppStander" > |
|
132 |
insert into epc_supp_stander_{rule}(id,NAME,type,type_name,sub_type,rule,ct_id,data_start,ins_p,ins_t,upd_p,upd_t) |
|
133 |
select id,NAME,type,type_name,sub_type,rule,ct_id,data_start,ins_p,ins_t,upd_p,upd_t |
|
134 |
from epc_center.epc_cost_supp_stander_template |
|
135 |
where cg_id = #{costTypeTempId} |
|
136 |
and ct_id = #{ctId} |
|
137 |
</insert> |
|
138 |
|
|
139 |
<insert id="copyAppStanderDef"> |
|
140 |
insert into epc_app_stander_def_{rule} |
|
141 |
select a.* |
|
142 |
from epc_center.epc_cost_app_stander_def_template a |
|
143 |
left join epc_center.epc_cost_supp_stander_template c on a.ss_id = c.id |
|
144 |
where c.cg_id = #{costTypeTempId} |
|
145 |
and c.ct_id = #{ctId} |
|
146 |
</insert> |
|
147 |
|
|
148 |
</mapper> |