update 标签管理
This commit is contained in:
+5
@@ -1,11 +1,16 @@
|
||||
package com.jero.common.exception;
|
||||
|
||||
import com.jero.common.util.MessageUtils;
|
||||
|
||||
public class JeroBootException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JeroBootException(String message){
|
||||
super(message);
|
||||
}
|
||||
public JeroBootException(String message, Object... args) {
|
||||
super(MessageUtils.getMessage(message,args));
|
||||
}
|
||||
|
||||
public JeroBootException(Throwable cause)
|
||||
{
|
||||
|
||||
@@ -51,8 +51,14 @@ public class LawsTag implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档库-表id*/
|
||||
private String cgformHeadId;
|
||||
/**表名*/
|
||||
private String tableName;
|
||||
|
||||
/**字段名字*/
|
||||
private String dbFieldName;
|
||||
|
||||
/**旧字段名字*/
|
||||
private String dbFieldNameOld;
|
||||
|
||||
/**所属模块(1文档库,0文档拆分)*/
|
||||
@Dict(dicCode = "module")
|
||||
@@ -132,9 +138,6 @@ public class LawsTag implements Serializable {
|
||||
/**逻辑删除标识 0未删 1已删*/
|
||||
private Integer isDelete;
|
||||
|
||||
/**字段名字*/
|
||||
private String dbFieldName;
|
||||
|
||||
/**是否主键 0否 1是*/
|
||||
private Integer dbIsKey;
|
||||
|
||||
|
||||
+25
-8
@@ -10,8 +10,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.document.enums.FieldTypeEnum;
|
||||
import com.jero.modules.enums.FixedFieldEnum;
|
||||
@@ -137,14 +139,19 @@ public class ILawsTagServiceImpl extends ServiceImpl<LawsTagMapper, LawsTag> imp
|
||||
lawsTag.setUpdateBy(sysUser.getUsername());
|
||||
String pinYin = HanYuPinYinUtil.changeToNumberPinYin(lawsTag.getDbFieldTxt());
|
||||
lawsTag.setDbFieldName(pinYin.replace(" ","_"));
|
||||
|
||||
String dbFieldName = lawsTag.getDbFieldName();
|
||||
// 数据库的字段名称必须以字母开头,若不以字母开头加上固定的grp前缀
|
||||
if (!Validator.isMatchRegex("^[a-zA-Z].*$", lawsTag.getDbFieldName())){
|
||||
lawsTag.setDbFieldName("grp_" + lawsTag.getDbFieldName());
|
||||
if (!Validator.isMatchRegex("^[a-zA-Z].*$", dbFieldName)){
|
||||
lawsTag.setDbFieldName("grp_" + dbFieldName);
|
||||
}
|
||||
|
||||
if (dbFieldName.length() > 64){
|
||||
throw new JeroBootException("tag.add.字段名称太长",dbFieldName);
|
||||
}
|
||||
executeDDL(lawsTag,"add");
|
||||
lawsTag.setDbFieldNameOld(dbFieldName);
|
||||
}
|
||||
save(lawsTag);
|
||||
executeDDL(lawsTag,"add");
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +201,7 @@ public class ILawsTagServiceImpl extends ServiceImpl<LawsTagMapper, LawsTag> imp
|
||||
}
|
||||
|
||||
//字段名称设置成拼音+下划线,存入数据库
|
||||
String pinYin = HanYuPinYinUtil.changeToNumberPinYin(lawsTag.getDbFieldName());
|
||||
String pinYin = HanYuPinYinUtil.changeToNumberPinYin(lawsTag.getDbFieldTxt());
|
||||
lawsTag.setDbFieldName(pinYin.replace(" ","_"));
|
||||
//处理DBLength为null的情况,默认为100
|
||||
Integer dbLength = lawsTag.getDbLength();
|
||||
@@ -232,9 +239,12 @@ public class ILawsTagServiceImpl extends ServiceImpl<LawsTagMapper, LawsTag> imp
|
||||
if (!Validator.isMatchRegex("^[a-zA-Z].*$", dbFieldName)){
|
||||
lawsTag.setDbFieldName("grp_" + dbFieldName);
|
||||
}
|
||||
saveOrUpdate(lawsTag);
|
||||
if (dbFieldName.length() > 64){
|
||||
throw new JeroBootException("tag.add.字段名称太长",dbFieldName);
|
||||
}
|
||||
executeDDL(lawsTag,"modify");
|
||||
|
||||
lawsTag.setDbFieldNameOld(dbFieldName);
|
||||
saveOrUpdate(lawsTag);
|
||||
}
|
||||
|
||||
private void executeDDL(LawsTag lawsTag, String modifyOrAdd) {
|
||||
@@ -252,7 +262,14 @@ public class ILawsTagServiceImpl extends ServiceImpl<LawsTagMapper, LawsTag> imp
|
||||
}
|
||||
String tableName = FileTableIdEnum.getTableName(isModel);
|
||||
String dbFieldTxt = lawsTag.getDbFieldTxt();
|
||||
String sql = "alter table " + tableName + " " + modifyOrAdd + " " + dbFieldName + " " + type + " null comment '"+dbFieldTxt+"'";
|
||||
String dbFieldNameOld = lawsTag.getDbFieldNameOld();
|
||||
String sql;
|
||||
if (StringUtils.isNotBlank(dbFieldNameOld)){
|
||||
sql = "alter table " + tableName + " change " + dbFieldNameOld + " " + dbFieldName + " " + type + " null comment '"+dbFieldTxt+"'";
|
||||
}else {
|
||||
sql = "alter table " + tableName + " " + modifyOrAdd + " " + dbFieldName + " " + type + " null comment '"+dbFieldTxt+"'";
|
||||
}
|
||||
|
||||
lawsTagMapper.executeDDL(sql);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
message=1
|
||||
message.operate.error=123{0}
|
||||
tag.add.\u5B57\u6BB5\u540D\u79F0\u592A\u957F=\u60A8\u8BBE\u7F6E\u7684\u5B57\u6BB5\u540D\u4E3A{0}\uFF0C\u6700\u957F\u4E3A64\u4F4D\u5B57\u7B26\u3002
|
||||
tag.delete.\u5305\u542B\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u5220\u9664=\u5305\u542B\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u5220\u9664
|
||||
tag.edit.\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u4FEE\u6539=\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u4FEE\u6539
|
||||
tag.edit.\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u5220\u9664=\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u5220\u9664
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
message=1
|
||||
message.operate.error=123{0}
|
||||
tag.add.\u5B57\u6BB5\u540D\u79F0\u592A\u957F=The field name you set is {0}, with a maximum length of 64 characters.
|
||||
tag.delete.\u5305\u542B\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u5220\u9664=It contains fixed fields and cannot be deleted.
|
||||
tag.edit.\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u4FEE\u6539=Fixed field, which cannot be modified.
|
||||
tag.edit.\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u5220\u9664=Fixed field, cannot be deleted.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
message=1
|
||||
message.operate.error=123{0}
|
||||
tag.add.\u5B57\u6BB5\u540D\u79F0\u592A\u957F=\u60A8\u8BBE\u7F6E\u7684\u5B57\u6BB5\u540D\u4E3A{0}\uFF0C\u6700\u957F\u4E3A64\u4F4D\u5B57\u7B26\u3002
|
||||
tag.delete.\u5305\u542B\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u5220\u9664=\u5305\u542B\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u5220\u9664
|
||||
tag.edit.\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u4FEE\u6539=\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u4FEE\u6539
|
||||
tag.edit.\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u5220\u9664=\u56FA\u5B9A\u5B57\u6BB5,\u4E0D\u53EF\u5220\u9664
|
||||
|
||||
Reference in New Issue
Block a user