refactor: 驼峰统一修改成下划线
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package org.nl.common.base;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019年10月24日20:48:53
|
||||
*/
|
||||
@Data
|
||||
public class BaseDTO implements Serializable {
|
||||
|
||||
private String create_name;
|
||||
|
||||
private String create_id;
|
||||
|
||||
private String update_name;
|
||||
|
||||
private String update_id;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date create_time;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date update_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.common.constants;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 字段名称常量:用于Map、JsonObject
|
||||
* @Date: 2023/12/4
|
||||
*/
|
||||
public class FieldConstant {
|
||||
public static final String DOP = "doP";
|
||||
public static final String DEPTS = "depts";
|
||||
public static final String ROLES = "roles";
|
||||
public static final String USER_ID = "user_id";
|
||||
public static final String DEPTIDS = "deptIds";
|
||||
public static final String ROLESIDS = "rolesIds";
|
||||
public static final String BLURRY = "blurry";
|
||||
public static final String SPECIAL_PARAM = "special_param";
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package org.nl.common.constants;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 通用定义类型数据
|
||||
* @Date: 2023/7/13
|
||||
*/
|
||||
public class GeneralDefinition {
|
||||
/**
|
||||
* 默认密码
|
||||
*/
|
||||
public static final String DEFAULT_PASSWORD = "123456";
|
||||
/**
|
||||
* 盐值加密
|
||||
*/
|
||||
public static final String SALT = "salt";
|
||||
/**
|
||||
* 转义点
|
||||
*/
|
||||
public static final String ESCAPE_DOT = "\\.";
|
||||
/**
|
||||
* 点
|
||||
*/
|
||||
public static final String DOT = ".";
|
||||
/**
|
||||
* 日期变量
|
||||
*/
|
||||
public static final String DATE_FORMAT = "yyyy-MM-dd";
|
||||
/**
|
||||
* 时间变量
|
||||
*/
|
||||
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
/**
|
||||
* 未知
|
||||
*/
|
||||
public static final String UNKNOWN = "-";
|
||||
// 统一编码定义
|
||||
/**
|
||||
* 窑自动任务开启
|
||||
*/
|
||||
public static final String AUTO_KILN_CALL = "auto_kiln_call";
|
||||
// 是否
|
||||
/**
|
||||
* 是/正确/可用...
|
||||
*/
|
||||
public static final String YES = "1";
|
||||
/**
|
||||
* 否/错误/不可用...
|
||||
*/
|
||||
public static final String NO = "0";
|
||||
// 账号定义
|
||||
/**
|
||||
* acs系统
|
||||
*/
|
||||
public static final String ACS_ID = "2";
|
||||
/**
|
||||
* acs系统
|
||||
*/
|
||||
public static final String ACS_NAME = "ACS系统";
|
||||
/**
|
||||
* mes系统
|
||||
*/
|
||||
public static final String MES_ID = "3";
|
||||
/**
|
||||
* mes系统
|
||||
*/
|
||||
public static final String MES_NAME = "MES系统";
|
||||
// 请求方向
|
||||
/**
|
||||
* ACS->LMS
|
||||
**/
|
||||
public static final String ACS_LMS = "1";
|
||||
/**
|
||||
* LMS->ACS
|
||||
**/
|
||||
public static final String LMS_ACS = "2";
|
||||
/**
|
||||
* MES->LMS
|
||||
**/
|
||||
public static final String MES_LMS = "3";
|
||||
/**
|
||||
* LMS->MES
|
||||
**/
|
||||
public static final String LMS_MES = "4";
|
||||
// 参数名称
|
||||
/**
|
||||
* 是否连接
|
||||
*/
|
||||
public static final String IS_CONNECT_ACS = "is_connect_acs";
|
||||
/**
|
||||
* ACS路径
|
||||
*/
|
||||
public static final String ACS_URL = "acs_url";
|
||||
/**
|
||||
* 是否连接
|
||||
*/
|
||||
public static final String IS_CONNECT_MES = "is_connect_mes";
|
||||
/**
|
||||
* MES路径
|
||||
*/
|
||||
public static final String MES_URL = "mes_url";
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.LambdaUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.ColumnCache;
|
||||
import lombok.Data;
|
||||
import org.nl.common.constants.FieldConstant;
|
||||
import org.nl.common.enums.QueryTEnum;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
|
||||
@@ -13,7 +14,7 @@ import java.lang.reflect.Type;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
/**
|
||||
* @author ZZQ
|
||||
* @Date 2022/12/14 6:33 下午
|
||||
* 泛型必须为数据tb对应do:由mybatis管理
|
||||
@@ -27,19 +28,19 @@ public class BaseQuery<T> {
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean isUsed;
|
||||
private Boolean is_used;
|
||||
/**
|
||||
* 创建时间范围查询
|
||||
*/
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private Date start_time;
|
||||
private Date end_time;
|
||||
|
||||
|
||||
/**
|
||||
* 字段映射Map:指定字段对应QueryWrapper的查询类型
|
||||
* 字段与数据库字段对应,不支持驼峰
|
||||
*
|
||||
* @see QueryTEnum
|
||||
* @see org.nl.common.enums.QueryTEnum
|
||||
* 通过buid构建
|
||||
*/
|
||||
public Map<String, QParam> doP = MapOf.of("blurry", QParam.builder().k(new String[]{"name"}).type(QueryTEnum.LK).build()
|
||||
@@ -55,7 +56,7 @@ public class BaseQuery<T> {
|
||||
Type[] types = ((ParameterizedTypeImpl) this.getClass().getGenericSuperclass()).getActualTypeArguments();
|
||||
Map<String, ColumnCache> columnMap = LambdaUtils.getColumnMap((Class<?>) types[0]);
|
||||
json.forEach((key, vel) -> {
|
||||
if (vel != null && !key.equals("doP")) {
|
||||
if (vel != null && !(FieldConstant.DOP).equals(key)) {
|
||||
QParam qParam = doP.get(key);
|
||||
if (qParam != null) {
|
||||
QueryTEnum.build(qParam.type, wrapper, qParam.k, vel);
|
||||
|
||||
@@ -13,7 +13,9 @@ import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
* 分页参数
|
||||
* @Author: lyd
|
||||
* @Description: 分页参数
|
||||
* @Date: 2023/8/14
|
||||
*/
|
||||
@Data
|
||||
public class PageQuery implements Serializable {
|
||||
@@ -51,7 +53,7 @@ public class PageQuery implements Serializable {
|
||||
public static final int DEFAULT_PAGE_SIZE = Integer.MAX_VALUE;
|
||||
|
||||
public <T> Page<T> build() {
|
||||
Integer pageNum = ObjectUtil.defaultIfNull(getPage(), DEFAULT_PAGE_NUM) + 1;
|
||||
Integer pageNum = ObjectUtil.defaultIfNull(getPage(), DEFAULT_PAGE_NUM);
|
||||
Integer pageSize = ObjectUtil.defaultIfNull(getSize(), DEFAULT_PAGE_SIZE);
|
||||
if (pageNum <= 0) {
|
||||
pageNum = DEFAULT_PAGE_NUM;
|
||||
@@ -63,7 +65,7 @@ public class PageQuery implements Serializable {
|
||||
String col = split[i];
|
||||
OrderItem item = new OrderItem();
|
||||
item.setColumn(col);
|
||||
item.setAsc(split[i + 1].toLowerCase(Locale.ROOT).equals("asc"));
|
||||
item.setAsc("asc".equals(split[i + 1].toLowerCase(Locale.ROOT)));
|
||||
page.addOrder(item);
|
||||
}
|
||||
}
|
||||
@@ -87,7 +89,7 @@ public class PageQuery implements Serializable {
|
||||
}
|
||||
OrderItem item = new OrderItem();
|
||||
item.setColumn(col);
|
||||
item.setAsc(split[i + 1].toLowerCase(Locale.ROOT).equals("asc"));
|
||||
item.setAsc("asc".equals(split[i + 1].toLowerCase(Locale.ROOT)));
|
||||
page.addOrder(item);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.common.domain.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.nl.common.base.BaseDTO;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class DeptVo extends BaseDTO implements Serializable {
|
||||
|
||||
|
||||
private String dept_id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String ext_id;
|
||||
|
||||
|
||||
private Integer dept_sort;
|
||||
|
||||
|
||||
@NotBlank
|
||||
|
||||
private String name;
|
||||
|
||||
@NotNull
|
||||
|
||||
private Boolean is_used;
|
||||
|
||||
|
||||
private Long pid;
|
||||
|
||||
|
||||
private Integer sub_count = 0;
|
||||
/**
|
||||
* 前端显示
|
||||
*/
|
||||
private Boolean has_children = Boolean.FALSE;
|
||||
|
||||
private List<DeptVo> children;
|
||||
|
||||
public void setSub_count(Integer sub_count) {
|
||||
this.sub_count = sub_count;
|
||||
if (sub_count > 0) {
|
||||
this.has_children = Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.common.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-20
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class MenuMetaVo implements Serializable {
|
||||
|
||||
private String title;
|
||||
|
||||
private String icon;
|
||||
|
||||
private Boolean noCache;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.common.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 构建前端路由时用到
|
||||
*
|
||||
* @author Zheng Jie
|
||||
* @date 2018-12-20
|
||||
*/
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
public class MenuVo implements Serializable {
|
||||
|
||||
private String name;
|
||||
|
||||
private String path;
|
||||
|
||||
private Boolean hidden;
|
||||
|
||||
private String redirect;
|
||||
|
||||
private String component;
|
||||
|
||||
private Boolean alwaysShow;
|
||||
|
||||
private MenuMetaVo meta;
|
||||
|
||||
private List<MenuVo> children;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.common.domain.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-22
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class RoleVo implements Serializable {
|
||||
|
||||
|
||||
private Long role_id;
|
||||
|
||||
@NotBlank
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private Integer level = 3;
|
||||
|
||||
|
||||
private String remark;
|
||||
|
||||
|
||||
private String order_seq;
|
||||
|
||||
|
||||
private String is_used;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.common.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 修改密码的 Vo 类
|
||||
*
|
||||
* @author Zheng Jie
|
||||
* @date 2019年7月11日13:59:49
|
||||
*/
|
||||
@Data
|
||||
public class UserPassVo {
|
||||
|
||||
private String oldPass;
|
||||
|
||||
private String newPass;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.nl.common.enums;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 日志类型枚举
|
||||
* @Date: 2023/8/14
|
||||
*/
|
||||
public enum LogTypeEnum {
|
||||
/**
|
||||
* 设备日志
|
||||
*/
|
||||
DEVICE_LOG("设备日志"),
|
||||
/**
|
||||
* 接口日志
|
||||
*/
|
||||
INTERFACE_LOG("接口日志");
|
||||
|
||||
private String desc;
|
||||
|
||||
LogTypeEnum(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.nl.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/5/9
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NoticeEnum {
|
||||
/**
|
||||
* 未读
|
||||
*/
|
||||
HAVE_READ_OFF("1", "未读"),
|
||||
/**
|
||||
* 已读
|
||||
*/
|
||||
HAVE_READ_ON("2", "已读"),
|
||||
/**
|
||||
* 未处理
|
||||
*/
|
||||
DEAL_STATUS_NO("1", "未处理"),
|
||||
/**
|
||||
* 已处理
|
||||
*/
|
||||
DEAL_STATUS_YES("2", "已处理"),
|
||||
/**
|
||||
* 无需处理
|
||||
*/
|
||||
DEAL_STATUS_NO_NEED("3", "无需处理");
|
||||
|
||||
private final String value;
|
||||
private final String desc;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 通知类型枚举
|
||||
* @Date: 2023/6/15
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NoticeTypeEnum {
|
||||
/**
|
||||
* 异常
|
||||
*/
|
||||
EXCEPTION("1", "异常"),
|
||||
/**
|
||||
* 警告
|
||||
*/
|
||||
WARN("2", "警告"),
|
||||
/**
|
||||
* 通知
|
||||
*/
|
||||
NOTIFICATION("3", "通知");
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.common.utils;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.coderule.ISysCodeRuleService;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 编码生成工具
|
||||
* @Date: 2023/8/14
|
||||
*/
|
||||
public class CodeUtil {
|
||||
|
||||
@SneakyThrows
|
||||
public static String getNewCode(String ruleCode) {
|
||||
RedissonClient redissonClient = SpringContextHolder.getBean(RedissonClient.class);
|
||||
RLock lock = redissonClient.getLock(ruleCode);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
String flag = "1";
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", flag);
|
||||
map.put("code", ruleCode);
|
||||
return SpringContextHolder.getBean(ISysCodeRuleService.class).codeDemo(map);
|
||||
} else {
|
||||
throw new BadRequestException("系统繁忙,稍后在试");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -163,25 +163,25 @@ public class GenUtil {
|
||||
// 存储模版字段数据
|
||||
Map<String, Object> genMap = new HashMap<>(16);
|
||||
// 接口别名
|
||||
genMap.put("apiAlias", genConfig.getApiAlias());
|
||||
genMap.put("apiAlias", genConfig.getApi_alias());
|
||||
// 包名称
|
||||
genMap.put("package", genConfig.getPack());
|
||||
// 模块名称
|
||||
genMap.put("moduleName", genConfig.getModuleName());
|
||||
genMap.put("moduleName", genConfig.getModule_name());
|
||||
// 作者
|
||||
genMap.put("author", genConfig.getAuthor());
|
||||
// 创建日期
|
||||
genMap.put("date", LocalDate.now().toString());
|
||||
// 表名
|
||||
genMap.put("tableName", genConfig.getTableName());
|
||||
genMap.put("tableName", genConfig.getTable_name());
|
||||
// 大写开头的类名
|
||||
String className = StringUtils.toCapitalizeCamelCase(genConfig.getTableName());
|
||||
String className = StringUtils.toCapitalizeCamelCase(genConfig.getTable_name());
|
||||
// 小写开头的类名
|
||||
String changeClassName = StringUtils.toCamelCase(genConfig.getTableName());
|
||||
String changeClassName = StringUtils.toCamelCase(genConfig.getTable_name());
|
||||
// 判断是否去除表前缀
|
||||
if (StrUtil.isNotEmpty(genConfig.getPrefix())) {
|
||||
className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(genConfig.getTableName(), genConfig.getPrefix()));
|
||||
changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(genConfig.getTableName(), genConfig.getPrefix()));
|
||||
className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(genConfig.getTable_name(), genConfig.getPrefix()));
|
||||
changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(genConfig.getTable_name(), genConfig.getPrefix()));
|
||||
}
|
||||
// 保存类名
|
||||
genMap.put("className", className); // 驼峰命名
|
||||
@@ -222,15 +222,15 @@ public class GenUtil {
|
||||
// 字段描述
|
||||
listMap.put("remark", column.getRemark());
|
||||
// 字段类型
|
||||
listMap.put("columnKey", column.getKeyType());
|
||||
listMap.put("columnKey", column.getKey_type());
|
||||
// 主键类型
|
||||
String colType = ColUtil.cloToJava(column.getColumnType());
|
||||
String colType = ColUtil.cloToJava(column.getColumn_type());
|
||||
// 小写开头的字段名 - 转驼峰
|
||||
// String changeColumnName = StringUtils.toCamelCase(column.getColumnName());
|
||||
String changeColumnName = column.getColumnName();
|
||||
String changeColumnName = column.getColumn_name();
|
||||
// 大写开头的字段名
|
||||
String capitalColumnName = StringUtils.toCapitalizeCamelCase(column.getColumnName());
|
||||
if (PK.equals(column.getKeyType())) { // 如果是主键
|
||||
String capitalColumnName = StringUtils.toCapitalizeCamelCase(column.getColumn_name());
|
||||
if (PK.equals(column.getKey_type())) { // 如果是主键
|
||||
genMap.put("hasPk", true);
|
||||
// 存储主键类型
|
||||
genMap.put("pkColumnType", colType);
|
||||
@@ -252,42 +252,42 @@ public class GenUtil {
|
||||
genMap.put("auto", true);
|
||||
}
|
||||
// 主键存在字典
|
||||
if (StrUtil.isNotEmpty(column.getDictName())) {
|
||||
if (StrUtil.isNotEmpty(column.getDict_name())) {
|
||||
genMap.put("hasDict", true);
|
||||
dicts.add(column.getDictName());
|
||||
dicts.add(column.getDict_name());
|
||||
}
|
||||
|
||||
// 存储字段类型
|
||||
listMap.put("columnType", colType);
|
||||
// 存储字原始段名称
|
||||
listMap.put("columnName", column.getColumnName());
|
||||
listMap.put("columnName", column.getColumn_name());
|
||||
// 不为空
|
||||
listMap.put("istNotNull", column.getNotNull());
|
||||
listMap.put("istNotNull", column.getNot_null());
|
||||
// 字段列表显示
|
||||
listMap.put("columnShow", column.getListShow());
|
||||
listMap.put("columnShow", column.getList_show());
|
||||
// 表单显示
|
||||
listMap.put("formShow", column.getFormShow());
|
||||
listMap.put("formShow", column.getForm_show());
|
||||
// 表单组件类型
|
||||
listMap.put("formType", StrUtil.isNotEmpty(column.getFormType()) ? column.getFormType() : "Input");
|
||||
listMap.put("formType", StrUtil.isNotEmpty(column.getForm_type()) ? column.getForm_type() : "Input");
|
||||
// 小写开头的字段名称
|
||||
listMap.put("changeColumnName", changeColumnName);
|
||||
//大写开头的字段名称
|
||||
listMap.put("capitalColumnName", capitalColumnName);
|
||||
// 字典名称
|
||||
listMap.put("dictName", column.getDictName());
|
||||
listMap.put("dictName", column.getDict_name());
|
||||
// 日期注解
|
||||
listMap.put("dateAnnotation", column.getDateAnnotation());
|
||||
if (StrUtil.isNotEmpty(column.getDateAnnotation())) {
|
||||
listMap.put("dateAnnotation", column.getDate_annotation());
|
||||
if (StrUtil.isNotEmpty(column.getDate_annotation())) {
|
||||
genMap.put("hasDateAnnotation", true);
|
||||
}
|
||||
// 添加非空字段信息
|
||||
if (column.getNotNull()) {
|
||||
if (column.getNot_null()) {
|
||||
isNotNullColumns.add(listMap);
|
||||
}
|
||||
// 判断是否有查询,如有则把查询的字段set进columnQuery
|
||||
if (!StrUtil.isEmpty(column.getQueryType())) {
|
||||
if (!StrUtil.isEmpty(column.getQuery_type())) {
|
||||
// 查询类型
|
||||
listMap.put("queryType", column.getQueryType());
|
||||
listMap.put("queryType", column.getQuery_type());
|
||||
// 是否存在查询
|
||||
genMap.put("hasQuery", true);
|
||||
if (TIMESTAMP.equals(colType)) {
|
||||
@@ -298,7 +298,7 @@ public class GenUtil {
|
||||
// 查询中存储 BigDecimal 类型
|
||||
genMap.put("queryHasBigDecimal", true);
|
||||
}
|
||||
if ("between".equalsIgnoreCase(column.getQueryType())) {
|
||||
if ("between".equalsIgnoreCase(column.getQuery_type())) {
|
||||
betweens.add(listMap);
|
||||
} else {
|
||||
// 添加到查询列表中
|
||||
@@ -332,7 +332,7 @@ public class GenUtil {
|
||||
public static String download(List<CodeColumnConfig> columns, CodeGenConfig genConfig) throws IOException {
|
||||
// 拼接的路径:/tmpnladmin-gen-temp/,这个路径在Linux下需要root用户才有权限创建,非root用户会权限错误而失败,更改为: /tmp/nladmin-gen-temp/
|
||||
// String tempPath =SYS_TEM_DIR + "nladmin-gen-temp" + File.separator + genConfig.getTableName() + File.separator;
|
||||
String tempPath = SYS_TEM_DIR + "nladmin-gen-temp" + File.separator + genConfig.getTableName() + File.separator;
|
||||
String tempPath = SYS_TEM_DIR + "nladmin-gen-temp" + File.separator + genConfig.getTable_name() + File.separator;
|
||||
Map<String, Object> genMap = getGenMap(columns, genConfig);
|
||||
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
|
||||
// 生成后端代码
|
||||
@@ -423,7 +423,7 @@ public class GenUtil {
|
||||
templates = getFrontTemplateNames();
|
||||
for (String templateName : templates) {
|
||||
Template template = engine.getTemplate("generator/front/" + templateName + ".ftl");
|
||||
String filePath = getFrontFilePath(templateName, genConfig.getApiPath(), genConfig.getPath(), genMap.get("changeClassName").toString());
|
||||
String filePath = getFrontFilePath(templateName, genConfig.getApi_path(), genConfig.getPath(), genMap.get("changeClassName").toString());
|
||||
|
||||
assert filePath != null;
|
||||
File file = new File(filePath);
|
||||
|
||||
@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.system.service.user.dto.CurrentUser;
|
||||
import org.nl.common.utils.dto.CurrentUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.nl.common.utils.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: lyd
|
||||
* @description: 当前用户的信息
|
||||
* @Date:
|
||||
*/
|
||||
@Data
|
||||
public class CurrentUser implements Serializable {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String presonName;
|
||||
|
||||
/**
|
||||
* 用户详细信息
|
||||
*/
|
||||
private SysUser user;
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
*/
|
||||
private List<String> permissions = new ArrayList<>();
|
||||
}
|
||||
Reference in New Issue
Block a user