<?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_default_mapping -->
|
<mapper namespace="com.changhong.epc.admin.mapper.centen.site.MasterDefaultMappingMapper">
|
|
<resultMap type="com.changhong.epc.bean.admin.MasterDefaultMapping" id="resultMap">
|
|
<id property="id" column="id"/>
|
<result property="mdCode" column="md_code"/>
|
<result property="tableName" column="table_name"/>
|
<result property="type" column="type"/>
|
</resultMap>
|
<sql id="masterDefaultMappingSql">
|
md_code, table_name
|
</sql>
|
|
<select id="selectMaster" resultMap="resultMap">
|
|
SELECT
|
id,md_code,table_name,type
|
FROM
|
epc_master_default_mapping
|
WHERE
|
md_code = #{code}
|
|
</select>
|
|
<select id="selectMasterById" resultMap="resultMap">
|
|
SELECT
|
id,md_code,table_name,type
|
FROM
|
epc_master_default_mapping
|
WHERE
|
id = #{id}
|
</select>
|
|
<select id="selectValue" resultType="java.util.Map">
|
select
|
<if test="tableName == 'epc_nationwide_site'">
|
DISTINCT
|
</if>
|
<foreach collection="list" item="ele" separator=",">
|
${ele.tableField} as #{ele.meCode}
|
</foreach>
|
from ${tableName}
|
where data_start = 0
|
and DEL_FLAG = 0
|
<if test="listParam != null and code != null">
|
and ${code} in
|
<foreach collection="listParam" item="item" index="index" open="(" close=")" separator=",">
|
#{item}
|
</foreach>
|
</if>
|
<if test="value != null and listParam ==null">
|
and ${value} LIKE CONCAT('%',#{value},'%')
|
</if>
|
<if test="value != null and listParam !=null">
|
or ${value} LIKE CONCAT('%',#{value},'%')
|
</if>
|
order by ROW_NO asc
|
<if test="isAll!=null">
|
limit 100
|
</if>
|
</select>
|
|
<select id="CodeConValue" resultType="java.lang.String">
|
SELECT
|
${con.valueFlied}
|
FROM
|
${con.tableName}
|
WHERE
|
${con.codeFlied} = #{con.code}
|
LIMIT 1;
|
</select>
|
|
<select id="ValueConCode" resultType="java.lang.String">
|
SELECT
|
${con.codeFlied}
|
FROM
|
${con.tableName}
|
WHERE
|
${con.valueFlied} = #{con.value}
|
LIMIT 1;
|
</select>
|
|
<update id="updateMasterDefaultMapping" parameterType="com.changhong.epc.bean.admin.MasterDefaultMapping">
|
update epc_master_default_mapping
|
<trim prefix="set" suffix=" where id = #{id} " suffixOverrides=",">
|
<if test="mdCode!=null and mdCode.length()>0">
|
md_code=#{mdCode},
|
</if>
|
<if test="tableName != null and tableName.length()>0">
|
table_name=#{tableName},
|
</if>
|
<if test="type != null and type.length()>0">
|
type=#{type},
|
</if>
|
<!-- <if test="updT != null">
|
upd_t=#{updT},
|
</if>
|
<if test="updP != null and updP.length()>0">
|
upd_p=#{updP},
|
</if>-->
|
</trim>
|
|
</update>
|
|
<insert id="insertDefaultMappingToId" parameterType="com.changhong.epc.bean.admin.MasterDefaultMapping"
|
useGeneratedKeys="true" keyProperty="mdm.id">
|
insert into epc_master_default_mapping(md_code,table_name,ins_p,ins_t,upd_p,upd_t,data_start,type)
|
values(#{mdm.mdCode},#{mdm.tableName},#{mdm.insP},#{mdm.insT},#{mdm.updP},#{mdm.updT},#{mdm.dataStart},#{mdm.type})
|
</insert>
|
|
<resultMap id="selectAllDefAndEleMap" type="com.changhong.epc.bean.admin.MasterDefaultMapping">
|
<id column="id" property="id"/>
|
<result column="md_code" property="mdCode"/>
|
<result column="table_name" property="tableName"/>
|
<result column="type" property="type"/>
|
<collection property="masterElementMappings" ofType="com.changhong.epc.bean.admin.MasterElementMapping" >
|
<id column="me_code" property="meCode"/>
|
<result column="table_field" property="tableField"/>
|
</collection>
|
</resultMap>
|
|
<select id="selectAllDefAndEle" resultMap="selectAllDefAndEleMap">
|
SELECT
|
def.id,
|
def.md_code,
|
def.table_name,
|
def.type,
|
ele.me_code,
|
ele.table_field
|
FROM
|
epc_master_default_mapping def
|
left join epc_master_element_mapping ele on ele.m_id = def.id
|
</select>
|
|
</mapper>
|