<?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_mapping_{rule} -->
|
<mapper namespace="com.changhong.epc.tenant.mapper.tenant.cost.CostFromMappingMapper">
|
|
<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" resultType="com.changhong.epc.bean.tenant.cost.CostFromMapping">
|
SELECT
|
id,f_name,f_id
|
FROM
|
epc_cost_from_mapping_{rule}
|
WHERE
|
ct_id = #{cost.ctId} and type = #{cost.type}
|
</select>
|
|
<update id="updateCost" parameterType="com.changhong.epc.bean.tenant.cost.CostFromMapping">
|
UPDATE epc_cost_from_mapping_{rule}
|
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="CostFromResult"
|
parameterType="com.changhong.epc.bean.tenant.cost.CostFromMapping">
|
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_mapping_{rule} 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_mapping_{rule} SET
|
data_start = 99
|
where ct_id = #{id}
|
|
|
</update>
|
|
<update id="deleteFormByCtidAndType">
|
DELETE
|
FROM
|
epc_cost_from_mapping_{rule}
|
WHERE
|
ct_id = #{ctId}
|
AND
|
type = #{type}
|
</update>
|
|
<select id="getConstFroms" parameterType="com.changhong.epc.bean.tenant.cost.CostFromMapping" resultMap="CostFromResult">
|
SELECT
|
a.id,
|
a.f_id,
|
a.f_name,
|
a.type,
|
a.ct_id
|
FROM
|
epc_cost_from_mapping_{rule} a
|
WHERE
|
a.ct_id IN(
|
SELECT
|
b.ct_id
|
FROM
|
epc_cost_from_mapping_{rule} b
|
WHERE
|
b.f_id = #{fId}
|
)
|
</select>
|
|
<select id="selectType" resultMap="CostFromResult">
|
SELECT
|
id,
|
f_id,
|
f_name,
|
type,
|
ct_id
|
FROM
|
epc_cost_from_mapping_{rule}
|
WHERE
|
data_start = 0
|
and type = #{type}
|
AND f_id is not null
|
</select>
|
<!--GROUP BY f_id-->
|
</mapper>
|