<?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_master_element_mapping -->
|
<mapper namespace="com.changhong.epc.admin.mapper.centen.site.MasterElementMappingMapper">
|
|
<resultMap type="com.changhong.epc.bean.admin.MasterElementMapping" id="resultMap">
|
<result property="meCode" column="me_code"/>
|
<result property="tableField" column="table_field"/>
|
</resultMap>
|
|
<select id="getField" resultMap="resultMap">
|
|
SELECT
|
|
<choose>
|
<when test="params != null">
|
(
|
CASE
|
<foreach collection="params" item="item" index="index">
|
WHEN me_code = #{item.code}
|
THEN #{item.alias}
|
</foreach>
|
END
|
) me_code,
|
|
</when>
|
<otherwise>
|
me_code,
|
</otherwise>
|
</choose>
|
table_field,
|
m_id
|
FROM
|
epc_master_element_mapping
|
WHERE
|
m_id = #{id}
|
<if test="params != null">
|
AND me_code in
|
<foreach collection="params" item="item" index="index" open="(" close=")" separator=",">
|
#{item.code}
|
|
</foreach>
|
</if>
|
|
</select>
|
|
<select id="getFieldOne" resultType="java.lang.String">
|
SELECT
|
table_field
|
FROM
|
epc_master_element_mapping
|
WHERE
|
m_id = #{id} and me_code = #{code}
|
|
|
</select>
|
|
<update id="updateMasterElementMapping" parameterType="com.changhong.epc.bean.admin.MasterElementMapping">
|
update epc_master_element_mapping
|
<trim prefix="set" suffix=" where id = #{id} " suffixOverrides=",">
|
<if test="mId != null">
|
m_id=#{mId},
|
</if>
|
<if test="meCode!=null and meCode.length()>0">
|
me_code=#{meCode},
|
</if>
|
<if test="tableField != null and tableField.length()>0">
|
table_field=#{tableField},
|
</if>
|
<!--<if test="updT != null">
|
upd_t=#{updT},
|
</if>
|
<if test="updP != null and updP.length()>0">
|
upd_p=#{updP},
|
</if>-->
|
|
</trim>
|
|
</update>
|
|
<select id="getFieldByMid" resultMap="resultMap">
|
select
|
me_code,table_field
|
from
|
epc_master_element_mapping
|
where
|
m_id=#{mid}
|
</select>
|
|
|
|
|
|
</mapper>
|