select
id
from epc_master_define_{rule}
where code = #{code}
and data_start = 0
select
distinct
code , name, DESCRIPTION, type
,(select meCode.code from epc_master_element_{rule} meCode where meCode.define_code = md.code and meCode.DEL_FLAG = 1 and meCode.ALIAS = 'code') ELECODE
,(select meCode.code from epc_master_element_{rule} meCode where meCode.define_code = md.code and meCode.DEL_FLAG = 1 and meCode.ALIAS = 'value') ELEVALUE
from epc_master_define_{rule} md
and type = #{type}
and del_flag = 0
ID,CODE,NAME,DESCRIPTION,TYPE,DEL_FLAG,INS_P,INS_T,UPD_P,UPD_T,TENANT_ID,DATA_START
SELECT
a.id ,
a. CODE ,
a. NAME ,
b.define_code ,
b.id bId,
b. CODE bCode,
b. NAME bName,
b.ALIAS alias
FROM
epc_master_define_{rule} a
LEFT JOIN epc_master_element_{rule} b ON a. CODE = b.define_code
a.NAME = #{name}
and a.id = #{id}
and a.CODE = #{code}
SELECT
a.id,
a. CODE ,
a. NAME ,
b.define_code,
b.id bId,
b. CODE bCode,
b. NAME bName
FROM
epc_master_define_{rule} a
LEFT JOIN epc_master_element_{rule} b ON a. CODE = b.define_code
a.NAME = #{master.name}
delete from epc_master_define_{rule}
SELECT
COUNT(*)
FROM
epc_master_define_{rule}
WHERE
DEL_FLAG = 0
AND CODE = #{code}
insert into ${tableName}
${key}
values
#{val}
select
td.code mdCode
, td.name mdName
, 0 type
, tdm.table_name
, tdm.type mapType
, te.`CODE` meCode
, te.`NAME` meName
, te.ALIAS meAlias
, tem.table_field
from epc_master_define_{rule} td
left join epc_center.epc_master_default_mapping tdm on td.`CODE` = tdm.md_code
left join epc_master_element_{rule} te on td.`CODE` = te.DEFINE_CODE
left join epc_center.epc_master_element_mapping tem on tdm.id = tem.m_id and te.code = tem.me_code
td.code = #{code}
UNION ALL
select
td.code mdCode
, td.name mdName
, 1 type
, tdm.table_name
, tdm.type mapType
, te.`CODE` meCode
, te.`NAME` meName
, te.ALIAS meAlias
, tem.table_field
from epc_center.epc_master_define td
left join epc_center.epc_master_default_mapping tdm on td.`CODE` = tdm.md_code
left join epc_center.epc_master_element te on td.`CODE` = te.DEFINE_CODE
left join epc_center.epc_master_element_mapping tem on tdm.id = tem.m_id and te.code = tem.me_code
td.code = #{code}