<?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.admin.mapper.centen.cost.CostTypeTemplateMapper">
|
<resultMap type="com.changhong.epc.bean.admin.CostTypeTemplate" id="selectCost">
|
<id property="id" column="id"/>
|
<result property="name" column="name"/>
|
<result property="costDesc" column="cost_desc"/>
|
<result property="formIdStr" column="FORM_ID_STR"/>
|
</resultMap>
|
|
<select id="selectByPage" parameterType="com.changhong.epc.bean.admin.CostTypeTemplate" resultMap="selectCost">
|
SELECT
|
ID,
|
NAME,
|
COST_DESC,
|
INS_T,
|
INS_P,
|
UPD_T,
|
UPD_P,
|
DATA_START,
|
FORM_ID_STR
|
FROM
|
EPC_COST_TYPE_TEMPLATE_GROUP
|
WHERE DATA_START = 0
|
ORDER BY ID DESC
|
</select>
|
|
|
<resultMap id="getCostTypeTemplateMap" type="com.changhong.epc.bean.admin.extend.CostTypeTemplateExtend">
|
<id column="gId" property="id"/>
|
<result column="FORM_ID_STR" property="formIdStr"/>
|
<collection property="constGroupTypes" ofType="com.changhong.epc.bean.admin.extend.CostGroupTypeExtend">
|
<id column="tId" property="id"/>
|
<result column="codeId" property="codeId"/>
|
<result column="node_name" property="nodeName"/>
|
<collection property="costFromTemplate" ofType="com.changhong.epc.bean.admin.CostFromTemplate">
|
<id column="fId" property="id"/>
|
<result column="ct_id" property="ctId"/>
|
<result column="f_id" property="fId"/>
|
<result column="f_name" property="fName"/>
|
<result column="type" property="type"/>
|
</collection>
|
</collection>
|
</resultMap>
|
|
<select id="getCostTypeTemplate" resultMap="getCostTypeTemplateMap">
|
select
|
tt.id tId
|
, tt.codeId
|
, tt.node_name
|
, ft.id fId
|
, ft.ct_id
|
, ft.f_id
|
, ft.f_name
|
, ft.type
|
, g.id gId
|
, g.FORM_ID_STR
|
from EPC_COST_TYPE_TEMPLATE_GROUP g
|
left join epc_cost_type_template tt on g.id = tt.g_id and tt.data_start = 0
|
left join epc_cost_from_template ft on tt.id = ft.ct_id and ft.data_start = 0
|
where g.id = #{ctId}
|
</select>
|
<!--and ft.id is not null-->
|
|
<update id="updateTemplate" parameterType="com.changhong.epc.bean.admin.CostTypeTemplate">
|
UPDATE EPC_COST_TYPE_TEMPLATE_GROUP
|
SET
|
<trim suffix="" suffixOverrides="," >
|
<if test="name != null">
|
name = #{name},
|
</if>
|
<if test="costDesc != null">
|
cost_desc = #{costDesc},
|
</if>
|
<if test="formIdStr != null">
|
form_id_str = #{formIdStr}
|
</if>
|
</trim>
|
WHERE id = #{id}
|
</update>
|
|
<select id="getCostTypeTemplateByName" resultType="com.changhong.epc.bean.admin.CostTypeTemplate">
|
SELECT
|
ID,
|
NAME,
|
COST_DESC,
|
INS_T,
|
INS_P,
|
UPD_T,
|
UPD_P,
|
DATA_START
|
FROM
|
EPC_COST_TYPE_TEMPLATE_GROUP
|
WHERE
|
NAME = #{name}
|
AND
|
DATA_START = 0
|
</select>
|
|
<insert id="createTemplate" parameterType="com.changhong.epc.bean.admin.CostTypeTemplate">
|
INSERT INTO EPC_COST_TYPE_TEMPLATE_GROUP
|
(
|
NAME,
|
COST_DESC,
|
INS_T,
|
INS_P,
|
UPD_T,
|
UPD_P,
|
DATA_START
|
)
|
VALUE
|
(
|
#{name},
|
#{costDesc},
|
#{insT},
|
#{insP},
|
#{updT},
|
#{updP},
|
#{dataStart}
|
)
|
</insert>
|
|
<resultMap id="suppAndapp" type="com.changhong.epc.bean.admin.extend.SuppStanderTemplateExtend">
|
<id property="id" column="id"/><!-- 主键id -->
|
<result property="name" column="name"/>
|
<result property="type" column="type"/>
|
<result property="typeName" column="type_name"/>
|
<result property="subType" column="sub_type"/>
|
<result property="rule" column="rule"/>
|
<result property="ctId" column="ct_id"/>
|
<result property="cgId" column="cg_id"/>
|
<!-- <result property="overlookExpendType" column="overlook_expend_type"/>-->
|
<result property="dataStart" column="data_start"/>
|
<result property="insP" column="ins_p"/>
|
<result property="insT" column="ins_t"/>
|
<result property="updP" column="upd_p"/>
|
<result property="updT" column="upd_t"/>
|
<collection property="appStanderDefs" javaType="java.util.List"
|
ofType="com.changhong.epc.bean.admin.extend.AppStanderDefTemplateExtend">
|
<id property="id" column="appId"/>
|
<result property="elIden" column="el_iden"/>
|
<result property="masDefineCode" column="mas_define_code"/>
|
<result property="type" column="aType"/>
|
<result property="defType" column="def_type"/>
|
<result property="defName" column="def_name"/>
|
<result property="asDefValue" column="def_value"/>
|
<result property="defValue" column="def_value"/>
|
<result property="rowNo" column="row_no"/>
|
<result property="colNo" column="col_no"/>
|
<result property="squ" column="squ"/>
|
<result property="showFlag" column="show_flag"/>
|
<result property="relation" column="relation"/>
|
<result property="inverse" column="inverse"/>
|
<result property="showCount" column="show_count"/>
|
<result property="count" column="count"/>
|
<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"/>
|
</collection>
|
</resultMap>
|
|
<select id="selectByid" resultMap="suppAndapp" parameterType="com.changhong.epc.bean.admin.SuppStanderTemplate">
|
SELECT
|
t1.id,
|
t1.NAME,
|
t1.type,
|
t1.type_name,
|
t1.sub_type,
|
t1.rule,
|
t1.ct_id,
|
t1.cg_id,
|
t1.data_start,
|
t1.ins_p,
|
t1.ins_t,
|
t1.upd_p,
|
t1.upd_t,
|
t2.el_iden,
|
t2.mas_define_code,
|
t2.type as aType,
|
t2.def_type,
|
t2.def_name,
|
t2.def_value,
|
t2.row_no,
|
t2.col_no,
|
t2.squ,
|
t2.show_flag,
|
t2.relation,
|
t2.inverse,
|
t2.show_count,
|
t2.count,
|
t2.ss_id,
|
t2.ins_p,
|
t2.ins_t,
|
t2.upd_p,
|
t2.upd_t,
|
t2.data_start
|
FROM epc_cost_supp_stander_template t1
|
LEFT JOIN epc_cost_app_stander_def_template t2 ON t1.id = t2.ss_id
|
<trim prefix="WHERE" prefixOverrides="AND | OR">
|
t1.data_start = 0
|
<if test="ctId!=null">
|
and t1.ct_id=#{ctId}
|
</if>
|
<if test="cgId!=null">
|
and t1.cg_id=#{cgId}
|
</if>
|
</trim>
|
group by t2.ss_id,t2.row_no,t2.col_no
|
</select>
|
|
<update id="suppStanderUpdate" parameterType="com.changhong.epc.bean.admin.extend.SuppStanderTemplateExtend">
|
update epc_cost_supp_stander_template SET data_start=99
|
where ct_id
|
<foreach collection="supp" item="sup" open="in(" close=")" separator=",">
|
#{sup.ctId}
|
</foreach>
|
and cg_id
|
<foreach collection="supp" item="sup" open="in(" close=")" separator=",">
|
#{sup.cgId}
|
</foreach>
|
</update>
|
|
<update id="appStanderDefUpdate" parameterType="com.changhong.epc.bean.admin.extend.SuppStanderTemplateExtend">
|
update epc_cost_app_stander_def_template SET data_start=99
|
where
|
ss_Id
|
in(
|
select id from epc_cost_supp_stander_template where ct_id
|
<foreach collection="supp" item="sup" open="in(" close=")" separator=",">
|
#{sup.ctId}
|
</foreach>
|
and cg_id
|
<foreach collection="supp" item="sup" open="in(" close=")" separator=",">
|
#{sup.cgId}
|
</foreach>
|
)
|
</update>
|
|
<insert id="suppStanderSave" parameterType="com.changhong.epc.bean.admin.extend.SuppStanderTemplateExtend"
|
useGeneratedKeys="true" keyProperty="supp.id">
|
insert into epc_cost_supp_stander_template (id, cg_id,name,type,type_name,sub_type,rule,ct_id,data_start,ins_p,ins_t,upd_p,upd_t)
|
values
|
(null,#{supp.cgId}, #{supp.name},#{supp.type},#{supp.typeName},#{supp.subType},#{supp.rule},#{supp.ctId},#{supp.dataStart},#{supp.insP},#{supp.insT},#{supp.updP},#{supp.updT})
|
</insert>
|
|
<insert id="appStanderDefSaveOne">
|
insert into epc_cost_app_stander_def_template (el_iden,mas_define_code,type,def_type,def_name,def_value,row_no,col_no,squ,show_flag,relation,inverse,
|
show_count,count,ss_id,ins_p,ins_t,upd_p,upd_t,data_start)
|
values
|
(#{app.elIden},#{app.masDefineCode},#{app.type},#{app.defType},#{app.defName},#{app.asDefValue},#{app.rowNo},#{app.colNo},#{app.squ},#{app.showFlag},#{app.relation},#{app.inverse},#{app.showCount},#{app.count},#{supp.id},#{supp.insP},#{supp.insT},#{supp.updP},#{supp.updT},#{supp.dataStart})
|
</insert>
|
|
</mapper>
|