<?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" >
|
<!-- Table:epc_cost_from_template -->
|
<mapper namespace="com.changhong.epc.admin.mapper.centen.cost.CostFromTemplateMapper">
|
<resultMap id="costFromTemplateMapperResultMap" type="com.changhong.epc.bean.admin.CostFromTemplate">
|
<id property="id" column="id"/>
|
<result property="ctId" column="ct_id"/><!-- 费用类型id -->
|
<result property="fId" column="f_id"/><!-- 表单id -->
|
<result property="fName" column="f_name"/>
|
<result property="type" column="type"/><!-- 预算:YS 申请:SQ 报销:BX -->
|
</resultMap>
|
|
<!-- <resultMap type="com.changhong.epc.bean.tenant.cost.extend.CostFromMappingExtend" id="CostFromResult">
|
<id property="id" column="id"/>
|
<result property="fId" column="f_id"/>
|
<result property="fName" column="f_name"/>
|
<result property="type" column="type"/>
|
<result property="ctId" column="ct_id"/>
|
<association property="costType" javaType="com.changhong.epc.bean.tenant.cost.CostType">
|
<id property="id" column="bId"/>
|
<result property="nodeName" column="node_name"/>
|
<result property="parentId" column="parent_id"/>
|
</association>
|
</resultMap> -->
|
|
<select id="selectByctId" resultMap="costFromTemplateMapperResultMap">
|
SELECT
|
id,f_name,f_id
|
FROM
|
epc_cost_from_template
|
WHERE
|
ct_id = #{cost.ctId} and type = #{cost.type}
|
</select>
|
|
<update id="updateCost" parameterType="com.changhong.epc.bean.admin.CostFromTemplate">
|
UPDATE epc_cost_from_template
|
SET
|
<if test="fName !=null">
|
f_name = #{fName},
|
</if>
|
<if test="fId !=null">
|
f_id = #{fId}
|
</if>
|
WHERE
|
ct_id = #{ctId} and type = #{type}
|
</update>
|
|
<select id="selectCostType" resultMap="costFromTemplateMapperResultMap"
|
parameterType="com.changhong.epc.bean.admin.CostFromTemplate">
|
SELECT
|
a.id,
|
a.f_id,
|
a.f_name,
|
a.type,
|
a.ct_id,
|
b.id bId,
|
b.node_name,
|
b.parent_id
|
FROM
|
epc_cost_from_template a
|
LEFT JOIN epc_cost_type_{rule} b ON a.ct_id = b.id
|
<trim prefix="where" >
|
<if test="fId !=null">
|
a.f_id = #{fId}
|
</if>
|
</trim>
|
LIMIT 1
|
</select>
|
|
<update id="deleteForm">
|
UPDATE epc_cost_from_template SET
|
data_start = 99
|
where ct_id = #{id}
|
|
|
</update>
|
<delete id="deleteCostNull">
|
delete from epc_cost_from_template
|
where ct_id = #{id}
|
</delete>
|
|
|
</mapper>
|