【feat】new_id创建唯一索引
This commit is contained in:
parent
401feb737e
commit
97e21e30dc
@ -90,7 +90,8 @@ public class Const {
|
|||||||
public static final List<String> TABLE_INDEX = Lists.newArrayList(
|
public static final List<String> TABLE_INDEX = Lists.newArrayList(
|
||||||
Const.CREATED_DATE,
|
Const.CREATED_DATE,
|
||||||
Const.LAST_MODIFIED_DATE,
|
Const.LAST_MODIFIED_DATE,
|
||||||
"IsDeleted"
|
"IsDeleted",
|
||||||
|
"new_id"
|
||||||
);
|
);
|
||||||
/**
|
/**
|
||||||
* 文件类型
|
* 文件类型
|
||||||
|
|||||||
@ -1072,6 +1072,15 @@ public class CommonServiceImpl implements CommonService {
|
|||||||
if (StringUtils.isNotBlank(blobField)) {
|
if (StringUtils.isNotBlank(blobField)) {
|
||||||
fileExtraFieldBuild(apiName, list, fieldList, fields);
|
fileExtraFieldBuild(apiName, list, fieldList, fields);
|
||||||
}
|
}
|
||||||
|
log.info("api {} not exist, create..", apiName);
|
||||||
|
//新增一个用来存储新sfid的字段
|
||||||
|
Map<String, Object> map = Maps.newHashMap();
|
||||||
|
map.put("type", "varchar(255)");
|
||||||
|
map.put("comment", "新sfid");
|
||||||
|
map.put("name", "new_id");
|
||||||
|
list.add(map);
|
||||||
|
fields.add("new_id");
|
||||||
|
|
||||||
// 构建索引
|
// 构建索引
|
||||||
List<Map<String, Object>> index = Lists.newArrayList();
|
List<Map<String, Object>> index = Lists.newArrayList();
|
||||||
for (String tableIndex : Const.TABLE_INDEX) {
|
for (String tableIndex : Const.TABLE_INDEX) {
|
||||||
@ -1084,13 +1093,6 @@ public class CommonServiceImpl implements CommonService {
|
|||||||
index.add(createDateMap);
|
index.add(createDateMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("api {} not exist, create..", apiName);
|
|
||||||
//新增一个用来存储新sfid的字段
|
|
||||||
Map<String, Object> map = Maps.newHashMap();
|
|
||||||
map.put("type", "varchar(255)");
|
|
||||||
map.put("comment", "新sfid");
|
|
||||||
map.put("name", "new_id");
|
|
||||||
list.add(map);
|
|
||||||
|
|
||||||
//DeleteEvent 回收站新增是否删除,数据内同字段
|
//DeleteEvent 回收站新增是否删除,数据内同字段
|
||||||
if ("DeleteEvent".equals(apiName)){
|
if ("DeleteEvent".equals(apiName)){
|
||||||
|
|||||||
@ -22,7 +22,14 @@
|
|||||||
`${map.name}` ${map.type} comment '${map.comment}',
|
`${map.name}` ${map.type} comment '${map.comment}',
|
||||||
</foreach>
|
</foreach>
|
||||||
<foreach item="map" collection="index">
|
<foreach item="map" collection="index">
|
||||||
INDEX `${map.name}`(`${map.field}`),
|
<choose>
|
||||||
|
<when test="map.field == 'new_id'">
|
||||||
|
UNIQUE INDEX `${map.name}`(`${map.field}`),
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
INDEX `${map.name}`(`${map.field}`),
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</foreach>
|
</foreach>
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) COMMENT = '${tableComment}';
|
) COMMENT = '${tableComment}';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user