<?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_app_stander_def_{rule} -->
|
<mapper namespace="com.changhong.epc.admin.mapper.centen.master.MasterElementMapper">
|
|
<resultMap type="com.changhong.epc.bean.tenant.master.MasterElement" id="elementInfosMap">
|
<result column="CODE" property="code"/>
|
<result column="NAME" property="name"/>
|
<result column="TYPE" property="type"/>
|
</resultMap>
|
|
|
<resultMap id="MasterElementMap" type="com.changhong.epc.bean.tenant.master.extend.MasterElementExtend" >
|
<id column="id" property="id" jdbcType="INTEGER" />
|
<result column="joinMd" property="joinMd"/>
|
<result column="DEFINE_CODE" property="defineCode" jdbcType="VARCHAR" />
|
<result column="CODE" property="code"/>
|
<result column="NAME" property="name"/>
|
<result column="TYPE" property="type"/>
|
<result column="LEN" property="len" />
|
<result column="PREC" property="prec" />
|
<result column="MUST_FLAG" property="mustFlag"/>
|
<result column="DESCRIPTION" property="description"/>
|
<result column="ALIAS" property="alias"/>
|
<result column="DEL_FLAG" property="delFlag"/>
|
</resultMap>
|
|
<resultMap id="MaterEleMentCodeMap" type="com.changhong.epc.bean.tenant.master.extend.GeneralMasterElement">
|
<result column="DEFINE_CODE" property="defineCode" jdbcType="VARCHAR" />
|
<result column="CODE" property="code"/>
|
<result column="NAME" property="name"/>
|
<result column="TYPE" property="type"/>
|
<result column="LEN" property="len" />
|
<result column="PREC" property="prec" />
|
<result column="ALIAS" property="alias"/>
|
<result column="DEL_FLAG" property="delFlag"/>
|
</resultMap>
|
|
<select id="selectByCode" resultMap="MasterElementMap" >
|
SELECT
|
(
|
SELECT
|
group_concat(c.DEFINE_CODE)
|
FROM
|
epc_master_element c
|
WHERE
|
c.`CODE` = me.`CODE`
|
AND c.ALIAS = 'code'
|
) joinMd,
|
me.ID,
|
me.DEFINE_CODE,
|
me.CODE,
|
me.NAME,
|
me.TYPE,
|
me.LEN,
|
me.PREC,
|
me.MUST_FLAG,
|
me.DESCRIPTION,
|
me.ALIAS,
|
me.DEL_FLAG,
|
me.DEF1,
|
me.DEF2,
|
me.DEF3,
|
me.DEF4,
|
me.DEF5,
|
me.INS_P,
|
me.INS_T,
|
me.UPD_P,
|
me.UPD_T,
|
me.TENANT_ID,
|
me.DATA_START
|
FROM
|
epc_master_element me
|
WHERE
|
DEFINE_CODE = #{code}
|
ORDER BY
|
alias DESC,
|
joinMd DESC
|
</select>
|
|
<select id="elementInfos" resultMap="elementInfosMap" >
|
select
|
CODE
|
, REPLACE(name,'code_','') NAME
|
, TYPE
|
from epc_master_element
|
where DEL_FLAG = 0
|
<if test="code != null">
|
and DEFINE_CODE = #{code}
|
</if>
|
|
</select>
|
|
<select id="geteleCode" resultType="java.lang.String">
|
SELECT
|
CODE
|
FROM
|
epc_master_element
|
WHERE
|
DEFINE_CODE = #{code}
|
AND ALIAS = #{type}
|
|
|
</select>
|
|
|
<delete id="deleteAll">
|
delete from epc_master_element
|
|
</delete>
|
|
<update id="updateAlias">
|
UPDATE epc_master_element
|
SET
|
ALIAS = #{alias}
|
WHERE
|
DEFINE_CODE = #{defineCode}
|
<if test="eleCode != null">
|
AND `CODE` = #{eleCode}
|
</if>
|
</update>
|
|
<delete id="deleteByDefineCode">
|
delete from
|
epc_master_element
|
where
|
define_code=#{code}
|
|
</delete>
|
|
<select id="findMasterEleByCode" resultMap="MaterEleMentCodeMap">
|
SELECT
|
id,define_code,code,name,type,len,prec,alias,del_flag
|
from
|
epc_master_element
|
where
|
define_code=#{code}
|
</select>
|
|
</mapper>
|