Commit b6ade232 by yuwei

2.0.0项目初始化

parent 5d229104
......@@ -63,6 +63,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -48,7 +48,7 @@ public abstract class BaseEntity implements Serializable {
* 状态(0不启用,1启用)
*/
@TableField(value = "status", fill = FieldFill.INSERT)
private Integer status;
private String status;
/**
* 备注
......
......@@ -31,17 +31,17 @@ public class DataConstant {
* 通用的是否
*/
public enum TrueOrFalse {
FALSE(0,false),
TRUE(1,true);
TrueOrFalse(Integer key, boolean val){
FALSE("0",false),
TRUE("1",true);
TrueOrFalse(String key, boolean val){
this.key = key;
this.val = val;
}
private final Integer key;
private final String key;
private final boolean val;
public Integer getKey() {
public String getKey() {
return key;
}
......@@ -83,17 +83,17 @@ public class DataConstant {
* 通用的启用禁用状态
*/
public enum EnableState {
DISABLE(0,"禁用"),
ENABLE(1,"启用");
EnableState(Integer key, String val){
DISABLE("0","禁用"),
ENABLE("1","启用");
EnableState(String key, String val){
this.key = key;
this.val = val;
}
private final Integer key;
private final String key;
private final String val;
public Integer getKey() {
public String getKey() {
return key;
}
......@@ -106,19 +106,19 @@ public class DataConstant {
* 流程审核状态
*/
public enum AuditState{
WAIT(1,"待审核"),
AUDIT(2,"审核中"),
PASS(3,"审核通过"),
NOTPASS(4,"审核不通过");
AuditState(Integer key, String val){
WAIT("1","待审核"),
AUDIT("2","审核中"),
PASS("3","审核通过"),
NOTPASS("4","审核不通过");
AuditState(String key, String val){
this.key = key;
this.val = val;
}
private final Integer key;
private final String key;
private final String val;
public Integer getKey() {
public String getKey() {
return key;
}
......@@ -131,17 +131,17 @@ public class DataConstant {
* 流程审批状态
*/
public enum ApproveState{
REJECT(0,"不通过"),
PASS(1,"通过");
ApproveState(Integer key, String val){
REJECT("0","不通过"),
PASS("1","通过");
ApproveState(String key, String val){
this.key = key;
this.val = val;
}
private final Integer key;
private final String key;
private final String val;
public Integer getKey() {
public String getKey() {
return key;
}
......@@ -154,19 +154,19 @@ public class DataConstant {
* 菜单类型
*/
public enum MenuType{
MODULE(0,"模块"),
MENU(1,"菜单"),
BUTTON(2,"按钮");
MODULE("0","模块"),
MENU("1","菜单"),
BUTTON("2","按钮");
MenuType(Integer key, String val){
MenuType(String key, String val){
this.key = key;
this.val = val;
}
private final Integer key;
private final String key;
private final String val;
public Integer getKey() {
public String getKey() {
return key;
}
......@@ -179,20 +179,20 @@ public class DataConstant {
* 数据范围
*/
public enum DataScope{
ALL(1,"全部数据权限"),
CUSTOM(2,"自定义数据权限"),
DEPT(3,"本部门数据权限"),
DEPTANDCHILD(4,"本部门及以下数据权限"),
SELF(5,"仅本人数据权限");
DataScope(Integer key, String val){
ALL("1","全部数据权限"),
CUSTOM("2","自定义数据权限"),
DEPT("3","本部门数据权限"),
DEPTANDCHILD("4","本部门及以下数据权限"),
SELF("5","仅本人数据权限");
DataScope(String key, String val){
this.key = key;
this.val = val;
}
private final Integer key;
private final String key;
private final String val;
public Integer getKey() {
public String getKey() {
return key;
}
......
......@@ -10,5 +10,5 @@ public class DataRole implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer dataScope;
private String dataScope;
}
......@@ -13,7 +13,7 @@ public class DbQueryProperty implements Serializable {
private static final long serialVersionUID = 1L;
private Integer dbType;
private String dbType;
private String host;
private String username;
private String password;
......@@ -24,12 +24,12 @@ public class DbQueryProperty implements Serializable {
* 参数合法性校验
*/
public void viald() {
if (null == dbType || StringUtils.isEmpty(host) ||
if (StringUtils.isEmpty(dbType) || StringUtils.isEmpty(host) ||
StringUtils.isEmpty(username) || StringUtils.isEmpty(password) ||
StringUtils.isEmpty(port) || StringUtils.isEmpty(dbName)) {
throw new DataQueryException("参数不完整");
}
if (DbType.OTHER.getDb() == dbType) {
if (DbType.OTHER.getDb().equals(dbType)) {
throw new DataQueryException("不支持的数据库类型");
}
}
......
......@@ -11,40 +11,40 @@ public enum DbType {
/**
* MYSQL
*/
MYSQL(1, "MySql数据库", "jdbc:mysql://${host}:${port}/${dbName}?serverTimezone=GMT%2B8&characterEncoding=UTF-8&useUnicode=true&useSSL=false"),
MYSQL("1", "MySql数据库", "jdbc:mysql://${host}:${port}/${dbName}?serverTimezone=GMT%2B8&characterEncoding=UTF-8&useUnicode=true&useSSL=false"),
/**
* MARIADB
*/
MARIADB(2, "MariaDB数据库", "jdbc:mariadb://${host}:${port}/${dbName}"),
MARIADB("2", "MariaDB数据库", "jdbc:mariadb://${host}:${port}/${dbName}"),
/**
* ORACLE
*/
ORACLE(3, "Oracle11g及以下数据库", "jdbc:oracle:thin:@${host}:${port}:${dbName}"),
ORACLE("3", "Oracle11g及以下数据库", "jdbc:oracle:thin:@${host}:${port}:${dbName}"),
/**
* oracle12c new pagination
*/
ORACLE_12C(4, "Oracle12c+数据库", "jdbc:oracle:thin:@${host}:${port}:${dbName}"),
ORACLE_12C("4", "Oracle12c+数据库", "jdbc:oracle:thin:@${host}:${port}:${dbName}"),
/**
* POSTGRESQL
*/
POSTGRE_SQL(5, "PostgreSql数据库", "jdbc:postgresql://${host}:${port}/${dbName}"),
POSTGRE_SQL("5", "PostgreSql数据库", "jdbc:postgresql://${host}:${port}/${dbName}"),
/**
* SQLSERVER2005
*/
SQL_SERVER2008(6, "SQLServer2008及以下数据库", "jdbc:sqlserver://${host}:${port};DatabaseName=${dbName}"),
SQL_SERVER2008("6", "SQLServer2008及以下数据库", "jdbc:sqlserver://${host}:${port};DatabaseName=${dbName}"),
/**
* SQLSERVER
*/
SQL_SERVER(7, "SQLServer2012+数据库", "jdbc:sqlserver://${host}:${port};DatabaseName=${dbName}"),
SQL_SERVER("7", "SQLServer2012+数据库", "jdbc:sqlserver://${host}:${port};DatabaseName=${dbName}"),
/**
* UNKONWN DB
*/
OTHER(8, "其他数据库", "");
OTHER("8", "其他数据库", "");
/**
* 数据库名称
*/
private final Integer db;
private final String db;
/**
* 描述
......@@ -56,7 +56,7 @@ public enum DbType {
*/
private final String url;
public Integer getDb() {
public String getDb() {
return this.db;
}
......@@ -68,7 +68,7 @@ public enum DbType {
return this.url;
}
DbType(Integer db, String desc, String url) {
DbType(String db, String desc, String url) {
this.db = db;
this.desc = desc;
this.url = url;
......@@ -79,9 +79,9 @@ public enum DbType {
*
* @param dbType 数据库类型字符串
*/
public static DbType getDbType(Integer dbType) {
public static DbType getDbType(String dbType) {
for (DbType type : DbType.values()) {
if (type.db == dbType) {
if (type.db.equals(dbType)) {
return type;
}
}
......
......@@ -62,7 +62,7 @@ public class DataScopeAspect {
List<DataRole> roles = user.getRoles();
if (CollUtil.isNotEmpty(roles)){
for (DataRole role : roles){
Integer roleDataScope = role.getDataScope();
String roleDataScope = role.getDataScope();
if (DataConstant.DataScope.ALL.getKey().equals(roleDataScope)) {
sqlString = new StringBuilder();
break;
......
......@@ -12,7 +12,7 @@ public class DataMetaObjectHandler implements MetaObjectHandler {
public void insertFill(MetaObject metaObject) {
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
this.strictInsertFill(metaObject, "status", Integer.class, 1);
this.strictInsertFill(metaObject, "status", String.class, "1");
String userId = getUserId();
this.strictInsertFill(metaObject, "createBy", String.class, userId);
this.strictInsertFill(metaObject, "updateBy", String.class, userId);
......
......@@ -78,7 +78,7 @@ public class DataScopeInterceptor extends AbstractSqlParserHandler implements In
List<DataRole> roles = user.getRoles();
if (CollUtil.isNotEmpty(roles)){
for (DataRole role : roles){
Integer roleDataScope = role.getDataScope();
String roleDataScope = role.getDataScope();
if (DataConstant.DataScope.ALL.getKey().equals(roleDataScope)) {
sqlString = new StringBuilder();
break;
......
......@@ -40,6 +40,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -40,6 +40,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -49,6 +49,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -8,6 +8,7 @@ import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;
......@@ -59,4 +60,9 @@ public class GenTableDto implements Serializable {
@NotEmpty(message = "表字段不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
@Size(min = 1, message="表字段长度不能少于{min}位")
private List<GenColumnDto> columns;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
package cn.datax.service.codegen.api.vo;
import cn.datax.common.dictionary.annotation.DictAop;
import cn.datax.service.codegen.api.dto.GenColumnDto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -22,7 +23,8 @@ public class GenTableVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
@DictAop(code = "status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
......
......@@ -86,6 +86,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
......@@ -33,6 +34,9 @@ public class DataSetDto implements Serializable {
@ApiModelProperty(value = "数据集sql")
@NotBlank(message = "数据集sql不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String setSql;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -7,6 +7,7 @@ import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
......@@ -27,13 +28,16 @@ public class DataSourceDto implements Serializable {
private String id;
@ApiModelProperty(value = "数据源类型")
@NotBlank(message = "数据源类型不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer dbType;
private String dbType;
@ApiModelProperty(value = "数据源名称")
@NotBlank(message = "数据源名称不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String sourceName;
@ApiModelProperty(value = "数据源连接信息")
@Valid
private DbSchema dbSchema;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -28,7 +28,7 @@ public class DataSourceEntity extends DataScopeBaseEntity {
/**
* 数据源类型
*/
private Integer dbType;
private String dbType;
/**
* 数据源名称
......
......@@ -20,9 +20,10 @@ public class DataSetVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String sourceId;
private String setName;
private String setSql;
......
......@@ -21,10 +21,11 @@ public class DataSourceVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private Integer dbType;
private String remark;
private String dbType;
private String sourceName;
private DbSchema dbSchema;
}
......@@ -82,6 +82,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -81,6 +81,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -87,6 +87,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -108,16 +108,16 @@ public class ApiInterceptor implements HandlerInterceptor {
Map<String, Object> finalParams = params;
dataApiEntity.getReqParams().stream().forEach(param -> {
if (finalParams.containsKey(param.getParamName())) {
Integer dataType = param.getDataType();
String dataType = param.getDataType();
// 数据类型是否正确
DataType.parse(DataType.getDataType(dataType), finalParams.get(param.getParamName()));
}
});
String apiName = dataApiEntity.getApiName();
Integer rateLimit = dataApiEntity.getRateLimit();
String rateLimit = dataApiEntity.getRateLimit();
rateLimit = Optional.ofNullable(rateLimit).orElse(DataConstant.TrueOrFalse.TRUE.getKey());
// 限流
if (DataConstant.TrueOrFalse.TRUE.getKey() == rateLimit) {
if (DataConstant.TrueOrFalse.TRUE.getKey().equals(rateLimit)) {
Integer times = dataApiEntity.getTimes();
Integer seconds = dataApiEntity.getSeconds();
// 请求次数
......@@ -149,7 +149,7 @@ public class ApiInterceptor implements HandlerInterceptor {
log.setCallerParams(bodyString);
log.setCallerDate(LocalDateTime.now());
log.setTime(System.currentTimeMillis());
log.setStatus(DataConstant.TrueOrFalse.TRUE.getKey());
log.setStatus(DataConstant.EnableState.ENABLE.getKey());
ThreadUtil.getInstance().set(log);
return true;
}
......
......@@ -4,5 +4,5 @@ import cn.datax.service.data.market.api.call.factory.crypto.Crypto;
public abstract class AbstractFactory {
public abstract Crypto getCrypto(Integer type);
public abstract Crypto getCrypto(String type);
}
......@@ -9,7 +9,7 @@ public class AlgorithmFactory extends AbstractFactory {
private static final AlgorithmRegistry ALGORITHM_REGISTRY = new AlgorithmRegistry();
@Override
public Crypto getCrypto(Integer type) {
public Crypto getCrypto(String type) {
AlgorithmCrypto crypto = AlgorithmCrypto.getAlgorithmCrypto(type);
return ALGORITHM_REGISTRY.getAlgorithm(crypto);
}
......
......@@ -4,7 +4,7 @@ import cn.datax.service.data.market.api.enums.CipherType;
public class FactoryProducer {
public static AbstractFactory getFactory(Integer type){
public static AbstractFactory getFactory(String type){
CipherType cipherType = CipherType.getCipherType(type);
switch (cipherType) {
case REGEX:
......
......@@ -9,7 +9,7 @@ public class RegexFactory extends AbstractFactory {
private static final RegexRegistry REGEX_REGISTRY = new RegexRegistry();
@Override
public Crypto getCrypto(Integer type) {
public Crypto getCrypto(String type) {
RegexCrypto crypto = RegexCrypto.getRegexCrypto(type);
return REGEX_REGISTRY.getRegex(crypto);
}
......
package cn.datax.service.data.market.api.call.service.impl;
import cn.datax.common.core.DataConstant;
import cn.datax.common.core.R;
import cn.datax.common.database.DataSourceFactory;
import cn.datax.common.database.DbQuery;
......@@ -57,7 +58,7 @@ public class ApiCallServiceImpl implements ApiCallService {
public PageResult<Map<String, Object>> v1() {
R apiResult = dataApiServiceFeign.getDataApiById(ThreadUtil.getInstance().get().getApiId());
if(apiResult == null || !apiResult.isSuccess() || ObjectUtil.isEmpty(apiResult.getData())){
ThreadUtil.getInstance().get().setStatus(0);
ThreadUtil.getInstance().get().setStatus(DataConstant.EnableState.DISABLE.getKey());
ThreadUtil.getInstance().get().setMsg("API调用查询数据API{" + ThreadUtil.getInstance().get().getApiId() + "}出错");
throw new DataException("API调用查询数据API出错");
}
......@@ -68,7 +69,7 @@ public class ApiCallServiceImpl implements ApiCallService {
}
R sourceResult = dataSourceServiceFeign.getDataSourceById(dataApiEntity.getExecuteConfig().getSourceId());
if(sourceResult == null || !sourceResult.isSuccess() || ObjectUtil.isEmpty(sourceResult.getData())){
ThreadUtil.getInstance().get().setStatus(0);
ThreadUtil.getInstance().get().setStatus(DataConstant.EnableState.DISABLE.getKey());
ThreadUtil.getInstance().get().setMsg("API调用查询数据源{"+dataApiEntity.getExecuteConfig().getSourceId()+"}出错");
throw new DataException("API调用查询数据源出错");
}
......@@ -97,7 +98,7 @@ public class ApiCallServiceImpl implements ApiCallService {
sqlFilterResult = SqlBuilderUtil.getInstance().applyFilters(dataApiEntity.getExecuteConfig().getSqlText(), params);
} catch (Exception e) {
log.error("全局异常信息ex={}, StackTrace={}", e.getMessage(), ThrowableUtil.getStackTrace(e));
ThreadUtil.getInstance().get().setStatus(0);
ThreadUtil.getInstance().get().setStatus(DataConstant.EnableState.DISABLE.getKey());
ThreadUtil.getInstance().get().setMsg(e.getMessage());
throw new DataException("API调用动态构造SQL语句出错");
}
......@@ -118,7 +119,7 @@ public class ApiCallServiceImpl implements ApiCallService {
pageResult = dbQuery.queryByPage(sqlFilterResult.getSql(), acceptedFilters, offset, pageSize);
} catch (Exception e) {
log.error("全局异常信息ex={}, StackTrace={}", e.getMessage(), ThrowableUtil.getStackTrace(e));
ThreadUtil.getInstance().get().setStatus(0);
ThreadUtil.getInstance().get().setStatus(DataConstant.EnableState.DISABLE.getKey());
ThreadUtil.getInstance().get().setMsg(e.getMessage());
throw new DataException("API调用查询结果集出错");
}
......@@ -142,7 +143,7 @@ public class ApiCallServiceImpl implements ApiCallService {
}
} catch (Exception e) {
log.error("全局异常信息ex={}, StackTrace={}", e.getMessage(), ThrowableUtil.getStackTrace(e));
ThreadUtil.getInstance().get().setStatus(0);
ThreadUtil.getInstance().get().setStatus(DataConstant.EnableState.DISABLE.getKey());
ThreadUtil.getInstance().get().setMsg(e.getMessage());
throw new DataException("API调用数据脱敏出错");
}
......
......@@ -21,5 +21,5 @@ public class ApiLogDto implements Serializable {
private LocalDateTime callerDate;
private Long time;
private String msg;
private Integer status;
private String status;
}
......@@ -8,6 +8,7 @@ import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;
......@@ -40,6 +41,9 @@ public class ApiMaskDto implements Serializable {
@NotEmpty(message = "脱敏字段规则配置不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
@Size(min = 1, message="脱敏字段规则配置长度不能少于{min}位")
private List<FieldRule> rules;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -49,7 +49,7 @@ public class DataApiDto implements Serializable {
private String deny;
@ApiModelProperty(value = "是否限流:0:否,1:是")
@NotNull(message = "是否限流不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer rateLimit;
private String rateLimit;
@ApiModelProperty(value = "请求次数默认5次")
private Integer times = 5;
@ApiModelProperty(value = "请求时间范围默认60秒")
......@@ -67,6 +67,9 @@ public class DataApiDto implements Serializable {
@NotEmpty(message = "返回参数不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
@Size(min = 1, message="返回参数长度不能少于{min}位")
private List<ResParam> resParams;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -23,7 +23,7 @@ public class ExecuteConfig implements Serializable {
@ApiModelProperty(value = "配置方式")
@NotNull(message = "配置方式不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer configType;
private String configType;
@ApiModelProperty(value = "选择表")
private String tableName;
......
......@@ -20,10 +20,10 @@ public class FieldParam implements Serializable {
private String fieldName;
@ApiModelProperty(value = "作为请求参数")
@NotNull(message = "作为请求参数不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer reqable;
private String reqable;
@ApiModelProperty(value = "作为返回参数")
@NotNull(message = "作为返回参数不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer resable;
private String resable;
@ApiModelProperty(value = "字段类型")
@NotBlank(message = "字段类型不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String fieldType;
......
......@@ -20,8 +20,8 @@ public class FieldRule implements Serializable {
private String fieldName;
@ApiModelProperty(value = "脱敏类型")
@NotNull(message = "脱敏类型不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer cipherType;
private String cipherType;
@ApiModelProperty(value = "规则类型")
@NotNull(message = "规则类型不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer cryptType;
private String cryptType;
}
......@@ -21,7 +21,7 @@ public class ReqParam implements Serializable {
@ApiModelProperty(value = "是否为空")
@NotNull(message = "是否为空不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer nullable;
private String nullable;
@ApiModelProperty(value = "描述")
@NotBlank(message = "描述不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
......@@ -29,11 +29,11 @@ public class ReqParam implements Serializable {
@ApiModelProperty(value = "操作符")
@NotNull(message = "操作符不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer whereType;
private String whereType;
@ApiModelProperty(value = "数据类型")
@NotNull(message = "数据类型不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer dataType;
private String dataType;
@ApiModelProperty(value = "示例值")
@NotBlank(message = "示例值不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
......
......@@ -25,7 +25,7 @@ public class ResParam implements Serializable {
@ApiModelProperty(value = "数据类型")
@NotNull(message = "数据类型不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer dataType;
private String dataType;
@ApiModelProperty(value = "示例值")
@NotBlank(message = "示例值不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
......
......@@ -59,7 +59,7 @@ public class ApiLogEntity implements Serializable {
/**
* 状态:0:失败,1:成功
*/
private Integer status;
private String status;
/**
* 调用时间
*/
......
......@@ -62,7 +62,7 @@ public class DataApiEntity extends DataScopeBaseEntity {
/**
* 是否限流:0:否,1:是
*/
private Integer rateLimit;
private String rateLimit;
/**
* 请求次数
......
......@@ -2,23 +2,23 @@ package cn.datax.service.data.market.api.enums;
public enum AlgorithmCrypto {
BASE64(1, "BASE64加密"),
MD5(2, "MD5加密"),
SHA_1(3, "SHA_1加密"),
SHA_256(4, "SHA_256加密"),
AES(5, "AES加密"),
DES(6, "DES加密");
BASE64("1", "BASE64加密"),
MD5("2", "MD5加密"),
SHA_1("3", "SHA_1加密"),
SHA_256("4", "SHA_256加密"),
AES("5", "AES加密"),
DES("6", "DES加密");
private final Integer key;
private final String key;
private final String val;
AlgorithmCrypto(Integer key, String val) {
AlgorithmCrypto(String key, String val) {
this.key = key;
this.val = val;
}
public Integer getKey() {
public String getKey() {
return key;
}
......@@ -26,9 +26,9 @@ public enum AlgorithmCrypto {
return val;
}
public static AlgorithmCrypto getAlgorithmCrypto(Integer algorithmCrypt) {
public static AlgorithmCrypto getAlgorithmCrypto(String algorithmCrypt) {
for (AlgorithmCrypto type : AlgorithmCrypto.values()) {
if (type.key == algorithmCrypt) {
if (type.key.equals(algorithmCrypt)) {
return type;
}
}
......
......@@ -2,19 +2,19 @@ package cn.datax.service.data.market.api.enums;
public enum CipherType {
REGEX(1, "正则替换"),
ALGORITHM(2, "加密算法");
REGEX("1", "正则替换"),
ALGORITHM("2", "加密算法");
private final Integer key;
private final String key;
private final String val;
CipherType(Integer key, String val) {
CipherType(String key, String val) {
this.key = key;
this.val = val;
}
public Integer getKey() {
public String getKey() {
return key;
}
......@@ -22,9 +22,9 @@ public enum CipherType {
return val;
}
public static CipherType getCipherType(Integer cipherType) {
public static CipherType getCipherType(String cipherType) {
for (CipherType type : CipherType.values()) {
if (type.key == cipherType) {
if (type.key.equals(cipherType)) {
return type;
}
}
......
......@@ -2,19 +2,19 @@ package cn.datax.service.data.market.api.enums;
public enum ConfigType {
FORM(1, "表引导模式"),
SCRIPT(2, "脚本模式");
FORM("1", "表引导模式"),
SCRIPT("2", "脚本模式");
private final Integer key;
private final String key;
private final String val;
ConfigType(Integer key, String val) {
ConfigType(String key, String val) {
this.key = key;
this.val = val;
}
public Integer getKey() {
public String getKey() {
return key;
}
......
......@@ -8,22 +8,22 @@ import java.math.BigDecimal;
public enum DataType {
String(1, "字符串"),
Integer(2, "整型"),
Float(3, "浮点型"),
Date(4, "时间"),
List(5, "集合");
String("1", "字符串"),
Integer("2", "整型"),
Float("3", "浮点型"),
Date("4", "时间"),
List("5", "集合");
private final Integer key;
private final String key;
private final String val;
DataType(Integer key, String val) {
DataType(String key, String val) {
this.key = key;
this.val = val;
}
public Integer getKey() {
public String getKey() {
return key;
}
......@@ -74,9 +74,9 @@ public enum DataType {
return null;
}
public static DataType getDataType(Integer dataType) {
public static DataType getDataType(String dataType) {
for (DataType type : DataType.values()) {
if (type.key == dataType) {
if (type.key.equals(dataType)) {
return type;
}
}
......
......@@ -2,25 +2,25 @@ package cn.datax.service.data.market.api.enums;
public enum RegexCrypto {
CHINESE_NAME(1, "中文姓名"),
ID_CARD(2, "身份证号"),
FIXED_PHONE(3, "固定电话"),
MOBILE_PHONE(4, "手机号码"),
ADDRESS(5, "地址"),
EMAIL(6, "电子邮箱"),
BANK_CARD(7, "银行卡号"),
CNAPS_CODE(8, "公司开户银行联号");
CHINESE_NAME("1", "中文姓名"),
ID_CARD("2", "身份证号"),
FIXED_PHONE("3", "固定电话"),
MOBILE_PHONE("4", "手机号码"),
ADDRESS("5", "地址"),
EMAIL("6", "电子邮箱"),
BANK_CARD("7", "银行卡号"),
CNAPS_CODE("8", "公司开户银行联号");
private final Integer key;
private final String key;
private final String val;
RegexCrypto(Integer key, String val) {
RegexCrypto(String key, String val) {
this.key = key;
this.val = val;
}
public Integer getKey() {
public String getKey() {
return key;
}
......@@ -28,9 +28,9 @@ public enum RegexCrypto {
return val;
}
public static RegexCrypto getRegexCrypto(Integer regexCrypt) {
public static RegexCrypto getRegexCrypto(String regexCrypt) {
for (RegexCrypto type : RegexCrypto.values()) {
if (type.key == regexCrypt) {
if (type.key.equals(regexCrypt)) {
return type;
}
}
......
......@@ -2,32 +2,32 @@ package cn.datax.service.data.market.api.enums;
public enum WhereType {
EQUALS(1, "=", "等于"),
NOT_EQUALS(2, "!=", "不等于"),
LIKE(3, "LIKE", "全模糊查询"),
LIKE_LEFT(4, "LIKE", "左模糊查询"),
LIKE_RIGHT(5, "LIKE", "右模糊查询"),
GREATER_THAN(6, ">", "大于"),
GREATER_THAN_EQUALS(7, ">=", "大于等于"),
LESS_THAN(8, "<", "小于"),
LESS_THAN_EQUALS(9, "<=", "小于等于"),
NULL(10, "IS NULL", "是否为空"),
NOT_NULL(11, "IS NOT NULL", "是否不为空"),
IN(12, "IN", "IN");
private final Integer type;
EQUALS("1", "=", "等于"),
NOT_EQUALS("2", "!=", "不等于"),
LIKE("3", "LIKE", "全模糊查询"),
LIKE_LEFT("4", "LIKE", "左模糊查询"),
LIKE_RIGHT("5", "LIKE", "右模糊查询"),
GREATER_THAN("6", ">", "大于"),
GREATER_THAN_EQUALS("7", ">=", "大于等于"),
LESS_THAN("8", "<", "小于"),
LESS_THAN_EQUALS("9", "<=", "小于等于"),
NULL("10", "IS NULL", "是否为空"),
NOT_NULL("11", "IS NOT NULL", "是否不为空"),
IN("12", "IN", "IN");
private final String type;
private final String key;
private final String desc;
WhereType(Integer type, String key, String desc) {
WhereType(String type, String key, String desc) {
this.type = type;
this.key = key;
this.desc = desc;
}
public Integer getType() {
public String getType() {
return type;
}
......@@ -39,9 +39,9 @@ public enum WhereType {
return desc;
}
public static WhereType getWhereType(Integer whereType) {
public static WhereType getWhereType(String whereType) {
for (WhereType type : WhereType.values()) {
if (type.type == whereType) {
if (type.type.equals(whereType)) {
return type;
}
}
......
......@@ -21,5 +21,5 @@ public class ApiLogVo implements Serializable {
private LocalDateTime callerDate;
private Long time;
private String msg;
private Integer status;
private String status;
}
......@@ -22,9 +22,10 @@ public class ApiMaskVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String apiId;
private String maskName;
private List<FieldRule> rules;
......
......@@ -24,16 +24,17 @@ public class DataApiVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String apiName;
private String apiVersion;
private String apiUrl;
private String reqMethod;
private String deny;
private String resType;
private Integer rateLimit;
private String rateLimit;
private Integer times;
private Integer seconds;
private ExecuteConfig executeConfig;
......
......@@ -81,6 +81,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
package cn.datax.service.data.market.service.impl;
import cn.datax.common.core.DataConstant;
import cn.datax.common.exception.DataException;
import cn.datax.common.utils.ThrowableUtil;
import cn.datax.service.data.market.api.dto.*;
......@@ -76,15 +77,15 @@ public class DataApiServiceImpl extends BaseServiceImpl<DataApiDao, DataApiEntit
private DataApiEntity shareCode(DataApiDto dataApiDto) {
DataApiEntity dataApi = dataApiMapper.toEntity(dataApiDto);
Integer configType = dataApi.getExecuteConfig().getConfigType();
if (ConfigType.FORM.getKey() == configType) {
String configType = dataApi.getExecuteConfig().getConfigType();
if (ConfigType.FORM.getKey().equals(configType)) {
try {
dataApi.getExecuteConfig().setSqlText(sqlJdbcNamedParameterBuild(dataApi));
} catch (JSQLParserException e) {
log.error("全局异常信息ex={}, StackTrace={}", e.getMessage(), ThrowableUtil.getStackTrace(e));
throw new DataException("SQL语法有问题,解析出错");
}
} else if (ConfigType.SCRIPT.getKey() == configType) {}
} else if (ConfigType.SCRIPT.getKey().equals(configType)) {}
return dataApi;
}
......@@ -165,7 +166,7 @@ public class DataApiServiceImpl extends BaseServiceImpl<DataApiDao, DataApiEntit
List<ReqParam> reqParams = variables.stream().map(s -> {
ReqParam reqParam = new ReqParam();
reqParam.setParamName(s);
reqParam.setNullable(0);
reqParam.setNullable(DataConstant.TrueOrFalse.FALSE.getKey());
return reqParam;
}).collect(Collectors.toList());
sqlParseVo.setReqParams(reqParams);
......
......@@ -86,6 +86,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -51,5 +51,4 @@ public class FileEntity extends BaseEntity {
* 文件来源
*/
private String fileType;
}
......@@ -12,9 +12,10 @@ public class FileVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String originalFilename;
private String fileName;
private Long fileSize;
......
......@@ -88,6 +88,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -41,10 +41,5 @@
<artifactId>datax-common-core</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>cn.datax</groupId>
<artifactId>datax-common-dictionary</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
......@@ -38,6 +39,9 @@ public class QrtzJobDto implements Serializable {
@ApiModelProperty(value = "cron表达式")
@NotBlank(message = "cron表达式不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String cronExpression;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -42,7 +42,7 @@ public class QrtzJobLogEntity implements Serializable {
/**
* 状态(0不启用,1启用)
*/
private Integer status;
private String status;
/**
* 创建时间
......
......@@ -20,7 +20,7 @@ public class QrtzJobLogVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String jobId;
......
......@@ -20,9 +20,10 @@ public class QrtzJobVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String jobName;
private String beanName;
private String methodName;
......
......@@ -87,6 +87,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -37,12 +37,12 @@ public class ScheduleJob extends QuartzJobBean {
executor.execute(task);
long times = System.currentTimeMillis() - startTime;
// 任务状态 0:失败 1:成功
jobLog.setStatus(1);
jobLog.setStatus("1");
jobLog.setMsg("【" + job.getJobName() + "】任务执行结束,总共耗时:" + times + "毫秒");
} catch (Exception e) {
jobLog.setMsg("【" + job.getJobName() + "】任务执行失败");
// 任务状态 0:失败 1:成功
jobLog.setStatus(0);
jobLog.setStatus("0");
log.error("全局异常信息ex={}, StackTrace={}", e.getMessage(), ThrowableUtil.getStackTrace(e));
} finally {
qrtzJobLogService.save(jobLog);
......
......@@ -97,7 +97,7 @@ public class ScheduleUtil {
// 交给scheduler去调度
scheduler.scheduleJob(jobDetail, trigger);
// 暂停任务
if (job.getStatus() == DataConstant.EnableState.DISABLE.getKey()) {
if (DataConstant.EnableState.DISABLE.getKey().equals(job.getStatus())) {
pauseJob(job.getId());
}
} catch (SchedulerException e) {
......@@ -124,7 +124,7 @@ public class ScheduleUtil {
((CronTriggerImpl)trigger).setStartTime(new Date());
scheduler.rescheduleJob(triggerKey, trigger);
// 暂停任务
if (job.getStatus() == DataConstant.EnableState.DISABLE.getKey()) {
if (DataConstant.EnableState.DISABLE.getKey().equals(job.getStatus())) {
pauseJob(job.getId());
}
} catch (SchedulerException e) {
......
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ApiModel(value = "部门Model")
......@@ -30,6 +31,10 @@ public class DeptDto implements Serializable {
@NotBlank(message = "部门编码不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String deptNo;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
......@@ -30,6 +31,9 @@ public class DictDto implements Serializable {
@ApiModelProperty(value = "字典编码")
@NotBlank(message = "字典编码不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String dictCode;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -37,6 +37,9 @@ public class DictItemDto implements Serializable {
@ApiModelProperty(value = "排序")
@NotNull(message = "排序不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer itemSort;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -44,7 +44,7 @@ public class MenuDto implements Serializable {
@ApiModelProperty(value = "类型")
@NotNull(message = "类型不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer menuType;
private String menuType;
@ApiModelProperty(value = "资源编码")
private String menuCode;
......@@ -53,6 +53,10 @@ public class MenuDto implements Serializable {
@NotNull(message = "排序不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer menuSort;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ApiModel(value = "岗位Model")
......@@ -22,6 +23,10 @@ public class PostDto implements Serializable {
@NotBlank(message = "岗位名称不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String postName;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -31,7 +31,7 @@ public class RoleDto implements Serializable {
@ApiModelProperty(value = "数据范围")
@NotNull(message = "数据范围不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private Integer dataScope;
private String dataScope;
@ApiModelProperty(value = "资源")
@NotEmpty(message = "资源不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
......@@ -40,6 +40,10 @@ public class RoleDto implements Serializable {
@ApiModelProperty(value = "数据范围为2时自定义数据权限")
private List<String> deptList;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
......@@ -33,4 +34,9 @@ public class SysConfigDto implements Serializable {
@ApiModelProperty(value = "参数键值")
@NotBlank(message = "参数键值不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String configValue;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -63,6 +63,10 @@ public class UserDto implements Serializable {
@Size(min = 1, max = 1, message="岗位长度必须位于{min}-{max}之间")
private List<String> postList;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
......@@ -26,7 +27,7 @@ public class WorkflowConfigDto implements Serializable {
private String id;
@ApiModelProperty(value = "流程定义")
@NotBlank(message = "流程定义不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String procesKey;
private String processKey;
@ApiModelProperty(value = "业务主题")
@NotBlank(message = "业务主题不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String businessTheme;
......@@ -36,4 +37,9 @@ public class WorkflowConfigDto implements Serializable {
@ApiModelProperty(value = "业务组件")
@NotBlank(message = "业务组件不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String businessComponent;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -60,7 +60,7 @@ public class MenuEntity extends BaseEntity {
/**
* 类型(0模块,1菜单,2按钮)
*/
private Integer menuType;
private String menuType;
/**
* 资源编码
......
......@@ -38,7 +38,7 @@ public class RoleEntity extends BaseEntity {
/**
* 数据范围(1:全部数据权限 2:自定义数据权限 3:本部门数据权限 4:本部门及以下数据权限 5:仅本人数据权限)
*/
private Integer dataScope;
private String dataScope;
@TableField(exist = false)
private List<MenuEntity> menus;
......
......@@ -27,7 +27,7 @@ public class WorkflowConfigEntity extends BaseEntity {
/**
* 流程定义
*/
private String procesKey;
private String processKey;
/**
* 业务主题
......
package cn.datax.service.system.api.vo;
import cn.datax.common.dictionary.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -13,9 +14,11 @@ public class DeptVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String parentId;
private String deptName;
private String deptNo;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.dictionary.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -20,9 +21,11 @@ public class DictItemVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String dictId;
private String itemText;
private String itemValue;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.dictionary.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -20,9 +21,11 @@ public class DictVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String dictName;
private String dictCode;
}
package cn.datax.service.system.api.vo;
import cn.datax.common.dictionary.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -12,9 +13,11 @@ public class MenuVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String parentId;
private String menuName;
private String menuPath;
......@@ -22,7 +25,8 @@ public class MenuVo implements Serializable {
private String menuRedirect;
private String menuPerms;
private String menuIcon;
private Integer menuType;
@DictAop(code = "sys_menu_type")
private String menuType;
private String menuCode;
private Integer menuSort;
}
package cn.datax.service.system.api.vo;
import cn.datax.common.dictionary.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -12,8 +13,10 @@ public class PostVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String postName;
}
......@@ -14,14 +14,15 @@ public class RoleVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
@DictAop(code = "status")
private Integer status;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String roleName;
private String roleCode;
@DictAop(code = "dataScope")
private Integer dataScope;
@DictAop(code = "sys_data_scope")
private String dataScope;
private List<MenuVo> menus;
private List<DeptVo> depts;
}
package cn.datax.service.system.api.vo;
import cn.datax.common.dictionary.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -20,9 +21,11 @@ public class SysConfigVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String configName;
private String configKey;
private String configValue;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.dictionary.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -14,9 +15,11 @@ public class UserVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String username;
private String nickname;
private String password;
......
package cn.datax.service.system.api.vo;
import cn.datax.common.dictionary.annotation.DictAop;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
......@@ -20,10 +21,12 @@ public class WorkflowConfigVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer status;
@DictAop(code = "sys_common_status")
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String procesKey;
private String remark;
private String processKey;
private String businessTheme;
private String businessCode;
private String businessComponent;
......
......@@ -81,6 +81,36 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<nonFilteredFileExtensions>
<!--解决分布式报表文件读取不到-->
<nonFilteredFileExtension>jasper</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -24,5 +24,5 @@ public interface DictDao extends BaseDao<DictEntity> {
* @return
* @param status
*/
List<DictEntity> queryDictList(@Param("status") Integer status);
List<DictEntity> queryDictList(@Param("status") String status);
}
......@@ -173,8 +173,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
.map(MenuEntity::getMenuPerms)
.collect(Collectors.toSet());
perms = new ArrayList<>(permSet);
List<MenuEntity> menus = menuEntitys.stream().filter(menuEntity -> DataConstant.MenuType.MODULE.getKey() == menuEntity.getMenuType()
|| DataConstant.MenuType.MENU.getKey() == menuEntity.getMenuType())
List<MenuEntity> menus = menuEntitys.stream().filter(menuEntity -> DataConstant.MenuType.MODULE.getKey().equals(menuEntity.getMenuType())
|| DataConstant.MenuType.MENU.getKey().equals(menuEntity.getMenuType()))
.collect(Collectors.toList());
routes = getRouteTree(menus, "0");
}
......
......@@ -11,7 +11,7 @@
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="remark" property="remark" />
<result column="proces_key" property="procesKey" />
<result column="process_key" property="processKey" />
<result column="business_theme" property="businessTheme" />
<result column="business_code" property="businessCode" />
<result column="business_component" property="businessComponent" />
......@@ -25,7 +25,7 @@
create_time,
update_by,
update_time,
remark, proces_key, business_theme, business_code, business_component
remark, process_key, business_theme, business_code, business_component
</sql>
</mapper>
......@@ -63,6 +63,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.7.RELEASE</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -80,6 +80,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -40,6 +40,25 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
......
import request from '@/utils/request'
// 查询字典数据详细
export function getDicts(dictCode) {
return request({
url: '/system/dicts/code/' + dictCode,
method: 'get'
})
}
......@@ -7,3 +7,33 @@ export function listPost (data) {
params: data
})
}
export function getPost (id) {
return request({
url: '/system/posts/' + id,
method: 'get'
})
}
export function delPost (id) {
return request({
url: '/system/posts/' + id,
method: 'delete'
})
}
export function addPost (data) {
return request({
url: '/system/posts',
method: 'post',
data: data
})
}
export function updatePost (data) {
return request({
url: '/system/posts/' + data.id,
method: 'put',
data: data
})
}
......@@ -16,6 +16,11 @@ import '@/icons'
import perms from '@/directive/permission'
import { getDicts } from '@/api/system/dict'
// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.use(ElementUI)
Vue.use(perms)
......
......@@ -3,17 +3,35 @@
<el-card class="box-card" shadow="always" :body-style="{ height: bodyHeight }" style="overflow-y: auto;">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button size="mini" icon="el-icon-plus" style="float: right; padding: 3px 0" round>保存</el-button>
<el-button size="mini" icon="el-icon-back" style="float: right; padding: 3px 0" round @click="showCard">返回列表</el-button>
<!-- <el-button-group style="float: right;">-->
<!-- </el-button-group>-->
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
111
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="岗位名称" prop="postName">
<el-input v-model="form.postName" placeholder="请输入岗位名称" />
</el-form-item>
<el-form-item label="岗位状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.id"
:label="dict.itemText"
>{{dict.itemValue}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import { addPost } from '@/api/system/post'
export default {
name: 'PostAdd',
data () {
......@@ -27,14 +45,42 @@ export default {
showAdd: false,
showEdit: false,
showDetail: false
}
},
// 表单参数
form: {
status: '1'
},
// 表单校验
rules: {
postName: [
{ required: true, message: "岗位名称不能为空", trigger: "blur" }
]
},
// 状态数据字典
statusOptions: []
}
},
created () {
this.getDicts("sys_common_status").then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
},
methods: {
showCard () {
this.$emit('showCard', this.showOptions)
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
addPost(this.form).then(response => {
if (response.success) {
}
})
}
})
}
}
}
......
<template>
<div>
<el-card class="box-card" shadow="always" :body-style="{ height: bodyHeight }" style="overflow-y: auto;">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="showCard">返回列表</el-button>
</div>
333
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="岗位名称" prop="postName">
<el-input v-model="form.postName" readonly />
</el-form-item>
<el-form-item label="岗位状态" prop="status">
<el-radio-group v-model="form.status" disabled>
<el-radio
v-for="dict in statusOptions"
:key="dict.id"
:label="dict.itemText"
>{{dict.itemValue}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" readonly />
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import { getPost } from '@/api/system/post'
export default {
name: 'PostAdd',
props: {
......@@ -30,15 +50,33 @@ export default {
showAdd: false,
showEdit: false,
showDetail: false
}
},
// 表单参数
form: {},
// 状态数据字典
statusOptions: []
}
},
created () {
console.log('id:' + this.id)
this.getDicts("sys_common_status").then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getPost(this.id)
},
methods: {
showCard () {
this.$emit('showCard', this.showOptions)
},
/** 获取详情 */
getPost: function(id) {
getPost(id).then(response => {
if (response.success) {
this.form = response.data
}
})
}
}
}
......
<template>
<div>
<el-card class="box-card" shadow="always" :body-style="{ height: bodyHeight }" style="overflow-y: auto;">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="showCard">返回列表</el-button>
</div>
222
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="岗位名称" prop="postName">
<el-input v-model="form.postName" placeholder="请输入岗位名称" />
</el-form-item>
<el-form-item label="岗位状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.id"
:label="dict.itemText"
>{{dict.itemValue}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import { getPost, updatePost } from '@/api/system/post'
export default {
name: 'PostAdd',
props: {
......@@ -30,15 +51,50 @@ export default {
showAdd: false,
showEdit: false,
showDetail: false
}
},
// 表单参数
form: {},
// 表单校验
rules: {
postName: [
{ required: true, message: "岗位名称不能为空", trigger: "blur" }
]
},
// 状态数据字典
statusOptions: []
}
},
created () {
console.log('id:' + this.id)
this.getDicts("sys_common_status").then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getPost(this.id)
},
methods: {
showCard () {
this.$emit('showCard', this.showOptions)
},
/** 获取详情 */
getPost: function(id) {
getPost(id).then(response => {
if (response.success) {
this.form = response.data
}
})
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
updatePost(this.form).then(response => {
if (response.success) {
}
})
}
})
}
}
}
......
......@@ -151,9 +151,9 @@
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="pageParams.pageNum"
:page-size.sync="pageParams.pageSize"
:total="pageParams.pageTotal"
:current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize"
:total="total"
></el-pagination>
</el-card>
</div>
......@@ -200,14 +200,12 @@ export default {
tableSize: 'medium',
// 岗位表格数据
postList: [],
// 分页参数
pageParams: {
pageNum: 1,
pageSize: 20,
pageTotal: 0
},
// 总数据条数
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
postName: ''
}
}
......@@ -220,13 +218,12 @@ export default {
/** 查询岗位列表 */
getList () {
this.loading = true
Object.assign(this.queryParams, this.pageParams);
listPost(this.queryParams).then(response => {
this.loading = false
if (response.success) {
const { data } = response
this.postList = data.data
this.pageParams.pageTotal = data.total
this.total = data.total
}
})
},
......@@ -247,7 +244,7 @@ export default {
},
/** 搜索按钮操作 */
handleQuery () {
this.pageParams.pageNum = 1
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
......@@ -259,7 +256,7 @@ export default {
handleRefresh () {
this.getList()
},
// 多选框选中数据
/** 多选框选中数据 */
handleSelectionChange (selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
......@@ -310,23 +307,17 @@ export default {
type: 'warning'
})
}
this.$confirm('选中数据将被永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).catch(() => {
})
this.$message.warning('不支持批量删除')
},
handleSizeChange (val) {
console.log(`每页 ${val} 条`)
this.pageParams.pageNum = 1
this.pageParams.pageSize = val
this.queryParams.pageNum = 1
this.queryParams.pageSize = val
this.getList()
},
handleCurrentChange (val) {
console.log(`当前页: ${val}`)
this.pageParams.pageNum = val
this.queryParams.pageNum = val
this.getList()
},
statusFormatter (row, column, cellValue, index) {
......
......@@ -121,51 +121,4 @@
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>${project.name}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<finalName>${project.build.finalName}</finalName>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>${maven.compiler.target}</target>
<source>${maven.compiler.source}</source>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<nonFilteredFileExtensions>
<!--解决分布式报表文件读取不到-->
<nonFilteredFileExtension>jasper</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment