update epc_master_value
set
data_start = 99
,upd_p = -1
,upd_t = now()
where
define_code = #{mdCode}
and row_no
#{data.rowNum}
delete from epc_master_value
where define_code = #{config.masDataDefCode}
and row_no = #{config.rowNum}
delete from epc_master_value
delete from
${tableName}
where
define_code=#{code}
CREATE TABLE
${tableName} (
`ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
`DEFINE_CODE` varchar(10) NOT NULL COMMENT '主数据定义代码',
${val} varchar(100) DEFAULT '',
`ROW_NO` int(11) DEFAULT NULL COMMENT '相同行号的数据,横向组成一行主数据值 记录',
`DEF1` varchar(100) DEFAULT '' COMMENT '备用字段1',
`DEF2` varchar(100) DEFAULT '' COMMENT '备用字段2',
`DEF3` varchar(100) DEFAULT '' COMMENT '备用字段3',
`DEF4` varchar(100) DEFAULT '' COMMENT '备用字段4',
`DEF5` varchar(100) DEFAULT '' COMMENT '备用字段5',
`DEL_FLAG` int(4) DEFAULT 0 COMMENT '删除标记',
`INS_P` varchar(20) DEFAULT NULL COMMENT '创建人',
`INS_T` datetime DEFAULT NULL COMMENT '创建时间',
`UPD_P` varchar(20) DEFAULT NULL COMMENT '修改人',
`UPD_T` datetime DEFAULT NULL COMMENT '修改时间',
`TENANT_ID` char(20) DEFAULT NULL COMMENT '租户ID',
`DATA_START` int(4) DEFAULT 0,
PRIMARY KEY (`ID`),
KEY `IDX_VALUE_DEFINE_CODE` (`DEFINE_CODE`),
KEY `IDX_VALUE_ROW_NO` (`ROW_NO`)
)
ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='主数据赋值表';
insert into
${tableName}(
DEL_FLAG,
DATA_START,
${o}
) values(
0,
0,
#{val}
)
INSERT INTO `epc_center`.`epc_master_value`
( `DEFINE_CODE`, `ELE_CODE`,
`ELE_VALUE`, `ROW_NO`,
`DEF1`, `DEF2`, `DEF3`,
`DEF4`, `DEF5`, `DEL_FLAG`,
`INS_P`, `INS_T`, `UPD_P`,
`UPD_T`, `DATA_START`)
VALUES
(#{val.defineCode}, #{val.eleCode},
#{val.eleValue}, #{val.rowNo},
#{val.def1}, #{val.def2}, #{val.def3},
#{val.def4}, #{val.def5},0,
#{val.insP},#{val.insT},#{val.updP},
#{val.updT},#{val.dataStart}
);
alter table ${tableName} add ${code} varchar(100) default ""
UPDATE epc_master_value
SET ELE_VALUE = #{mv.eleValue}
WHERE
DEFINE_CODE = #{mv.defineCode}
AND ELE_CODE = #{mv.eleCode}
AND ROW_NO = #{mv.rowNo}
DELETE
FROM
epc_master_value
WHERE
define_code = #{mv.defineCode}
and
row_no = #{mv.rowNo}
update
${tableName}
set
${key}=#{val}
where
define_code=#{defineCode} and row_no=#{rowNo}
delete from ${tableName}
where define_code=#{defineCode} and row_no=#{rowNo}