commit
758cfbf0b9
147 changed files with 11130 additions and 0 deletions
@ -0,0 +1,16 @@ |
|||
/target/ |
|||
/logs/ |
|||
/.idea/ |
|||
*.iml |
|||
*.bak |
|||
*.log |
|||
/.settings/ |
|||
*.project |
|||
*.classpath |
|||
*.factorypath |
|||
*.springBeans |
|||
/.apt_generated/ |
|||
/.externalToolBuilders/ |
|||
/bin/ |
|||
/model2d3d-viewer-back-controller/tmp/ |
|||
application-*.properties |
@ -0,0 +1,31 @@ |
|||
aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin 381659385655.dkr.ecr.ap-northeast-1.amazonaws.com |
|||
|
|||
docker tag 67f91fc6cfbf 381659385655.dkr.ecr.ap-northeast-1.amazonaws.com/tokyo-build-business:latest |
|||
|
|||
docker push 381659385655.dkr.ecr.ap-northeast-1.amazonaws.com/tokyo-build-business:latest |
|||
|
|||
docker pull 381659385655.dkr.ecr.ap-northeast-1.amazonaws.com/tokyo-build-business:latest |
|||
|
|||
docker run -d -p 8887:20008 -v /home/data-center-business/back/application.properties:/home/data-center-business/config/application.properties 381659385655.dkr.ecr.ap-northeast-1.amazonaws.com/tokyo-build-business |
|||
|
|||
aws configure |
|||
|
|||
docker run -e apiEnable=false -e datasourceDNS=tokyo-building-db.caetvgb7diak.ap-northeast-1.rds.amazonaws.com -e datasourceTimeZone=Asia/Tokyo -e datasourceUsername=techsor -e datasourcePassword=Abc#123456xyz -e loggingLevel=ERROR -e loggingPath=/home/data-center-business/log -e loggingAppender=SYSLOG -e redisHost=replication-group-tokyo-build.ncvpel.ng.0001.apne1.cache.amazonaws.com -e redisPassword= -e awsAccesskey=AKIA5OFH5OOZHM3U3KX4 -e awsSecretkey=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 -e awsBucket=tokyo-build-databucket-381659385655 -e ibatisLoggingLog=ERROR -e ibatisLoggingLogFactory=ERROR -d -p 20008:20008 923770123186.dkr.ecr.ap-northeast-1.amazonaws.com/tokyo-build-business:latest |
|||
|
|||
阿里云 |
|||
docker tag e1fe6f58961e registry.cn-shanghai.aliyuncs.com/test-data-business/data-business-server:latest |
|||
|
|||
docker push registry.cn-shanghai.aliyuncs.com/test-data-business/data-business-server:latest |
|||
|
|||
docker pull registry.cn-shanghai.aliyuncs.com/test-data-business/data-business-server:latest |
|||
|
|||
docker exec -it 3c77bb84d338 /bin/bash |
|||
|
|||
docker run -d -p 20008:20015 -v /home/application.properties:/home/model2d3d-viewer-back/config/application.properties registry.cn-shanghai.aliyuncs.com/test-data-business/data-business-server |
|||
|
|||
测试环境 |
|||
aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin 923770123186.dkr.ecr.ap-northeast-1.amazonaws.com |
|||
|
|||
docker tag ecee6b583d3c 923770123186.dkr.ecr.ap-northeast-1.amazonaws.com/tokyo-build-business:latest |
|||
|
|||
docker push 923770123186.dkr.ecr.ap-northeast-1.amazonaws.com/tokyo-build-business:latest |
@ -0,0 +1,140 @@ |
|||
/* |
|||
SQLyog 企业版 - MySQL GUI v8.14 |
|||
MySQL - 8.0.28 : Database - model2d3d_viewer_back |
|||
********************************************************************* |
|||
*/ |
|||
|
|||
/*!40101 SET NAMES utf8 */; |
|||
|
|||
/*!40101 SET SQL_MODE=''*/; |
|||
|
|||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; |
|||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; |
|||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; |
|||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; |
|||
CREATE DATABASE /*!32312 IF NOT EXISTS*/`model2d3d_viewer_back` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; |
|||
|
|||
USE `model2d3d_viewer_back`; |
|||
|
|||
/*Table structure for table `basic_company` */ |
|||
|
|||
DROP TABLE IF EXISTS `basic_company`; |
|||
|
|||
CREATE TABLE `basic_company` ( |
|||
`id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, |
|||
`parent_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`company_name` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`flag` int DEFAULT '0' COMMENT '0-正常,1-删除', |
|||
`create_time` bigint DEFAULT NULL, |
|||
`modify_time` bigint DEFAULT NULL, |
|||
PRIMARY KEY (`id`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='企业表'; |
|||
|
|||
/*Data for the table `basic_company` */ |
|||
|
|||
insert into `basic_company`(`id`,`parent_id`,`company_name`,`flag`,`create_time`,`modify_time`) values ('1','-1','MiniSolution',0,1658978002231,1658978002231); |
|||
/*Table structure for table `basic_menu` */ |
|||
|
|||
DROP TABLE IF EXISTS `basic_menu`; |
|||
|
|||
CREATE TABLE `basic_menu` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT, |
|||
`parent_menu_id` bigint DEFAULT NULL, |
|||
`menu_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`menu_name_en` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`menu_name_jp` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`remark` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`menu_level` int DEFAULT '1' COMMENT '菜单级别', |
|||
`flag` int DEFAULT '0' COMMENT '0-正常,1-删除', |
|||
`create_time` bigint DEFAULT NULL, |
|||
PRIMARY KEY (`id`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
|||
|
|||
/*Data for the table `basic_menu` */ |
|||
|
|||
/*Table structure for table `basic_role` */ |
|||
|
|||
DROP TABLE IF EXISTS `basic_role`; |
|||
|
|||
CREATE TABLE `basic_role` ( |
|||
`id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, |
|||
`company_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`role_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`description` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`flag` int DEFAULT '0' COMMENT '0-正常,1-删除', |
|||
`creator_id` bigint DEFAULT NULL, |
|||
`create_time` bigint DEFAULT NULL, |
|||
`modifier_id` bigint DEFAULT NULL, |
|||
`modify_time` bigint DEFAULT NULL, |
|||
PRIMARY KEY (`id`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
|||
|
|||
/*Table structure for table `basic_role_menu_relation` */ |
|||
|
|||
DROP TABLE IF EXISTS `basic_role_menu_relation`; |
|||
|
|||
CREATE TABLE `basic_role_menu_relation` ( |
|||
`role_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`menu_id` bigint DEFAULT NULL, |
|||
`creator_id` bigint DEFAULT NULL, |
|||
`create_time` bigint DEFAULT NULL |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
|||
|
|||
|
|||
/*Table structure for table `basic_role_user_relation` */ |
|||
|
|||
DROP TABLE IF EXISTS `basic_role_user_relation`; |
|||
|
|||
CREATE TABLE `basic_role_user_relation` ( |
|||
`user_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`role_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`creator_id` bigint DEFAULT NULL, |
|||
`create_time` bigint DEFAULT NULL |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
|||
|
|||
|
|||
/*Table structure for table `basic_user` */ |
|||
|
|||
DROP TABLE IF EXISTS `basic_user`; |
|||
|
|||
CREATE TABLE `basic_user` ( |
|||
`id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, |
|||
`company_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, |
|||
`shop_uuid` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`login_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`password_modify_time` bigint DEFAULT NULL, |
|||
`salt` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`mobile_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`last_login_time` bigint DEFAULT NULL, |
|||
`remark` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', |
|||
`flag` int NOT NULL DEFAULT '0' COMMENT '0-正常,1-删除', |
|||
`expire_time` bigint DEFAULT '4114487556000', |
|||
`create_time` bigint DEFAULT NULL, |
|||
`creator_id` bigint DEFAULT NULL, |
|||
`modify_time` bigint DEFAULT NULL, |
|||
`modifier_id` bigint DEFAULT NULL, |
|||
PRIMARY KEY (`id`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
|||
|
|||
/*Data for the table `basic_user` */ |
|||
|
|||
insert into `basic_user`(`id`,`company_id`,`shop_uuid`,`username`,`login_name`,`password`,`password_modify_time`,`salt`,`email`,`mobile_number`,`last_login_time`,`remark`,`flag`,`expire_time`,`create_time`,`creator_id`,`modify_time`,`modifier_id`) values ('1','1','1','admin_name','admin','nVg+buw0YAs=',1670312031273,'09bc3a7898','1053492832@qq.com',NULL,1743496632944,NULL,0,4114487556000,NULL,NULL,NULL,NULL); |
|||
/*Table structure for table `login_history` */ |
|||
|
|||
DROP TABLE IF EXISTS `login_history`; |
|||
|
|||
CREATE TABLE `login_history` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT, |
|||
`user_id` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`request_ip` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, |
|||
`login_time` bigint DEFAULT NULL, |
|||
PRIMARY KEY (`id`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
|||
|
|||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; |
|||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; |
|||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; |
|||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; |
@ -0,0 +1,30 @@ |
|||
#! /bin/sh |
|||
#启动方法 |
|||
start(){ |
|||
now=`date "+%Y%m%d%H%M%S"` |
|||
cd /home/model2d3d-viewer-back/back/server/run && nohup /usr/local/java/jdk1.8.0_221/bin/java -server -Xms256m -Xmx256m -jar /home/model2d3d-viewer-back/back/server/run/model2d3d-viewer-back-controller-0.0.1-SNAPSHOT.jar > /dev/null 2>boot.log & |
|||
} |
|||
#停止方法 |
|||
stop(){ |
|||
ps -ef|grep java|grep model2d3d-viewer-back-controller-0.0.1-SNAPSHOT.jar|awk '{print $2}'|while read pid |
|||
do |
|||
kill -9 $pid |
|||
done |
|||
} |
|||
|
|||
case "$1" in |
|||
start) |
|||
start |
|||
;; |
|||
stop) |
|||
stop |
|||
;; |
|||
restart) |
|||
stop |
|||
start |
|||
;; |
|||
*) |
|||
printf 'Usage: %s {start|stop|restart}\n' "$prog" |
|||
exit 1 |
|||
;; |
|||
esac |
@ -0,0 +1,17 @@ |
|||
#!/bin/bash |
|||
|
|||
projectName=model2d3d-viewer-back |
|||
backFilePath=/home/$projectName/back/server |
|||
|
|||
basepath=$(cd `dirname $0`; pwd) |
|||
cd $basepath |
|||
|
|||
echo "start for Web" |
|||
|
|||
rm -rf $backFilePath/run/lib |
|||
unzip -o $backFilePath/$projectName.zip -d $backFilePath/run |
|||
\cp -r $backFilePath/run/$projectName/* $backFilePath/run/ |
|||
rm -rf $backFilePath/run/$projectName |
|||
|
|||
sh start.sh restart |
|||
exit |
@ -0,0 +1,15 @@ |
|||
/target/ |
|||
/logs/ |
|||
/.idea/ |
|||
*.iml |
|||
*.bak |
|||
*.log |
|||
/.settings/ |
|||
*.project |
|||
*.classpath |
|||
*.factorypath |
|||
*.springBeans |
|||
/.apt_generated/ |
|||
/.externalToolBuilders/ |
|||
/bin/ |
|||
application-*.properties |
@ -0,0 +1,35 @@ |
|||
<?xml version="1.0"?> |
|||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>model2d3d-viewer-back</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</parent> |
|||
<artifactId>model2d3d-viewer-back-common</artifactId> |
|||
<name>model2d3d-viewer-back-common</name> |
|||
<url>http://maven.apache.org</url> |
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
</properties> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>junit</groupId> |
|||
<artifactId>junit</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>model2d3d-viewer-back-dao</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>model2d3d-viewer-back-util</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
</project> |
@ -0,0 +1,18 @@ |
|||
package com.model2d3d.viewer.back.common; |
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年5月20日 下午2:01:41 |
|||
*/ |
|||
public class Constants { |
|||
|
|||
//这个很重要,不要随便动
|
|||
public static final String DES_SALT = "ci3b512jwy199511"; |
|||
|
|||
public static final String APP_NAME = "model2d3d_viewer_back:"; |
|||
|
|||
//用户ID,登录名,企业ID,token
|
|||
public static final String ACCESS_TOKEN_FORMAT = APP_NAME + "RequestHeader:AccessToken:{0}:{1}:{2}:{3}"; |
|||
|
|||
public static final String CAPTCHA_VERIFICATION = APP_NAME + "CAPTCHA:VERIFICATION:"; |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.model2d3d.viewer.back.common.exception; |
|||
|
|||
/** |
|||
* 业务异常处理 |
|||
* |
|||
*/ |
|||
public class BusinessException extends RuntimeException{ |
|||
|
|||
/** |
|||
* 实例化一个新的业务异常 |
|||
* |
|||
* @param msg 异常信息 |
|||
*/ |
|||
public BusinessException(String msg) { |
|||
super(msg); |
|||
} |
|||
|
|||
/** |
|||
* 实例化一个新的业务异常 |
|||
* |
|||
* @param cause 异常原因 |
|||
*/ |
|||
public BusinessException(Throwable cause) { |
|||
super(cause); |
|||
} |
|||
|
|||
/** |
|||
* 实例化一个新的业务异常 |
|||
* |
|||
* @param msg 异常信息 |
|||
* @param cause 异常原因 |
|||
*/ |
|||
public BusinessException(String msg, Throwable cause) { |
|||
super(msg, cause); |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.model2d3d.viewer.back.common.exception; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
public class MsgCodeException extends RuntimeException{ |
|||
|
|||
private String message; |
|||
|
|||
public MsgCodeException(String message) { |
|||
super(message); |
|||
this.message = message; |
|||
} |
|||
|
|||
|
|||
public String getMessage() { |
|||
return message; |
|||
} |
|||
|
|||
public void setMessage(String message) { |
|||
this.message = message; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.model2d3d.viewer.back.common.language; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.List; |
|||
|
|||
import org.springframework.boot.env.YamlPropertySourceLoader; |
|||
import org.springframework.core.env.PropertySource; |
|||
import org.springframework.core.io.support.DefaultPropertySourceFactory; |
|||
import org.springframework.core.io.support.EncodedResource; |
|||
|
|||
/** |
|||
* @PropertySource 解析.yum文件需要指定该工厂 |
|||
*/ |
|||
public class PropertySourceYumFactory extends DefaultPropertySourceFactory { |
|||
|
|||
@Override |
|||
public PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException { |
|||
if (resource == null) { |
|||
return super.createPropertySource(name, resource); |
|||
} |
|||
List<PropertySource<?>> sources = new YamlPropertySourceLoader().load(resource.getResource().getFilename(), resource.getResource()); |
|||
return sources.get(0); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,54 @@ |
|||
package com.model2d3d.viewer.back.common.language.msg; |
|||
|
|||
import org.apache.commons.collections.MapUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component |
|||
public class MsgLanguageChange { |
|||
@Autowired |
|||
private Msg_EN msgEn; |
|||
@Autowired |
|||
private Msg_CN msgCn; |
|||
@Autowired |
|||
private Msg_JP msgJp; |
|||
|
|||
/** |
|||
* 参数映射 |
|||
* @param languaType |
|||
* @param code |
|||
* @return |
|||
*/ |
|||
public String getParameterMapByCode(Integer languaType,String code){ |
|||
String msg = null; |
|||
if(null != languaType){ |
|||
if(languaType == 0){//中文
|
|||
msg = MapUtils.getString(msgCn.getParameterMap(), code, code); |
|||
}else if(languaType == 1){//英文
|
|||
msg = MapUtils.getString(msgEn.getParameterMap(), code, code); |
|||
}else if(languaType == 2){//日语
|
|||
msg = MapUtils.getString(msgJp.getParameterMap(), code, code); |
|||
} |
|||
}else{ |
|||
msg = MapUtils.getString(msgJp.getParameterMap(), code, code); |
|||
} |
|||
return msg; |
|||
} |
|||
|
|||
public String getBadRequestMessage(Integer languaType,String code){ |
|||
String msg = null; |
|||
if(null != languaType){ |
|||
if(languaType == 0){//中文
|
|||
msg = MapUtils.getString(msgCn.getArgumentNotValid(), code, code); |
|||
}else if(languaType == 1){//英文
|
|||
msg = MapUtils.getString(msgEn.getArgumentNotValid(), code, code); |
|||
}else if(languaType == 2){//日语
|
|||
msg = MapUtils.getString(msgJp.getArgumentNotValid(), code, code); |
|||
} |
|||
}else{ |
|||
msg = MapUtils.getString(msgJp.getArgumentNotValid(), code, code); |
|||
} |
|||
return msg; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.model2d3d.viewer.back.common.language.msg; |
|||
|
|||
import java.util.Map; |
|||
|
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.context.annotation.PropertySource; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import com.model2d3d.viewer.back.common.language.PropertySourceYumFactory; |
|||
|
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
@Setter |
|||
@Getter |
|||
@Component |
|||
@PropertySource(value = "classpath:/config/language/msg/msg_cn.yml", encoding = "UTF-8", factory = PropertySourceYumFactory.class) |
|||
@ConfigurationProperties(prefix = "msgcn") |
|||
public class Msg_CN { |
|||
|
|||
private Map<String,String> parameterMap; |
|||
|
|||
private Map<String,String> argumentNotValid; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.model2d3d.viewer.back.common.language.msg; |
|||
|
|||
import java.util.Map; |
|||
|
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.context.annotation.PropertySource; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import com.model2d3d.viewer.back.common.language.PropertySourceYumFactory; |
|||
|
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
@Setter |
|||
@Getter |
|||
@Component |
|||
@PropertySource(value = "classpath:/config/language/msg/msg_en.yml", encoding = "UTF-8", factory = PropertySourceYumFactory.class) |
|||
@ConfigurationProperties(prefix = "msgen") |
|||
public class Msg_EN { |
|||
|
|||
private Map<String,String> parameterMap; |
|||
|
|||
private Map<String,String> argumentNotValid; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.model2d3d.viewer.back.common.language.msg; |
|||
|
|||
import java.util.Map; |
|||
|
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.context.annotation.PropertySource; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import com.model2d3d.viewer.back.common.language.PropertySourceYumFactory; |
|||
|
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
@Setter |
|||
@Getter |
|||
@Component |
|||
@PropertySource(value = "classpath:/config/language/msg/msg_jp.yml", encoding = "UTF-8", factory = PropertySourceYumFactory.class) |
|||
@ConfigurationProperties(prefix = "msgjp") |
|||
public class Msg_JP { |
|||
|
|||
private Map<String,String> parameterMap; |
|||
|
|||
private Map<String,String> argumentNotValid; |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.model2d3d.viewer.back.common.response; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
public class BaseResponse<T> { |
|||
/** |
|||
* 返回码 |
|||
*/ |
|||
@Schema(description ="状态码, 0或者200表示成功",example = "0") |
|||
private int code; |
|||
/** |
|||
* 提示信息 |
|||
*/ |
|||
@Schema(description ="简单的提示信息",example = "服务器错误") |
|||
private String msg = "success"; |
|||
|
|||
public BaseResponse() { |
|||
|
|||
} |
|||
|
|||
public BaseResponse(int code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public BaseResponse(int code, String msg) { |
|||
this.code = code; |
|||
this.msg = msg; |
|||
} |
|||
|
|||
public int getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(int code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public String getMsg() { |
|||
return msg; |
|||
} |
|||
|
|||
public void setMsg(String msg) { |
|||
this.msg = msg; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,66 @@ |
|||
package com.model2d3d.viewer.back.common.response; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
* @param <T> |
|||
*/ |
|||
public class PageResponse<T> extends BaseResponse<T>{ |
|||
/** |
|||
* 对象信息 |
|||
*/ |
|||
private T data; |
|||
|
|||
private Map<String,String> errorMap; |
|||
|
|||
public PageResponse() { |
|||
} |
|||
|
|||
public PageResponse(int code) { |
|||
super(code); |
|||
} |
|||
|
|||
public PageResponse(int code, String msg) { |
|||
super(code, msg); |
|||
} |
|||
|
|||
public PageResponse(int code,String msg,Map<String,String> errorMap){ |
|||
super(code, msg); |
|||
this.errorMap = errorMap; |
|||
} |
|||
|
|||
public static PageResponse success(Object data){ |
|||
PageResponse pageResponse = new PageResponse(); |
|||
pageResponse.setData((IPage) data); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
return pageResponse; |
|||
} |
|||
|
|||
|
|||
public Map<String, String> getErrorMap() { |
|||
return errorMap; |
|||
} |
|||
|
|||
public void setErrorMap(Map<String, String> errorMap) { |
|||
this.errorMap = errorMap; |
|||
} |
|||
|
|||
public T getData() { |
|||
return data; |
|||
} |
|||
|
|||
public void setData(T data) { |
|||
this.data = data; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.model2d3d.viewer.back.common.response; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
public class ResponseCode { |
|||
|
|||
/** 成功 */ |
|||
public static final int OK = 0; |
|||
/** |
|||
* 请求已成功,请求所希望的响应头或数据体将随此响应返回。 |
|||
*/ |
|||
public static final int SUCCESS = 200; |
|||
|
|||
//错误请求
|
|||
public static final int BAD_REQUEST = 400; |
|||
//未授权
|
|||
public static final int AUTHORIZE_FAILED = 401; |
|||
|
|||
//服务器内部错误
|
|||
public static final int SERVER_ERROR = 500; |
|||
public static final String SERVER_ERROR_MSG = "service error"; |
|||
|
|||
//查看msg提示信息
|
|||
public static final int MSG_ERROR = 20001; |
|||
} |
@ -0,0 +1,104 @@ |
|||
package com.model2d3d.viewer.back.common.response; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonInclude; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
* @param <T> |
|||
*/ |
|||
@JsonInclude(JsonInclude.Include.NON_NULL) |
|||
public class SimpleDataResponse<T> extends BaseResponse<T> { |
|||
/** |
|||
* 单个对象 |
|||
*/ |
|||
@Schema(description ="返回的数据",example = "object") |
|||
private T data; |
|||
|
|||
/** |
|||
* The parameters Error map. |
|||
*/ |
|||
@Schema(description ="复杂的提示信息",example = "{\"name\":\"长度过长\",\"age\":\"年龄太大\",\"weight\":\"体重超标\"}") |
|||
private Map<String, String> errorMap; |
|||
|
|||
public SimpleDataResponse() { |
|||
super(); |
|||
} |
|||
|
|||
public SimpleDataResponse(int code) { |
|||
super(code); |
|||
} |
|||
|
|||
public SimpleDataResponse(int code, String msg) { |
|||
super(code, msg); |
|||
} |
|||
|
|||
/** |
|||
* 响应结果,携带错误Map |
|||
* @param code |
|||
* @param msg |
|||
* @param errorMap |
|||
*/ |
|||
public SimpleDataResponse(int code, String msg, Map<String, String> errorMap) { |
|||
this(code, msg); |
|||
this.errorMap = errorMap; |
|||
} |
|||
|
|||
/** |
|||
* 成功响应 |
|||
* @return |
|||
*/ |
|||
public static SimpleDataResponse success(){ |
|||
return new SimpleDataResponse(ResponseCode.SUCCESS,"Success"); |
|||
} |
|||
|
|||
/** |
|||
* 多条数据,成功响应 |
|||
* @param rows |
|||
* @return |
|||
*/ |
|||
public static SimpleDataResponse success(int rows){ |
|||
return new SimpleDataResponse(ResponseCode.SUCCESS,"Success: "+rows); |
|||
} |
|||
|
|||
/** |
|||
* 成功响应,携带数据对象返回 |
|||
* @param data |
|||
* @return |
|||
*/ |
|||
public static SimpleDataResponse success(Object data){ |
|||
SimpleDataResponse comm = success(); |
|||
comm.setData(data); |
|||
return comm; |
|||
} |
|||
|
|||
|
|||
public static SimpleDataResponse fail(int code,String message){ |
|||
return new SimpleDataResponse(code,message); |
|||
} |
|||
public static SimpleDataResponse fail(int code,String message,Object data){ |
|||
SimpleDataResponse simpleDataResponse= new SimpleDataResponse(code,message); |
|||
simpleDataResponse.setData(data); |
|||
return simpleDataResponse; |
|||
} |
|||
public T getData() { |
|||
return data; |
|||
} |
|||
|
|||
public void setData(T data) { |
|||
this.data = data; |
|||
} |
|||
|
|||
public Map<String, String> getErrorMap() { |
|||
return errorMap; |
|||
} |
|||
|
|||
public void setErrorMap(Map<String, String> errorMap) { |
|||
this.errorMap = errorMap; |
|||
} |
|||
} |
@ -0,0 +1,38 @@ |
|||
msgcn: |
|||
argumentNotValid: |
|||
1000: 未通过参数校验 |
|||
1001: 参数不能为空 |
|||
1002: 长度不能超过{0} |
|||
1003: 长度无效 |
|||
1004: 无效的邮箱 |
|||
1005: 数值范围在{0}到{1}之间 |
|||
1006: 必须大于或等于{0} |
|||
1007: 必须小于或等于{0} |
|||
1008: 无效的参数 |
|||
parameterMap: |
|||
serviceError: 内部服务错误 |
|||
tokenError: 接口鉴权失败 |
|||
excelEmpty: 表格为空 |
|||
lineNum: 第{0}行: |
|||
paramsFormatError: 参数格式错误 |
|||
verifCodeExpired: 验证码过期 |
|||
verifCodeError: 验证码错误 |
|||
accountExpired: 该账号已过期 |
|||
pwdError: 密码错误 |
|||
userNotExist: 用户不存在 |
|||
noOperationAuth: 无操作权限 |
|||
excelBuildingLineDuplicate: 表格内存在相同的数据 |
|||
userOrEmailNotExist: 用户名或邮箱不存在 |
|||
companyNameHasExisted: 平台已存在此企业 |
|||
taowaComapny: 不可使用下级企业作为父企业 |
|||
hasSubsidiary: 删除的企业拥有下级企业,需先处理下级企业 |
|||
roleNameExist: 角色名已存在 |
|||
roleHasBinded: 角色已绑定用户,请先解绑再删除 |
|||
loginNameOrEmailHasExisted: 用户名或邮箱已被使用 |
|||
mailAddUserPwdSubject: 新建账号密码 |
|||
mailAddUserPwdContent: 账号 <u>{0}</u> 的密码为:<u>{1}</u>, 请妥善保管<br/><br/>登陆网址:<u>{2}</u> |
|||
mailResetUserPwdSubject: 重置账号密码 |
|||
pwdFormatError: 密码组成必须包含数字、英文字母、特殊符号(~!@#$%^&*)且大于等于12位 |
|||
oldPwdError: 旧密码错误 |
|||
newPwdSameOld: 新密码不得与旧密码相同 |
|||
companyLimit: 最多可创建15个企业 |
@ -0,0 +1,38 @@ |
|||
msgen: |
|||
argumentNotValid: |
|||
1000: 未通过参数校验 |
|||
1001: 参数不能为空 |
|||
1002: 长度不能超过{0} |
|||
1003: 长度无效 |
|||
1004: 无效的邮箱 |
|||
1005: 数值范围在{0}到{1}之间 |
|||
1006: 必须大于或等于{0} |
|||
1007: 必须小于或等于{0} |
|||
1008: 无效的参数 |
|||
parameterMap: |
|||
serviceError: Internal service error. |
|||
tokenError: API authentication failed. |
|||
excelEmpty: The spreadsheet is empty. |
|||
lineNum: "Lines {0}:" |
|||
paramsFormatError: Parameter format error. |
|||
verifCodeExpired: Verification code expired. |
|||
verifCodeError: Verification code error. |
|||
accountExpired: The account has expired. |
|||
pwdError: Password error. |
|||
userNotExist: User does not exist. |
|||
noOperationAuth: No operation permission. |
|||
excelBuildingLineDuplicate: Duplicate data exists in the spreadsheet. |
|||
userOrEmailNotExist: 用户名或邮箱不存在 |
|||
companyNameHasExisted: 平台已存在此企业 |
|||
taowaComapny: 不可使用下级企业作为父企业 |
|||
hasSubsidiary: 删除的企业拥有下级企业,需先处理下级企业 |
|||
roleNameExist: 角色名已存在 |
|||
roleHasBinded: 角色已绑定用户,请先解绑再删除 |
|||
loginNameOrEmailHasExisted: 用户名或邮箱已被使用 |
|||
mailAddUserPwdSubject: 新建账号密码 |
|||
mailAddUserPwdContent: 账号 <u>{0}</u> 的密码为:<u>{1}</u>, 请妥善保管<br/><br/>登陆网址:<u>{2}</u> |
|||
mailResetUserPwdSubject: 重置账号密码 |
|||
pwdFormatError: 密码组成必须包含数字、英文字母、特殊符号(~!@#$%^&*)且大于等于12位 |
|||
oldPwdError: 旧密码错误 |
|||
newPwdSameOld: 新密码不得与旧密码相同 |
|||
companyLimit: 最多可创建15个企业 |
@ -0,0 +1,38 @@ |
|||
msgjp: |
|||
argumentNotValid: |
|||
1000: 未通过参数校验 |
|||
1001: 参数不能为空 |
|||
1002: 长度不能超过{0} |
|||
1003: 长度无效 |
|||
1004: 无效的邮箱 |
|||
1005: 数值范围在{0}到{1}之间 |
|||
1006: 必须大于或等于{0} |
|||
1007: 必须小于或等于{0} |
|||
1008: 无效的参数 |
|||
parameterMap: |
|||
serviceError: 内部サービスのエラー |
|||
tokenError: インターフェイスの認証に失敗 |
|||
excelEmpty: フォームが空になっている |
|||
lineNum: 行{0}: |
|||
paramsFormatError: パラメータのフォーマットエラー |
|||
verifCodeExpired: 確認コード期限切れ |
|||
verifCodeError: 確認コードエラー |
|||
accountExpired: アカウントの有効期限が切れている |
|||
pwdError: パスワードエラー |
|||
userNotExist: ユーザーが存在しない |
|||
noOperationAuth: 操作権限なし |
|||
excelBuildingLineDuplicate: テーブルに同じデータがある |
|||
userOrEmailNotExist: ユーザーが存在しません |
|||
companyNameHasExisted: 会社はすでにプラットフォーム上に存在する |
|||
taowaComapny: 下位の会社を親会社として利用することは不可 |
|||
hasSubsidiary: 削除対象の会社には下位の会社があるので、先に下位の会社を対応してください |
|||
roleNameExist: 役割名が既に登録済み |
|||
roleHasBinded: 役割はユーザーにバインドされている ので、削除する前にバインドを解除してください |
|||
loginNameOrEmailHasExisted: ユーザー名またはメールボックスはすでに使用されています |
|||
mailAddUserPwdSubject: 新規アカウント・パスワードの作成 |
|||
mailAddUserPwdContent: アカウント <u>{0}</u> のパスワードは:<u>{1}</u>, お忘れにならないようにお願いします。<br/><br/>ログインWebアドレス:<u>{2}</u> |
|||
mailResetUserPwdSubject: アカウント・パスワードのリセット |
|||
pwdFormatError: パスワードの構成には、数字、アルファベット、特殊文字(~!@#$%^&*) で、12桁以上 |
|||
oldPwdError: 旧パスワードエラー |
|||
newPwdSameOld: 注:旧パスワードと同じものを使用しないでください |
|||
companyLimit: 最大15のエンタープライズを作成可能 |
@ -0,0 +1,15 @@ |
|||
/target/ |
|||
/logs/ |
|||
/.idea/ |
|||
*.iml |
|||
*.bak |
|||
*.log |
|||
/.settings/ |
|||
*.project |
|||
*.classpath |
|||
*.factorypath |
|||
*.springBeans |
|||
/.apt_generated/ |
|||
/.externalToolBuilders/ |
|||
/bin/ |
|||
application-*.properties |
@ -0,0 +1,69 @@ |
|||
#FROM openjdk:8-jre-alpine |
|||
#FROM amazon-corretto-8 |
|||
#FROM amazoncorretto:11 |
|||
|
|||
# 使用Ubuntu 20.04 LTS作为基础镜像 |
|||
FROM ubuntu:20.04 |
|||
|
|||
# 设置系统的默认编码方式为 UTF-8 |
|||
ENV LANG=en_US.UTF-8 |
|||
ENV LC_CTYPE=zh_CN.UTF-8 |
|||
|
|||
# 设置环境变量,避免交互式安装 |
|||
ENV DEBIAN_FRONTEND=noninteractive |
|||
|
|||
# 更新APT软件包索引并安装必要的软件包 |
|||
RUN apt-get update && \ |
|||
apt-get install -y \ |
|||
curl \ |
|||
unzip \ |
|||
vim \ |
|||
fontconfig \ |
|||
&& apt-get clean \ |
|||
&& rm -rf /var/lib/apt/lists/* |
|||
|
|||
# 安装Terraform |
|||
RUN curl -fsSLk https://releases.hashicorp.com/terraform/1.7.5/terraform_1.7.5_linux_amd64.zip -o /tmp/terraform.zip && \ |
|||
unzip /tmp/terraform.zip -d /usr/local/bin/ && \ |
|||
rm /tmp/terraform.zip |
|||
|
|||
# 安装Amazon Corretto 11 JDK |
|||
RUN curl -fsSLk https://corretto.aws/downloads/resources/11.0.22.7.1/amazon-corretto-11.0.22.7.1-linux-x64.tar.gz -o /tmp/amazon-corretto-11.tar.gz && \ |
|||
mkdir /usr/lib/jvm/ && \ |
|||
tar -xzvf /tmp/amazon-corretto-11.tar.gz -C /usr/lib/jvm/ && \ |
|||
rm /tmp/amazon-corretto-11.tar.gz |
|||
|
|||
# 设置JAVA_HOME环境变量 |
|||
ENV JAVA_HOME=/usr/lib/jvm/amazon-corretto-11.0.22.7.1-linux-x64 |
|||
ENV PATH=$JAVA_HOME/bin:$PATH |
|||
|
|||
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" |
|||
|
|||
# 打印Terraform版本 |
|||
RUN terraform --version |
|||
|
|||
# 打印Java版本 |
|||
RUN java -version |
|||
|
|||
WORKDIR /home/data-center-admin |
|||
|
|||
#EXPOSE 20008 |
|||
|
|||
# 设置时区 |
|||
#RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone |
|||
|
|||
ARG JAR_FILE |
|||
ARG LIB_DIR |
|||
ARG CONFIG_DIR |
|||
ARG AURORA_TERRAFORM |
|||
ARG JVM_OPTS |
|||
|
|||
COPY ${JAR_FILE} app.jar |
|||
COPY ${LIB_DIR} lib |
|||
COPY ${CONFIG_DIR} config |
|||
COPY ${AURORA_TERRAFORM} aurora_terraform |
|||
|
|||
#ENTRYPOINT ["java", "${JVM_OPTS}", "-jar","app.jar"] |
|||
ENTRYPOINT java ${JVM_OPTS} -jar app.jar |
|||
|
|||
|
@ -0,0 +1,350 @@ |
|||
<?xml version="1.0"?> |
|||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>model2d3d-viewer-back</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</parent> |
|||
<artifactId>model2d3d-viewer-back-controller</artifactId> |
|||
<name>model2d3d-viewer-back-controller</name> |
|||
<url>http://maven.apache.org</url> |
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
|
|||
<aws.ecr.repository>tokyo-build-admin</aws.ecr.repository> |
|||
<aws.ecr.tag>latest</aws.ecr.tag> |
|||
<aws.ecr.region>ap-northeast-1</aws.ecr.region> |
|||
|
|||
<aws.ecr.registry.test>923770123186.dkr.ecr.ap-northeast-1.amazonaws.com</aws.ecr.registry.test> |
|||
<aws.access.key.test>AKIA5OFH5OOZHM3U3KX4</aws.access.key.test> |
|||
<aws.secret.access.key.test>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</aws.secret.access.key.test> |
|||
|
|||
<aws.ecr.registry.production>381659385655.dkr.ecr.ap-northeast-1.amazonaws.com</aws.ecr.registry.production> |
|||
<aws.access.key.production>AKIAVRXFMB43XVQ3GXAL</aws.access.key.production> |
|||
<aws.secret.access.key.production>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</aws.secret.access.key.production> |
|||
|
|||
</properties> |
|||
|
|||
<dependencies> |
|||
|
|||
<dependency> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>model2d3d-viewer-back-service</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>model2d3d-viewer-back-common</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>junit</groupId> |
|||
<artifactId>junit</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.spotify</groupId> |
|||
<artifactId>dockerfile-maven-plugin</artifactId> |
|||
<version>1.4.13</version> |
|||
<!--排除掉下面这个,不然重复导入javax.annotation,amazon-corretto-11下报错java.lang.String javax.annotation.Resource.lookup()--> |
|||
<exclusions> |
|||
<exclusion> |
|||
<groupId>javax.annotation</groupId> |
|||
<artifactId>jsr250-api</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<profiles> |
|||
<profile> |
|||
<id>only-package</id> |
|||
<activation> |
|||
<activeByDefault>true</activeByDefault> |
|||
</activation> |
|||
<build> |
|||
<!-- 项目的打包配置 --> |
|||
<plugins> |
|||
<!-- 自定义打zip包 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-assembly-plugin</artifactId> |
|||
<configuration> |
|||
<finalName>model2d3d-viewer-back</finalName> |
|||
<descriptors> |
|||
<descriptor>src/main/resources/assembly.xml</descriptor> |
|||
</descriptors> |
|||
<appendAssemblyId>false</appendAssemblyId> |
|||
</configuration> |
|||
<executions> |
|||
<execution> |
|||
<id>make-assembly</id> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>single</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</profile> |
|||
<profile> |
|||
<id>docker-package</id> |
|||
<build> |
|||
<!-- 先用dockerfile-maven-plugin构建镜像,然后maven-antrun-plugin执行推送aws ecr的命令 --> |
|||
<plugins> |
|||
<!-- dockerfile-maven-plugin构建镜像--> |
|||
<plugin> |
|||
<groupId>com.spotify</groupId> |
|||
<artifactId>dockerfile-maven-plugin</artifactId> |
|||
<version>1.4.13</version> |
|||
<executions> |
|||
<execution> |
|||
<id>default</id> |
|||
<goals> |
|||
<goal>build</goal> |
|||
<!-- <goal>push</goal>--> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
<configuration> |
|||
<repository>registry.cn-shanghai.aliyuncs.com/clouddog/datacenter-admin</repository> |
|||
<tag>${aws.ecr.tag}</tag> |
|||
<buildArgs> |
|||
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE> |
|||
<LIB_DIR>target/lib</LIB_DIR> |
|||
<CONFIG_DIR>target/config</CONFIG_DIR> |
|||
<AURORA_TERRAFORM>target/aurora_terraform</AURORA_TERRAFORM> |
|||
<JVM_OPTS>${java.jvm.opts}</JVM_OPTS> |
|||
</buildArgs> |
|||
</configuration> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</profile> |
|||
<profile> |
|||
<id>docker-aliyun</id> |
|||
<build> |
|||
<!-- 先用dockerfile-maven-plugin构建镜像,然后maven-antrun-plugin执行推送aws ecr的命令 --> |
|||
<plugins> |
|||
<!-- dockerfile-maven-plugin构建镜像--> |
|||
<plugin> |
|||
<groupId>com.spotify</groupId> |
|||
<artifactId>dockerfile-maven-plugin</artifactId> |
|||
<version>1.4.13</version> |
|||
<executions> |
|||
<execution> |
|||
<id>default</id> |
|||
<goals> |
|||
<goal>build</goal> |
|||
<!-- <goal>push</goal>--> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
<configuration> |
|||
<repository>registry.cn-shanghai.aliyuncs.com/clouddog/datacenter-admin</repository> |
|||
<tag>${aws.ecr.tag}</tag> |
|||
<buildArgs> |
|||
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE> |
|||
<LIB_DIR>target/lib</LIB_DIR> |
|||
<CONFIG_DIR>target/config</CONFIG_DIR> |
|||
<AURORA_TERRAFORM>target/aurora_terraform</AURORA_TERRAFORM> |
|||
<JVM_OPTS>${java.jvm.opts}</JVM_OPTS> |
|||
</buildArgs> |
|||
</configuration> |
|||
</plugin> |
|||
<!-- maven-antrun-plugin执行推送aws ecr的命令 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-antrun-plugin</artifactId> |
|||
<version>3.0.0</version> |
|||
<executions> |
|||
<execution> |
|||
<!--放在package阶段后面执行--> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>run</goal> |
|||
</goals> |
|||
<configuration> |
|||
<target> |
|||
<!-- Run AWS ECR login command using Ant tasks --> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="docker login --username=409950420@qq.com registry.cn-shanghai.aliyuncs.com --password=Youqu48bnb1." /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="docker push registry.cn-shanghai.aliyuncs.com/clouddog/datacenter-admin:${aws.ecr.tag}" /> |
|||
</exec> |
|||
</target> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</profile> |
|||
<profile> |
|||
<id>docker-test</id> |
|||
<build> |
|||
<!-- 先用dockerfile-maven-plugin构建镜像,然后maven-antrun-plugin执行推送aws ecr的命令 --> |
|||
<plugins> |
|||
<!-- dockerfile-maven-plugin构建镜像--> |
|||
<plugin> |
|||
<groupId>com.spotify</groupId> |
|||
<artifactId>dockerfile-maven-plugin</artifactId> |
|||
<version>1.4.13</version> |
|||
<executions> |
|||
<execution> |
|||
<id>default</id> |
|||
<goals> |
|||
<goal>build</goal> |
|||
<!-- <goal>push</goal>--> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
<configuration> |
|||
<repository>${aws.ecr.registry.test}/${aws.ecr.repository}</repository> |
|||
<tag>${aws.ecr.tag}</tag> |
|||
<buildArgs> |
|||
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE> |
|||
<LIB_DIR>target/lib</LIB_DIR> |
|||
<CONFIG_DIR>target/config</CONFIG_DIR> |
|||
<AURORA_TERRAFORM>target/aurora_terraform</AURORA_TERRAFORM> |
|||
<JVM_OPTS>${java.jvm.opts}</JVM_OPTS> |
|||
</buildArgs> |
|||
</configuration> |
|||
</plugin> |
|||
<!-- maven-antrun-plugin执行推送aws ecr的命令 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-antrun-plugin</artifactId> |
|||
<version>3.0.0</version> |
|||
<executions> |
|||
<execution> |
|||
<!--放在package阶段后面执行--> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>run</goal> |
|||
</goals> |
|||
<configuration> |
|||
<target> |
|||
<!-- Run AWS ECR login command using Ant tasks --> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="aws configure set aws_access_key_id ${aws.access.key.test}" /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="aws configure set aws_secret_access_key ${aws.secret.access.key.test}" /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="aws configure set default.region ${aws.ecr.region}" /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="aws configure set default.output text" /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="aws ecr get-login-password --region ${aws.ecr.region} | docker login --username AWS --password-stdin ${aws.ecr.registry.test}" /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="docker push ${aws.ecr.registry.test}/${aws.ecr.repository}:${aws.ecr.tag}" /> |
|||
</exec> |
|||
</target> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</profile> |
|||
<profile> |
|||
<id>docker-production</id> |
|||
<build> |
|||
<!-- 先用dockerfile-maven-plugin构建镜像,然后maven-antrun-plugin执行推送aws ecr的命令 --> |
|||
<plugins> |
|||
<!-- dockerfile-maven-plugin构建镜像--> |
|||
<plugin> |
|||
<groupId>com.spotify</groupId> |
|||
<artifactId>dockerfile-maven-plugin</artifactId> |
|||
<version>1.4.13</version> |
|||
<executions> |
|||
<execution> |
|||
<id>default</id> |
|||
<goals> |
|||
<goal>build</goal> |
|||
<!-- <goal>push</goal>--> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
<configuration> |
|||
<repository>${aws.ecr.registry.production}/${aws.ecr.repository}</repository> |
|||
<tag>${aws.ecr.tag}</tag> |
|||
<buildArgs> |
|||
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE> |
|||
<LIB_DIR>target/lib</LIB_DIR> |
|||
<CONFIG_DIR>target/config</CONFIG_DIR> |
|||
<AURORA_TERRAFORM>target/aurora_terraform</AURORA_TERRAFORM> |
|||
<JVM_OPTS>${java.jvm.opts}</JVM_OPTS> |
|||
</buildArgs> |
|||
</configuration> |
|||
</plugin> |
|||
<!-- maven-antrun-plugin执行推送aws ecr的命令 --> |
|||
<plugin> |
|||
<groupId>org.apache.maven.plugins</groupId> |
|||
<artifactId>maven-antrun-plugin</artifactId> |
|||
<version>3.0.0</version> |
|||
<executions> |
|||
<execution> |
|||
<!--放在package阶段后面执行--> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>run</goal> |
|||
</goals> |
|||
<configuration> |
|||
<target> |
|||
<!-- Run AWS ECR login command using Ant tasks --> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="aws configure set aws_access_key_id ${aws.access.key.production}" /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="aws configure set aws_secret_access_key ${aws.secret.access.key.production}" /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="aws configure set default.region ${aws.ecr.region}" /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="aws configure set default.output text" /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="aws ecr get-login-password --region ${aws.ecr.region} | docker login --username AWS --password-stdin ${aws.ecr.registry.production}" /> |
|||
</exec> |
|||
<exec executable="cmd" osfamily="windows"> |
|||
<arg value="/c" /> |
|||
<arg value="docker push ${aws.ecr.registry.production}/${aws.ecr.repository}:${aws.ecr.tag}" /> |
|||
</exec> |
|||
</target> |
|||
</configuration> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</profile> |
|||
</profiles> |
|||
|
|||
</project> |
@ -0,0 +1,19 @@ |
|||
package com.model2d3d.viewer.back; |
|||
|
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.boot.web.servlet.ServletComponentScan; |
|||
import org.springframework.scheduling.annotation.EnableAsync; |
|||
import org.springframework.scheduling.annotation.EnableScheduling; |
|||
|
|||
@SpringBootApplication |
|||
@ServletComponentScan |
|||
@EnableAsync |
|||
//@EnableScheduling
|
|||
public class Model2d3dViewerApplication { |
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(Model2d3dViewerApplication.class, args); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,65 @@ |
|||
package com.model2d3d.viewer.back.configurator; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.DbType; |
|||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
|||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
|||
import jakarta.servlet.MultipartConfigElement; |
|||
import org.springframework.boot.web.servlet.MultipartConfigFactory; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.mobile.device.DeviceHandlerMethodArgumentResolver; |
|||
import org.springframework.util.unit.DataSize; |
|||
import org.springframework.web.method.support.HandlerMethodArgumentResolver; |
|||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
|||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
|||
|
|||
import com.model2d3d.viewer.back.configurator.interceptor.AccessApiInterceptor; |
|||
|
|||
import java.io.File; |
|||
import java.util.List; |
|||
|
|||
@Configuration |
|||
public class ApiConfig implements WebMvcConfigurer { |
|||
|
|||
@Bean |
|||
public AccessApiInterceptor accessApiInterceptor(){ |
|||
return new AccessApiInterceptor(); |
|||
} |
|||
|
|||
@Override |
|||
public void addInterceptors(InterceptorRegistry registry){ |
|||
registry.addInterceptor(accessApiInterceptor()); |
|||
} |
|||
|
|||
@Bean |
|||
public DeviceHandlerMethodArgumentResolver deviceHandlerMethodArgumentResolver() { |
|||
return new DeviceHandlerMethodArgumentResolver(); |
|||
} |
|||
|
|||
@Override |
|||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { |
|||
argumentResolvers.add(deviceHandlerMethodArgumentResolver()); |
|||
} |
|||
|
|||
@Bean |
|||
public MybatisPlusInterceptor mybatisPlusInterceptor() { |
|||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
|||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // 如果配置多个插件, 切记分页最后添加
|
|||
// 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
|
|||
return interceptor; |
|||
} |
|||
|
|||
|
|||
@Bean |
|||
public MultipartConfigElement multipartConfigElement() { |
|||
String path = System.getProperty("user.dir")+"/tmp"; |
|||
MultipartConfigFactory factory = new MultipartConfigFactory(); |
|||
factory.setMaxFileSize(DataSize.ofMegabytes(20L)); |
|||
File tmpFile = new File(path); |
|||
if (!tmpFile.exists()) { |
|||
tmpFile.mkdirs(); |
|||
} |
|||
factory.setLocation(path); |
|||
return factory.createMultipartConfig(); |
|||
} |
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.model2d3d.viewer.back.configurator; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.boot.web.servlet.FilterRegistrationBean; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.web.cors.CorsConfiguration; |
|||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
|||
import org.springframework.web.filter.CorsFilter; |
|||
|
|||
/** |
|||
* 跨域配置 |
|||
* @author jwy |
|||
* @time 2022-5-12 17:54:43 |
|||
*/ |
|||
@Configuration |
|||
public class CorsConfigurer { |
|||
@Value("${crosxss.origin:*}") |
|||
private String corsOrigin; |
|||
@Bean |
|||
public FilterRegistrationBean corsFilter() { |
|||
List<String> allowedOriginPatterns = new ArrayList<String>(); |
|||
allowedOriginPatterns.add(corsOrigin); |
|||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
|||
CorsConfiguration config = new CorsConfiguration(); |
|||
config.setAllowCredentials(true); |
|||
config.setAllowedOriginPatterns(allowedOriginPatterns); |
|||
config.addAllowedHeader("*"); |
|||
config.addAllowedMethod("*"); |
|||
source.registerCorsConfiguration("/**", config); |
|||
FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source)); |
|||
bean.setOrder(0); |
|||
return bean; |
|||
} |
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.model2d3d.viewer.back.configurator; |
|||
|
|||
import java.io.IOException; |
|||
|
|||
import javax.servlet.Filter; |
|||
import javax.servlet.FilterChain; |
|||
import javax.servlet.FilterConfig; |
|||
import javax.servlet.ServletException; |
|||
import javax.servlet.ServletRequest; |
|||
import javax.servlet.ServletResponse; |
|||
import javax.servlet.annotation.WebFilter; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import java.util.UUID; |
|||
|
|||
import org.jboss.logging.MDC; |
|||
|
|||
@WebFilter |
|||
public class CrosXssFilter implements Filter { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(CrosXssFilter.class); |
|||
|
|||
@Value("${crosxss.filter.disable:false}") |
|||
private boolean disable; |
|||
|
|||
@Override |
|||
public void init(FilterConfig filterConfig) throws ServletException { |
|||
} |
|||
|
|||
@Override |
|||
public void doFilter(ServletRequest request, ServletResponse response, |
|||
FilterChain chain) throws IOException, ServletException { |
|||
try { |
|||
MDC.put("processNo", UUID.randomUUID().toString().replace("-", "")); |
|||
request.setCharacterEncoding("utf-8"); |
|||
// response.setContentType("text/html;charset=utf-8");
|
|||
if (disable) { |
|||
chain.doFilter(request, response); |
|||
} else { |
|||
//跨域设置
|
|||
if (response instanceof HttpServletResponse) { |
|||
HttpServletResponse httpServletResponse = (HttpServletResponse) response; |
|||
//禁用浏览器缓存
|
|||
httpServletResponse.setHeader("Cache-Control", "no-store"); |
|||
//禁止被IFrame嵌套
|
|||
httpServletResponse.setHeader("X-Frame-Options", "deny"); |
|||
//安全性配置
|
|||
httpServletResponse.setHeader("X-XSS-Protection", "1; mode=block"); |
|||
httpServletResponse.setHeader("X-Content-Type-Options", "nosniff"); |
|||
httpServletResponse.setHeader("Referrer-Policy", "origin"); |
|||
} |
|||
ServletRequest requestWrapper = null; |
|||
if(request instanceof HttpServletRequest) { |
|||
requestWrapper = new RequestWrapper((HttpServletRequest) request); |
|||
} |
|||
if(requestWrapper == null) { |
|||
chain.doFilter(request, response); |
|||
} else { |
|||
chain.doFilter(requestWrapper, response); |
|||
} |
|||
} |
|||
} finally { |
|||
// 避免线程泄漏
|
|||
MDC.clear(); |
|||
} |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void destroy() { |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,92 @@ |
|||
package com.model2d3d.viewer.back.configurator; |
|||
|
|||
import javax.servlet.ReadListener; |
|||
import javax.servlet.ServletInputStream; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletRequestWrapper; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
|
|||
import java.io.*; |
|||
|
|||
public class RequestWrapper extends HttpServletRequestWrapper { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(HttpServletRequestWrapper.class); |
|||
|
|||
private final String body; |
|||
|
|||
public RequestWrapper(HttpServletRequest request) { |
|||
super(request); |
|||
StringBuilder stringBuilder = new StringBuilder(); |
|||
BufferedReader bufferedReader = null; |
|||
InputStream inputStream = null; |
|||
try { |
|||
inputStream = request.getInputStream(); |
|||
if (inputStream != null) { |
|||
bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); |
|||
char[] charBuffer = new char[128]; |
|||
int bytesRead = -1; |
|||
while ((bytesRead = bufferedReader.read(charBuffer)) > 0) { |
|||
stringBuilder.append(charBuffer, 0, bytesRead); |
|||
} |
|||
} else { |
|||
stringBuilder.append(""); |
|||
} |
|||
} catch (IOException ex) { |
|||
logger.error("RequestWrapper读取流错误", ex); |
|||
} finally { |
|||
if (inputStream != null) { |
|||
try { |
|||
inputStream.close(); |
|||
} |
|||
catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
if (bufferedReader != null) { |
|||
try { |
|||
bufferedReader.close(); |
|||
} |
|||
catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
} |
|||
body = stringBuilder.toString(); |
|||
} |
|||
|
|||
@Override |
|||
public ServletInputStream getInputStream() throws IOException { |
|||
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(body.getBytes()); |
|||
ServletInputStream servletInputStream = new ServletInputStream() { |
|||
@Override |
|||
public boolean isFinished() { |
|||
return false; |
|||
} |
|||
@Override |
|||
public boolean isReady() { |
|||
return false; |
|||
} |
|||
@Override |
|||
public void setReadListener(ReadListener readListener) { |
|||
} |
|||
@Override |
|||
public int read() throws IOException { |
|||
return byteArrayInputStream.read(); |
|||
} |
|||
}; |
|||
return servletInputStream; |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public BufferedReader getReader() throws IOException { |
|||
return new BufferedReader(new InputStreamReader(this.getInputStream())); |
|||
} |
|||
|
|||
public String getBody() { |
|||
return this.body; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,118 @@ |
|||
package com.model2d3d.viewer.back.configurator.handler; |
|||
|
|||
import com.model2d3d.viewer.back.common.language.msg.MsgLanguageChange; |
|||
import com.model2d3d.viewer.back.common.response.ResponseCode; |
|||
import com.model2d3d.viewer.back.common.response.SimpleDataResponse; |
|||
import jakarta.servlet.http.HttpServletRequest; |
|||
import jakarta.validation.constraints.Max; |
|||
import jakarta.validation.constraints.Min; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.hibernate.validator.constraints.Range; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.validation.FieldError; |
|||
import org.springframework.web.bind.MethodArgumentNotValidException; |
|||
import org.springframework.web.bind.annotation.ExceptionHandler; |
|||
import org.springframework.web.bind.annotation.ResponseStatus; |
|||
import org.springframework.web.bind.annotation.RestControllerAdvice; |
|||
|
|||
import java.lang.reflect.Field; |
|||
import java.text.MessageFormat; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
@RestControllerAdvice |
|||
public class GlobalExceptionHandler { |
|||
|
|||
@Autowired |
|||
private MsgLanguageChange msgLanguageChange; |
|||
|
|||
// 处理@NotNull等校验异常
|
|||
@ResponseStatus(HttpStatus.BAD_REQUEST)// 这里jakarta.validation.constraints MethodArgumentNotValidException错误码是400(Bad Request)
|
|||
@ExceptionHandler(MethodArgumentNotValidException.class) |
|||
public SimpleDataResponse handleValidationExceptions( |
|||
MethodArgumentNotValidException ex, |
|||
HttpServletRequest request) { |
|||
|
|||
// 获取语言类型,默认为中文
|
|||
String languageType = request.getHeader("LanguageType"); |
|||
if (languageType == null || languageType.isEmpty()) { |
|||
languageType = "0"; // 默认中文
|
|||
} |
|||
|
|||
Map<String, String> errors = new HashMap<>(); |
|||
|
|||
Integer finalLanguageType = Integer.valueOf(languageType); |
|||
ex.getBindingResult().getAllErrors().forEach((error) -> { |
|||
String fieldName = ((FieldError) error).getField(); |
|||
String errorMessage = error.getDefaultMessage(); |
|||
|
|||
// 尝试获取字段的注解信息
|
|||
try { |
|||
Field field = ex.getBindingResult().getTarget().getClass().getDeclaredField(fieldName); |
|||
|
|||
Length lengthAnnotation = field.getAnnotation(Length.class); |
|||
Range rangeAnnotation = field.getAnnotation(Range.class); |
|||
Min minAnnotation = field.getAnnotation(Min.class); |
|||
Max maxAnnotation = field.getAnnotation(Max.class); |
|||
// 处理Length校验
|
|||
if (lengthAnnotation != null && ("1002".equals(errorMessage) || errorMessage.contains("length"))) {// 处理长度校验错误
|
|||
errorMessage = handleLengthValidationError(lengthAnnotation, finalLanguageType); |
|||
} |
|||
// 处理Range校验
|
|||
else if (rangeAnnotation != null && ("1005".equals(errorMessage) || errorMessage.contains("Range"))) { |
|||
errorMessage = handleRangeValidationError(rangeAnnotation, finalLanguageType); |
|||
} |
|||
// 处理min校验
|
|||
else if (minAnnotation != null && ("1006".equals(errorMessage) || errorMessage.contains("Min"))) { |
|||
errorMessage = handleMinValidationError(minAnnotation, finalLanguageType); |
|||
} |
|||
// 处理max校验
|
|||
else if (maxAnnotation != null && ("1007".equals(errorMessage) || errorMessage.contains("Max"))) { |
|||
errorMessage = handleMaxValidationError(maxAnnotation, finalLanguageType); |
|||
} |
|||
// 处理其他校验错误
|
|||
else { |
|||
errorMessage = translateErrorMessage(errorMessage, finalLanguageType); |
|||
} |
|||
} catch (Exception e) { |
|||
// 如果无法获取字段信息,使用默认翻译
|
|||
errorMessage = translateErrorMessage(errorMessage, finalLanguageType); |
|||
} |
|||
|
|||
errors.put(fieldName, errorMessage); |
|||
}); |
|||
|
|||
return new SimpleDataResponse( |
|||
ResponseCode.BAD_REQUEST, |
|||
msgLanguageChange.getBadRequestMessage(finalLanguageType, "1000"), |
|||
errors); |
|||
} |
|||
|
|||
private String handleMaxValidationError(Max max, Integer languageType) { |
|||
long value = max.value(); |
|||
return MessageFormat.format(msgLanguageChange.getBadRequestMessage(languageType, "1007"), value) ; |
|||
} |
|||
|
|||
private String handleMinValidationError(Min min, Integer languageType) { |
|||
long value = min.value(); |
|||
return MessageFormat.format(msgLanguageChange.getBadRequestMessage(languageType, "1006"), value) ; |
|||
} |
|||
|
|||
private String handleRangeValidationError(Range rangeAnnotation, Integer finalLanguageType) { |
|||
long max = rangeAnnotation.max(); |
|||
long min = rangeAnnotation.min(); |
|||
return MessageFormat.format(msgLanguageChange.getBadRequestMessage(finalLanguageType, "1005"), min, max) ; |
|||
} |
|||
|
|||
private String handleLengthValidationError(Length lengthAnnotation, Integer languageType) { |
|||
int max = lengthAnnotation.max(); |
|||
// int min = lengthAnnotation.min();
|
|||
return MessageFormat.format(msgLanguageChange.getBadRequestMessage(languageType, "1002"), max) ; |
|||
} |
|||
|
|||
private String translateErrorMessage(String errorCode, Integer languageType) { |
|||
return msgLanguageChange.getBadRequestMessage(languageType, errorCode); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,73 @@ |
|||
package com.model2d3d.viewer.back.configurator.interceptor; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.model2d3d.viewer.back.common.response.ResponseCode; |
|||
import com.model2d3d.viewer.back.service.AccountService; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.web.method.HandlerMethod; |
|||
import org.springframework.web.servlet.HandlerInterceptor; |
|||
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.lang.reflect.Method; |
|||
|
|||
public class AccessApiInterceptor implements HandlerInterceptor { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(AccessApiInterceptor.class); |
|||
|
|||
@Value("${user.login.keytimeout}") |
|||
private long keytimeout; |
|||
|
|||
@Autowired |
|||
private AccountService accountService; |
|||
|
|||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { |
|||
if(handler instanceof HandlerMethod) { |
|||
HandlerMethod handlerMethod = (HandlerMethod) handler; |
|||
Class<?> tClass = handlerMethod.getBeanType(); |
|||
AccessRequired annotation = tClass.getAnnotation(AccessRequired.class); |
|||
if (annotation == null) { |
|||
Method method = handlerMethod.getMethod(); |
|||
annotation = method.getAnnotation(AccessRequired.class); |
|||
} |
|||
try { |
|||
if (annotation != null) { |
|||
String loginName = request.getHeader("LoginName"); |
|||
String accessToken = request.getHeader("AccessToken"); |
|||
String userId = request.getHeader("UserId"); |
|||
String companyId = request.getHeader("CompanyId"); |
|||
|
|||
String languageType = request.getHeader("LanguageType"); |
|||
response.setContentType("application/json;charset=utf-8"); |
|||
String URI = request.getRequestURI(); |
|||
logger.info("===============请求的URI :" + URI + " ==============="); |
|||
JSONObject jsonObject = new JSONObject(); |
|||
|
|||
boolean result = accountService.accessAuth(loginName, companyId, userId, accessToken, languageType, jsonObject, keytimeout); |
|||
if(!result) { |
|||
response.getWriter().print(jsonObject.toString()); |
|||
} |
|||
return result; |
|||
} |
|||
} catch (Exception e) { |
|||
logger.error("Error from AccessApiInterceptor!", e); |
|||
JSONObject jsonObject = new JSONObject(); |
|||
jsonObject.put("code", ResponseCode.SERVER_ERROR); |
|||
jsonObject.put("msg", ResponseCode.SERVER_ERROR_MSG); |
|||
response.getWriter().print(jsonObject.toString()); |
|||
return false; |
|||
} |
|||
// 没有注解通过拦截
|
|||
return true; |
|||
}else if(handler instanceof ResourceHttpRequestHandler) {//资源文件不拦截
|
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.model2d3d.viewer.back.configurator.interceptor; |
|||
|
|||
import java.lang.annotation.*; |
|||
|
|||
@Target({ElementType.TYPE,ElementType.METHOD}) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
@Documented |
|||
public @interface AccessRequired { |
|||
|
|||
} |
@ -0,0 +1,96 @@ |
|||
package com.model2d3d.viewer.back.controller; |
|||
|
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import jakarta.servlet.http.HttpServletRequest; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import org.apache.commons.codec.binary.Base64; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.mobile.device.Device; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.google.code.kaptcha.impl.DefaultKaptcha; |
|||
import com.model2d3d.viewer.back.common.response.SimpleDataResponse; |
|||
import com.model2d3d.viewer.back.configurator.interceptor.AccessRequired; |
|||
import com.model2d3d.viewer.back.dto.account.CacheUserData; |
|||
import com.model2d3d.viewer.back.dto.account.LoginParam; |
|||
import com.model2d3d.viewer.back.service.AccountService; |
|||
import com.model2d3d.viewer.back.service.captcha.CaptchaService; |
|||
import com.model2d3d.viewer.back.service.captcha.CaptchaVO; |
|||
|
|||
import java.awt.image.BufferedImage; |
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.IOException; |
|||
|
|||
import javax.imageio.ImageIO; |
|||
|
|||
/** |
|||
* 账户管理 |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/account") |
|||
@Tag(name = "AccountController",description = "账号登录/登出、获取验证码接口") |
|||
public class AccountController { |
|||
|
|||
@Autowired |
|||
private AccountService accountService; |
|||
@Autowired |
|||
private DefaultKaptcha producer; |
|||
@Autowired |
|||
private CaptchaService captchaService; |
|||
|
|||
|
|||
@Operation(summary = "用户登录") |
|||
@RequestMapping(value = "/login", method = RequestMethod.POST) |
|||
public SimpleDataResponse<CacheUserData> login(@RequestBody LoginParam loginParam, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
HttpServletRequest request, |
|||
HttpServletResponse response, |
|||
Device device) { |
|||
return accountService.login(loginParam,device,LanguageType,request,response); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 用户退出登录 |
|||
*/ |
|||
@AccessRequired |
|||
@Operation(summary = "用户退出") |
|||
@RequestMapping(value = "/logout", method = RequestMethod.GET) |
|||
public SimpleDataResponse logout( @Parameter(name="LoginName",description="登录名",required=true) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false) @RequestHeader(required=false) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType) { |
|||
return accountService.logout(AccessToken,CompanyId,LoginName,UserId); |
|||
} |
|||
|
|||
/** |
|||
* 获取验证码 |
|||
* @return |
|||
*/ |
|||
@Operation(summary = "获取登录验证码") |
|||
@RequestMapping(value = "/getCaptcha", method = RequestMethod.GET ) |
|||
public SimpleDataResponse<CaptchaVO> getCaptcha() throws IOException { |
|||
// 生成文字验证码
|
|||
String content = producer.createText(); |
|||
// 生成图片验证码
|
|||
ByteArrayOutputStream outputStream = null; |
|||
BufferedImage image = producer.createImage(content); |
|||
outputStream = new ByteArrayOutputStream(); |
|||
ImageIO.write(image, "jpg", outputStream); |
|||
// 对字节数组Base64编码
|
|||
// BASE64Encoder encoder = new BASE64Encoder();
|
|||
String str = "data:image/jpeg;base64,"; |
|||
String base64Img = str + Base64.encodeBase64String(outputStream.toByteArray()).replace("\n", "").replace("\r", ""); |
|||
CaptchaVO captchaVO = captchaService.cacheCaptcha(content); |
|||
captchaVO.setBase64Img(base64Img); |
|||
return SimpleDataResponse.success(captchaVO); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,48 @@ |
|||
package com.model2d3d.viewer.back.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import io.swagger.v3.oas.annotations.Hidden; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PathVariable; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.model2d3d.viewer.back.common.response.SimpleDataResponse; |
|||
import com.model2d3d.viewer.back.service.CommonService; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
//@Hidden
|
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@RequestMapping("/common") //http请求路径映射
|
|||
@Tag(name = "CommonController",description = "公共接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class CommonController{ |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(CommonController.class); |
|||
|
|||
@Autowired |
|||
private CommonService commonService; |
|||
|
|||
|
|||
@Hidden |
|||
@Operation(summary = "检测apikey是否有效") |
|||
@RequestMapping(value = "/checkApikey",method = RequestMethod.GET) |
|||
public SimpleDataResponse checkApikey( |
|||
@Parameter(name="apikey",description="apikey值",required=true) @RequestParam String apikey){ |
|||
return commonService.checkApikey(apikey); |
|||
} |
|||
} |
@ -0,0 +1,126 @@ |
|||
package com.model2d3d.viewer.back.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.model2d3d.viewer.back.common.response.PageResponse; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.model2d3d.viewer.back.common.exception.BusinessException; |
|||
import com.model2d3d.viewer.back.common.response.ResponseCode; |
|||
import com.model2d3d.viewer.back.common.response.SimpleDataResponse; |
|||
import com.model2d3d.viewer.back.configurator.interceptor.AccessRequired; |
|||
import com.model2d3d.viewer.back.dto.company.CompanySearchParams; |
|||
import com.model2d3d.viewer.back.dto.company.DeleteCompanyParams; |
|||
import com.model2d3d.viewer.back.dto.company.OptCompanyParams; |
|||
import com.model2d3d.viewer.back.vo.company.CompanyPageDTO; |
|||
import com.model2d3d.viewer.back.vo.TreeMenusDTO; |
|||
import com.model2d3d.viewer.back.service.CompanyService; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
//@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/company") //http请求路径映射
|
|||
@Tag(name = "CompanyController",description = "企业管理的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class CompanyController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(CompanyController.class); |
|||
|
|||
@Autowired |
|||
private CompanyService companyService; |
|||
|
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "添加企业") |
|||
@RequestMapping(value = "/add",method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody @Validated OptCompanyParams optCompanyParams, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return companyService.add(optCompanyParams, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "编辑企业") |
|||
@RequestMapping(value = "/edit",method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody @Validated OptCompanyParams optCompanyParams, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType) { |
|||
return companyService.edit(optCompanyParams, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "删除企业") |
|||
@RequestMapping(value = "/batchDelete",method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody @Validated DeleteCompanyParams deleteCompanyParams, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return companyService.batchDelete(deleteCompanyParams, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "获取当前登录用户下的企业菜单树") |
|||
@RequestMapping(value = "/getCompanyTree",method = RequestMethod.GET) |
|||
public SimpleDataResponse<List<TreeMenusDTO>> getCompanyTree( |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return companyService.getCompanyTree(CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "获取企业列表") |
|||
@RequestMapping(value = "/getListPage",method = RequestMethod.GET) |
|||
public PageResponse<IPage<CompanyPageDTO>> getListPage( |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) String CompanyId, |
|||
// @Parameter(name="LoginCompanyId",description="登录用户的企业ID",required=false,schema = @Schema(defaultValue = "1") @RequestHeader(required=false) Long LoginCompanyId,
|
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType, |
|||
@Parameter(name="UTCOffset",description="格林威治时间与本地时间的差值,单位是分钟,比如东八区是 -480",required=true,schema = @Schema(defaultValue = "-480")) @RequestHeader(required=true) Integer UTCOffset, |
|||
CompanySearchParams pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
|
|||
PageResponse<IPage<CompanyPageDTO>> pageResponse = new PageResponse<IPage<CompanyPageDTO>>(); |
|||
try{ |
|||
pageResponse.setData(companyService.getListPage(pageSearchParam, CompanyId, UserId, LanguageType, UTCOffset)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
}catch (Exception e){ |
|||
logger.error("查询列表报错",e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg(ResponseCode.SERVER_ERROR_MSG); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.model2d3d.viewer.back.controller; |
|||
|
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
|
|||
import java.io.BufferedReader; |
|||
import java.io.IOException; |
|||
import java.io.InputStreamReader; |
|||
import java.io.Reader; |
|||
import java.util.Properties; |
|||
|
|||
@RestController |
|||
@Tag(name = "HealthController",description = "健康检测接口") |
|||
public class HealthController { |
|||
|
|||
@GetMapping("/healthcheck") |
|||
public String health(){ |
|||
return "ok"; |
|||
} |
|||
|
|||
@GetMapping("/version") |
|||
public String getVersion() throws IOException { |
|||
Properties properties = new Properties(); |
|||
Reader in = new InputStreamReader(this.getClass().getResourceAsStream("/config/version.properties"),"utf-8"); |
|||
BufferedReader bufferedReader = new BufferedReader(in); |
|||
properties.load(bufferedReader); |
|||
String version=properties.getProperty("project.latest.version"); |
|||
String content = properties.getProperty(version); |
|||
JSONObject jsonObject = new JSONObject(); |
|||
jsonObject.put("version", version); |
|||
jsonObject.put("content", content); |
|||
return jsonObject.toString(); |
|||
} |
|||
} |
@ -0,0 +1,133 @@ |
|||
package com.model2d3d.viewer.back.controller; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.model2d3d.viewer.back.common.exception.BusinessException; |
|||
import com.model2d3d.viewer.back.common.response.PageResponse; |
|||
import com.model2d3d.viewer.back.common.response.ResponseCode; |
|||
import com.model2d3d.viewer.back.common.response.SimpleDataResponse; |
|||
import com.model2d3d.viewer.back.configurator.interceptor.AccessRequired; |
|||
import com.model2d3d.viewer.back.dto.role.DeleteRoleParam; |
|||
import com.model2d3d.viewer.back.dto.role.OptRoleParam; |
|||
import com.model2d3d.viewer.back.dto.role.RolePageSearchParam; |
|||
import com.model2d3d.viewer.back.vo.TreeMenusDTO; |
|||
import com.model2d3d.viewer.back.vo.role.RolePageDTO; |
|||
import com.model2d3d.viewer.back.service.RoleService; |
|||
|
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/role") //http请求路径映射
|
|||
@Tag(name = "RoleController",description = "角色权限的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class RoleController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(RoleController.class); |
|||
|
|||
@Autowired |
|||
private RoleService roleService; |
|||
|
|||
|
|||
@Operation(summary = "添加角色") |
|||
@RequestMapping(value = "/add",method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody @Validated OptRoleParam optRoleParam, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return roleService.add(optRoleParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@Operation(summary = "编辑角色") |
|||
@RequestMapping(value = "/edit",method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody @Validated OptRoleParam optRoleParam, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return roleService.edit(optRoleParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@Operation(summary = "删除角色") |
|||
@RequestMapping(value = "/batchDelete",method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody @Validated DeleteRoleParam deleteRoleParam, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return roleService.batchDelete(deleteRoleParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@Operation(summary = "获取角色列表") |
|||
@RequestMapping(value = "/getListPage",method = RequestMethod.GET) |
|||
public PageResponse<IPage<RolePageDTO>> getListPage( |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType, |
|||
RolePageSearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<IPage<RolePageDTO>> pageResponse = new PageResponse<IPage<RolePageDTO>>(); |
|||
try{ |
|||
pageResponse.setData(roleService.getListPage(pageSearchParam, CompanyId, UserId, LanguageType)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
}catch (Exception e){ |
|||
logger.error("查询列表报错",e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg(ResponseCode.SERVER_ERROR_MSG); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
@Operation(summary = "获取当前登录用户拥有的权限菜单树") |
|||
@RequestMapping(value = "/getOwnMenuIds",method = RequestMethod.GET) |
|||
public SimpleDataResponse<List<TreeMenusDTO>> getOwnMenuIds( |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return roleService.getOwnMenuIds(CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@Operation(summary = "获取对应角色拥有的权限菜单ID") |
|||
@RequestMapping(value = "/getMenuIdsByRoleId",method = RequestMethod.GET) |
|||
public SimpleDataResponse<String> getMenuIdsByRoleId( |
|||
@Parameter(name="roleId",description="角色ID",required=true, schema = @Schema(defaultValue = "28")) @RequestParam Long roleId, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return roleService.getMenuIdsByRoleId(roleId, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,138 @@ |
|||
package com.model2d3d.viewer.back.controller; |
|||
|
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.model2d3d.viewer.back.common.exception.BusinessException; |
|||
import com.model2d3d.viewer.back.common.response.PageResponse; |
|||
import com.model2d3d.viewer.back.common.response.ResponseCode; |
|||
import com.model2d3d.viewer.back.common.response.SimpleDataResponse; |
|||
import com.model2d3d.viewer.back.configurator.interceptor.AccessRequired; |
|||
import com.model2d3d.viewer.back.dto.user.DeleteUserParam; |
|||
import com.model2d3d.viewer.back.dto.user.ModifyPassword; |
|||
import com.model2d3d.viewer.back.dto.user.OptUserParam; |
|||
import com.model2d3d.viewer.back.dto.user.PageSearchParam; |
|||
import com.model2d3d.viewer.back.dto.user.ResetPassword; |
|||
import com.model2d3d.viewer.back.service.UserService; |
|||
import com.model2d3d.viewer.back.vo.user.UserPageDTO; |
|||
|
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
//@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/user") //http请求路径映射
|
|||
@Tag(name = "UserController",description = "用户管理的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class UserController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(UserController.class); |
|||
|
|||
@Autowired |
|||
private UserService userService; |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "添加用户") |
|||
@RequestMapping(value = "/add",method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody @Validated OptUserParam optUserParam, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return userService.add(optUserParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "编辑用户") |
|||
@RequestMapping(value = "/edit",method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody @Validated OptUserParam optUserParam, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return userService.edit(optUserParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "删除用户") |
|||
@RequestMapping(value = "/batchDelete",method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody @Validated DeleteUserParam deleteUserParam, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return userService.batchDelete(deleteUserParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "重置密码") |
|||
@RequestMapping(value = "/batchResetPassword",method = RequestMethod.POST) |
|||
public SimpleDataResponse batchResetPassword( |
|||
@RequestBody @Validated ResetPassword resetPassword, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return userService.batchResetPassword(resetPassword, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "修改密码") |
|||
@RequestMapping(value = "/modifyPassword",method = RequestMethod.POST) |
|||
public SimpleDataResponse modifyPassword( |
|||
@RequestBody @Validated ModifyPassword modifyPassword, |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType |
|||
) { |
|||
return userService.modifyPassword(modifyPassword, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "获取用户列表") |
|||
@RequestMapping(value = "/getListPage",method = RequestMethod.GET) |
|||
public PageResponse<IPage<UserPageDTO>> getListPage( |
|||
@Parameter(name="LoginName",description="登录名",required=true,schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken",description="鉴权token",required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId",description="用户ID",required=true,schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId",description="所属企业ID",required=false,schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) String CompanyId, |
|||
@Parameter(name="LanguageType",description="语言类型 0:中文 1:英文 2:日文",required=true,schema = @Schema(defaultValue = "0")) @RequestHeader(required=true) Integer LanguageType, |
|||
PageSearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<IPage<UserPageDTO>> pageResponse = new PageResponse<IPage<UserPageDTO>>(); |
|||
try{ |
|||
pageResponse.setData(userService.getListPage(pageSearchParam, CompanyId, UserId, LanguageType)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
}catch (Exception e){ |
|||
logger.error("查询列表报错",e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg(ResponseCode.SERVER_ERROR_MSG); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,59 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<assembly> |
|||
<!-- 最终打包文件的后缀,格式为 ${fileName}-bin --> |
|||
<id>model2d3d-viewer-back</id> |
|||
<!-- 最终打包成一个用于发布的zip文件 --> |
|||
<formats> |
|||
<format>zip</format> |
|||
</formats> |
|||
|
|||
<!-- 文件配置 --> |
|||
<fileSets> |
|||
|
|||
<!-- 把项目自己编译出来根目录下的jar文件,打包进zip文件的根目录 --> |
|||
<fileSet> |
|||
<directory>${project.build.directory}</directory> |
|||
<outputDirectory>/</outputDirectory> |
|||
<includes> |
|||
<include>*.jar</include> |
|||
</includes> |
|||
</fileSet> |
|||
|
|||
<!-- 把项目自己编译出来的jar文件夹下的jar文件,去除第三方jar,打包进zip文件的根目录 --> |
|||
<fileSet> |
|||
<directory>${project.build.directory}/jar</directory> |
|||
<outputDirectory>/</outputDirectory> |
|||
<excludes> |
|||
<exclude>lib/*.jar</exclude> |
|||
</excludes> |
|||
<includes> |
|||
<include>*.jar</include> |
|||
</includes> |
|||
</fileSet> |
|||
|
|||
<!-- 把项目自己编译出来的lib文件夹下的jar文件,打包进zip文件的lib目录 --> |
|||
<fileSet> |
|||
<directory>${project.build.directory}/lib</directory> |
|||
<outputDirectory>/lib</outputDirectory> |
|||
<includes> |
|||
<include>*.jar</include> |
|||
</includes> |
|||
</fileSet> |
|||
|
|||
<!-- 把编译出来的config文件夹,去除application.properties,打包进zip文件的config目录 --> |
|||
<fileSet> |
|||
<directory>${project.build.directory}/config</directory> |
|||
<outputDirectory>/config</outputDirectory> |
|||
<excludes> |
|||
<exclude>application.properties</exclude> |
|||
</excludes> |
|||
</fileSet> |
|||
|
|||
<!-- 把编译出来的sql文件夹,打包进zip文件的sql目录 --> |
|||
<fileSet> |
|||
<directory>${project.build.directory}/sql</directory> |
|||
<outputDirectory>/sql</outputDirectory> |
|||
</fileSet> |
|||
|
|||
</fileSets> |
|||
</assembly> |
@ -0,0 +1,98 @@ |
|||
server.port=${serverPort} |
|||
|
|||
api.enable=${apiEnable} |
|||
|
|||
spring.mvc.pathmatch.matching-strategy= ANT_PATH_MATCHER |
|||
|
|||
#mybatis.mapperLocations=classpath:mappers/**/*.xml |
|||
# MyBatis-Plus 配置 |
|||
mybatis-plus.mapper-locations=classpath:mappers/**/*.xml |
|||
# MyBatis 原生配置 |
|||
mybatis-plus.configuration.map-underscore-to-camel-case=true |
|||
mybatis-plus.configuration.cache-enabled=false |
|||
mybatis-plus.configuration.lazy-loading-enabled=false |
|||
mybatis-plus.configuration.multiple-result-sets-enabled=false |
|||
# MyBatis-Plus 全局配置 |
|||
mybatis-plus.global-config.banner=false |
|||
mybatis-plus.global-config.enable-sql-runner=false |
|||
# 数据库相关配置 |
|||
mybatis-plus.global-config.db-config.table-underline=true |
|||
|
|||
spring.datasource.name=model2d3d_viewer_back |
|||
spring.datasource.url=jdbc:mysql://${datasourceDNS}/model2d3d_viewer_back?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=${datasourceTimeZone} |
|||
spring.datasource.username=${datasourceUsername} |
|||
spring.datasource.password=${datasourcePassword} |
|||
#使用druid数据源 |
|||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
|||
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver |
|||
|
|||
#配置log日志 |
|||
logging.config=classpath:config/logback-boot.xml |
|||
logging_level=${loggingLevel} |
|||
logging_path=${loggingPath} |
|||
#部署时使用SYSLOG |
|||
logging_appender=${loggingAppender} |
|||
logging_maxHistory=${loggingMaxHistory:7} |
|||
logging_maxFileSize=100MB |
|||
mybatis_log_level=${mybatisLogLevel} |
|||
|
|||
user.login.keytimeout=360000 |
|||
|
|||
#集群模式cluster |
|||
spring.redis.cluster.nodes=192.168.0.30:7000,192.168.0.30:7001 |
|||
#跨集群执行命令时要遵循的最大重定向数量 |
|||
spring.redis.cluster.max-redirects=3 |
|||
#哨兵模式sentinel |
|||
spring.redis.sentinel.master=mymaster |
|||
spring.redis.sentinel.nodes=192.168.0.30:16379,192.168.0.30:16379 |
|||
|
|||
#单机模式standalone |
|||
spring.redis.host=${redisHost} |
|||
spring.redis.port=6379 |
|||
|
|||
spring.redis.password=${redisPassword} |
|||
spring.redis.timeout=5000 |
|||
#Redis数据库索引(默认为0) |
|||
spring.redis.database=15 |
|||
#配置启动模式cluster、sentinel、standalone |
|||
spring.redis.mode=standalone |
|||
# Lettuce |
|||
# 连接池最大连接数(使用负值表示没有限制) |
|||
spring.redis.lettuce.pool.max-active=8 |
|||
# 连接池最大阻塞等待时间(使用负值表示没有限制) |
|||
spring.redis.lettuce.pool.max-wait=100 |
|||
# 连接池中的最大空闲连接 |
|||
spring.redis.lettuce.pool.max-idle=8 |
|||
# 连接池中的最小空闲连接 |
|||
spring.redis.lettuce.pool.min-idle=0 |
|||
# 关闭超时时间 |
|||
spring.redis.lettuce.shutdown-timeout=100 |
|||
|
|||
|
|||
#邮件发送信息 |
|||
mail.smtp.host=email-smtp.ap-northeast-1.amazonaws.com |
|||
mail.smtp.port=465 |
|||
mail.smtp.auth=true |
|||
mail.smtp.ssl=true |
|||
mail.sender.username=AKIAVRXFMB43Z4Q6WGZN |
|||
mail.sender.password_encrypted=true |
|||
mail.sender.password=a/52R0rao7ksRMvl1j17fVEmPCw7gC9OreHDqWOE+S7sgmoQT0YgoLRJqOlJqX7e |
|||
mail.sender.sendername=datacenter-info |
|||
mail.sender.from=alert@ttkdatatechbuild.com |
|||
#邮件通知服务开关 |
|||
mail.send.switch=true |
|||
|
|||
Spring.mvc.hiddenmethod.filter.enabled=true |
|||
#单个文件上传发大小 |
|||
spring.servlet.multipart.max-file-size=20MB |
|||
#多个文件上传的共大小不得超过100M |
|||
spring.servlet.multipart.max-request-size=100MB |
|||
|
|||
server.servlet.context-path=/api |
|||
|
|||
web.login.url=${webLoginUrl} |
|||
|
|||
|
|||
springdoc.swagger-ui.doc-expansion=none |
|||
springdoc.swagger-ui.operations-sorter=alpha |
|||
springdoc.swagger-ui.tags-sorter=alpha |
@ -0,0 +1,53 @@ |
|||
<configuration> |
|||
<springProperty scop="context" name="logging_level" source="logging_level" defaultValue="debug"/> |
|||
<springProperty scop="context" name="logging_path" source="logging_path"/> |
|||
<springProperty scop="context" name="logging_appender" source="logging_appender"/> |
|||
<springProperty scop="context" name="logging_maxHistory" source="logging_maxHistory"/> |
|||
<springProperty scop="context" name="logging_maxFileSize" source="logging_maxFileSize"/> |
|||
<springProperty scop="context" name="mybatis_log_level" source="mybatis_log_level"/> |
|||
|
|||
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,%i索引【从数字0开始递增】,,, --> |
|||
<!-- appender是configuration的子节点,是负责写日志的组件。 --> |
|||
<!-- ConsoleAppender:把日志输出到控制台 --> |
|||
<appender name="CONSOLELOG" class="ch.qos.logback.core.ConsoleAppender"> |
|||
<encoder> |
|||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%t] %m%n</pattern> |
|||
<!-- <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%t] %c (%file:%line\)- %m%n</pattern> --> |
|||
<charset>UTF-8</charset> |
|||
</encoder> |
|||
</appender> |
|||
<!-- RollingFileAppender:滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 --> |
|||
<appender name="SYSLOG" |
|||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<File>${logging_path}/spring.log</File> |
|||
<!-- rollingPolicy:当发生滚动时,决定 RollingFileAppender 的行为,涉及文件移动和重命名。 --> |
|||
<!-- TimeBasedRollingPolicy: 最常用的滚动策略,它根据时间来制定滚动策略,既负责滚动也负责出发滚动 --> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<!-- 活动文件的名字会根据fileNamePattern的值,每隔一段时间改变一次 --> |
|||
<!-- 文件名:log/spring.2019-05-27.0.log --> |
|||
<fileNamePattern>${logging_path}/spring.%d.%i.gz</fileNamePattern> |
|||
<!-- 每产生一个日志文件,该日志文件的保存期限为15天 --> |
|||
<maxHistory>${logging_maxHistory}</maxHistory> |
|||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<!-- maxFileSize:这是活动文件的大小,默认值是10MB--> |
|||
<maxFileSize>${logging_maxFileSize}</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
</rollingPolicy> |
|||
<encoder> |
|||
<!-- pattern节点,用来设置日志的输入格式 --> |
|||
<pattern> |
|||
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p [%t] %c %m%n |
|||
</pattern> |
|||
<!-- 记录日志的编码 --> |
|||
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
|||
</encoder> |
|||
</appender> |
|||
|
|||
<!-- project default level --> |
|||
<logger name="com.model2d3d.viewer.back" level="${logging_level}"/> |
|||
<logger name="com.model2d3d.viewer.back.dao" level="${mybatis_log_level}"/> |
|||
<!-- 控制台输出日志级别 --> |
|||
<root level="INFO"> |
|||
<appender-ref ref="${logging_appender}" /> |
|||
</root> |
|||
</configuration> |
@ -0,0 +1,3 @@ |
|||
project.latest.version=v0.0.1.20240228 |
|||
|
|||
v0.0.1.20240228=1.初始版本 |
@ -0,0 +1,15 @@ |
|||
/target/ |
|||
/logs/ |
|||
/.idea/ |
|||
*.iml |
|||
*.bak |
|||
*.log |
|||
/.settings/ |
|||
*.project |
|||
*.classpath |
|||
*.factorypath |
|||
*.springBeans |
|||
/.apt_generated/ |
|||
/.externalToolBuilders/ |
|||
/bin/ |
|||
application-*.properties |
@ -0,0 +1,91 @@ |
|||
<?xml version="1.0"?> |
|||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>model2d3d-viewer-back</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</parent> |
|||
<artifactId>model2d3d-viewer-back-dao</artifactId> |
|||
<name>model2d3d-viewer-back-dao</name> |
|||
<url>http://maven.apache.org</url> |
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
</properties> |
|||
<dependencies> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/org.freemarker/freemarker --> |
|||
<dependency> |
|||
<groupId>org.freemarker</groupId> |
|||
<artifactId>freemarker</artifactId> |
|||
<version>2.3.34</version> |
|||
</dependency> |
|||
|
|||
<!-- MyBatis-Plus --> |
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-boot-starter</artifactId> |
|||
<version>3.5.11</version> |
|||
<exclusions> |
|||
<!-- 版本匹配问题,防止出现Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String --> |
|||
<exclusion> |
|||
<groupId>org.mybatis</groupId> |
|||
<artifactId>mybatis-spring</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-jsqlparser --> |
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-jsqlparser</artifactId> |
|||
<version>3.5.11</version> |
|||
</dependency> |
|||
|
|||
|
|||
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-generator --> |
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-generator</artifactId> |
|||
<version>3.5.11</version> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring --> |
|||
<dependency> |
|||
<groupId>org.mybatis</groupId> |
|||
<artifactId>mybatis-spring</artifactId> |
|||
<version>3.0.4</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>model2d3d-viewer-back-model</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</dependency> |
|||
|
|||
<!-- <dependency>--> |
|||
<!-- <groupId>com.github.pagehelper</groupId>--> |
|||
<!-- <artifactId>pagehelper-spring-boot-starter</artifactId>--> |
|||
<!-- <version>1.4.7</version>--> |
|||
<!-- </dependency>--> |
|||
|
|||
<dependency> |
|||
<groupId>com.mysql</groupId> |
|||
<artifactId>mysql-connector-j</artifactId> |
|||
<version>9.2.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.alibaba</groupId> |
|||
<artifactId>druid</artifactId> |
|||
<version>1.1.3</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>junit</groupId> |
|||
<artifactId>junit</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
</project> |
@ -0,0 +1,152 @@ |
|||
package com.model2d3d.viewer.back.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.generator.AutoGenerator; |
|||
import com.baomidou.mybatisplus.generator.config.*; |
|||
import com.baomidou.mybatisplus.generator.config.builder.GeneratorBuilder; |
|||
import com.baomidou.mybatisplus.generator.config.rules.DateType; |
|||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; |
|||
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; |
|||
import com.baomidou.mybatisplus.generator.config.querys.MySqlQuery; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
public class MyBatisPlusGenerator { |
|||
|
|||
public static void main(String[] args) { |
|||
// 1. 数据源配置
|
|||
DataSourceConfig dataSourceConfig = new DataSourceConfig.Builder( |
|||
"jdbc:mysql://rm-bp11k2zm2fr7864428o.mysql.rds.aliyuncs.com:3306/model2d3d_viewer_back?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai", |
|||
"zhc", |
|||
"Youqu48bnb1") |
|||
.dbQuery(new MySqlQuery()) |
|||
.schema("model2d3d_viewer_back") |
|||
.build(); |
|||
|
|||
// 2. 全局配置(这里设置公共配置,实际路径在pathInfo中单独指定)
|
|||
GlobalConfig globalConfig = GeneratorBuilder.globalConfigBuilder() |
|||
.author("jwy") |
|||
.disableOpenDir() |
|||
.enableSwagger() |
|||
.dateType(DateType.TIME_PACK) |
|||
.commentDate("") |
|||
.build(); |
|||
|
|||
// 3. 包配置(包名设置)
|
|||
PackageConfig packageConfig = GeneratorBuilder.packageConfigBuilder() |
|||
.parent("com.model2d3d.viewer.back") |
|||
.entity("model") // 实体类包名
|
|||
.mapper("dao.auto") // Mapper接口包名
|
|||
.service("service") // Service接口包名
|
|||
.serviceImpl("service.impl") // Service实现类包名
|
|||
.controller("controller") // Controller包名
|
|||
.xml("mappers.auto") // XML文件包名
|
|||
.pathInfo(getPathInfo()) // 各层级的实际输出路径
|
|||
.build(); |
|||
|
|||
// 4
|
|||
// 自增主键的表
|
|||
List<String> autoIncrementTables = Arrays.asList( |
|||
"login_history", |
|||
"basic_menu" |
|||
); |
|||
// uuid算法主键的表
|
|||
List<String> assignIdTables = Arrays.asList( |
|||
"basic_role", |
|||
"basic_company", |
|||
"basic_user" |
|||
); |
|||
// 没有主键的表
|
|||
List<String> noIdTables = Arrays.asList( |
|||
"basic_role_menu_relation", |
|||
"basic_role_user_relation" |
|||
); |
|||
|
|||
// 5. 为不同类型表创建不同的策略配置
|
|||
generateForTables(dataSourceConfig, globalConfig, packageConfig, |
|||
autoIncrementTables, IdType.AUTO); |
|||
|
|||
generateForTables(dataSourceConfig, globalConfig, packageConfig, |
|||
assignIdTables, IdType.ASSIGN_UUID); |
|||
|
|||
generateForTables(dataSourceConfig, globalConfig, packageConfig, |
|||
noIdTables, IdType.NONE); |
|||
} |
|||
|
|||
private static void generateForTables(DataSourceConfig dataSourceConfig, |
|||
GlobalConfig globalConfig, |
|||
PackageConfig packageConfig, |
|||
List<String> tables, |
|||
IdType idType) { |
|||
StrategyConfig strategyConfig = GeneratorBuilder.strategyConfigBuilder() |
|||
.addInclude(tables) |
|||
|
|||
.entityBuilder() |
|||
.enableFileOverride() // 实体类覆盖
|
|||
.enableLombok() |
|||
.enableTableFieldAnnotation() |
|||
.naming(NamingStrategy.underline_to_camel) |
|||
.columnNaming(NamingStrategy.underline_to_camel) |
|||
.enableChainModel() |
|||
.enableRemoveIsPrefix() |
|||
.logicDeleteColumnName("deleted") |
|||
.idType(idType) |
|||
|
|||
.mapperBuilder() |
|||
.enableFileOverride() // Mapper接口覆盖
|
|||
.enableBaseResultMap() |
|||
.enableBaseColumnList() |
|||
.formatMapperFileName("%sMapper") |
|||
.formatXmlFileName("%sMapper") |
|||
|
|||
.controllerBuilder() |
|||
.enableRestStyle() |
|||
.disable() |
|||
|
|||
.serviceBuilder() |
|||
.formatServiceFileName("I%sService") |
|||
.formatServiceImplFileName("%sServiceImpl") |
|||
.disable() |
|||
|
|||
.build(); |
|||
|
|||
// 5. 模板配置
|
|||
TemplateConfig templateConfig = GeneratorBuilder.templateConfigBuilder() |
|||
.entity("/templates/entity.java") //使用自定义模板
|
|||
.build(); |
|||
|
|||
// 6. 创建生成器并执行
|
|||
new AutoGenerator(dataSourceConfig) |
|||
.global(globalConfig) |
|||
.packageInfo(packageConfig) |
|||
.strategy(strategyConfig) |
|||
.template(templateConfig) |
|||
.execute(new FreemarkerTemplateEngine()); |
|||
} |
|||
|
|||
// 自定义各层级的实际输出路径
|
|||
private static Map<OutputFile, String> getPathInfo() { |
|||
String projectRoot = System.getProperty("user.dir"); |
|||
Map<OutputFile, String> pathInfo = new HashMap<>(); |
|||
|
|||
// 实体类输出到 model 模块
|
|||
pathInfo.put(OutputFile.entity, projectRoot + "/model2d3d-viewer-back-model/src/main/java/com/pet/map/back/model"); |
|||
// Mapper接口输出到 dao 模块
|
|||
pathInfo.put(OutputFile.mapper, projectRoot + "/model2d3d-viewer-back-dao/src/main/java/com/pet/map/back/dao/auto"); |
|||
// XML文件输出到 resources 目录
|
|||
pathInfo.put(OutputFile.xml, projectRoot + "/model2d3d-viewer-back-dao/src/main/resources/mappers/auto"); |
|||
|
|||
// Service和ServiceImpl输出到 service 模块
|
|||
pathInfo.put(OutputFile.service, projectRoot + "/model2d3d-viewer-back-service/src/main/java/com/pet/map/back/service"); |
|||
pathInfo.put(OutputFile.serviceImpl, projectRoot + "/model2d3d-viewer-back-service/src/main/java/com/pet/map/back/service/impl"); |
|||
// Controller输出到 controller 模块
|
|||
pathInfo.put(OutputFile.controller, projectRoot + "/model2d3d-viewer-back-controller/src/main/java/com/pet/map/back/controller"); |
|||
|
|||
|
|||
|
|||
return pathInfo; |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.model2d3d.viewer.back.dao.auto; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.model2d3d.viewer.back.model.BasicCompany; |
|||
|
|||
/** |
|||
* <p> |
|||
* 企业表 Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author jwy |
|||
* @since |
|||
*/ |
|||
public interface BasicCompanyMapper extends BaseMapper<BasicCompany> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,17 @@ |
|||
package com.model2d3d.viewer.back.dao.auto; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.model2d3d.viewer.back.model.BasicMenu; |
|||
|
|||
/** |
|||
* <p> |
|||
* Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author jwy |
|||
* @since |
|||
*/ |
|||
public interface BasicMenuMapper extends BaseMapper<BasicMenu> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,17 @@ |
|||
package com.model2d3d.viewer.back.dao.auto; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.model2d3d.viewer.back.model.BasicRole; |
|||
|
|||
/** |
|||
* <p> |
|||
* Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author jwy |
|||
* @since |
|||
*/ |
|||
public interface BasicRoleMapper extends BaseMapper<BasicRole> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,17 @@ |
|||
package com.model2d3d.viewer.back.dao.auto; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.model2d3d.viewer.back.model.BasicRoleMenuRelation; |
|||
|
|||
/** |
|||
* <p> |
|||
* Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author jwy |
|||
* @since |
|||
*/ |
|||
public interface BasicRoleMenuRelationMapper extends BaseMapper<BasicRoleMenuRelation> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,17 @@ |
|||
package com.model2d3d.viewer.back.dao.auto; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.model2d3d.viewer.back.model.BasicRoleUserRelation; |
|||
|
|||
/** |
|||
* <p> |
|||
* Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author jwy |
|||
* @since |
|||
*/ |
|||
public interface BasicRoleUserRelationMapper extends BaseMapper<BasicRoleUserRelation> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,17 @@ |
|||
package com.model2d3d.viewer.back.dao.auto; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.model2d3d.viewer.back.model.BasicUser; |
|||
|
|||
/** |
|||
* <p> |
|||
* Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author jwy |
|||
* @since |
|||
*/ |
|||
public interface BasicUserMapper extends BaseMapper<BasicUser> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,17 @@ |
|||
package com.model2d3d.viewer.back.dao.auto; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.model2d3d.viewer.back.model.LoginHistory; |
|||
|
|||
/** |
|||
* <p> |
|||
* Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author jwy |
|||
* @since |
|||
*/ |
|||
public interface LoginHistoryMapper extends BaseMapper<LoginHistory> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,32 @@ |
|||
package com.model2d3d.viewer.back.dao.ex; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.model2d3d.viewer.back.model.BasicCompany; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import com.model2d3d.viewer.back.dao.auto.BasicCompanyMapper; |
|||
import com.model2d3d.viewer.back.dto.company.CompanySearchParams; |
|||
import com.model2d3d.viewer.back.dto.company.OptCompanyParams; |
|||
import com.model2d3d.viewer.back.vo.TreeMenusDTO; |
|||
import com.model2d3d.viewer.back.vo.company.CompanyPageDTO; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
@Mapper |
|||
public interface BasicCompanyMapperExt extends BasicCompanyMapper{ |
|||
|
|||
List<BasicCompany> getSubCompanyByParentId(Map<String, Object> searchChildMap); |
|||
|
|||
List<BasicCompany> getSelectList(Map<String, Object> paramMap); |
|||
|
|||
int checkExist(OptCompanyParams optCompanyParams); |
|||
|
|||
IPage<CompanyPageDTO> getListPage(Page<?> page, @Param("params") CompanySearchParams pageSearchParam); |
|||
|
|||
List<TreeMenusDTO> getListForTree(); |
|||
|
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.model2d3d.viewer.back.dao.ex; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.model2d3d.viewer.back.dto.role.RolePageSearchParam; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import com.model2d3d.viewer.back.dao.auto.BasicRoleMapper; |
|||
import com.model2d3d.viewer.back.dto.role.OptRoleParam; |
|||
import com.model2d3d.viewer.back.vo.TreeMenusDTO; |
|||
import com.model2d3d.viewer.back.vo.role.RolePageDTO; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
@Mapper |
|||
public interface BasicRoleMapperExt extends BasicRoleMapper { |
|||
|
|||
Long checkExist(OptRoleParam param); |
|||
|
|||
List<TreeMenusDTO> getOwnMenuIds(Map<String, Object> paramMap); |
|||
|
|||
IPage<RolePageDTO> getListPage(Page page, @Param("params") RolePageSearchParam pageSearchParam); |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.model2d3d.viewer.back.dao.ex; |
|||
|
|||
import java.util.Map; |
|||
|
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import com.model2d3d.viewer.back.dao.auto.BasicRoleMenuRelationMapper; |
|||
|
|||
@Mapper |
|||
public interface BasicRoleMenuRelationMapperExt extends BasicRoleMenuRelationMapper { |
|||
|
|||
void batchInsert(Map<String, Object> paramMap); |
|||
|
|||
String getMenuIdsByRoleId(Long roleId); |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.model2d3d.viewer.back.dao.ex; |
|||
|
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import com.model2d3d.viewer.back.dao.auto.BasicRoleUserRelationMapper; |
|||
|
|||
@Mapper |
|||
public interface BasicRoleUserRelationMapperExt extends BasicRoleUserRelationMapper { |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.model2d3d.viewer.back.dao.ex; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import com.model2d3d.viewer.back.dao.auto.BasicUserMapper; |
|||
import com.model2d3d.viewer.back.dto.user.OptUserParam; |
|||
import com.model2d3d.viewer.back.dto.user.PageSearchParam; |
|||
import com.model2d3d.viewer.back.vo.user.UserInfoVO; |
|||
import com.model2d3d.viewer.back.vo.user.UserPageDTO; |
|||
|
|||
@Mapper |
|||
public interface BasicUserMapperExt extends BasicUserMapper{ |
|||
|
|||
Long checkExist(OptUserParam param); |
|||
|
|||
IPage<UserPageDTO> getListPage(Page<?> page, @Param("params") PageSearchParam pageSearchParam); |
|||
|
|||
String getMenuIdsByUserId(@Param("userId") String userId); |
|||
|
|||
UserInfoVO getAccountInfo(Map<String, Object> paramMap); |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.model2d3d.viewer.back.dao.ex; |
|||
|
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import com.model2d3d.viewer.back.dao.auto.LoginHistoryMapper; |
|||
|
|||
@Mapper |
|||
public interface LoginHistoryMapperExt extends LoginHistoryMapper{ |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.auto.BasicCompanyMapper"> |
|||
|
|||
<!-- 通用查询映射结果 --> |
|||
<resultMap id="BaseResultMap" type="com.model2d3d.viewer.back.model.BasicCompany"> |
|||
<id column="id" property="id" /> |
|||
<result column="parent_id" property="parentId" /> |
|||
<result column="company_name" property="companyName" /> |
|||
<result column="flag" property="flag" /> |
|||
<result column="create_time" property="createTime" /> |
|||
<result column="modify_time" property="modifyTime" /> |
|||
</resultMap> |
|||
|
|||
<!-- 通用查询结果列 --> |
|||
<sql id="Base_Column_List"> |
|||
id, parent_id, company_name, flag, create_time, modify_time |
|||
</sql> |
|||
|
|||
</mapper> |
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.auto.BasicMenuMapper"> |
|||
|
|||
<!-- 通用查询映射结果 --> |
|||
<resultMap id="BaseResultMap" type="com.model2d3d.viewer.back.model.BasicMenu"> |
|||
<id column="id" property="id" /> |
|||
<result column="parent_menu_id" property="parentMenuId" /> |
|||
<result column="menu_name" property="menuName" /> |
|||
<result column="menu_name_en" property="menuNameEn" /> |
|||
<result column="menu_name_jp" property="menuNameJp" /> |
|||
<result column="remark" property="remark" /> |
|||
<result column="menu_level" property="menuLevel" /> |
|||
<result column="flag" property="flag" /> |
|||
<result column="create_time" property="createTime" /> |
|||
</resultMap> |
|||
|
|||
<!-- 通用查询结果列 --> |
|||
<sql id="Base_Column_List"> |
|||
id, parent_menu_id, menu_name, menu_name_en, menu_name_jp, remark, menu_level, flag, create_time |
|||
</sql> |
|||
|
|||
</mapper> |
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.auto.BasicRoleMapper"> |
|||
|
|||
<!-- 通用查询映射结果 --> |
|||
<resultMap id="BaseResultMap" type="com.model2d3d.viewer.back.model.BasicRole"> |
|||
<id column="id" property="id" /> |
|||
<result column="company_id" property="companyId" /> |
|||
<result column="role_name" property="roleName" /> |
|||
<result column="description" property="description" /> |
|||
<result column="flag" property="flag" /> |
|||
<result column="creator_id" property="creatorId" /> |
|||
<result column="create_time" property="createTime" /> |
|||
<result column="modifier_id" property="modifierId" /> |
|||
<result column="modify_time" property="modifyTime" /> |
|||
</resultMap> |
|||
|
|||
<!-- 通用查询结果列 --> |
|||
<sql id="Base_Column_List"> |
|||
id, company_id, role_name, description, flag, creator_id, create_time, modifier_id, modify_time |
|||
</sql> |
|||
|
|||
</mapper> |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.auto.BasicRoleMenuRelationMapper"> |
|||
|
|||
<!-- 通用查询映射结果 --> |
|||
<resultMap id="BaseResultMap" type="com.model2d3d.viewer.back.model.BasicRoleMenuRelation"> |
|||
<result column="role_id" property="roleId" /> |
|||
<result column="menu_id" property="menuId" /> |
|||
<result column="creator_id" property="creatorId" /> |
|||
<result column="create_time" property="createTime" /> |
|||
</resultMap> |
|||
|
|||
<!-- 通用查询结果列 --> |
|||
<sql id="Base_Column_List"> |
|||
role_id, menu_id, creator_id, create_time |
|||
</sql> |
|||
|
|||
</mapper> |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.auto.BasicRoleUserRelationMapper"> |
|||
|
|||
<!-- 通用查询映射结果 --> |
|||
<resultMap id="BaseResultMap" type="com.model2d3d.viewer.back.model.BasicRoleUserRelation"> |
|||
<result column="user_id" property="userId" /> |
|||
<result column="role_id" property="roleId" /> |
|||
<result column="creator_id" property="creatorId" /> |
|||
<result column="create_time" property="createTime" /> |
|||
</resultMap> |
|||
|
|||
<!-- 通用查询结果列 --> |
|||
<sql id="Base_Column_List"> |
|||
user_id, role_id, creator_id, create_time |
|||
</sql> |
|||
|
|||
</mapper> |
@ -0,0 +1,32 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.auto.BasicUserMapper"> |
|||
|
|||
<!-- 通用查询映射结果 --> |
|||
<resultMap id="BaseResultMap" type="com.model2d3d.viewer.back.model.BasicUser"> |
|||
<id column="id" property="id" /> |
|||
<result column="company_id" property="companyId" /> |
|||
<result column="shop_uuid" property="shopUuid" /> |
|||
<result column="username" property="username" /> |
|||
<result column="login_name" property="loginName" /> |
|||
<result column="password" property="password" /> |
|||
<result column="password_modify_time" property="passwordModifyTime" /> |
|||
<result column="salt" property="salt" /> |
|||
<result column="email" property="email" /> |
|||
<result column="mobile_number" property="mobileNumber" /> |
|||
<result column="last_login_time" property="lastLoginTime" /> |
|||
<result column="remark" property="remark" /> |
|||
<result column="flag" property="flag" /> |
|||
<result column="expire_time" property="expireTime" /> |
|||
<result column="create_time" property="createTime" /> |
|||
<result column="creator_id" property="creatorId" /> |
|||
<result column="modify_time" property="modifyTime" /> |
|||
<result column="modifier_id" property="modifierId" /> |
|||
</resultMap> |
|||
|
|||
<!-- 通用查询结果列 --> |
|||
<sql id="Base_Column_List"> |
|||
id, company_id, shop_uuid, username, login_name, password, password_modify_time, salt, email, mobile_number, last_login_time, remark, flag, expire_time, create_time, creator_id, modify_time, modifier_id |
|||
</sql> |
|||
|
|||
</mapper> |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.auto.LoginHistoryMapper"> |
|||
|
|||
<!-- 通用查询映射结果 --> |
|||
<resultMap id="BaseResultMap" type="com.model2d3d.viewer.back.model.LoginHistory"> |
|||
<id column="id" property="id" /> |
|||
<result column="user_id" property="userId" /> |
|||
<result column="request_ip" property="requestIp" /> |
|||
<result column="login_time" property="loginTime" /> |
|||
</resultMap> |
|||
|
|||
<!-- 通用查询结果列 --> |
|||
<sql id="Base_Column_List"> |
|||
id, user_id, request_ip, login_time |
|||
</sql> |
|||
|
|||
</mapper> |
@ -0,0 +1,72 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.ex.BasicCompanyMapperExt"> |
|||
|
|||
<select id="getSubCompanyByParentId" resultType="com.model2d3d.viewer.back.model.BasicCompany" > |
|||
SELECT |
|||
bcom.id |
|||
FROM |
|||
basic_company bcom |
|||
WHERE |
|||
bcom.flag != 1 and bcom.parent_id IN |
|||
<foreach collection="companyIds" item="id" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</select> |
|||
|
|||
<select id="getSelectList" resultType="com.model2d3d.viewer.back.model.BasicCompany" > |
|||
SELECT |
|||
bcom.id, |
|||
bcom.company_name companyName |
|||
FROM |
|||
basic_company bcom |
|||
WHERE bcom.flag != 1 AND bcom.id IN |
|||
<foreach collection="companyIds" item="id" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</select> |
|||
|
|||
|
|||
<select id="checkExist" resultType="java.lang.Integer"> |
|||
SELECT |
|||
COUNT(1) |
|||
FROM |
|||
basic_company |
|||
WHERE |
|||
flag != 1 AND company_name = #{companyName} |
|||
<if test="companyId != null"> |
|||
AND id != #{companyId} |
|||
</if> |
|||
</select> |
|||
|
|||
|
|||
<select id="getListPage" resultType="com.model2d3d.viewer.back.vo.company.CompanyPageDTO"> |
|||
SELECT |
|||
bcom.id companyId, |
|||
bcom.company_name companyName, |
|||
parentcom.id parentId, |
|||
parentcom.company_name parentCompanyName |
|||
FROM |
|||
basic_company bcom |
|||
LEFT JOIN basic_company parentcom ON parentcom.id = bcom.parent_id |
|||
WHERE |
|||
bcom.flag != 1 AND bcom.id IN <foreach collection="params.companyIdList" item="item" open="(" separator="," close=")">#{item}</foreach> |
|||
<if test="params.companyName != null"> |
|||
AND bcom.company_name LIKE CONCAT('%',#{params.companyName},'%') |
|||
</if> |
|||
ORDER BY bcom.create_time DESC, bcom.id DESC |
|||
</select> |
|||
|
|||
|
|||
<select id="getListForTree" resultType="com.model2d3d.viewer.back.vo.TreeMenusDTO"> |
|||
SELECT |
|||
bcom.id `key`, |
|||
bcom.parent_id parentKey, |
|||
bcom.company_name label |
|||
FROM |
|||
basic_company bcom |
|||
WHERE |
|||
bcom.flag != 1 |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,68 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.ex.BasicRoleMapperExt"> |
|||
|
|||
<select id="checkExist" resultType="java.lang.Long"> |
|||
SELECT |
|||
COUNT(1) |
|||
FROM |
|||
basic_role brole |
|||
WHERE |
|||
brole.flag != 1 AND brole.role_name = #{roleName} AND brole.company_id = #{companyId} |
|||
<if test="roleId != null"> |
|||
AND brole.id != #{roleId} |
|||
</if> |
|||
</select> |
|||
|
|||
<select id="getOwnMenuIds" resultType="com.model2d3d.viewer.back.vo.TreeMenusDTO"> |
|||
SELECT |
|||
bmenu.id `key`, |
|||
bmenu.parent_menu_id parentKey, |
|||
<choose> |
|||
<when test="languageType == 0"> |
|||
bmenu.menu_name label |
|||
</when> |
|||
<when test="languageType == 1"> |
|||
bmenu.menu_name_en label |
|||
</when> |
|||
<otherwise> |
|||
bmenu.menu_name_jp label |
|||
</otherwise> |
|||
</choose> |
|||
FROM |
|||
<choose> |
|||
<when test="superRole != null and superRole == 1"> |
|||
basic_menu bmenu WHERE bmenu.flag != 1 |
|||
</when> |
|||
<otherwise> |
|||
basic_role_user_relation brur |
|||
INNER JOIN basic_role_menu_relation brmr ON brur.role_id = brmr.role_id |
|||
INNER JOIN basic_menu bmenu ON bmenu.id = brmr.menu_id |
|||
WHERE |
|||
bmenu.flag != 1 AND brur.user_id = #{userId} |
|||
</otherwise> |
|||
</choose> |
|||
|
|||
</select> |
|||
|
|||
|
|||
<select id="getListPage" resultType="com.model2d3d.viewer.back.vo.role.RolePageDTO"> |
|||
SELECT |
|||
brole.id roleId, |
|||
brole.role_name roleName, |
|||
brole.description, |
|||
brole.modify_time modifyTime |
|||
FROM |
|||
basic_role brole |
|||
WHERE |
|||
brole.flag != 1 AND brole.company_id IN <foreach collection="params.companyIdList" item="item" open="(" separator="," close=")">#{item}</foreach> |
|||
AND brole.id != IFNULL((SELECT role_id FROM basic_role_user_relation WHERE user_id = #{params.userId}), -9) |
|||
<if test="params.roleName != null and params.roleName != ''"> |
|||
AND brole.role_name LIKE CONCAT('%',#{params.roleName},'%') |
|||
</if> |
|||
ORDER BY brole.create_time DESC, brole.id DESC |
|||
|
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,24 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.ex.BasicRoleMenuRelationMapperExt"> |
|||
|
|||
<insert id="batchInsert"> |
|||
INSERT INTO |
|||
basic_role_menu_relation (role_id, menu_id, creator_id, create_time) |
|||
VALUES |
|||
<foreach collection="menuIds" item="item" index="index" separator=","> |
|||
(#{roleId}, #{item}, #{creatorId}, #{createTime}) |
|||
</foreach> |
|||
</insert> |
|||
|
|||
<select id="getMenuIdsByRoleId" resultType="java.lang.String"> |
|||
SELECT |
|||
GROUP_CONCAT(bmenu.id) |
|||
FROM |
|||
basic_role_menu_relation brmr |
|||
INNER JOIN basic_menu bmenu ON bmenu.id = brmr.menu_id |
|||
WHERE |
|||
bmenu.flag != 1 AND brmr.role_id = #{roleId} |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,96 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.model2d3d.viewer.back.dao.ex.BasicUserMapperExt"> |
|||
|
|||
<select id="checkExist" resultType="java.lang.Long"> |
|||
SELECT |
|||
COUNT(1) |
|||
FROM |
|||
basic_user buser |
|||
WHERE |
|||
buser.flag != 1 AND (buser.login_name = #{email} OR buser.email = #{loginName} OR buser.email = #{email}) |
|||
<if test="userId != null"> |
|||
AND buser.id != #{userId} |
|||
</if> |
|||
</select> |
|||
|
|||
|
|||
<select id="getListPage" resultType="com.model2d3d.viewer.back.vo.user.UserPageDTO"> |
|||
SELECT |
|||
bcom.id companyId, |
|||
bcom.company_name companyName, |
|||
buser.id userId, |
|||
buser.username username, |
|||
buser.login_name loginName, |
|||
buser.email, |
|||
buser.mobile_number mobileNumber, |
|||
buser.create_time createTime, |
|||
any_value(brole.id) roleId, |
|||
any_value(brole.role_name) roleName |
|||
FROM |
|||
basic_user buser |
|||
INNER JOIN basic_company bcom ON buser.company_id = bcom.id |
|||
INNER JOIN basic_role_user_relation brur ON brur.user_id = buser.id |
|||
INNER JOIN basic_role brole ON brur.role_id = brole.id |
|||
WHERE |
|||
buser.flag != 1 AND brole.flag != 1 AND buser.company_id IN <foreach collection="params.companyIdList" item="item" open="(" separator="," close=")">#{item}</foreach> |
|||
<if test="params.userId != null"> |
|||
AND buser.id != #{params.userId} |
|||
</if> |
|||
<if test="params.keyword != null and params.keyword !=''"> |
|||
AND ( |
|||
buser.username LIKE CONCAT('%',#{params.keyword},'%') |
|||
OR |
|||
buser.email LIKE CONCAT('%',#{params.keyword},'%') |
|||
) |
|||
</if> |
|||
ORDER BY buser.create_time DESC, buser.id DESC |
|||
</select> |
|||
|
|||
|
|||
<select id="getMenuIdsByUserId" resultType="java.lang.String"> |
|||
SELECT |
|||
GROUP_CONCAT(bmenu.id) |
|||
FROM |
|||
<choose> |
|||
<when test="userId != null and userId == 1"> |
|||
basic_menu bmenu WHERE bmenu.flag != 1 |
|||
</when> |
|||
<otherwise> |
|||
basic_role_user_relation brur |
|||
INNER JOIN basic_role brole ON brole.id = brur.role_id |
|||
INNER JOIN basic_role_menu_relation brmr ON brur.role_id = brmr.role_id |
|||
INNER JOIN basic_menu bmenu ON bmenu.id = brmr.menu_id |
|||
WHERE |
|||
brole.flag != 1 AND bmenu.flag != 1 AND brur.user_id = #{userId} |
|||
</otherwise> |
|||
</choose> |
|||
|
|||
</select> |
|||
|
|||
|
|||
<select id="getAccountInfo" resultType="com.model2d3d.viewer.back.vo.user.UserInfoVO"> |
|||
SELECT |
|||
buser.id, |
|||
buser.company_id, |
|||
buser.username, |
|||
buser.login_name, |
|||
buser.`password`, |
|||
buser.salt, |
|||
buser.email, |
|||
buser.mobile_number, |
|||
buser.last_login_time, |
|||
buser.flag, |
|||
buser.expire_time, |
|||
buser.create_time, |
|||
buser.creator_id, |
|||
buser.modify_time, |
|||
buser.modifier_id, |
|||
bcom.parent_id parentCompanyId |
|||
FROM |
|||
basic_user buser |
|||
inner join basic_company bcom on bcom.id = buser.company_id |
|||
WHERE buser.flag != 1 and bcom.flag != 1 and (buser.login_name = #{loginname} OR buser.email = #{loginName}) |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,61 @@ |
|||
package ${package.Entity}; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.io.Serializable; |
|||
<#-- 自动导入日期类型 --> |
|||
<#list table.fields as field> |
|||
<#if field.propertyType == "LocalDate"> |
|||
import java.time.LocalDate; |
|||
<#break> |
|||
</#if> |
|||
</#list> |
|||
<#list table.fields as field> |
|||
<#if field.propertyType == "LocalDateTime"> |
|||
import java.time.LocalDateTime; |
|||
<#break> |
|||
</#if> |
|||
</#list> |
|||
|
|||
<#-- 类定义 --> |
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@Accessors(chain = true) |
|||
@TableName("${table.name}") |
|||
@Schema(description = "${table.comment!}") |
|||
public class ${entity} implements Serializable { |
|||
|
|||
<#-- 主键字段处理 --> |
|||
<#assign hasPk = false> |
|||
<#list table.fields as field> |
|||
<#if field.keyFlag> |
|||
<#assign hasPk = true> |
|||
@TableId(value = "${field.name}", type = IdType.${idType!"ASSIGN_ID"}) |
|||
@Schema(description = "${field.comment!}") |
|||
private ${field.propertyType} ${field.propertyName}; |
|||
|
|||
</#if> |
|||
</#list> |
|||
|
|||
<#-- 普通字段处理 --> |
|||
<#list table.fields as field> |
|||
<#if !field.keyFlag> |
|||
@TableField("${field.name}") |
|||
@Schema(description = "${field.comment!}") |
|||
private ${field.propertyType} ${field.propertyName}; |
|||
|
|||
</#if> |
|||
</#list> |
|||
|
|||
<#-- 无主键表的额外处理 --> |
|||
<#if !hasPk> |
|||
<#-- 在这里可以添加无主键表特有的方法或注释 --> |
|||
<#-- 例如,可能需要提供手动主键生成策略或者修改操作方法 --> |
|||
</#if> |
|||
} |
@ -0,0 +1,15 @@ |
|||
/target/ |
|||
/logs/ |
|||
/.idea/ |
|||
*.iml |
|||
*.bak |
|||
*.log |
|||
/.settings/ |
|||
*.project |
|||
*.classpath |
|||
*.factorypath |
|||
*.springBeans |
|||
/.apt_generated/ |
|||
/.externalToolBuilders/ |
|||
/bin/ |
|||
application-*.properties |
@ -0,0 +1,56 @@ |
|||
<?xml version="1.0"?> |
|||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>model2d3d-viewer-back</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</parent> |
|||
<artifactId>model2d3d-viewer-back-model</artifactId> |
|||
<name>model2d3d-viewer-back-model</name> |
|||
<url>http://maven.apache.org</url> |
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
</properties> |
|||
<dependencies> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator --> |
|||
<dependency> |
|||
<groupId>org.hibernate.validator</groupId> |
|||
<artifactId>hibernate-validator</artifactId> |
|||
<version>9.0.0.CR1</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.glassfish</groupId> |
|||
<artifactId>javax.el</artifactId> |
|||
<version>3.0.1-b11</version> |
|||
</dependency> |
|||
<!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator-cdi --> |
|||
<dependency> |
|||
<groupId>org.hibernate.validator</groupId> |
|||
<artifactId>hibernate-validator-cdi</artifactId> |
|||
<version>9.0.0.CR1</version> |
|||
</dependency> |
|||
|
|||
<!-- MyBatis-Plus --> |
|||
<dependency> |
|||
<groupId>com.baomidou</groupId> |
|||
<artifactId>mybatis-plus-boot-starter</artifactId> |
|||
<version>3.5.11</version> |
|||
<exclusions> |
|||
<!-- 版本匹配问题,防止出现Invalid value type for attribute ‘factoryBeanObjectType‘: java.lang.String --> |
|||
<exclusion> |
|||
<groupId>org.mybatis</groupId> |
|||
<artifactId>mybatis-spring</artifactId> |
|||
</exclusion> |
|||
</exclusions> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>junit</groupId> |
|||
<artifactId>junit</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
</project> |
@ -0,0 +1,25 @@ |
|||
package com.model2d3d.viewer.back.dto; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年4月23日 下午1:55:22 |
|||
*/ |
|||
@Setter |
|||
@Getter |
|||
public class BaseSearchNoCompanysParams { |
|||
|
|||
/** 页码 */ |
|||
@Schema(description = "当前页码(默认第一页)",example = "1") |
|||
private Integer pageNum; |
|||
/** 每页显示的条数 */ |
|||
@Schema(description = "每页显示的条数(默认20条)", example = "20") |
|||
private Integer pageSize; |
|||
|
|||
@Schema(description = "用户ID", hidden = true) |
|||
private Long userId; |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.model2d3d.viewer.back.dto; |
|||
|
|||
import java.util.List; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年4月23日 下午1:55:22 |
|||
*/ |
|||
@Setter |
|||
@Getter |
|||
public class BaseSearchParams extends BaseSearchNoCompanysParams{ |
|||
|
|||
@Schema(description = "查询对象所属企业ID,多个使用逗号连接") |
|||
private String companyIds; |
|||
|
|||
@Schema(description = "查询对象所属企业ID", hidden = true) |
|||
private List<String> companyIdList; |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.model2d3d.viewer.back.dto.account; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年5月20日 下午2:08:50 |
|||
*/ |
|||
@Data |
|||
public class CacheUserData { |
|||
|
|||
private String accessToken; |
|||
private String userId; |
|||
private String companyId; |
|||
private String username; |
|||
private String loginName; |
|||
private String password; |
|||
private Long createTime; |
|||
private Long expireTime; |
|||
private String menuIds; |
|||
// private String userGroupIds;
|
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.model2d3d.viewer.back.dto.account; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年5月20日 下午7:13:50 |
|||
*/ |
|||
@Data |
|||
public class LoginParam { |
|||
|
|||
@Schema(description ="登录名",example = "admin") |
|||
private String loginname; |
|||
|
|||
@Schema(description = "密码",example = "123456") |
|||
private String password; |
|||
|
|||
@Schema(description = "验证码的请求标识ID",example = "111weyu2-123rt2u1-121ueiu2") |
|||
private String captchaRequestId; |
|||
|
|||
@Schema(description = "验证码值",example = "Z3xA") |
|||
private String captcha; |
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.model2d3d.viewer.back.dto.company; |
|||
|
|||
import com.model2d3d.viewer.back.dto.BaseSearchParams; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年7月21日 下午8:50:31 |
|||
*/ |
|||
@Data |
|||
public class CompanySearchParams extends BaseSearchParams{ |
|||
|
|||
@Schema(description ="企业名",example = "张三李四") |
|||
private String companyName; |
|||
|
|||
@Schema(description ="登录账号的企业ID",example = "1", hidden = true) |
|||
private String selfCompanyId; |
|||
|
|||
// @Schema(description ="1-未进入系统homepage页面获取,2-点击企业后进入系统后获取",example = "2")
|
|||
// private Integer searchType;
|
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.model2d3d.viewer.back.dto.company; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年7月21日 下午8:50:31 |
|||
*/ |
|||
@Data |
|||
public class DeleteCompanyParams{ |
|||
|
|||
@NotBlank(message = "1001") |
|||
@Schema(description ="企业ID,多个使用半角字符逗号连接",example = "2738967,587") |
|||
private String companyIds; |
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.model2d3d.viewer.back.dto.company; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import jakarta.validation.constraints.NotNull; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年7月21日 下午8:50:31 |
|||
*/ |
|||
@Data |
|||
public class OptCompanyParams{ |
|||
|
|||
@Schema(description ="企业唯一标识ID,新增时无此参数",example = "2738967") |
|||
private String companyId; |
|||
|
|||
@Schema(description ="父企业ID",example = "2738967", hidden = true) |
|||
private String parentId; |
|||
|
|||
@NotBlank(message = "1001") |
|||
@Length(max = 500,message = "1002") |
|||
@Schema(description ="企业名称",example = "testAccount1", required = true) |
|||
private String companyName; |
|||
|
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.model2d3d.viewer.back.dto.role; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年4月23日 下午1:59:33 |
|||
*/ |
|||
@Setter |
|||
@Getter |
|||
public class DeleteRoleParam { |
|||
|
|||
@NotBlank(message = "1001") |
|||
@Schema(description ="Id,多个使用逗号连接",example = "3,5", required = true) |
|||
private String roleIds; |
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.model2d3d.viewer.back.dto.role; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import jakarta.validation.constraints.Max; |
|||
import jakarta.validation.constraints.Min; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.hibernate.validator.constraints.Range; |
|||
|
|||
/** |
|||
* @author zhc |
|||
* @time 2022年6月14日10:56:38 |
|||
*/ |
|||
@Setter |
|||
@Getter |
|||
public class OptRoleParam { |
|||
|
|||
@Schema(description ="角色ID, 新增时无此参数",example = "111", required = false) |
|||
private String roleId; |
|||
|
|||
@NotBlank(message = "1001") |
|||
@Length(max = 100,message = "1002") |
|||
@Schema(description ="角色名称",example = "管理员", required = true) |
|||
private String roleName; |
|||
|
|||
@Length(max = 500,message = "1002") |
|||
@Schema(description ="描述",example = "这是管理员描述") |
|||
private String description; |
|||
|
|||
@Schema(description ="菜单权限ID,使用逗号连接",example = "1,4,5,6") |
|||
private String menuIds; |
|||
|
|||
@Schema(description ="所属企业ID",example = "2", hidden = true) |
|||
private String companyId; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.model2d3d.viewer.back.dto.role; |
|||
|
|||
import com.model2d3d.viewer.back.dto.BaseSearchParams; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @author Mr.zhc |
|||
* @time 2022年7月27日12:06:35 |
|||
*/ |
|||
@Setter |
|||
@Getter |
|||
public class RolePageSearchParam extends BaseSearchParams{ |
|||
|
|||
@Schema(description ="角色名",example = "test", required = false) |
|||
private String roleName; |
|||
|
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.model2d3d.viewer.back.dto.user; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年4月23日 下午1:59:33 |
|||
*/ |
|||
@Setter |
|||
@Getter |
|||
public class DeleteUserParam { |
|||
|
|||
@NotBlank(message = "1001") |
|||
@Schema(description ="Id,多个使用逗号连接",example = "3,5", required = true) |
|||
private String userIds; |
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.model2d3d.viewer.back.dto.user; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年4月23日 下午1:59:33 |
|||
*/ |
|||
@Setter |
|||
@Getter |
|||
public class ModifyPassword{ |
|||
|
|||
@NotBlank(message = "1001") |
|||
@Schema(description ="旧密码",example = "haoihg09278", required = true) |
|||
private String oldPassword; |
|||
|
|||
@NotBlank(message = "1001") |
|||
@Schema(description ="新密码",example = "og.ayhgih", required = true) |
|||
private String newPassword; |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.model2d3d.viewer.back.dto.user; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import jakarta.validation.constraints.Email; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
/** |
|||
* @author zhc |
|||
* @time 2022年6月14日10:56:38 |
|||
*/ |
|||
@Setter |
|||
@Getter |
|||
public class OptUserParam { |
|||
|
|||
|
|||
@Schema(description ="用户ID, 新增时无此参数",example = "111", required = false) |
|||
private String userId; |
|||
|
|||
@Schema(description ="角色ID",example = "24", required = false) |
|||
private String roleId; |
|||
|
|||
@NotBlank(message = "1001") |
|||
@Length(max = 255,message = "1002") |
|||
@Schema(description ="用户名",example = "管理员", required = true) |
|||
private String username; |
|||
|
|||
@Schema(description ="登录名",example = "adminmin", hidden = true) |
|||
private String loginName; |
|||
|
|||
@Email(message = "1004") |
|||
@Schema(description ="用户邮箱",example = "1057897@qq.com", required = true) |
|||
private String email; |
|||
|
|||
@Schema(description ="手机号码,这里要加上国际区号,比如日本是+81,传给后台的就是+81-08041165856,中国是+86,传给后台的就是+86-18841165856",example = "+81-08041165856", required = false) |
|||
private String mobileNumber; |
|||
|
|||
@Schema(description ="所属企业ID",example = "2", hidden = true) |
|||
private String companyId; |
|||
|
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.model2d3d.viewer.back.dto.user; |
|||
|
|||
import com.model2d3d.viewer.back.dto.BaseSearchParams; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @author Mr.zhc |
|||
* @time 2022年7月27日12:06:35 |
|||
*/ |
|||
@Setter |
|||
@Getter |
|||
public class PageSearchParam extends BaseSearchParams{ |
|||
|
|||
@Schema(description ="用户名/用户邮箱",example = "test", required = false) |
|||
private String keyword; |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.model2d3d.viewer.back.dto.user; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年4月23日 下午1:59:33 |
|||
*/ |
|||
@Setter |
|||
@Getter |
|||
public class ResetPassword{ |
|||
|
|||
@NotBlank(message = "1001") |
|||
@Schema(description ="Id,多个使用逗号连接",example = "3,5", required = true) |
|||
private String userIds; |
|||
|
|||
// @Schema(description ="重置密码方式 1-管理员直接重置密码,账号邮箱接收该密码,2-发送重置密码链接到绑定的账户邮箱中,用户自己重置密码",example = "2", required = true)
|
|||
// private Integer resetType = 1;
|
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
package com.model2d3d.viewer.back.model; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@Accessors(chain = true) |
|||
@TableName("basic_company") |
|||
@Schema(description = "企业表") |
|||
public class BasicCompany implements Serializable { |
|||
|
|||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
|||
@Schema(description = "") |
|||
private String id; |
|||
|
|||
|
|||
@TableField("parent_id") |
|||
@Schema(description = "") |
|||
private String parentId; |
|||
|
|||
@TableField("company_name") |
|||
@Schema(description = "") |
|||
private String companyName; |
|||
|
|||
@TableField("flag") |
|||
@Schema(description = "0-正常,1-删除") |
|||
private Integer flag; |
|||
|
|||
@TableField("create_time") |
|||
@Schema(description = "") |
|||
private Long createTime; |
|||
|
|||
@TableField("modify_time") |
|||
@Schema(description = "") |
|||
private Long modifyTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,58 @@ |
|||
package com.model2d3d.viewer.back.model; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@Accessors(chain = true) |
|||
@TableName("basic_menu") |
|||
@Schema(description = "") |
|||
public class BasicMenu implements Serializable { |
|||
|
|||
@TableId(value = "id", type = IdType.AUTO) |
|||
@Schema(description = "") |
|||
private Long id; |
|||
|
|||
|
|||
@TableField("parent_menu_id") |
|||
@Schema(description = "") |
|||
private Long parentMenuId; |
|||
|
|||
@TableField("menu_name") |
|||
@Schema(description = "") |
|||
private String menuName; |
|||
|
|||
@TableField("menu_name_en") |
|||
@Schema(description = "") |
|||
private String menuNameEn; |
|||
|
|||
@TableField("menu_name_jp") |
|||
@Schema(description = "") |
|||
private String menuNameJp; |
|||
|
|||
@TableField("remark") |
|||
@Schema(description = "") |
|||
private String remark; |
|||
|
|||
@TableField("menu_level") |
|||
@Schema(description = "菜单级别") |
|||
private Integer menuLevel; |
|||
|
|||
@TableField("flag") |
|||
@Schema(description = "0-正常,1-删除") |
|||
private Integer flag; |
|||
|
|||
@TableField("create_time") |
|||
@Schema(description = "") |
|||
private Long createTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,58 @@ |
|||
package com.model2d3d.viewer.back.model; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@Accessors(chain = true) |
|||
@TableName("basic_role") |
|||
@Schema(description = "") |
|||
public class BasicRole implements Serializable { |
|||
|
|||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
|||
@Schema(description = "") |
|||
private String id; |
|||
|
|||
|
|||
@TableField("company_id") |
|||
@Schema(description = "") |
|||
private String companyId; |
|||
|
|||
@TableField("role_name") |
|||
@Schema(description = "") |
|||
private String roleName; |
|||
|
|||
@TableField("description") |
|||
@Schema(description = "") |
|||
private String description; |
|||
|
|||
@TableField("flag") |
|||
@Schema(description = "0-正常,1-删除") |
|||
private Integer flag; |
|||
|
|||
@TableField("creator_id") |
|||
@Schema(description = "") |
|||
private Long creatorId; |
|||
|
|||
@TableField("create_time") |
|||
@Schema(description = "") |
|||
private Long createTime; |
|||
|
|||
@TableField("modifier_id") |
|||
@Schema(description = "") |
|||
private Long modifierId; |
|||
|
|||
@TableField("modify_time") |
|||
@Schema(description = "") |
|||
private Long modifyTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.model2d3d.viewer.back.model; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@Accessors(chain = true) |
|||
@TableName("basic_role_menu_relation") |
|||
@Schema(description = "") |
|||
public class BasicRoleMenuRelation implements Serializable { |
|||
|
|||
|
|||
@TableField("role_id") |
|||
@Schema(description = "") |
|||
private String roleId; |
|||
|
|||
@TableField("menu_id") |
|||
@Schema(description = "") |
|||
private Long menuId; |
|||
|
|||
@TableField("creator_id") |
|||
@Schema(description = "") |
|||
private Long creatorId; |
|||
|
|||
@TableField("create_time") |
|||
@Schema(description = "") |
|||
private Long createTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.model2d3d.viewer.back.model; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@Accessors(chain = true) |
|||
@TableName("basic_role_user_relation") |
|||
@Schema(description = "") |
|||
public class BasicRoleUserRelation implements Serializable { |
|||
|
|||
|
|||
@TableField("user_id") |
|||
@Schema(description = "") |
|||
private String userId; |
|||
|
|||
@TableField("role_id") |
|||
@Schema(description = "") |
|||
private String roleId; |
|||
|
|||
@TableField("creator_id") |
|||
@Schema(description = "") |
|||
private Long creatorId; |
|||
|
|||
@TableField("create_time") |
|||
@Schema(description = "") |
|||
private Long createTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
package com.model2d3d.viewer.back.model; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@Accessors(chain = true) |
|||
@TableName("basic_user") |
|||
@Schema(description = "") |
|||
public class BasicUser implements Serializable { |
|||
|
|||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
|||
@Schema(description = "") |
|||
private String id; |
|||
|
|||
|
|||
@TableField("company_id") |
|||
@Schema(description = "") |
|||
private String companyId; |
|||
|
|||
@TableField("shop_uuid") |
|||
@Schema(description = "") |
|||
private String shopUuid; |
|||
|
|||
@TableField("username") |
|||
@Schema(description = "") |
|||
private String username; |
|||
|
|||
@TableField("login_name") |
|||
@Schema(description = "") |
|||
private String loginName; |
|||
|
|||
@TableField("password") |
|||
@Schema(description = "") |
|||
private String password; |
|||
|
|||
@TableField("password_modify_time") |
|||
@Schema(description = "") |
|||
private Long passwordModifyTime; |
|||
|
|||
@TableField("salt") |
|||
@Schema(description = "") |
|||
private String salt; |
|||
|
|||
@TableField("email") |
|||
@Schema(description = "") |
|||
private String email; |
|||
|
|||
@TableField("mobile_number") |
|||
@Schema(description = "") |
|||
private String mobileNumber; |
|||
|
|||
@TableField("last_login_time") |
|||
@Schema(description = "") |
|||
private Long lastLoginTime; |
|||
|
|||
@TableField("remark") |
|||
@Schema(description = "备注") |
|||
private String remark; |
|||
|
|||
@TableField("flag") |
|||
@Schema(description = "0-正常,1-删除") |
|||
private Integer flag; |
|||
|
|||
@TableField("expire_time") |
|||
@Schema(description = "") |
|||
private Long expireTime; |
|||
|
|||
@TableField("create_time") |
|||
@Schema(description = "") |
|||
private Long createTime; |
|||
|
|||
@TableField("creator_id") |
|||
@Schema(description = "") |
|||
private Long creatorId; |
|||
|
|||
@TableField("modify_time") |
|||
@Schema(description = "") |
|||
private Long modifyTime; |
|||
|
|||
@TableField("modifier_id") |
|||
@Schema(description = "") |
|||
private Long modifierId; |
|||
|
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.model2d3d.viewer.back.model; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@Accessors(chain = true) |
|||
@TableName("login_history") |
|||
@Schema(description = "") |
|||
public class LoginHistory implements Serializable { |
|||
|
|||
@TableId(value = "id", type = IdType.AUTO) |
|||
@Schema(description = "") |
|||
private Long id; |
|||
|
|||
|
|||
@TableField("user_id") |
|||
@Schema(description = "") |
|||
private String userId; |
|||
|
|||
@TableField("request_ip") |
|||
@Schema(description = "") |
|||
private String requestIp; |
|||
|
|||
@TableField("login_time") |
|||
@Schema(description = "") |
|||
private Long loginTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.model2d3d.viewer.back.vo; |
|||
|
|||
import java.util.List; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年7月29日 下午4:37:50 |
|||
*/ |
|||
@Data |
|||
public class TreeMenusDTO { |
|||
|
|||
@Schema(description ="节点ID",example = "11", required = true) |
|||
private String key; |
|||
|
|||
@Schema(description ="父节点ID",example = "2", hidden = true) |
|||
private String parentKey; |
|||
|
|||
@Schema(description ="节点名称",example = "添加", required = true) |
|||
private String label; |
|||
|
|||
@Schema(description ="子节点",example = "[]", required = false) |
|||
private List<TreeMenusDTO> children; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.model2d3d.viewer.back.vo.company; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年7月21日 下午8:50:31 |
|||
*/ |
|||
@Data |
|||
public class CompanyPageDTO{ |
|||
|
|||
@Schema(description ="企业唯一标识ID,新增时无此参数",example = "2738967") |
|||
private String companyId; |
|||
|
|||
@Schema(description ="企业名称",example = "testAccount1", required = true) |
|||
private String companyName; |
|||
|
|||
@Schema(description ="所属企业ID",example = "2738967") |
|||
private String parentId; |
|||
|
|||
@Schema(description ="所属企业名称",example = "testAccount1", required = true) |
|||
private String parentCompanyName; |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.model2d3d.viewer.back.vo.role; |
|||
|
|||
import java.util.List; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年7月29日 下午4:37:50 |
|||
*/ |
|||
@Data |
|||
public class RoleMenuDTO { |
|||
|
|||
@Schema(description ="菜单ID",example = "11", required = true) |
|||
private String key; |
|||
|
|||
@Schema(description ="父菜单ID",example = "2", hidden = true) |
|||
private String parentKey; |
|||
|
|||
@Schema(description ="菜单名称",example = "添加", required = true) |
|||
private String label; |
|||
|
|||
@Schema(description ="子菜单",example = "[]", required = false) |
|||
private List<RoleMenuDTO> children; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.model2d3d.viewer.back.vo.role; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年5月22日 下午10:37:02 |
|||
*/ |
|||
@Data |
|||
public class RolePageDTO { |
|||
|
|||
@Schema(description ="角色ID",example = "111", required = true) |
|||
private String roleId; |
|||
|
|||
@Schema(description ="角色名称",example = "管理员", required = true) |
|||
private String roleName; |
|||
|
|||
@Schema(description ="描述",example = "这是管理员描述", required = true) |
|||
private String description; |
|||
|
|||
@Schema(description ="最后更新时间",example = "1689878789647", required = true) |
|||
private Long modifyTime; |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.model2d3d.viewer.back.vo.user; |
|||
|
|||
import com.model2d3d.viewer.back.model.BasicUser; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Mr.Jiang |
|||
* @time 2022年5月22日 下午10:37:02 |
|||
*/ |
|||
@Data |
|||
public class UserInfoVO extends BasicUser { |
|||
|
|||
private String parentCompanyId; |
|||
|
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue