commit
5e83bae822
432 changed files with 66668 additions and 0 deletions
@ -0,0 +1,16 @@ |
|||
/target/ |
|||
/logs/ |
|||
/.idea/ |
|||
*.iml |
|||
*.bak |
|||
*.log |
|||
/.settings/ |
|||
*.project |
|||
*.classpath |
|||
*.factorypath |
|||
*.springBeans |
|||
/.apt_generated/ |
|||
/.externalToolBuilders/ |
|||
/bin/ |
|||
/dongjian-dashboard-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/dongjian-dashboard-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,85 @@ |
|||
USE `data_center_new`; |
|||
|
|||
DROP procedure IF EXISTS `add_column`; |
|||
|
|||
DELIMITER $$ |
|||
|
|||
CREATE PROCEDURE add_column() |
|||
|
|||
BEGIN |
|||
IF NOT EXISTS ( |
|||
SELECT * |
|||
FROM information_schema.columns |
|||
WHERE table_schema = 'data_center_new' |
|||
AND table_name = 'basic_company' |
|||
AND column_name = 'aurora_flag' |
|||
) THEN |
|||
ALTER TABLE basic_company |
|||
ADD COLUMN `aurora_flag` int DEFAULT '0' COMMENT '0-未创建,1-创建中,2-创建成功,3-创建失败'; |
|||
END IF; |
|||
|
|||
IF NOT EXISTS ( |
|||
SELECT * |
|||
FROM information_schema.columns |
|||
WHERE table_schema = 'data_center_new' |
|||
AND table_name = 'basic_company' |
|||
AND column_name = 'aurora_url' |
|||
) THEN |
|||
ALTER TABLE basic_company |
|||
ADD COLUMN `aurora_url` varchar(255) DEFAULT NULL; |
|||
END IF; |
|||
|
|||
IF NOT EXISTS ( |
|||
SELECT * |
|||
FROM information_schema.columns |
|||
WHERE table_schema = 'data_center_new' |
|||
AND table_name = 'basic_company' |
|||
AND column_name = 'aurora_username' |
|||
) THEN |
|||
ALTER TABLE basic_company |
|||
ADD COLUMN `aurora_username` varchar(255) DEFAULT NULL; |
|||
END IF; |
|||
|
|||
IF NOT EXISTS ( |
|||
SELECT * |
|||
FROM information_schema.columns |
|||
WHERE table_schema = 'data_center_new' |
|||
AND table_name = 'basic_company' |
|||
AND column_name = 'aurora_password' |
|||
) THEN |
|||
ALTER TABLE basic_company |
|||
ADD COLUMN `aurora_password` varchar(255) DEFAULT NULL; |
|||
END IF; |
|||
|
|||
IF NOT EXISTS ( |
|||
SELECT * |
|||
FROM information_schema.columns |
|||
WHERE table_schema = 'data_center_new' |
|||
AND table_name = 'basic_company' |
|||
AND column_name = 'redis_db_id' |
|||
) THEN |
|||
ALTER TABLE basic_company |
|||
ADD COLUMN `redis_db_id` int DEFAULT NULL COMMENT '使用的redis库id'; |
|||
END IF; |
|||
|
|||
IF NOT EXISTS ( |
|||
SELECT * |
|||
FROM information_schema.columns |
|||
WHERE table_schema = 'data_center_new' |
|||
AND table_name = 'basic_company' |
|||
AND column_name = 'bearer_token' |
|||
) THEN |
|||
ALTER TABLE basic_company |
|||
ADD COLUMN `bearer_token` text; |
|||
END IF; |
|||
|
|||
update basic_company set aurora_flag = 2 where aurora_url is not null; |
|||
|
|||
END$$ |
|||
|
|||
DELIMITER ; |
|||
|
|||
|
|||
CALL add_column(); |
|||
|
|||
DROP procedure IF EXISTS `add_column`; |
|||
@ -0,0 +1,62 @@ |
|||
USE `data_center_new`; |
|||
|
|||
/*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) DEFAULT NULL, |
|||
`menu_name_en` varchar(100) DEFAULT NULL, |
|||
`menu_name_jp` varchar(100) DEFAULT NULL, |
|||
`remark` varchar(100) 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 AUTO_INCREMENT=43 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
|||
|
|||
/*Data for the table `basic_menu` */ |
|||
|
|||
insert into `basic_menu`(`id`,`parent_menu_id`,`menu_name`,`menu_name_en`,`menu_name_jp`,`remark`,`menu_level`,`flag`,`create_time`) values (1,-1,'项目管理','项目管理','プロジェクト管理','项目管理',1,0,1659079777164),(2,-1,'楼宇模块','楼宇模块','ビルモジュール','楼宇模块',1,0,1659079777164),(3,-1,'设备模块','设备模块','設備モジュール','设备模块',1,0,1659079777164),(4,-1,'转发管理','转发管理','転送管理','转发管理',1,0,1659079777164),(5,-1,'数据来源管理','数据来源管理','データ源管理','数据来源管理',1,0,1659079777164),(6,1,'添加','添加','追加','项目管理-添加',2,0,1659079777164),(7,1,'编辑','编辑','編集','项目管理-编辑',2,0,1659079777164),(8,1,'删除','删除','削除','项目管理-删除',2,0,1659079777164),(9,1,'批量添加','批量添加','大量に追加','项目管理-批量添加',2,0,1659079777164),(10,2,'楼宇管理','楼宇管理','ビル管理','楼宇管理',2,0,1659079777164),(11,2,'楼层管理','楼层管理','フロア管理','楼层管理',2,0,1659079777164),(12,2,'房间管理','房间管理','部屋管理','房间管理',2,0,1659079777164),(13,2,'资产管理','资产管理','資産管理','资产管理',2,0,1659079777164),(14,10,'添加','添加','追加','楼宇管理-添加',3,0,1659079777164),(15,10,'编辑','编辑','編集','楼宇管理-编辑',3,0,1659079777164),(16,10,'删除','删除','削除','楼宇管理-删除',3,0,1659079777164),(17,11,'添加','添加','追加','楼层管理-添加',3,0,1659079777164),(18,11,'编辑','编辑','編集','楼层管理-编辑',3,0,1659079777164),(19,11,'删除','删除','削除','楼层管理-删除',3,0,1659079777164),(20,12,'添加','添加','追加','房间管理-添加',3,0,1659079777164),(21,12,'编辑','编辑','編集','房间管理-编辑',3,0,1659079777164),(22,12,'删除','删除','削除','房间管理-删除',3,0,1659079777164),(23,13,'添加','添加','追加','资产管理-添加',3,0,1659079777164),(24,13,'编辑','编辑','編集','资产管理-编辑',3,0,1659079777164),(25,13,'删除','删除','削除','资产管理-删除',3,0,1659079777164),(26,3,'设备管理','设备管理','設備管理','设备管理',2,0,1659079777164),(27,26,'添加','添加','追加','设备管理-添加',3,0,1659079777164),(28,26,'编辑','编辑','編集','设备管理-编辑',3,0,1659079777164),(29,26,'删除','删除','削除','设备管理-删除',3,0,1659079777164),(30,26,'批量添加','批量添加','大量に追加','设备管理-批量添加',3,0,1659079777164),(31,26,'批量删除','批量删除','一括削除','设备管理-批量删除',3,0,1659079777164),(32,3,'设备类别管理','设备类别管理','設備の種類管理','设备类别管理',2,0,1659079777164),(33,32,'添加','添加','追加','设备类别管理-添加',3,0,1659079777164),(34,32,'编辑','编辑','編集','设备类别管理-编辑',3,0,1659079777164),(35,32,'删除','删除','削除','设备类别管理-删除',3,0,1659079777164),(36,4,'添加','添加','追加','转发管理-添加',3,0,1659079777164),(37,4,'编辑','编辑','編集','转发管理-编辑',3,0,1659079777164),(38,4,'删除','删除','削除','转发管理-删除',3,0,1659079777164),(39,5,'添加','添加','追加','数据来源管理-添加',3,0,1659079777164),(40,5,'编辑','编辑','編集','数据来源管理-编辑',3,0,1659079777164),(41,5,'删除','删除','削除','数据来源管理-删除',3,0,1659079777164),(42,26,'设置告警模板','设置告警模板','アラームテンプレートの設定','设备管理-设置告警模板',3,0,1659079777164); |
|||
|
|||
|
|||
/*Table structure for table `basic_role` */ |
|||
|
|||
DROP TABLE IF EXISTS `basic_role`; |
|||
|
|||
CREATE TABLE `basic_role` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT, |
|||
`company_id` bigint DEFAULT NULL, |
|||
`role_name` varchar(100) DEFAULT NULL, |
|||
`description` varchar(500) 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_0900_ai_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` bigint DEFAULT NULL, |
|||
`menu_id` bigint DEFAULT NULL, |
|||
`creator_id` bigint DEFAULT NULL, |
|||
`create_time` bigint DEFAULT NULL |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_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` bigint DEFAULT NULL, |
|||
`role_id` bigint DEFAULT NULL, |
|||
`creator_id` bigint DEFAULT NULL, |
|||
`create_time` bigint DEFAULT NULL |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
|||
@ -0,0 +1,161 @@ |
|||
/* |
|||
SQLyog 企业版 - MySQL GUI v8.14 |
|||
MySQL - 8.0.28 : Database - data_center_new |
|||
********************************************************************* |
|||
*/ |
|||
|
|||
|
|||
/*!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*/`data_center_new` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; |
|||
|
|||
USE `data_center_new`; |
|||
|
|||
/*Table structure for table `basic_company` */ |
|||
|
|||
DROP TABLE IF EXISTS `basic_company`; |
|||
|
|||
CREATE TABLE `basic_company` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT, |
|||
`parent_id` bigint DEFAULT NULL, |
|||
`company_name` varchar(500) DEFAULT NULL, |
|||
`mfa_switch` int DEFAULT '0' COMMENT '谷歌mfa服务开关。0-关闭,1-开启', |
|||
`flag` int DEFAULT '0' COMMENT '0-正常,1-删除', |
|||
`create_time` bigint DEFAULT NULL, |
|||
`modify_time` bigint DEFAULT NULL, |
|||
`apikey` varchar(255) DEFAULT NULL, |
|||
PRIMARY KEY (`id`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
|||
|
|||
/*Data for the table `basic_company` */ |
|||
|
|||
insert into `basic_company`(`id`,`parent_id`,`company_name`,`mfa_switch`,`flag`,`create_time`,`modify_time`) values (1,-1,'MiniSolution',0,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) DEFAULT NULL, |
|||
`menu_name_en` varchar(100) DEFAULT NULL, |
|||
`menu_name_jp` varchar(100) DEFAULT NULL, |
|||
`remark` varchar(100) 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_0900_ai_ci; |
|||
|
|||
/*Data for the table `basic_menu` */ |
|||
|
|||
insert into `basic_menu`(`id`,`parent_menu_id`,`menu_name`,`menu_name_en`,`menu_name_jp`,`remark`,`menu_level`,`flag`,`create_time`) values (1,-1,'项目管理','项目管理','项目管理','项目管理',1,0,1659079777164),(2,-1,'楼宇模块','楼宇模块','楼宇模块','楼宇模块',1,0,1659079777164),(3,-1,'设备模块','设备模块','设备模块','设备模块',1,0,1659079777164),(4,-1,'转发管理','转发管理','转发管理','转发管理',1,0,1659079777164),(5,-1,'数据来源管理','数据来源管理','数据来源管理','数据来源管理',1,0,1659079777164),(6,1,'添加','添加','添加','项目管理-添加',2,0,1659079777164),(7,1,'编辑','编辑','编辑','项目管理-编辑',2,0,1659079777164),(8,1,'删除','删除','删除','项目管理-删除',2,0,1659079777164),(9,1,'批量添加','批量添加','批量添加','项目管理-批量添加',2,0,1659079777164),(10,2,'楼宇管理','楼宇管理','楼宇管理','楼宇管理',2,0,1659079777164),(11,2,'楼层管理','楼层管理','楼层管理','楼层管理',2,0,1659079777164),(12,2,'房间管理','房间管理','房间管理','房间管理',2,0,1659079777164),(13,2,'资产管理','资产管理','资产管理','资产管理',2,0,1659079777164),(14,10,'添加','添加','添加','楼宇管理-添加',3,0,1659079777164),(15,10,'编辑','编辑','编辑','楼宇管理-编辑',3,0,1659079777164),(16,10,'删除','删除','删除','楼宇管理-删除',3,0,1659079777164),(17,11,'添加','添加','添加','楼层管理-添加',3,0,1659079777164),(18,11,'编辑','编辑','编辑','楼层管理-编辑',3,0,1659079777164),(19,11,'删除','删除','删除','楼层管理-删除',3,0,1659079777164),(20,12,'添加','添加','添加','房间管理-添加',3,0,1659079777164),(21,12,'编辑','编辑','编辑','房间管理-编辑',3,0,1659079777164),(22,12,'删除','删除','删除','房间管理-删除',3,0,1659079777164),(23,13,'添加','添加','添加','资产管理-添加',3,0,1659079777164),(24,13,'编辑','编辑','编辑','资产管理-编辑',3,0,1659079777164),(25,13,'删除','删除','删除','资产管理-删除',3,0,1659079777164),(26,3,'设备管理','设备管理','设备管理','设备管理',2,0,1659079777164),(27,26,'添加','添加','添加','设备管理-添加',3,0,1659079777164),(28,26,'编辑','编辑','编辑','设备管理-编辑',3,0,1659079777164),(29,26,'删除','删除','删除','设备管理-删除',3,0,1659079777164),(30,26,'批量添加','批量添加','批量添加','设备管理-批量添加',3,0,1659079777164),(31,26,'批量删除','批量删除','批量删除','设备管理-批量删除',3,0,1659079777164),(32,3,'设备类别管理','设备类别管理','设备类别管理','设备类别管理',2,0,1659079777164),(33,32,'添加','添加','添加','设备类别管理-添加',3,0,1659079777164),(34,32,'编辑','编辑','编辑','设备类别管理-编辑',3,0,1659079777164),(35,32,'删除','删除','删除','设备类别管理-删除',3,0,1659079777164),(36,4,'添加','添加','添加','转发管理-添加',3,0,1659079777164),(37,4,'编辑','编辑','编辑','转发管理-编辑',3,0,1659079777164),(38,4,'删除','删除','删除','转发管理-删除',3,0,1659079777164),(39,5,'添加','添加','添加','数据来源管理-添加',3,0,1659079777164),(40,5,'编辑','编辑','编辑','数据来源管理-编辑',3,0,1659079777164),(41,5,'删除','删除','删除','数据来源管理-删除',3,0,1659079777164); |
|||
|
|||
/*Table structure for table `basic_role` */ |
|||
|
|||
DROP TABLE IF EXISTS `basic_role`; |
|||
|
|||
CREATE TABLE `basic_role` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT, |
|||
`company_id` bigint DEFAULT NULL, |
|||
`role_name` varchar(100) DEFAULT NULL, |
|||
`description` varchar(500) 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_0900_ai_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` bigint DEFAULT NULL, |
|||
`menu_id` bigint DEFAULT NULL, |
|||
`creator_id` bigint DEFAULT NULL, |
|||
`create_time` bigint DEFAULT NULL |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_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` bigint DEFAULT NULL, |
|||
`role_id` bigint DEFAULT NULL, |
|||
`creator_id` bigint DEFAULT NULL, |
|||
`create_time` bigint DEFAULT NULL |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
|||
|
|||
/*Table structure for table `basic_user` */ |
|||
|
|||
DROP TABLE IF EXISTS `basic_user`; |
|||
|
|||
CREATE TABLE `basic_user` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT, |
|||
`user_type` int DEFAULT '0' COMMENT '0-未知,1-管理平台用户,2-普通平台用户', |
|||
`company_id` bigint NOT NULL, |
|||
`username` varchar(255) DEFAULT NULL, |
|||
`login_name` varchar(255) DEFAULT NULL, |
|||
`password` varchar(255) DEFAULT NULL, |
|||
`password_modify_time` bigint DEFAULT NULL, |
|||
`salt` varchar(255) DEFAULT NULL, |
|||
`email` varchar(255) DEFAULT NULL, |
|||
`mobile_number` varchar(255) DEFAULT NULL, |
|||
`mfa_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, |
|||
`mfa_bind` int DEFAULT '0' COMMENT '用户是否绑定了mfa设备。0-未绑定,1-已绑定', |
|||
`last_login_time` bigint DEFAULT NULL, |
|||
`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_0900_ai_ci; |
|||
|
|||
/*Data for the table `basic_user` */ |
|||
|
|||
insert into `basic_user`(`id`,`user_type`,`company_id`,`username`,`login_name`,`password`,`password_modify_time`,`salt`,`email`,`mobile_number`,`mfa_secret`,`mfa_bind`,`last_login_time`,`flag`,`expire_time`,`create_time`,`creator_id`,`modify_time`,`modifier_id`) values (1,1,1,'admin','admin','nVg+buw0YAs=',1670312031273,'09bc3a7898','1053492832@qq.com',NULL,NULL,0,1706177793183,0,4114487556000,4114487556000,NULL,1670312031273,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` bigint DEFAULT NULL, |
|||
`request_ip` varchar(255) DEFAULT NULL, |
|||
`login_time` bigint DEFAULT NULL, |
|||
PRIMARY KEY (`id`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
|||
|
|||
/*Table structure for table `worker_node` */ |
|||
|
|||
DROP TABLE IF EXISTS `worker_node`; |
|||
|
|||
CREATE TABLE `worker_node` ( |
|||
`ID` bigint NOT NULL AUTO_INCREMENT COMMENT 'auto increment id', |
|||
`HOST_NAME` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'host name', |
|||
`PORT` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'port', |
|||
`TYPE` int NOT NULL COMMENT 'node type: ACTUAL or CONTAINER', |
|||
`LAUNCH_DATE` date NOT NULL COMMENT 'launch date', |
|||
`MODIFIED` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'modified time', |
|||
`CREATED` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'created time', |
|||
PRIMARY KEY (`ID`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='DB WorkerID Assigner for UID Generator'; |
|||
|
|||
/*!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/dongjian-dashboard-back/back/server/run && nohup /usr/local/java/jdk1.8.0_221/bin/java -server -Xms256m -Xmx256m -jar /home/dongjian-dashboard-back/back/server/run/dongjian-dashboard-back-controller-0.0.1-SNAPSHOT.jar > /dev/null 2>boot.log & |
|||
} |
|||
#停止方法 |
|||
stop(){ |
|||
ps -ef|grep java|grep dongjian-dashboard-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=dongjian-dashboard-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>dongjian-dashboard-back</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</parent> |
|||
<artifactId>dongjian-dashboard-back-common</artifactId> |
|||
<name>dongjian-dashboard-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>dongjian-dashboard-back-dao</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>dongjian-dashboard-back-util</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</dependency> |
|||
|
|||
</dependencies> |
|||
</project> |
|||
@ -0,0 +1,54 @@ |
|||
package com.dongjian.dashboard.back.common; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @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 = "data-center-business:"; |
|||
|
|||
//用户ID,登录名,企业ID,token
|
|||
public static final String ACCESS_TOKEN_FORMAT = "RequestHeader:AccessToken:{0}:{1}:{2}:{3}"; |
|||
|
|||
public static final String CAPTCHA_VERIFICATION = "CAPTCHA:VERIFICATION:"; |
|||
|
|||
public static final String DATASOURCE_PREFIX = "dataSourceForCompany_"; |
|||
|
|||
public static final String THIRD_DB_PREFIX = "data_center_dongjian_"; |
|||
|
|||
public static final int AURORA_IN_BATCH_SIZE = 1000; |
|||
|
|||
// 定义大类常量
|
|||
public static final int CATEGORY_ALARM = 1;//报警
|
|||
public static final int CATEGORY_ACCUMULATE = 2;//累积
|
|||
public static final int CATEGORY_MEASURE = 3;//计测
|
|||
public static final int CATEGORY_STATUS= 4;//状态
|
|||
|
|||
// 所有设备类型ID的总集合
|
|||
public static final List<Integer> ALL_DEVICE_TYPE_IDS = new ArrayList<>(); |
|||
|
|||
// 定义分类与设备类型的映射
|
|||
public static final Map<Integer, List<Integer>> CATEGORY_DEVICE_TYPE_MAP = new HashMap<>(); |
|||
static { |
|||
CATEGORY_DEVICE_TYPE_MAP.put(CATEGORY_ALARM, Arrays.asList(46, 110)); |
|||
CATEGORY_DEVICE_TYPE_MAP.put(CATEGORY_MEASURE, Arrays.asList(47, 111, 121)); |
|||
CATEGORY_DEVICE_TYPE_MAP.put(CATEGORY_ACCUMULATE, Arrays.asList(48, 112, 122)); |
|||
CATEGORY_DEVICE_TYPE_MAP.put(CATEGORY_STATUS, Arrays.asList(86, 113, 123)); |
|||
|
|||
// 收集所有的设备类型ID
|
|||
for (List<Integer> ids : CATEGORY_DEVICE_TYPE_MAP.values()) { |
|||
ALL_DEVICE_TYPE_IDS.addAll(ids); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,129 @@ |
|||
package com.dongjian.dashboard.back.common.config; |
|||
|
|||
import com.alibaba.druid.pool.DruidDataSource; |
|||
import com.dongjian.dashboard.back.common.Constants; |
|||
|
|||
import org.apache.ibatis.session.SqlSessionFactory; |
|||
import org.mybatis.spring.SqlSessionFactoryBean; |
|||
import org.mybatis.spring.SqlSessionTemplate; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Qualifier; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.boot.jdbc.DataSourceBuilder; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.context.annotation.Primary; |
|||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import javax.sql.DataSource; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
@Configuration |
|||
public class DataSourceAdminConfig { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(DataSourceAdminConfig.class); |
|||
|
|||
@Value("${spring.datasource.admin.name}") |
|||
private String name; |
|||
|
|||
@Value("${spring.datasource.admin.url}") |
|||
private String url; |
|||
|
|||
@Value("${spring.datasource.admin.username}") |
|||
private String username; |
|||
|
|||
@Value("${spring.datasource.admin.password}") |
|||
private String password; |
|||
|
|||
@Value("${spring.datasource.admin.driverClassName}") |
|||
private String driverClassName; |
|||
|
|||
@Value("${spring.datasource.admin.type}") |
|||
private String type; |
|||
|
|||
@Value("${dynamic.jdbc.url}") |
|||
private String dynamicJdbcUrl; |
|||
|
|||
|
|||
private final static String THIRD_DB_PREFIX = Constants.THIRD_DB_PREFIX; |
|||
|
|||
private final static String DATASOURCE_PREFIX = Constants.DATASOURCE_PREFIX; |
|||
|
|||
|
|||
@Primary |
|||
@Bean |
|||
public DataSource adminDatasource() { |
|||
DruidDataSource datasource = DataSourceBuilder.create() |
|||
.url(url) |
|||
.username(username) |
|||
.password(password).driverClassName(driverClassName) |
|||
.type(DruidDataSource.class) |
|||
.build(); |
|||
|
|||
return datasource; |
|||
} |
|||
|
|||
@Bean |
|||
public JdbcTemplate jdbcTemplate(DataSource adminDatasource) { |
|||
return new JdbcTemplate(adminDatasource); |
|||
} |
|||
|
|||
@Bean |
|||
@ConfigurationProperties(prefix = "mybatis.configuration") |
|||
public org.apache.ibatis.session.Configuration globalConfiguration() { |
|||
return new org.apache.ibatis.session.Configuration(); |
|||
} |
|||
|
|||
@Bean |
|||
public SqlSessionFactory sqlSessionFactory(@Qualifier("dynamicDataSource") DataSource dynamicDataSource) throws Exception { |
|||
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); |
|||
sessionFactory.setDataSource(dynamicDataSource); // 设置为动态数据源
|
|||
sessionFactory.setConfiguration(globalConfiguration());//驼峰设置mybatis.configuration.map-underscore-to-camel-case不生效处理
|
|||
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mappers/**/*.xml")); // 设置Mapper XML文件的位置
|
|||
return sessionFactory.getObject(); |
|||
} |
|||
|
|||
@Bean |
|||
public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) { |
|||
return new SqlSessionTemplate(sqlSessionFactory); |
|||
} |
|||
|
|||
|
|||
@Bean |
|||
public DataSource dynamicDataSource(JdbcTemplate jdbcTemplate, DataSource adminDatasource) { |
|||
DynamicRouteDataSource dynamicDataSource = new DynamicRouteDataSource(); |
|||
Map<Object, Object> targetDataSources = new HashMap<>(); |
|||
|
|||
//Requirement for 2024-07-16: Small enterprises and large enterprises share the same database. For large enterprises, parent_id = 1
|
|||
String sql="\t\tSELECT\n" + |
|||
"\t\t\tbcom.id,\n" + |
|||
"\t\t\tbcom.company_name companyName\n" + |
|||
"\t\tFROM\n" + |
|||
"\t\t\tdata_center_new.basic_company bcom\n" + |
|||
"\t\tWHERE bcom.flag != 1 and (parent_id = 1 or parent_id = -1)"; |
|||
|
|||
jdbcTemplate.query(sql,rs->{ |
|||
DruidDataSource dataSource1 = new DruidDataSource(); |
|||
String dbName=THIRD_DB_PREFIX+rs.getInt("id"); |
|||
String dbUrl=String.format(dynamicJdbcUrl,dbName); |
|||
dataSource1.setUrl(dbUrl); |
|||
dataSource1.setUsername(username); |
|||
dataSource1.setPassword(password); |
|||
dataSource1.setDriverClassName(driverClassName); |
|||
dataSource1.setDbType(type); |
|||
targetDataSources.put(DATASOURCE_PREFIX+rs.getInt("id"), dataSource1); |
|||
|
|||
}); |
|||
|
|||
dynamicDataSource.setTargetDataSources(targetDataSources); |
|||
dynamicDataSource.setDefaultTargetDataSource(adminDatasource); // 设置默认数据源
|
|||
return dynamicDataSource; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.dongjian.dashboard.back.common.config; |
|||
|
|||
public class DataSourceContextHolder { |
|||
|
|||
private static final ThreadLocal<String> contextHolder = new ThreadLocal<>(); |
|||
|
|||
public static void setCurrentDataSourceKey(String dataSourceKey) { |
|||
contextHolder.set(dataSourceKey); |
|||
} |
|||
|
|||
public static String getCurrentDataSourceKey() { |
|||
return contextHolder.get(); |
|||
} |
|||
|
|||
public static void clearCurrentDataSourceKey() { |
|||
contextHolder.remove(); |
|||
} |
|||
} |
|||
@ -0,0 +1,117 @@ |
|||
package com.dongjian.dashboard.back.common.config; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.jdbc.core.JdbcTemplate; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.servlet.HandlerInterceptor; |
|||
|
|||
import com.dongjian.dashboard.back.common.Constants; |
|||
|
|||
import jakarta.servlet.http.HttpServletRequest; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashSet; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
import java.util.concurrent.atomic.AtomicLong; |
|||
|
|||
|
|||
@Slf4j |
|||
@Component |
|||
public class DataSourceInterceptor implements HandlerInterceptor { |
|||
|
|||
@Autowired |
|||
JdbcTemplate jdbcTemplate; |
|||
|
|||
@Override |
|||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { |
|||
String companyId = request.getHeader("companyId"); |
|||
if (StringUtils.isNotBlank(companyId)) { |
|||
|
|||
// 如果包含 /role 或 /user,使用默认数据源(adminDatasource),不设置动态数据源
|
|||
String uri = request.getRequestURI(); |
|||
if (useDefaultDataSource(uri)){ |
|||
log.info("路径 {} 命中 adminDatasource,使用默认数据源", uri); |
|||
DataSourceContextHolder.clearCurrentDataSourceKey(); // 确保没有设置动态数据源键
|
|||
return true; |
|||
} |
|||
|
|||
|
|||
//Find the ID of the large enterprise.
|
|||
long topCompanyId = getTopCompanyId(companyId); |
|||
|
|||
String dataSourceKey = Constants.DATASOURCE_PREFIX + topCompanyId; // 创建数据源键
|
|||
log.info("当前数据源为:" + dataSourceKey); |
|||
DataSourceContextHolder.setCurrentDataSourceKey(dataSourceKey); |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
public boolean useDefaultDataSource(String uri) { |
|||
return uri.contains("/role") || uri.contains("/user"); |
|||
} |
|||
|
|||
public long getTopCompanyId(String companyId) { |
|||
|
|||
String sql="SELECT " |
|||
+ " bcom.id, bcom.parent_id parentId" |
|||
+ " FROM data_center_new.basic_company bcom " |
|||
+ " WHERE bcom.flag != 1 and bcom.id = " + companyId; |
|||
|
|||
AtomicLong parentId = new AtomicLong(0); |
|||
AtomicLong id = new AtomicLong(0); |
|||
jdbcTemplate.query(sql,rs -> { |
|||
parentId.set(rs.getLong("parentId")); |
|||
id.set(rs.getLong("id")); |
|||
}); |
|||
//Recursive logic
|
|||
if (1 == parentId.get() || -1 == parentId.get()) { |
|||
return id.get(); |
|||
} else { |
|||
return getTopCompanyId(parentId.get()+""); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 获取所有的一级企业 |
|||
* @return |
|||
*/ |
|||
public List<Long> getTopCompanyIdList(){ |
|||
List<Long> companyIdList=new ArrayList<>(); |
|||
String sql="\t\tSELECT\n" + |
|||
"\t\t\tbcom.id,\n" + |
|||
"\t\t\tbcom.company_name companyName\n" + |
|||
"\t\tFROM\n" + |
|||
"\t\t\tdata_center_new.basic_company bcom\n" + |
|||
"\t\tWHERE (bcom.parent_id=1 or bcom.parent_id=-1) and bcom.flag != 1"; |
|||
|
|||
jdbcTemplate.query(sql,rs->{ |
|||
companyIdList.add(rs.getLong("id")); |
|||
}); |
|||
|
|||
// // 用于存放去重后的 topCompanyIdList
|
|||
// List<Long> topCompanyIdList = new ArrayList<>();
|
|||
// Set<Long> seenIds = new HashSet<>(); // 用于快速判断重复
|
|||
// // 遍历 companyIdList
|
|||
// for (Integer companyId : companyIdList) {
|
|||
// Long topCompanyId = getTopCompanyId(companyId.toString());
|
|||
// // 如果 topCompanyId 未出现在 seenIds 中,则添加
|
|||
// if (seenIds.add(topCompanyId)) {
|
|||
// topCompanyIdList.add(topCompanyId);
|
|||
// }
|
|||
// }
|
|||
|
|||
return companyIdList; |
|||
} |
|||
|
|||
@Override |
|||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { |
|||
DataSourceContextHolder.clearCurrentDataSourceKey(); // 清理数据源键
|
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
package com.dongjian.dashboard.back.common.config; |
|||
|
|||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; |
|||
|
|||
|
|||
public class DynamicRouteDataSource extends AbstractRoutingDataSource { |
|||
|
|||
@Override |
|||
protected Object determineCurrentLookupKey() { |
|||
// 返回当前线程要使用的数据源的键
|
|||
return DataSourceContextHolder.getCurrentDataSourceKey(); |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
package com.dongjian.dashboard.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.dongjian.dashboard.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.dongjian.dashboard.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.dongjian.dashboard.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 languageType,String code){ |
|||
String msg = null; |
|||
if(null != languageType){ |
|||
if(languageType == 0){//中文
|
|||
msg = MapUtils.getString(msgCn.getParameterMap(), code, code); |
|||
}else if(languageType == 1){//英文
|
|||
msg = MapUtils.getString(msgEn.getParameterMap(), code, code); |
|||
}else if(languageType == 2){//日语
|
|||
msg = MapUtils.getString(msgJp.getParameterMap(), code, code); |
|||
} |
|||
}else{ |
|||
msg = MapUtils.getString(msgJp.getParameterMap(), code, code); |
|||
} |
|||
return msg; |
|||
} |
|||
|
|||
public String getOperationLogMapByCode(Integer languageType,String code){ |
|||
String msg = null; |
|||
if(null != languageType){ |
|||
if(languageType == 0){//中文
|
|||
msg = MapUtils.getString(msgCn.getOperationLogMap(), code, code); |
|||
}else if(languageType == 1){//英文
|
|||
msg = MapUtils.getString(msgEn.getOperationLogMap(), code, code); |
|||
}else if(languageType == 2){//日语
|
|||
msg = MapUtils.getString(msgJp.getOperationLogMap(), code, code); |
|||
} |
|||
}else{ |
|||
msg = MapUtils.getString(msgJp.getOperationLogMap(), code, code); |
|||
} |
|||
return msg; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
package com.dongjian.dashboard.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.dongjian.dashboard.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> reportMap; |
|||
|
|||
private Map<String,String> operationLogMap; |
|||
|
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
package com.dongjian.dashboard.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.dongjian.dashboard.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> reportMap; |
|||
|
|||
private Map<String,String> operationLogMap; |
|||
|
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
package com.dongjian.dashboard.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.dongjian.dashboard.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> reportMap; |
|||
|
|||
private Map<String,String> operationLogMap; |
|||
|
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
package com.dongjian.dashboard.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,401 @@ |
|||
package com.dongjian.dashboard.back.common.response; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.Collections; |
|||
import java.util.List; |
|||
|
|||
import com.github.pagehelper.Page; |
|||
import com.github.pagehelper.PageSerializable; |
|||
|
|||
/** |
|||
* 对Page<E>结果进行包装 |
|||
* <p/> |
|||
* 新增分页的多项属性,主要参考:http://bbs.csdn.net/topics/360010907
|
|||
* |
|||
* @author liuzh/abel533/isea533 |
|||
* @version 3.3.0 |
|||
* @since 3.2.2 |
|||
* 项目地址 : http://git.oschina.net/free/Mybatis_PageHelper
|
|||
*/ |
|||
@SuppressWarnings({"rawtypes", "unchecked"}) |
|||
public class PageInfo<T> extends PageSerializable<T> { |
|||
public static final int DEFAULT_NAVIGATE_PAGES = 8; |
|||
public static final PageInfo EMPTY = new PageInfo(Collections.emptyList(), 0); |
|||
/** |
|||
* 当前页 |
|||
*/ |
|||
private int pageNum; |
|||
/** |
|||
* 每页的数量 |
|||
*/ |
|||
private int pageSize; |
|||
/** |
|||
* 当前页的数量 |
|||
*/ |
|||
private int size; |
|||
|
|||
/** |
|||
* 由于startRow和endRow不常用,这里说个具体的用法 |
|||
* 可以在页面中"显示startRow到endRow 共size条数据" |
|||
* 当前页面第一个元素在数据库中的行号 |
|||
*/ |
|||
private long startRow; |
|||
/** |
|||
* 当前页面最后一个元素在数据库中的行号 |
|||
*/ |
|||
private long endRow; |
|||
/** |
|||
* 总页数 |
|||
*/ |
|||
private int pages; |
|||
/** |
|||
* 前一页 |
|||
*/ |
|||
private int prePage; |
|||
/** |
|||
* 下一页 |
|||
*/ |
|||
private int nextPage; |
|||
|
|||
/** |
|||
* 是否为第一页 |
|||
*/ |
|||
private boolean isFirstPage = false; |
|||
/** |
|||
* 是否为最后一页 |
|||
*/ |
|||
private boolean isLastPage = false; |
|||
/** |
|||
* 是否有前一页 |
|||
*/ |
|||
private boolean hasPreviousPage = false; |
|||
/** |
|||
* 是否有下一页 |
|||
*/ |
|||
private boolean hasNextPage = false; |
|||
|
|||
/** |
|||
* 导航页码数 |
|||
*/ |
|||
private int navigatePages; |
|||
/** |
|||
* 所有导航页号 |
|||
*/ |
|||
private int[] navigatepageNums; |
|||
/** |
|||
* 导航条上的第一页 |
|||
*/ |
|||
private int navigateFirstPage; |
|||
/** |
|||
* 导航条上的最后一页 |
|||
*/ |
|||
private int navigateLastPage; |
|||
|
|||
public PageInfo() { |
|||
} |
|||
|
|||
/** |
|||
* 包装Page对象 |
|||
* |
|||
* @param list |
|||
*/ |
|||
public PageInfo(List<? extends T> list) { |
|||
this(list, DEFAULT_NAVIGATE_PAGES); |
|||
} |
|||
|
|||
/** |
|||
* 包装Page对象 |
|||
* |
|||
* @param list page结果 |
|||
* @param navigatePages 页码数量 |
|||
*/ |
|||
public PageInfo(List<? extends T> list, int navigatePages) { |
|||
super(list); |
|||
if (list instanceof Page) { |
|||
Page page = (Page) list; |
|||
this.pageNum = page.getPageNum(); |
|||
this.pageSize = page.getPageSize(); |
|||
|
|||
this.pages = page.getPages(); |
|||
this.size = page.size(); |
|||
//由于结果是>startRow的,所以实际的需要+1
|
|||
if (this.size == 0) { |
|||
this.startRow = 0; |
|||
this.endRow = 0; |
|||
} else { |
|||
this.startRow = page.getStartRow() + 1; |
|||
//计算实际的endRow(最后一页的时候特殊)
|
|||
this.endRow = this.startRow - 1 + this.size; |
|||
} |
|||
} else if (list instanceof Collection) { |
|||
this.pageNum = 1; |
|||
this.pageSize = list.size(); |
|||
|
|||
this.pages = this.pageSize > 0 ? 1 : 0; |
|||
this.size = list.size(); |
|||
this.startRow = 0; |
|||
this.endRow = list.size() > 0 ? list.size() - 1 : 0; |
|||
} |
|||
if (list instanceof Collection) { |
|||
calcByNavigatePages(navigatePages); |
|||
} |
|||
} |
|||
|
|||
public static <T> PageInfo<T> of(List<? extends T> list) { |
|||
return new PageInfo<T>(list); |
|||
} |
|||
|
|||
public static <T> PageInfo<T> of(List<? extends T> list, int navigatePages) { |
|||
return new PageInfo<T>(list, navigatePages); |
|||
} |
|||
|
|||
/** |
|||
* 返回一个空的 Pageinfo 对象 |
|||
* |
|||
* @return |
|||
*/ |
|||
public static <T> PageInfo<T> emptyPageInfo() { |
|||
return EMPTY; |
|||
} |
|||
|
|||
public void calcByNavigatePages(int navigatePages) { |
|||
setNavigatePages(navigatePages); |
|||
//计算导航页
|
|||
calcNavigatepageNums(); |
|||
//计算前后页,第一页,最后一页
|
|||
calcPage(); |
|||
//判断页面边界
|
|||
judgePageBoudary(); |
|||
} |
|||
|
|||
/** |
|||
* 计算导航页 |
|||
*/ |
|||
private void calcNavigatepageNums() { |
|||
//当总页数小于或等于导航页码数时
|
|||
if (pages <= navigatePages) { |
|||
navigatepageNums = new int[pages]; |
|||
for (int i = 0; i < pages; i++) { |
|||
navigatepageNums[i] = i + 1; |
|||
} |
|||
} else { //当总页数大于导航页码数时
|
|||
navigatepageNums = new int[navigatePages]; |
|||
int startNum = pageNum - navigatePages / 2; |
|||
int endNum = pageNum + navigatePages / 2; |
|||
|
|||
if (startNum < 1) { |
|||
startNum = 1; |
|||
//(最前navigatePages页
|
|||
for (int i = 0; i < navigatePages; i++) { |
|||
navigatepageNums[i] = startNum++; |
|||
} |
|||
} else if (endNum > pages) { |
|||
endNum = pages; |
|||
//最后navigatePages页
|
|||
for (int i = navigatePages - 1; i >= 0; i--) { |
|||
navigatepageNums[i] = endNum--; |
|||
} |
|||
} else { |
|||
//所有中间页
|
|||
for (int i = 0; i < navigatePages; i++) { |
|||
navigatepageNums[i] = startNum++; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 计算前后页,第一页,最后一页 |
|||
*/ |
|||
private void calcPage() { |
|||
if (navigatepageNums != null && navigatepageNums.length > 0) { |
|||
navigateFirstPage = navigatepageNums[0]; |
|||
navigateLastPage = navigatepageNums[navigatepageNums.length - 1]; |
|||
if (pageNum > 1) { |
|||
prePage = pageNum - 1; |
|||
} |
|||
if (pageNum < pages) { |
|||
nextPage = pageNum + 1; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 判定页面边界 |
|||
*/ |
|||
private void judgePageBoudary() { |
|||
isFirstPage = pageNum == 1; |
|||
isLastPage = pageNum == pages || pages == 0; |
|||
hasPreviousPage = pageNum > 1; |
|||
hasNextPage = pageNum < pages; |
|||
} |
|||
|
|||
/** |
|||
* 是否包含内容 |
|||
*/ |
|||
public boolean hasContent() { |
|||
return this.size > 0; |
|||
} |
|||
|
|||
public int getPageNum() { |
|||
return pageNum; |
|||
} |
|||
|
|||
public void setPageNum(int pageNum) { |
|||
this.pageNum = pageNum; |
|||
} |
|||
|
|||
public int getPageSize() { |
|||
return pageSize; |
|||
} |
|||
|
|||
public void setPageSize(int pageSize) { |
|||
this.pageSize = pageSize; |
|||
} |
|||
|
|||
public int getSize() { |
|||
return size; |
|||
} |
|||
|
|||
public void setSize(int size) { |
|||
this.size = size; |
|||
} |
|||
|
|||
public long getStartRow() { |
|||
return startRow; |
|||
} |
|||
|
|||
public void setStartRow(long startRow) { |
|||
this.startRow = startRow; |
|||
} |
|||
|
|||
public long getEndRow() { |
|||
return endRow; |
|||
} |
|||
|
|||
public void setEndRow(long endRow) { |
|||
this.endRow = endRow; |
|||
} |
|||
|
|||
public int getPages() { |
|||
return pages; |
|||
} |
|||
|
|||
public void setPages(int pages) { |
|||
this.pages = pages; |
|||
} |
|||
|
|||
public int getPrePage() { |
|||
return prePage; |
|||
} |
|||
|
|||
public void setPrePage(int prePage) { |
|||
this.prePage = prePage; |
|||
} |
|||
|
|||
public int getNextPage() { |
|||
return nextPage; |
|||
} |
|||
|
|||
public void setNextPage(int nextPage) { |
|||
this.nextPage = nextPage; |
|||
} |
|||
|
|||
public boolean isIsFirstPage() { |
|||
return isFirstPage; |
|||
} |
|||
|
|||
public void setIsFirstPage(boolean isFirstPage) { |
|||
this.isFirstPage = isFirstPage; |
|||
} |
|||
|
|||
public boolean isIsLastPage() { |
|||
return isLastPage; |
|||
} |
|||
|
|||
public void setIsLastPage(boolean isLastPage) { |
|||
this.isLastPage = isLastPage; |
|||
} |
|||
|
|||
public boolean isHasPreviousPage() { |
|||
return hasPreviousPage; |
|||
} |
|||
|
|||
public void setHasPreviousPage(boolean hasPreviousPage) { |
|||
this.hasPreviousPage = hasPreviousPage; |
|||
} |
|||
|
|||
public boolean isHasNextPage() { |
|||
return hasNextPage; |
|||
} |
|||
|
|||
public void setHasNextPage(boolean hasNextPage) { |
|||
this.hasNextPage = hasNextPage; |
|||
} |
|||
|
|||
public int getNavigatePages() { |
|||
return navigatePages; |
|||
} |
|||
|
|||
public void setNavigatePages(int navigatePages) { |
|||
this.navigatePages = navigatePages; |
|||
} |
|||
|
|||
public int[] getNavigatepageNums() { |
|||
return navigatepageNums; |
|||
} |
|||
|
|||
public void setNavigatepageNums(int[] navigatepageNums) { |
|||
this.navigatepageNums = navigatepageNums; |
|||
} |
|||
|
|||
public int getNavigateFirstPage() { |
|||
return navigateFirstPage; |
|||
} |
|||
|
|||
public int getNavigateLastPage() { |
|||
return navigateLastPage; |
|||
} |
|||
|
|||
public void setNavigateFirstPage(int navigateFirstPage) { |
|||
this.navigateFirstPage = navigateFirstPage; |
|||
} |
|||
|
|||
public void setNavigateLastPage(int navigateLastPage) { |
|||
this.navigateLastPage = navigateLastPage; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
final StringBuilder sb = new StringBuilder("PageInfo{"); |
|||
sb.append("pageNum=").append(pageNum); |
|||
sb.append(", pageSize=").append(pageSize); |
|||
sb.append(", size=").append(size); |
|||
sb.append(", startRow=").append(startRow); |
|||
sb.append(", endRow=").append(endRow); |
|||
sb.append(", total=").append(total); |
|||
sb.append(", pages=").append(pages); |
|||
sb.append(", list=").append(list); |
|||
sb.append(", prePage=").append(prePage); |
|||
sb.append(", nextPage=").append(nextPage); |
|||
sb.append(", isFirstPage=").append(isFirstPage); |
|||
sb.append(", isLastPage=").append(isLastPage); |
|||
sb.append(", hasPreviousPage=").append(hasPreviousPage); |
|||
sb.append(", hasNextPage=").append(hasNextPage); |
|||
sb.append(", navigatePages=").append(navigatePages); |
|||
sb.append(", navigateFirstPage=").append(navigateFirstPage); |
|||
sb.append(", navigateLastPage=").append(navigateLastPage); |
|||
sb.append(", navigatepageNums="); |
|||
if (navigatepageNums == null) { |
|||
sb.append("null"); |
|||
} else { |
|||
sb.append('['); |
|||
for (int i = 0; i < navigatepageNums.length; ++i) { |
|||
sb.append(i == 0 ? "" : ", ").append(navigatepageNums[i]); |
|||
} |
|||
sb.append(']'); |
|||
} |
|||
sb.append('}'); |
|||
return sb.toString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
package com.dongjian.dashboard.back.common.response; |
|||
|
|||
import com.github.pagehelper.PageInfo; |
|||
|
|||
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((PageInfo) 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,32 @@ |
|||
package com.dongjian.dashboard.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 AUTHORIZE_FAILED = 401; |
|||
|
|||
//服务器内部错误
|
|||
public static final int SERVER_ERROR = 500; |
|||
public static final String SERVER_ERROR_MSG = "service error"; |
|||
|
|||
/** 系统错误 */ |
|||
public static final int SYSTEM_ERROR = 20000; |
|||
//
|
|||
public static final int MSG_ERROR = 20001; |
|||
|
|||
public static final int MSG_DATA_NULL_ERROR = 20002; |
|||
|
|||
public static final int MSG_DATA_ERROR = 20003; |
|||
} |
|||
@ -0,0 +1,104 @@ |
|||
package com.dongjian.dashboard.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,131 @@ |
|||
msgcn: |
|||
parameterMap: |
|||
serviceError: 内部服务错误 |
|||
tokenError: 接口鉴权失败 |
|||
excelEmpty: 表格为空 |
|||
lineNum: 第{0}行: |
|||
paramsFormatError: 参数格式错误 |
|||
verifCodeExpired: 验证码过期 |
|||
verifCodeError: 验证码错误 |
|||
accountExpired: 该账号已过期 |
|||
pwdError: 密码错误 |
|||
userNotExist: 用户不存在 |
|||
noOperationAuth: 无操作权限 |
|||
projectNameHasExisted: 项目名称已存在 |
|||
projectNameDoesNotExist: 项目名称不存在 |
|||
buildingNameHasExisted: 楼宇名称已存在 |
|||
buildingNameDoesNotExist: 楼宇名称不存在 |
|||
floorNameHasExisted: 楼层名称已存在 |
|||
floorNameDoesNotExist: 楼层名称不存在 |
|||
buildingNotFound: 不存在该楼宇 |
|||
fbNotSameCompany: 需与楼宇归属于同一企业 |
|||
spaceNameHasExisted: 房间名称已存在 |
|||
floorNotFound: 不存在该楼层 |
|||
rfNotSameCompany: 需与楼层归属于同一企业 |
|||
assetNameHasExisted: 资产名称已存在 |
|||
assetSymbolHasExisted: 资产记号已存在 |
|||
assetNameDoesNotExist: 资产名称不存在 |
|||
assetSymbolDoesNotExist: 资产记号不存在 |
|||
spaceNotFound: 不存在该房间 |
|||
faNotSameCompany: 需与房间归属于同一企业 |
|||
bindedDevice: 绑定了设备 |
|||
deviceTypeNotExist: 设备类型不存在 |
|||
excelBuildingLineDuplicate: 表格内存在相同的数据 |
|||
dbBuildingDuplicate: 平台已存在此楼宇 |
|||
dbFloorDuplicate: 平台已存在此楼层 |
|||
dbSpaceDuplicate: 平台已存在此房间 |
|||
dbAssetDuplicate: 平台已存在此资产 |
|||
excelCompanyNameIsNull: 需填写企业名称 |
|||
excelBuildingNameIsNull: 需填写楼宇 |
|||
excelFloorNameIsNull: 需填写楼层 |
|||
excelSpaceNameIsNull: 需填写房间 |
|||
excelSpaceOrFloorNameIsNull: 需填写楼层和房间 |
|||
excelCompanyNameNotExist: 平台不存在此企业名称 |
|||
userOrEmailNotExist: 用户名或邮箱不存在 |
|||
companyNameHasExisted: 平台已存在此企业 |
|||
taowaComapny: 不可使用下级企业作为父企业 |
|||
hasSubsidiary: 删除的企业拥有下级企业,需先处理下级企业 |
|||
roleNameExist: 角色名已存在 |
|||
roleHasBinded: 角色已绑定用户,请先解绑再删除 |
|||
loginNameOrEmailHasExisted: 用户名或邮箱已被使用 |
|||
mailAddUserPwdSubject: 新建账号密码 |
|||
mailAddUserPwdContent: '账号 <u>{0}</u> 的密码为 <span style="text-transform: none;"><u>{1}</u></span> 请妥善保管<br/><br/>登陆网址:<u>{2}</u>' |
|||
mailResetUserPwdSubject: 重置账号密码 |
|||
pwdFormatError: 密码组成必须包含数字、英文字母、特殊符号(~!@#$%^&*)且大于等于12位 |
|||
oldPwdError: 旧密码错误 |
|||
newPwdSameOld: 新密码不得与旧密码相同 |
|||
companyLimit: 最多可创建15个企业 |
|||
consecutiveLoginFail: 登录失败次数过多,请等待{0}分{1}秒后再登录 |
|||
loginFailCount: 已登录失败{0}次,剩余尝试登录次数:{1} |
|||
deviceGroupNameHasExisted: 此设备组名称已存在 |
|||
groupTypeNotMatch: 设备类型与分组类型不匹配 |
|||
monitoringPointCategoryNameHasExisted: 此监控点分类名称已存在 |
|||
monitoringPointCategoryGroupNameHasExisted: 此监控点分组名称已存在 |
|||
alertLevel_1: 正常 |
|||
alertLevel_2: 紧急故障 |
|||
alertLevel_3: 严重故障 |
|||
alertLevel_4: 中等故障 |
|||
alertLevel_5: 轻微故障 |
|||
confirmStatus_0: 未确认 |
|||
confirmStatus_1: 已确认 |
|||
handleStatus_1: 未对应 |
|||
handleStatus_2: 对应中 |
|||
handleStatus_3: 完成 |
|||
handleStatus_4: 自动恢复 |
|||
canNotProcessed: 无法再处理 |
|||
alreadyExists: 平台已存在 |
|||
hasChildLevel: 存在下级层级,不允许删除 |
|||
operationLogMap: |
|||
addRole: 新增角色 |
|||
editRole: 编辑角色 |
|||
deleteRole: 删除角色 |
|||
queryRole: 查询角色列表 |
|||
addUser: 添加用户 |
|||
editUser: 编辑用户 |
|||
deleteUser: 删除用户 |
|||
resetPassword: 重置密码 |
|||
changePassword: 修改密码 |
|||
unbindMFADevice: 解绑MFA设备 |
|||
queryUser: 查询用户列表 |
|||
queryOperationLog: 查询操作日志 |
|||
getS3Credentials: 获取s3文件操作token |
|||
addSlack: 新增slack |
|||
editSlack: 编辑slack |
|||
deleteSlack: 删除slack |
|||
querySlack: 查询slack列表 |
|||
addTeams: 新增teams |
|||
editTeams: 编辑teams |
|||
deleteTeams: 删除teams |
|||
queryTeams: 获取teams列表 |
|||
getCumulativeDataList: 获取积算数据列表 |
|||
queryDeviceList: 获取设备列表 |
|||
addDeviceGroup: 新增设备组 |
|||
editDeviceGroup: 编辑设备组 |
|||
deleteDeviceGroup: 删除设备组 |
|||
queryDeviceGroup: 获取设备组列表 |
|||
bindGroupForDevice: 给设备绑定设备组 |
|||
bindDeviceForGroup: 给设备组设置绑定的设备 |
|||
addMonitoringPointCategory: 新增监控点分类 |
|||
editMonitoringPointCategory: 编辑监控点分类 |
|||
deleteMonitoringPointCategory: 删除监控点分类 |
|||
queryMonitoringPointCategory: 获取监控点分类列表 |
|||
addMonitoringPointCategoryGroup: 新增监控点分类组 |
|||
editMonitoringPointCategoryGroup: 编辑监控点分类组 |
|||
deleteMonitoringPointCategoryGroup: 删除监控点分类组 |
|||
queryMonitoringPointCategoryGroup: 获取监控点分类组列表 |
|||
bindGroupForCategory: 给监控点分类绑定分组 |
|||
bindCategoryForGroup: 给分组设置绑定的监控点分类 |
|||
confirmAlarm: 确认告警 |
|||
handleAlarm: 处理告警 |
|||
exportCumulativeData: 导出积算数据 |
|||
getAlarmDataList: 获取告警数据列表 |
|||
exportAlarmData: 导出告警数据 |
|||
getMeasureDataList: 获取计量数据列表 |
|||
exportMeasureData: 导出计量数据 |
|||
getBaStatusDataList: 获取运行状态列表 |
|||
exportBaStatusData: 导出运行状态数据 |
|||
getFavoriteList: 获取收藏设备列表 |
|||
removeFavoriteDevice: 删除收藏设备 |
|||
addFavoriteDevice: 新增收藏设备 |
|||
|
|||
|
|||
@ -0,0 +1,136 @@ |
|||
msgen: |
|||
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. |
|||
projectNameHasExisted: Project name already exists. |
|||
projectNameDoesNotExist: Project name does not exist. |
|||
buildingNameHasExisted: Building name already exists. |
|||
buildingNameDoesNotExist: Building name does not exist. |
|||
floorNameHasExisted: Floor name already exists. |
|||
floorNameDoesNotExist: Floor name does not exist. |
|||
buildingNotFound: Building not found. |
|||
fbNotSameCompany: Must belong to the same company as the building. |
|||
spaceNameHasExisted: Room name already exists. |
|||
floorNotFound: Floor not found. |
|||
rfNotSameCompany: Must belong to the same company as the floor. |
|||
assetNameHasExisted: Asset name already exists. |
|||
assetSymbolHasExisted: Asset symbol already exists. |
|||
assetNameDoesNotExist: Asset name does not exist. |
|||
assetSymbolDoesNotExist: 资产记号不存在 |
|||
spaceNotFound: Room not found. |
|||
faNotSameCompany: Must belong to the same company as the room. |
|||
bindedDevice: Device is bound. |
|||
deviceTypeNotExist: Device type does not exist. |
|||
excelBuildingLineDuplicate: Duplicate data exists in the spreadsheet. |
|||
dbBuildingDuplicate: This building already exists on the platform. |
|||
dbFloorDuplicate: 平台已存在此楼层 |
|||
dbSpaceDuplicate: 平台已存在此房间 |
|||
dbAssetDuplicate: 平台已存在此资产 |
|||
excelCompanyNameIsNull: Company name needs to be filled out. |
|||
excelBuildingNameIsNull: Building name needs to be filled out. |
|||
excelFloorNameIsNull: 需填写楼层 |
|||
excelSpaceNameIsNull: 需填写房间 |
|||
excelSpaceOrFloorNameIsNull: 需填写楼层和房间 |
|||
excelCompanyNameNotExist: The platform does not have this company name. |
|||
userOrEmailNotExist: 用户名或邮箱不存在 |
|||
companyNameHasExisted: 平台已存在此企业 |
|||
taowaComapny: 不可使用下级企业作为父企业 |
|||
hasSubsidiary: 删除的企业拥有下级企业,需先处理下级企业 |
|||
roleNameExist: 角色名已存在 |
|||
roleHasBinded: 角色已绑定用户,请先解绑再删除 |
|||
loginNameOrEmailHasExisted: 用户名或邮箱已被使用 |
|||
mailAddUserPwdSubject: 新建账号密码 |
|||
mailAddUserPwdContent: '账号 <u>{0}</u> 的密码为 <span style="text-transform: none;"><u>{1}</u></span> 请妥善保管<br/><br/>登陆网址:<u>{2}</u>' |
|||
mailResetUserPwdSubject: 重置账号密码 |
|||
pwdFormatError: 密码组成必须包含数字、英文字母、特殊符号(~!@#$%^&*)且大于等于12位 |
|||
oldPwdError: 旧密码错误 |
|||
newPwdSameOld: 新密码不得与旧密码相同 |
|||
companyLimit: 最多可创建15个企业 |
|||
consecutiveLoginFail: Too many failed login attempts. Please wait {0} minute(s) and {1} second(s) before trying again. |
|||
loginFailCount: Login failed {0} times. Remaining login attempts:{1}. |
|||
deviceGroupNameHasExisted: Device group name already exists. |
|||
groupTypeNotMatch: Device type does not match the group type |
|||
monitoringPointCategoryNameHasExisted: This monitoring point category name already exists |
|||
monitoringPointCategoryGroupNameHasExisted: The monitoring point group name already exists |
|||
alertLevel_1: Normal |
|||
alertLevel_2: Critical Fault |
|||
alertLevel_3: Severe Fault |
|||
alertLevel_4: Moderate Fault |
|||
alertLevel_5: Minor Fault |
|||
confirmStatus_0: Unconfirmed |
|||
confirmStatus_1: Confirmed |
|||
handleStatus_1: Not Handled |
|||
handleStatus_2: Handling |
|||
handleStatus_3: Completed |
|||
handleStatus_4: Auto Recovered |
|||
canNotProcessed: Can not be processed further |
|||
alreadyExists: 平台已存在 |
|||
hasChildLevel: 存在下级层级,不允许删除 |
|||
operationLogMap: |
|||
addRole: Add Role |
|||
editRole: Edit Role |
|||
deleteRole: Delete Role |
|||
queryRole: Query Role List |
|||
addUser: Add user |
|||
editUser: Edit user |
|||
deleteUser: Delete user |
|||
resetPassword: Reset password |
|||
changePassword: Change password |
|||
unbindMFADevice: Unbind MFA device |
|||
queryUser: Query user list |
|||
queryOperationLog: Query operation log |
|||
getS3Credentials: Get S3 file operation token |
|||
addSlack: Add Slack |
|||
editSlack: Edit Slack |
|||
deleteSlack: Delete Slack |
|||
querySlack: Query Slack List |
|||
addTeams: Add Teams |
|||
editTeams: Edit Teams |
|||
deleteTeams: Delete Teams |
|||
queryTeams: Query Teams List |
|||
getCumulativeDataList: Get Cumulative Data List |
|||
queryDeviceList: Get Device List |
|||
addDeviceGroup: Add Device Group |
|||
editDeviceGroup: Edit Device Group |
|||
deleteDeviceGroup: Delete Device Group |
|||
queryDeviceGroup: Get Device Group List |
|||
bindGroupForDevice: Bind device to device group |
|||
bindDeviceForGroup: Set bound devices for the device group |
|||
addMonitoringPointCategory: Add Monitoring Point Category |
|||
editMonitoringPointCategory: Edit Monitoring Point Category |
|||
deleteMonitoringPointCategory: Delete Monitoring Point Category |
|||
queryMonitoringPointCategory: Get Monitoring Point Category List |
|||
addMonitoringPointCategoryGroup: Add monitoring point category group |
|||
editMonitoringPointCategoryGroup: Edit monitoring point category group |
|||
deleteMonitoringPointCategoryGroup: Delete monitoring point category group |
|||
queryMonitoringPointCategoryGroup: Get monitoring point category group list |
|||
bindGroupForCategory: Bind group to monitoring point category |
|||
bindCategoryForGroup: Bind monitoring point categories to group |
|||
confirmAlarm: Confirm Alarm |
|||
handleAlarm: Handle Alarm |
|||
exportCumulativeData: Export cumulative data |
|||
getAlarmDataList: Get alarm data list |
|||
exportAlarmData: Export alarm data |
|||
getMeasureDataList: Get measurement data list |
|||
exportMeasureData: Export measurement data |
|||
getBaStatusDataList: Get operation status list |
|||
exportBaStatusData: Export operation status data |
|||
getFavoriteList: Get list of favorited devices |
|||
removeFavoriteDevice: Remove favorited device |
|||
addFavoriteDevice: Add favorited device |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,135 @@ |
|||
msgjp: |
|||
parameterMap: |
|||
serviceError: 内部サービスのエラー |
|||
tokenError: インターフェイスの認証に失敗 |
|||
excelEmpty: フォームが空になっている |
|||
lineNum: 行{0}: |
|||
paramsFormatError: パラメータのフォーマットエラー |
|||
verifCodeExpired: 確認コード期限切れ |
|||
verifCodeError: 確認コードエラー |
|||
accountExpired: アカウントの有効期限が切れている |
|||
pwdError: パスワードエラー |
|||
userNotExist: ユーザーが存在しない |
|||
noOperationAuth: 操作権限なし |
|||
projectNameHasExisted: プロジェクト名がすでにある |
|||
projectNameDoesNotExist: プロジェクト名がない |
|||
buildingNameHasExisted: 該当ビル名がすでにある |
|||
buildingNameDoesNotExist: 該当ビル名がない |
|||
floorNameHasExisted: 該当フロア名がすでにある |
|||
floorNameDoesNotExist: 該当フロア名がない |
|||
buildingNotFound: 該当ビルがない |
|||
fbNotSameCompany: ビルと同じ会社に所属してください |
|||
spaceNameHasExisted: 該当部屋名がすでにある |
|||
floorNotFound: 該当フロア名がない |
|||
rfNotSameCompany: フロアと同じ会社に所属してください |
|||
assetNameHasExisted: 該当資産名がすでにある |
|||
assetSymbolHasExisted: 記号はすでに存在します |
|||
assetNameDoesNotExist: 該当資産名がない |
|||
assetSymbolDoesNotExist: 資産記号が存在しません |
|||
spaceNotFound: 該当部屋がない |
|||
faNotSameCompany: 部屋と同じ会社に所属してください |
|||
bindedDevice: デバイスと関連付け |
|||
deviceTypeNotExist: デバイスタイプがない |
|||
excelBuildingLineDuplicate: テーブルに同じデータがある |
|||
dbBuildingDuplicate: プラットフォームにすでに該当ビルがない |
|||
dbFloorDuplicate: プラットフォームには既にこのフロアが存在しています。 |
|||
dbSpaceDuplicate: プラットフォームには既にこのスペースが存在しています。 |
|||
dbAssetDuplicate: プラットフォームには既にこのアセットが存在しています。 |
|||
excelCompanyNameIsNull: 会社名を入力してください |
|||
excelBuildingNameIsNull: ビルを入力してください |
|||
excelFloorNameIsNull: フロア名を入力してください。 |
|||
excelSpaceNameIsNull: スペース名を入力してください。 |
|||
excelSpaceOrFloorNameIsNull: フロア名とスペース名を入力してください。 |
|||
excelCompanyNameNotExist: プラットフォーム上に該当会社名はない |
|||
userOrEmailNotExist: ユーザーが存在しません |
|||
companyNameHasExisted: 会社はすでにプラットフォーム上に存在する |
|||
taowaComapny: 下位の会社を親会社として利用することは不可 |
|||
hasSubsidiary: 削除対象の会社には下位の会社があるので、先に下位の会社を対応してください |
|||
roleNameExist: 役割名が既に登録済み |
|||
roleHasBinded: 役割はユーザーにバインドされている ので、削除する前にバインドを解除してください |
|||
loginNameOrEmailHasExisted: ユーザー名またはメールボックスはすでに使用されています |
|||
mailAddUserPwdSubject: 新規アカウント・パスワードの作成 |
|||
mailAddUserPwdContent: 'アカウント <u>{0}</u> のパスワードは <span style="text-transform: none;"><u>{1}</u></span> お忘れにならないようにお願いします。<br/><br/>ログインWebアドレス:<u>{2}</u>' |
|||
mailResetUserPwdSubject: アカウント・パスワードのリセット |
|||
pwdFormatError: パスワードの構成には、数字、アルファベット、特殊文字(~!@#$%^&*) で、12桁以上 |
|||
oldPwdError: 旧パスワードエラー |
|||
newPwdSameOld: 注:旧パスワードと同じものを使用しないでください |
|||
companyLimit: 最大15のエンタープライズを作成可能 |
|||
consecutiveLoginFail: ログインの失敗が多すぎます。{0}分{1}秒待ってから再度ログインしてください。 |
|||
loginFailCount: ログインに{0}回失敗しました。残りの試行回数:{1}回。 |
|||
deviceGroupNameHasExisted: デバイスグループ名は既に存在しています。 |
|||
groupTypeNotMatch: デバイスタイプがグループタイプと一致しません。 |
|||
monitoringPointCategoryNameHasExisted: この監視ポイントカテゴリ名は既に存在します |
|||
monitoringPointCategoryGroupNameHasExisted: この監視ポイントグループ名は既に存在します |
|||
alertLevel_1: 通常 |
|||
alertLevel_2: 緊急故障 |
|||
alertLevel_3: 深刻な故障 |
|||
alertLevel_4: 中程度の故障 |
|||
alertLevel_5: 軽微な故障 |
|||
confirmStatus_0: 未確認 |
|||
confirmStatus_1: 確認済み |
|||
handleStatus_1: 未対応 |
|||
handleStatus_2: 対応中 |
|||
handleStatus_3: 完了 |
|||
handleStatus_4: 自動復旧 |
|||
canNotProcessed: これ以上の処理はできません |
|||
alreadyExists: 平台已存在 |
|||
hasChildLevel: 存在下级层级,不允许删除 |
|||
operationLogMap: |
|||
addRole: ロールを追加 |
|||
editRole: ロールを編集 |
|||
deleteRole: ロールを削除 |
|||
queryRole: ロール一覧を取得 |
|||
addUser: ユーザーを追加 |
|||
editUser: ユーザーを編集 |
|||
deleteUser: ユーザーを削除 |
|||
resetPassword: パスワードをリセット |
|||
changePassword: パスワードを変更 |
|||
unbindMFADevice: MFAデバイスの連携を解除 |
|||
queryUser: ユーザー一覧を取得 |
|||
queryOperationLog: 操作ログを照会する |
|||
getS3Credentials: S3ファイル操作トークンを取得する |
|||
addSlack: Slackを追加 |
|||
editSlack: Slackを編集 |
|||
deleteSlack: Slackを削除 |
|||
querySlack: Slackリストを取得 |
|||
addTeams: Teamsを追加 |
|||
editTeams: Teamsを編集 |
|||
deleteTeams: Teamsを削除 |
|||
queryTeams: Teamsリストを取得 |
|||
getCumulativeDataList: 積算データ一覧を取得 |
|||
queryDeviceList: デバイス一覧を取得 |
|||
addDeviceGroup: デバイスグループを追加 |
|||
editDeviceGroup: デバイスグループを編集 |
|||
deleteDeviceGroup: デバイスグループを削除 |
|||
queryDeviceGroup: デバイスグループ一覧を取得 |
|||
bindGroupForDevice: デバイスにデバイスグループを割り当てる |
|||
bindDeviceForGroup: デバイスグループに紐付けるデバイスを設定する |
|||
addMonitoringPointCategory: 監視ポイントカテゴリを追加 |
|||
editMonitoringPointCategory: 監視ポイントカテゴリを編集 |
|||
deleteMonitoringPointCategory: 監視ポイントカテゴリを削除 |
|||
queryMonitoringPointCategory: 監視ポイントカテゴリ一覧を取得 |
|||
addMonitoringPointCategoryGroup: 監視ポイントカテゴリグループを追加 |
|||
editMonitoringPointCategoryGroup: 監視ポイントカテゴリグループを編集 |
|||
deleteMonitoringPointCategoryGroup: 監視ポイントカテゴリグループを削除 |
|||
queryMonitoringPointCategoryGroup: 監視ポイントカテゴリグループ一覧を取得 |
|||
bindGroupForCategory: 監視ポイントカテゴリにグループをバインド |
|||
bindCategoryForGroup: グループに監視ポイントカテゴリをバインド |
|||
confirmAlarm: アラームを確認 |
|||
handleAlarm: アラームを対応 |
|||
exportCumulativeData: 積算データをエクスポート |
|||
getAlarmDataList: アラームデータ一覧を取得 |
|||
exportAlarmData: アラームデータをエクスポート |
|||
getMeasureDataList: 計測データ一覧を取得 |
|||
exportMeasureData: 計測データをエクスポート |
|||
getBaStatusDataList: 稼働設備一覧を取得 |
|||
exportBaStatusData: 稼働設備データをエクスポート |
|||
getFavoriteList: お気に入りデバイス一覧を取得 |
|||
removeFavoriteDevice: お気に入りデバイスを削除 |
|||
addFavoriteDevice: お気に入りデバイスを追加 |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,15 @@ |
|||
/target/ |
|||
/logs/ |
|||
/.idea/ |
|||
*.iml |
|||
*.bak |
|||
*.log |
|||
/.settings/ |
|||
*.project |
|||
*.classpath |
|||
*.factorypath |
|||
*.springBeans |
|||
/.apt_generated/ |
|||
/.externalToolBuilders/ |
|||
/bin/ |
|||
application-*.properties |
|||
@ -0,0 +1,11 @@ |
|||
aws configure set aws_access_key_id AKIAQNYBBSGDVT3VF4ON |
|||
aws configure set aws_secret_access_key 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 |
|||
aws configure set default.region ap-northeast-1 |
|||
aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin 029530100103.dkr.ecr.ap-northeast-1.amazonaws.com |
|||
|
|||
docker build -t 029530100103.dkr.ecr.ap-northeast-1.amazonaws.com/aeon/dashboard-back:latest\ |
|||
--build-arg JAR_FILE=target/dongjian-dashboard-back-controller-0.0.1-SNAPSHOT.jar \ |
|||
--build-arg LIB_DIR=target/lib \ |
|||
--build-arg CONFIG_DIR=target/config \ |
|||
. |
|||
docker push 029530100103.dkr.ecr.ap-northeast-1.amazonaws.com/aeon/dashboard-back:latest |
|||
@ -0,0 +1,11 @@ |
|||
aws configure set aws_access_key_id AKIAVRXFMB43TOELSROK |
|||
aws configure set aws_secret_access_key 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 |
|||
aws configure set default.region ap-northeast-1 |
|||
aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin 381659385655.dkr.ecr.ap-northeast-1.amazonaws.com |
|||
|
|||
docker build -t 381659385655.dkr.ecr.ap-northeast-1.amazonaws.com/dashboard-back:latest\ |
|||
--build-arg JAR_FILE=target/dongjian-dashboard-back-controller-0.0.1-SNAPSHOT.jar \ |
|||
--build-arg LIB_DIR=target/lib \ |
|||
--build-arg CONFIG_DIR=target/config \ |
|||
. |
|||
docker push 381659385655.dkr.ecr.ap-northeast-1.amazonaws.com/dashboard-back:latest |
|||
@ -0,0 +1,11 @@ |
|||
aws configure set aws_access_key_id AKIA5OFH5OOZPCXZIRUQ |
|||
aws configure set aws_secret_access_key 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 |
|||
aws configure set default.region ap-northeast-1 |
|||
aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin 923770123186.dkr.ecr.ap-northeast-1.amazonaws.com |
|||
|
|||
docker build -t 923770123186.dkr.ecr.ap-northeast-1.amazonaws.com/dashboard-back:latest\ |
|||
--build-arg JAR_FILE=target/dongjian-dashboard-back-controller-0.0.1-SNAPSHOT.jar \ |
|||
--build-arg LIB_DIR=target/lib \ |
|||
--build-arg CONFIG_DIR=target/config \ |
|||
. |
|||
docker push 923770123186.dkr.ecr.ap-northeast-1.amazonaws.com/dashboard-back:latest |
|||
@ -0,0 +1,21 @@ |
|||
FROM registry.ap-northeast-1.aliyuncs.com/southwave/jdk17-template:latest |
|||
# FROM openjdk:17-jdk |
|||
ENV TZ=Asia/Tokyo |
|||
WORKDIR /home/data-center-dashboard |
|||
|
|||
#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 |
|||
|
|||
COPY ${JAR_FILE} app.jar |
|||
COPY ${LIB_DIR} lib |
|||
COPY ${CONFIG_DIR} config |
|||
|
|||
ENTRYPOINT ["java","-jar","app.jar"] |
|||
|
|||
|
|||
@ -0,0 +1,552 @@ |
|||
<?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>dongjian-dashboard-back</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</parent> |
|||
<artifactId>dongjian-dashboard-back-controller</artifactId> |
|||
<name>dongjian-dashboard-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>dongjian-dashboard-back-service</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>dongjian-dashboard-back-common</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>junit</groupId> |
|||
<artifactId>junit</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-aop</artifactId> |
|||
<version>3.5.3</version> |
|||
</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>dongjian-dashboard-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> |
|||
<plugin> |
|||
<groupId>com.google.cloud.tools</groupId> |
|||
<artifactId>jib-maven-plugin</artifactId> |
|||
<version>3.4.5</version> |
|||
<configuration> |
|||
<from> |
|||
<![CDATA[ |
|||
<!-- |
|||
这里先登录【docker login --username=409950420@qq.com registry.ap-northeast-1.aliyuncs.com】, |
|||
然后【docker pull registry.ap-northeast-1.aliyuncs.com/southwave/jdk17-template:latest】到本地, |
|||
再docker://使用本地镜像 |
|||
--> |
|||
]]> |
|||
<image>docker://registry.ap-northeast-1.aliyuncs.com/southwave/jdk17-template:latest</image> |
|||
</from> |
|||
<to> |
|||
<image>registry.cn-shanghai.aliyuncs.com/clouddog/datacenter-admin:${aws.ecr.tag}</image> |
|||
</to> |
|||
<container> |
|||
<workingDirectory>/home/dongjian-dashboard-back</workingDirectory> |
|||
<environment> |
|||
<TZ>Asia/Tokyo</TZ> |
|||
</environment> |
|||
<entrypoint> |
|||
<entrypoint>java</entrypoint> |
|||
<entrypoint>-jar</entrypoint> |
|||
<entrypoint>${project.build.finalName}.jar</entrypoint> |
|||
</entrypoint> |
|||
</container> |
|||
<extraDirectories> |
|||
<paths> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>${project.build.finalName}.jar</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>lib/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>config/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>aurora_terraform/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
</paths> |
|||
<permissions> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/lib</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/config</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/aurora_terraform</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
</permissions> |
|||
</extraDirectories> |
|||
</configuration> |
|||
<executions> |
|||
<execution> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<!-- 本地,使用dockerBuild目标而不是build --> |
|||
<goal>dockerBuild</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</profile> |
|||
<profile> |
|||
<id>docker-aliyun</id> |
|||
<build> |
|||
<!-- 先用dockerfile-maven-plugin构建镜像,然后maven-antrun-plugin执行推送aws ecr的命令 --> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>com.google.cloud.tools</groupId> |
|||
<artifactId>jib-maven-plugin</artifactId> |
|||
<version>3.4.5</version> |
|||
<configuration> |
|||
<from> |
|||
<![CDATA[ |
|||
<!-- |
|||
这里先登录【docker login --username=409950420@qq.com registry.ap-northeast-1.aliyuncs.com】, |
|||
然后【docker pull registry.ap-northeast-1.aliyuncs.com/southwave/jdk17-template:latest】到本地, |
|||
再docker://使用本地镜像 |
|||
--> |
|||
]]> |
|||
<image>docker://registry.ap-northeast-1.aliyuncs.com/southwave/jdk17-template:latest</image> |
|||
</from> |
|||
<to> |
|||
<image>${aws.ecr.registry.test}/${aws.ecr.repository}:${aws.ecr.tag}</image> |
|||
</to> |
|||
<container> |
|||
<workingDirectory>/home/dongjian-dashboard-back</workingDirectory> |
|||
<environment> |
|||
<TZ>Asia/Tokyo</TZ> |
|||
</environment> |
|||
<entrypoint> |
|||
<entrypoint>java</entrypoint> |
|||
<entrypoint>-jar</entrypoint> |
|||
<entrypoint>${project.build.finalName}.jar</entrypoint> |
|||
</entrypoint> |
|||
</container> |
|||
<extraDirectories> |
|||
<paths> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>${project.build.finalName}.jar</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>lib/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>config/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>aurora_terraform/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
</paths> |
|||
<permissions> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/lib</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/config</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/aurora_terraform</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
</permissions> |
|||
</extraDirectories> |
|||
</configuration> |
|||
<executions> |
|||
<execution> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<!-- 本地,使用dockerBuild目标而不是build --> |
|||
<goal>dockerBuild</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</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> |
|||
<plugin> |
|||
<groupId>com.google.cloud.tools</groupId> |
|||
<artifactId>jib-maven-plugin</artifactId> |
|||
<version>3.4.5</version> |
|||
<configuration> |
|||
<from> |
|||
<![CDATA[ |
|||
<!-- |
|||
这里先登录【docker login --username=409950420@qq.com registry.ap-northeast-1.aliyuncs.com】, |
|||
然后【docker pull registry.ap-northeast-1.aliyuncs.com/southwave/jdk17-template:latest】到本地, |
|||
再docker://使用本地镜像 |
|||
--> |
|||
]]> |
|||
<image>docker://registry.ap-northeast-1.aliyuncs.com/southwave/jdk17-template:latest</image> |
|||
</from> |
|||
<to> |
|||
<image>${aws.ecr.registry.test}/${aws.ecr.repository}:${aws.ecr.tag}</image> |
|||
</to> |
|||
<container> |
|||
<workingDirectory>/home/dongjian-dashboard-back</workingDirectory> |
|||
<environment> |
|||
<TZ>Asia/Tokyo</TZ> |
|||
</environment> |
|||
<entrypoint> |
|||
<entrypoint>java</entrypoint> |
|||
<entrypoint>-jar</entrypoint> |
|||
<entrypoint>${project.build.finalName}.jar</entrypoint> |
|||
</entrypoint> |
|||
</container> |
|||
<extraDirectories> |
|||
<paths> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>${project.build.finalName}.jar</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>lib/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>config/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>aurora_terraform/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
</paths> |
|||
<permissions> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/lib</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/config</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/aurora_terraform</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
</permissions> |
|||
</extraDirectories> |
|||
</configuration> |
|||
<executions> |
|||
<execution> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<!-- 本地,使用dockerBuild目标而不是build --> |
|||
<goal>dockerBuild</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</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> |
|||
<plugin> |
|||
<groupId>com.google.cloud.tools</groupId> |
|||
<artifactId>jib-maven-plugin</artifactId> |
|||
<version>3.4.5</version> |
|||
<configuration> |
|||
<from> |
|||
<![CDATA[ |
|||
<!-- |
|||
这里先登录【docker login --username=409950420@qq.com registry.ap-northeast-1.aliyuncs.com】, |
|||
然后【docker pull registry.ap-northeast-1.aliyuncs.com/southwave/jdk17-template:latest】到本地, |
|||
再docker://使用本地镜像 |
|||
--> |
|||
]]> |
|||
<image>docker://registry.ap-northeast-1.aliyuncs.com/southwave/jdk17-template:latest</image> |
|||
</from> |
|||
<to> |
|||
<image>${aws.ecr.registry.production}/${aws.ecr.repository}:${aws.ecr.tag}</image> |
|||
</to> |
|||
<container> |
|||
<workingDirectory>/home/dongjian-dashboard-back</workingDirectory> |
|||
<environment> |
|||
<TZ>Asia/Tokyo</TZ> |
|||
</environment> |
|||
<entrypoint> |
|||
<entrypoint>java</entrypoint> |
|||
<entrypoint>-jar</entrypoint> |
|||
<entrypoint>${project.build.finalName}.jar</entrypoint> |
|||
</entrypoint> |
|||
</container> |
|||
<extraDirectories> |
|||
<paths> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>${project.build.finalName}.jar</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>lib/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>config/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
<path> |
|||
<from>${project.build.directory}</from> |
|||
<includes>aurora_terraform/**</includes> |
|||
<into>/home/dongjian-dashboard-back/</into> |
|||
</path> |
|||
</paths> |
|||
<permissions> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/lib</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/config</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
<permission> |
|||
<file>/home/dongjian-dashboard-back/aurora_terraform</file> |
|||
<mode>755</mode> |
|||
</permission> |
|||
</permissions> |
|||
</extraDirectories> |
|||
</configuration> |
|||
<executions> |
|||
<execution> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>build</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
</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.dongjian.dashboard.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 DongjianDashboardBackApplication { |
|||
|
|||
public static void main(String[] args) { |
|||
SpringApplication.run(DongjianDashboardBackApplication.class, args); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
package com.dongjian.dashboard.back.configurator; |
|||
|
|||
import com.dongjian.dashboard.back.common.config.DataSourceInterceptor; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
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.mobile.device.DeviceResolverHandlerInterceptor; |
|||
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.ResourceHandlerRegistry; |
|||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
|||
|
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessApiInterceptor; |
|||
|
|||
import jakarta.servlet.MultipartConfigElement; |
|||
|
|||
import java.io.File; |
|||
import java.util.List; |
|||
|
|||
@Configuration |
|||
public class ApiConfig implements WebMvcConfigurer { |
|||
|
|||
@Bean |
|||
public AccessApiInterceptor accessApiInterceptor(){ |
|||
return new AccessApiInterceptor(); |
|||
} |
|||
|
|||
@Bean |
|||
public DataSourceInterceptor dataSourceInterceptor(){ |
|||
return new DataSourceInterceptor(); |
|||
} |
|||
|
|||
@Override |
|||
public void addInterceptors(InterceptorRegistry registry){ |
|||
registry.addInterceptor(dataSourceInterceptor()); |
|||
registry.addInterceptor(accessApiInterceptor()); |
|||
} |
|||
|
|||
@Bean |
|||
public DeviceHandlerMethodArgumentResolver deviceHandlerMethodArgumentResolver() { |
|||
return new DeviceHandlerMethodArgumentResolver(); |
|||
} |
|||
|
|||
@Override |
|||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { |
|||
argumentResolvers.add(deviceHandlerMethodArgumentResolver()); |
|||
} |
|||
|
|||
@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.dongjian.dashboard.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.dongjian.dashboard.back.configurator; |
|||
|
|||
import java.io.IOException; |
|||
|
|||
import jakarta.servlet.Filter; |
|||
import jakarta.servlet.FilterChain; |
|||
import jakarta.servlet.FilterConfig; |
|||
import jakarta.servlet.ServletException; |
|||
import jakarta.servlet.ServletRequest; |
|||
import jakarta.servlet.ServletResponse; |
|||
import javax.servlet.annotation.WebFilter; |
|||
import jakarta.servlet.http.HttpServletRequest; |
|||
import jakarta.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.dongjian.dashboard.back.configurator; |
|||
|
|||
import jakarta.servlet.ReadListener; |
|||
import jakarta.servlet.ServletInputStream; |
|||
import jakarta.servlet.http.HttpServletRequest; |
|||
import jakarta.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,15 @@ |
|||
package com.dongjian.dashboard.back.configurator.aspect; |
|||
|
|||
import java.lang.annotation.ElementType; |
|||
import java.lang.annotation.Retention; |
|||
import java.lang.annotation.RetentionPolicy; |
|||
import java.lang.annotation.Target; |
|||
|
|||
@Target(ElementType.METHOD) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
public @interface OperationLog { |
|||
String operation() default ""; |
|||
String remark() default ""; |
|||
} |
|||
|
|||
|
|||
@ -0,0 +1,102 @@ |
|||
package com.dongjian.dashboard.back.configurator.aspect; |
|||
|
|||
import com.dongjian.dashboard.back.common.Constants; |
|||
import com.dongjian.dashboard.back.common.config.DataSourceContextHolder; |
|||
import com.dongjian.dashboard.back.common.config.DataSourceInterceptor; |
|||
import com.dongjian.dashboard.back.dao.ex.DashboardOperationLogMapperExt; |
|||
import com.dongjian.dashboard.back.model.DashboardOperationLog; |
|||
import com.dongjian.dashboard.back.service.common.CommonOpt; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import jakarta.servlet.http.HttpServletRequest; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.aspectj.lang.ProceedingJoinPoint; |
|||
import org.aspectj.lang.annotation.Around; |
|||
import org.aspectj.lang.annotation.Aspect; |
|||
import org.aspectj.lang.annotation.Pointcut; |
|||
import org.aspectj.lang.reflect.MethodSignature; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.web.context.request.RequestContextHolder; |
|||
import org.springframework.web.context.request.ServletRequestAttributes; |
|||
|
|||
import java.lang.reflect.Method; |
|||
import java.util.Arrays; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
@Aspect |
|||
@Component |
|||
@Slf4j |
|||
public class OperationLogAspect { |
|||
|
|||
@Autowired |
|||
private DashboardOperationLogMapperExt dashboardOperationLogMapperExt; |
|||
@Autowired |
|||
private DataSourceInterceptor dataSourceInterceptor; |
|||
|
|||
private static final ObjectMapper objectMapper = new ObjectMapper(); |
|||
|
|||
|
|||
|
|||
|
|||
@Pointcut("@annotation(com.dongjian.dashboard.back.configurator.aspect.OperationLog)") |
|||
public void controllerOperationLog() {} |
|||
|
|||
@Around("controllerOperationLog()") |
|||
public Object recordLog(ProceedingJoinPoint joinPoint) throws Throwable { |
|||
|
|||
long start = System.currentTimeMillis(); |
|||
Object result = joinPoint.proceed(); |
|||
|
|||
try { |
|||
long duration = System.currentTimeMillis() - start; |
|||
|
|||
MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
|||
Method method = signature.getMethod(); |
|||
|
|||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
|||
|
|||
String uri = request.getRequestURI(); |
|||
// 读取注解上的描述
|
|||
OperationLog annotation = method.getAnnotation(OperationLog.class); |
|||
String operation = (annotation != null) ? annotation.operation() : ""; |
|||
String remark = (annotation != null) ? annotation.remark() : ""; |
|||
|
|||
DashboardOperationLog logEntry = new DashboardOperationLog(); |
|||
logEntry.setOperation(operation); |
|||
logEntry.setOperationRemark(remark); |
|||
logEntry.setUri(uri); |
|||
logEntry.setMethodName(method.getName()); |
|||
logEntry.setClassName(signature.getDeclaringTypeName()); |
|||
logEntry.setIpAddress(request.getRemoteAddr()); |
|||
String paramsJson = objectMapper.writeValueAsString(joinPoint.getArgs()); |
|||
logEntry.setRequestParams(paramsJson); |
|||
logEntry.setExecutionTimeMs(duration); |
|||
logEntry.setCreatedAt(System.currentTimeMillis()); |
|||
|
|||
// 如果有用户信息,可以在这里设置
|
|||
String userId = request.getHeader("UserId"); |
|||
String companyId = request.getHeader("CompanyId"); |
|||
if (StringUtils.isNotBlank(companyId)){ |
|||
logEntry.setUserId(StringUtils.isNotBlank(userId) ? Long.parseLong(userId) : null); |
|||
logEntry.setCompanyId(Long.parseLong(companyId)); |
|||
|
|||
if (dataSourceInterceptor.useDefaultDataSource(uri)) { |
|||
long topCompanyId = dataSourceInterceptor.getTopCompanyId(companyId); |
|||
|
|||
String dataSourceKey = Constants.DATASOURCE_PREFIX+ topCompanyId; |
|||
log.info("操作日志切换数据源为:" + dataSourceKey); |
|||
DataSourceContextHolder.setCurrentDataSourceKey(dataSourceKey); |
|||
} |
|||
|
|||
dashboardOperationLogMapperExt.insertSelective(logEntry); |
|||
|
|||
} |
|||
} catch (Exception e) { |
|||
log.error("recordLog error", e); |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
} |
|||
@ -0,0 +1,73 @@ |
|||
package com.dongjian.dashboard.back.configurator.interceptor; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.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 jakarta.servlet.http.HttpServletRequest; |
|||
import jakarta.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", "service error"); |
|||
response.getWriter().print(jsonObject.toString()); |
|||
return false; |
|||
} |
|||
// 没有注解通过拦截
|
|||
return true; |
|||
}else if(handler instanceof ResourceHttpRequestHandler) {//资源文件不拦截
|
|||
return true; |
|||
} |
|||
return false; |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
package com.dongjian.dashboard.back.configurator.interceptor; |
|||
|
|||
import java.lang.annotation.*; |
|||
|
|||
@Target({ElementType.TYPE,ElementType.METHOD}) |
|||
@Retention(RetentionPolicy.RUNTIME) |
|||
@Documented |
|||
public @interface AccessRequired { |
|||
|
|||
} |
|||
@ -0,0 +1,73 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.building.BuildingSearchParams; |
|||
import com.dongjian.dashboard.back.service.BuildingService; |
|||
import com.dongjian.dashboard.back.vo.building.BuildingPageVO; |
|||
import io.swagger.v3.oas.annotations.Hidden; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
|
|||
import java.io.FileNotFoundException; |
|||
import java.util.List; |
|||
|
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@RestController |
|||
@AccessRequired |
|||
@RequestMapping("/building") // HTTP request path mapping
|
|||
@Tag(name = "楼宇接口", description = "") |
|||
@SuppressWarnings("unchecked") |
|||
public class BuildingController { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(BuildingController.class); |
|||
|
|||
@Autowired |
|||
private BuildingService buildingService; |
|||
|
|||
|
|||
@Hidden |
|||
@Operation(summary = "Get a page of building list") |
|||
@RequestMapping(value = "/getListPage", method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<BuildingPageVO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Difference between GMT and local time in minutes", required = true, schema = @Schema(defaultValue = "-480")) @RequestHeader(required = true) Integer UTCOffset, |
|||
BuildingSearchParams pageSearchParam) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
|
|||
PageResponse<PageInfo<BuildingPageVO>> pageResponse = new PageResponse<>(); |
|||
try { |
|||
pageResponse.setData(buildingService.getListPage(pageSearchParam, CompanyId, UserId, LanguageType, UTCOffset)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
} catch (Exception e) { |
|||
logger.error("Error querying list", e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import java.util.List; |
|||
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.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.service.CommonService; |
|||
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; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
//@ApiIgnore
|
|||
@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 = "接收Lambda测试数据") |
|||
@RequestMapping(value = "/testReceiveLambdaData",method = RequestMethod.POST) |
|||
public SimpleDataResponse testReceiveLambdaData(@RequestBody JSONObject jsonObj){ |
|||
logger.info("testReceiveLambdaData接收数据--{}", jsonObj.toString()); |
|||
return SimpleDataResponse.success(); |
|||
} |
|||
|
|||
@Hidden |
|||
@Operation(summary = "检测apikey是否有效") |
|||
@RequestMapping(value = "/checkApikey",method = RequestMethod.GET) |
|||
public SimpleDataResponse checkApikey( |
|||
@Parameter(name = "apikey", description = "API key value", required = true) @RequestParam String apikey){ |
|||
return commonService.checkApikey(apikey); |
|||
} |
|||
|
|||
@Hidden |
|||
@Operation(summary = "初始化企业对应数据库") |
|||
@RequestMapping(value = "/initDatabase/{companyId}",method = RequestMethod.GET) |
|||
public SimpleDataResponse initDatabase( |
|||
@PathVariable Long companyId |
|||
){ |
|||
return commonService.initDatabase(companyId); |
|||
} |
|||
|
|||
@Hidden |
|||
@Operation(summary = "初始化企业对应aurora") |
|||
@RequestMapping(value = "/initAurora/{companyId}",method = RequestMethod.GET) |
|||
public SimpleDataResponse initAurora( |
|||
@PathVariable Long companyId |
|||
){ |
|||
return commonService.initAurora(companyId); |
|||
} |
|||
|
|||
@Hidden |
|||
@Operation(summary = "销毁企业对应aurora") |
|||
@RequestMapping(value = "/destroyAurora/{companyId}",method = RequestMethod.GET) |
|||
public SimpleDataResponse destroyAurora( |
|||
@PathVariable Long companyId |
|||
){ |
|||
return commonService.destroyAurora(companyId); |
|||
} |
|||
} |
|||
@ -0,0 +1,140 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import io.swagger.v3.oas.annotations.Hidden; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.company.CompanySearchParams; |
|||
import com.dongjian.dashboard.back.dto.company.DeleteCompanyParams; |
|||
import com.dongjian.dashboard.back.dto.company.OptCompanyParams; |
|||
import com.dongjian.dashboard.back.vo.company.CompanyPageDTO; |
|||
import com.dongjian.dashboard.back.vo.TreeMenusDTO; |
|||
import com.dongjian.dashboard.back.service.CompanyService; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
//@AccessRequired //注解标识是否需要验证token
|
|||
@Hidden |
|||
@RequestMapping("/company/del") //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 OptCompanyParams optCompanyParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @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 OptCompanyParams optCompanyParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @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 DeleteCompanyParams deleteCompanyParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @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 = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return companyService.getCompanyTree(CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@Operation(summary = "获取企业列表") |
|||
@RequestMapping(value = "/getListPage",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<CompanyPageDTO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
// @ApiParam(name="LoginCompanyId",value="登录用户的企业ID",required=false,defaultValue = "1") @RequestHeader(required=false) Long LoginCompanyId,
|
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @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); |
|||
// if (1 == pageSearchParam.getSearchType()) {
|
|||
// pageSearchParam.setCompanyId(LoginCompanyId);
|
|||
// } else if (2 == pageSearchParam.getSearchType()) {
|
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
// }
|
|||
|
|||
PageResponse<PageInfo<CompanyPageDTO>> pageResponse = new PageResponse<PageInfo<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("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
@Operation(summary = "创建大阪区资源") |
|||
@RequestMapping(value = "/initAurora/osaka",method = RequestMethod.GET) |
|||
public SimpleDataResponse osakaInitAurora(){ |
|||
return companyService.osakaInitAurora(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,82 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.device.DeviceSearchParams; |
|||
import com.dongjian.dashboard.back.dto.device.OptDeviceFieldParams; |
|||
import com.dongjian.dashboard.back.service.DeviceService; |
|||
import com.dongjian.dashboard.back.vo.device.DeviceVO; |
|||
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.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/device") //http请求路径映射
|
|||
@Tag(name = "设备的相关接口",description = "设备的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class DeviceController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(DeviceController.class); |
|||
|
|||
@Autowired |
|||
private DeviceService deviceService; |
|||
|
|||
@OperationLog(operation = "queryDeviceList", remark = "") |
|||
@Operation(summary = "获取设备列表") |
|||
@RequestMapping(value = "/getListPage",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<DeviceVO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
DeviceSearchParams pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<PageInfo<DeviceVO>> pageResponse = new PageResponse<PageInfo<DeviceVO>>(); |
|||
try{ |
|||
pageResponse.setData(deviceService.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("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
@OperationLog(operation = "editRole", remark = "") |
|||
@Operation(summary = "编辑设备属性") |
|||
@RequestMapping(value = "/editField",method = RequestMethod.POST) |
|||
public SimpleDataResponse editField( |
|||
@RequestBody OptDeviceFieldParams optDeviceFieldParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return deviceService.editField(optDeviceFieldParams, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,129 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import com.alibaba.excel.EasyExcel; |
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.data.AccumulateDataSearchParam; |
|||
import com.dongjian.dashboard.back.dto.device.LineDataSearchParams; |
|||
import com.dongjian.dashboard.back.easyexcel.ExportDeviceAccumulateDataDTO; |
|||
import com.dongjian.dashboard.back.easyexcel.LanguageDynamicHeaderAdapter; |
|||
import com.dongjian.dashboard.back.service.DeviceDataAccumulateService; |
|||
import com.dongjian.dashboard.back.vo.data.DeviceAccumulateData; |
|||
import com.dongjian.dashboard.back.vo.device.LineData; |
|||
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.HttpServletResponse; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.io.IOException; |
|||
import java.net.URLEncoder; |
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/deviceAccumulate") //http请求路径映射
|
|||
@Tag(name = "积算设备的相关接口",description = "积算设备的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class DeviceDataAccumulateController { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(DeviceDataAccumulateController.class); |
|||
|
|||
@Autowired |
|||
private DeviceDataAccumulateService deviceDataAccumulateService; |
|||
|
|||
@OperationLog(operation = "getCumulativeDataList", remark = "") |
|||
@Operation(summary = "获取积算数据列表") |
|||
@RequestMapping(value = "/getDataList",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<DeviceAccumulateData>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
AccumulateDataSearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<PageInfo<DeviceAccumulateData>> pageResponse = new PageResponse<PageInfo<DeviceAccumulateData>>(); |
|||
try{ |
|||
pageResponse.setData(deviceDataAccumulateService.getDataList(pageSearchParam, CompanyId, UserId, LanguageType)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
}catch (Exception e){ |
|||
logger.error("查询列表报错",e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
|
|||
@OperationLog(operation = "exportCumulativeData", remark = "") |
|||
@GetMapping("/exportData") |
|||
public void exportDeviceAccumulate(HttpServletResponse response, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
AccumulateDataSearchParam pageSearchParam |
|||
) throws IOException { |
|||
|
|||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|||
response.setCharacterEncoding("utf-8"); |
|||
String fileName = URLEncoder.encode("積算データ", StandardCharsets.UTF_8).replace("+", "%20"); |
|||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
|||
|
|||
PageInfo<DeviceAccumulateData> pageData = deviceDataAccumulateService.getDataList(pageSearchParam, CompanyId, UserId, LanguageType); |
|||
List<DeviceAccumulateData> list = pageData.getList(); |
|||
|
|||
List<ExportDeviceAccumulateDataDTO> exportList = list.stream().map(item -> { |
|||
ExportDeviceAccumulateDataDTO dto = new ExportDeviceAccumulateDataDTO(); |
|||
BeanUtils.copyProperties(item, dto); |
|||
return dto; |
|||
}).toList(); |
|||
|
|||
// 构造 Excel header:每列三语组合为字符串 "中文||English||日本語"
|
|||
List<List<String>> head = LanguageDynamicHeaderAdapter.buildHead(ExportDeviceAccumulateDataDTO.class, LanguageType); |
|||
|
|||
EasyExcel.write(response.getOutputStream()) |
|||
.head(head) |
|||
.sheet("sheet1") |
|||
.doWrite(exportList); |
|||
} |
|||
|
|||
|
|||
@OperationLog(operation = "getLineData", remark = "") |
|||
@Operation(summary = "获取7日趋势数据") |
|||
@RequestMapping(value = "/getLineData",method = RequestMethod.GET) |
|||
public SimpleDataResponse<LineData> getLineData( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
LineDataSearchParams lineDataSearchParams |
|||
) throws BusinessException { |
|||
return deviceDataAccumulateService.getLineData(lineDataSearchParams, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,157 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import com.alibaba.excel.EasyExcel; |
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.data.AlarmDataSearchParam; |
|||
import com.dongjian.dashboard.back.dto.data.HandleAlarmParams; |
|||
import com.dongjian.dashboard.back.dto.data.HandleHistorySearchParam; |
|||
import com.dongjian.dashboard.back.easyexcel.ExportDeviceAlarmDataDTO; |
|||
import com.dongjian.dashboard.back.easyexcel.LanguageDynamicHeaderAdapter; |
|||
import com.dongjian.dashboard.back.service.DeviceDataAlarmService; |
|||
import com.dongjian.dashboard.back.vo.data.DeviceAlarmData; |
|||
import com.dongjian.dashboard.back.vo.data.HandleHistoryDataVO; |
|||
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.HttpServletResponse; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.io.IOException; |
|||
import java.net.URLEncoder; |
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/deviceAlarm") //http请求路径映射
|
|||
@Tag(name = "警报设备的相关接口",description = "警报设备的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class DeviceDataAlarmController { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(DeviceDataAlarmController.class); |
|||
|
|||
@Autowired |
|||
private DeviceDataAlarmService deviceDataAlarmService; |
|||
|
|||
@OperationLog(operation = "getAlarmDataList", remark = "") |
|||
@Operation(summary = "告警设备列表") |
|||
@RequestMapping(value = "/getDataList",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<DeviceAlarmData>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
AlarmDataSearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<PageInfo<DeviceAlarmData>> pageResponse = new PageResponse<PageInfo<DeviceAlarmData>>(); |
|||
try{ |
|||
pageResponse.setData(deviceDataAlarmService.getDataList(pageSearchParam, CompanyId, UserId, LanguageType)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
}catch (Exception e){ |
|||
logger.error("查询列表报错",e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
|
|||
@OperationLog(operation = "exportAlarmData", remark = "") |
|||
@GetMapping("/exportData") |
|||
public void exportDeviceAlarm(HttpServletResponse response, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
AlarmDataSearchParam pageSearchParam |
|||
) throws IOException { |
|||
|
|||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|||
response.setCharacterEncoding("utf-8"); |
|||
String fileName = URLEncoder.encode("警報データ", StandardCharsets.UTF_8).replace("+", "%20"); |
|||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
|||
|
|||
PageInfo<DeviceAlarmData> pageData = deviceDataAlarmService.getDataList(pageSearchParam, CompanyId, UserId, LanguageType); |
|||
List<DeviceAlarmData> list = pageData.getList(); |
|||
|
|||
List<ExportDeviceAlarmDataDTO> exportList = list.stream().map(item -> { |
|||
ExportDeviceAlarmDataDTO dto = new ExportDeviceAlarmDataDTO(); |
|||
BeanUtils.copyProperties(item, dto); |
|||
return dto; |
|||
}).toList(); |
|||
|
|||
// 构造 Excel header:每列三语组合为字符串 "中文||English||日本語"
|
|||
List<List<String>> head = LanguageDynamicHeaderAdapter.buildHead(ExportDeviceAlarmDataDTO.class, LanguageType); |
|||
|
|||
EasyExcel.write(response.getOutputStream()) |
|||
.head(head) |
|||
.sheet("sheet1") |
|||
.doWrite(exportList); |
|||
} |
|||
|
|||
@OperationLog(operation = "handleAlarm", remark = "") |
|||
@Operation(summary = "处理告警") |
|||
@RequestMapping(value = "/handleAlarm", method = RequestMethod.POST) |
|||
public SimpleDataResponse handleAlarm( |
|||
@RequestBody HandleAlarmParams handleAlarmParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return deviceDataAlarmService.handleAlarm(handleAlarmParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
|
|||
@GetMapping("/getHandleHistory/{alertHistoryId}") |
|||
@Operation(summary = "告警处理历史") |
|||
public PageResponse<PageInfo<HandleHistoryDataVO>> getHandleHistory( |
|||
@PathVariable Long alertHistoryId, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
HandleHistorySearchParam pageSearchParam |
|||
) throws IOException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
pageSearchParam.setAlertHistoryId(alertHistoryId); |
|||
|
|||
PageResponse<PageInfo<HandleHistoryDataVO>> pageResponse = new PageResponse<>(); |
|||
try { |
|||
pageResponse.setData(deviceDataAlarmService.getHandleHistory(pageSearchParam, CompanyId, UserId, LanguageType)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
} catch (Exception e) { |
|||
logger.error("Error querying list", e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,111 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import com.alibaba.excel.EasyExcel; |
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.data.BaStatusDataSearchParam; |
|||
import com.dongjian.dashboard.back.easyexcel.ExportDeviceBaStatusDataDTO; |
|||
import com.dongjian.dashboard.back.easyexcel.LanguageDynamicHeaderAdapter; |
|||
import com.dongjian.dashboard.back.service.DeviceDataBaStatusService; |
|||
import com.dongjian.dashboard.back.vo.data.DeviceBaStatusData; |
|||
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.HttpServletResponse; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.io.IOException; |
|||
import java.net.URLEncoder; |
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/deviceBaStatus") //http请求路径映射
|
|||
@Tag(name = "运行状态设备的相关接口",description = "运行状态设备的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class DeviceDataBaStatusController { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(DeviceDataAccumulateController.class); |
|||
|
|||
@Autowired |
|||
private DeviceDataBaStatusService deviceDataBaStatusService; |
|||
|
|||
@OperationLog(operation = "getBaStatusDataList", remark = "") |
|||
@Operation(summary = "获取状态数据列表") |
|||
@RequestMapping(value = "/getDataList",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<DeviceBaStatusData>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
BaStatusDataSearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<PageInfo<DeviceBaStatusData>> pageResponse = new PageResponse<PageInfo<DeviceBaStatusData>>(); |
|||
try{ |
|||
pageResponse.setData(deviceDataBaStatusService.getDataList(pageSearchParam, CompanyId, UserId, LanguageType)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
}catch (Exception e){ |
|||
logger.error("查询列表报错",e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
|
|||
@OperationLog(operation = "exportBaStatusData", remark = "") |
|||
@GetMapping("/exportData") |
|||
public void exportDeviceBaStatus(HttpServletResponse response, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
BaStatusDataSearchParam pageSearchParam |
|||
) throws IOException { |
|||
|
|||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|||
response.setCharacterEncoding("utf-8"); |
|||
String fileName = URLEncoder.encode("稼働設備", StandardCharsets.UTF_8).replace("+", "%20"); |
|||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
|||
|
|||
PageInfo<DeviceBaStatusData> pageData = deviceDataBaStatusService.getDataList(pageSearchParam, CompanyId, UserId, LanguageType); |
|||
List<DeviceBaStatusData> list = pageData.getList(); |
|||
|
|||
List<ExportDeviceBaStatusDataDTO> exportList = list.stream().map(item -> { |
|||
ExportDeviceBaStatusDataDTO dto = new ExportDeviceBaStatusDataDTO(); |
|||
BeanUtils.copyProperties(item, dto); |
|||
return dto; |
|||
}).toList(); |
|||
|
|||
// 构造 Excel header:每列三语组合为字符串 "中文||English||日本語"
|
|||
List<List<String>> head = LanguageDynamicHeaderAdapter.buildHead(ExportDeviceBaStatusDataDTO.class, LanguageType); |
|||
|
|||
EasyExcel.write(response.getOutputStream()) |
|||
.head(head) |
|||
.sheet("sheet1") |
|||
.doWrite(exportList); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,128 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import com.alibaba.excel.EasyExcel; |
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.data.MeasureDataSearchParam; |
|||
import com.dongjian.dashboard.back.dto.device.LineDataSearchParams; |
|||
import com.dongjian.dashboard.back.easyexcel.ExportDeviceMeasureDataDTO; |
|||
import com.dongjian.dashboard.back.easyexcel.LanguageDynamicHeaderAdapter; |
|||
import com.dongjian.dashboard.back.service.DeviceDataMeasureService; |
|||
import com.dongjian.dashboard.back.vo.data.DeviceMeasureData; |
|||
import com.dongjian.dashboard.back.vo.device.LineData; |
|||
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.HttpServletResponse; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.io.IOException; |
|||
import java.net.URLEncoder; |
|||
import java.nio.charset.StandardCharsets; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/deviceMeasure") //http请求路径映射
|
|||
@Tag(name = "计测设备的相关接口",description = "计测设备的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class DeviceDataMeasureController { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(DeviceDataAccumulateController.class); |
|||
|
|||
@Autowired |
|||
private DeviceDataMeasureService deviceDataMeasureService; |
|||
|
|||
@OperationLog(operation = "getMeasureDataList", remark = "") |
|||
@Operation(summary = "获取计测数据列表") |
|||
@RequestMapping(value = "/getDataList",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<DeviceMeasureData>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
MeasureDataSearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<PageInfo<DeviceMeasureData>> pageResponse = new PageResponse<PageInfo<DeviceMeasureData>>(); |
|||
try{ |
|||
pageResponse.setData(deviceDataMeasureService.getDataList(pageSearchParam, CompanyId, UserId, LanguageType)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
}catch (Exception e){ |
|||
logger.error("查询列表报错",e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
|
|||
@OperationLog(operation = "exportMeasureData", remark = "") |
|||
@GetMapping("/exportData") |
|||
public void exportDeviceMeasure(HttpServletResponse response, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
MeasureDataSearchParam pageSearchParam |
|||
) throws IOException { |
|||
|
|||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
|||
response.setCharacterEncoding("utf-8"); |
|||
String fileName = URLEncoder.encode("計測データ", StandardCharsets.UTF_8).replace("+", "%20"); |
|||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
|||
|
|||
PageInfo<DeviceMeasureData> pageData = deviceDataMeasureService.getDataList(pageSearchParam, CompanyId, UserId, LanguageType); |
|||
List<DeviceMeasureData> list = pageData.getList(); |
|||
|
|||
List<ExportDeviceMeasureDataDTO> exportList = list.stream().map(item -> { |
|||
ExportDeviceMeasureDataDTO dto = new ExportDeviceMeasureDataDTO(); |
|||
BeanUtils.copyProperties(item, dto); |
|||
return dto; |
|||
}).toList(); |
|||
|
|||
// 构造 Excel header:每列三语组合为字符串 "中文||English||日本語"
|
|||
List<List<String>> head = LanguageDynamicHeaderAdapter.buildHead(ExportDeviceMeasureDataDTO.class, LanguageType); |
|||
|
|||
EasyExcel.write(response.getOutputStream()) |
|||
.head(head) |
|||
.sheet("sheet1") |
|||
.doWrite(exportList); |
|||
} |
|||
|
|||
@OperationLog(operation = "getLineData", remark = "") |
|||
@Operation(summary = "获取7日趋势数据") |
|||
@RequestMapping(value = "/getLineData",method = RequestMethod.GET) |
|||
public SimpleDataResponse<LineData> getLineData( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
LineDataSearchParams lineDataSearchParams |
|||
) throws BusinessException { |
|||
return deviceDataMeasureService.getLineData(lineDataSearchParams, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,158 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.dto.devicegroup.*; |
|||
import com.dongjian.dashboard.back.vo.device.DeviceVO; |
|||
import io.swagger.v3.oas.annotations.Hidden; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.service.DeviceGroupService; |
|||
import com.dongjian.dashboard.back.vo.devicegroup.DeviceGroupPageVO; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Hidden |
|||
@RestController |
|||
@AccessRequired |
|||
@RequestMapping("/deviceGroup") |
|||
@Tag(name = "设备组相关接口", description = "设备组相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class DeviceGroupController { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(DeviceGroupController.class); |
|||
|
|||
@Autowired |
|||
private DeviceGroupService deviceGroupService; |
|||
|
|||
@OperationLog(operation = "addDeviceGroup", remark = "") |
|||
@Operation(summary = "Add deviceGroup") |
|||
@RequestMapping(value = "/deviceGroup/add", method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody OptDeviceGroupParams optDeviceGroupParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return deviceGroupService.add(optDeviceGroupParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "editDeviceGroup", remark = "") |
|||
@Operation(summary = "Edit deviceGroup") |
|||
@RequestMapping(value = "/deviceGroup/edit", method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody OptDeviceGroupParams optDeviceGroupParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return deviceGroupService.edit(optDeviceGroupParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "deleteDeviceGroup", remark = "") |
|||
@Operation(summary = "Delete deviceGroup") |
|||
@RequestMapping(value = "/deviceGroup/batchDelete", method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody DeleteDeviceGroupParams deleteDeviceGroupParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return deviceGroupService.batchDelete(deleteDeviceGroupParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "queryDeviceGroup", remark = "") |
|||
@Operation(summary = "Get deviceGroup list") |
|||
@RequestMapping(value = "/deviceGroup/getListPage", method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<DeviceGroupPageVO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Time zone offset in minutes from GMT, e.g., +480 for UTC+8", required = true, schema = @Schema(defaultValue = "-480")) @RequestHeader(required = true) Integer UTCOffset, |
|||
DeviceGroupSearchParams pageSearchParam) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
|
|||
PageResponse<PageInfo<DeviceGroupPageVO>> pageResponse = new PageResponse<>(); |
|||
try { |
|||
pageResponse.setData(deviceGroupService.getListPage(pageSearchParam, CompanyId, UserId, LanguageType, UTCOffset)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
} catch (Exception e) { |
|||
logger.error("Error querying list", e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
|
|||
@OperationLog(operation = "bindGroupForDevice", remark = "") |
|||
@Operation(summary = "给设备绑定设备组") |
|||
@RequestMapping(value = "/deviceGroup/bindGroupForDevice", method = RequestMethod.POST) |
|||
public SimpleDataResponse bindGroupForDevice( |
|||
@RequestBody BindGroupForDeviceParams bindGroupForDeviceParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return deviceGroupService.bindGroupForDevice(bindGroupForDeviceParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "bindDeviceForGroup", remark = "") |
|||
@Operation(summary = "给设备组设置绑定的设备") |
|||
@RequestMapping(value = "/deviceGroup/bindDeviceForGroup", method = RequestMethod.POST) |
|||
public SimpleDataResponse bindDeviceForGroup( |
|||
@RequestBody BindDeviceForGroupParams bindDeviceForGroupParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return deviceGroupService.bindDeviceForGroup(bindDeviceForGroupParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@Operation(summary = "根据设备主键ID获取绑定的设备组") |
|||
@RequestMapping(value = "/deviceGroup/getBindedGroupByDevice/{deviceInfoId}", method = RequestMethod.GET) |
|||
public SimpleDataResponse<List<DeviceGroupPageVO>> getBindedGroupByDevice( |
|||
@PathVariable Integer deviceInfoId, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return deviceGroupService.getBindedGroupByDevice(deviceInfoId, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@Operation(summary = "根据设备组ID获取绑定的设备") |
|||
@RequestMapping(value = "/deviceGroup/getBindedDeviceByGroup/{deviceGroupId}", method = RequestMethod.GET) |
|||
public SimpleDataResponse<List<DeviceVO>> getBindedDeviceByGroup( |
|||
@PathVariable Long deviceGroupId, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return deviceGroupService.getBindedDeviceByGroup(deviceGroupId, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,87 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.device.FavoritedDeviceSearchParams; |
|||
import com.dongjian.dashboard.back.dto.device.OptFavoritedDeviceParams; |
|||
import com.dongjian.dashboard.back.service.FavoritedDeviceService; |
|||
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.web.bind.annotation.*; |
|||
|
|||
@RestController |
|||
@AccessRequired |
|||
@RequestMapping("/favoritedDevice") |
|||
@Tag(name = "收藏设备相关接口", description = "收藏设备相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class FavoritedDeviceController { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(FavoritedDeviceController.class); |
|||
|
|||
@Autowired |
|||
private FavoritedDeviceService favoritedDeviceService; |
|||
|
|||
|
|||
@OperationLog(operation = "getFavoriteList", remark = "") |
|||
@Operation(summary = "Get favorite list") |
|||
@RequestMapping(value = "/getListPage", method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<Object>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Time zone offset in minutes from GMT, e.g., +480 for UTC+8", required = true, schema = @Schema(defaultValue = "-480")) @RequestHeader(required = true) Integer UTCOffset, |
|||
FavoritedDeviceSearchParams pageSearchParam) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
|
|||
PageResponse<PageInfo<Object>> pageResponse = new PageResponse<>(); |
|||
try { |
|||
pageResponse.setData(favoritedDeviceService.getListPage(pageSearchParam, CompanyId, UserId, LanguageType, UTCOffset)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
} catch (Exception e) { |
|||
logger.error("Error querying list", e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
@OperationLog(operation = "addFavoriteDevice", remark = "") |
|||
@Operation(summary = "Add to Favorites") |
|||
@RequestMapping(value = "/addToFavorite", method = RequestMethod.POST) |
|||
public SimpleDataResponse addToFavorite( |
|||
@RequestBody OptFavoritedDeviceParams optFavoritedDeviceParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return favoritedDeviceService.addToFavorite(optFavoritedDeviceParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "removeFavoriteDevice", remark = "") |
|||
@Operation(summary = "Remove from Favorites") |
|||
@RequestMapping(value = "/removeFavoriteDevice", method = RequestMethod.POST) |
|||
public SimpleDataResponse removeFavoriteDevice( |
|||
@RequestBody OptFavoritedDeviceParams optFavoritedDeviceParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return favoritedDeviceService.removeFavoriteDevice(optFavoritedDeviceParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
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 |
|||
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,111 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.levelhierarchy.DeleteLevelHierarchyParam; |
|||
import com.dongjian.dashboard.back.dto.levelhierarchy.OptLevelHierarchyParam; |
|||
import com.dongjian.dashboard.back.dto.levelhierarchy.PageLevelHierarchySearchParam; |
|||
import com.dongjian.dashboard.back.vo.levelhierarchy.LevelHierarchyPageDTO; |
|||
import com.dongjian.dashboard.back.service.LevelHierarchyService; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/levelHierarchy") //http请求路径映射
|
|||
@Tag(name = "支社、支店等层级的相关接口",description = "支社、支店等层级的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class LevelHierarchyController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(LevelHierarchyController.class); |
|||
|
|||
@Autowired |
|||
private LevelHierarchyService levelHierarchyService; |
|||
|
|||
|
|||
@OperationLog(operation = "addLevelHierarchy", remark = "") |
|||
@Operation(summary = "添加层级") |
|||
@RequestMapping(value = "/add",method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody OptLevelHierarchyParam optLevelHierarchyParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return levelHierarchyService.add(optLevelHierarchyParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "editLevelHierarchy", remark = "") |
|||
@Operation(summary = "编辑层级") |
|||
@RequestMapping(value = "/edit",method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody OptLevelHierarchyParam optLevelHierarchyParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return levelHierarchyService.edit(optLevelHierarchyParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "deleteLevelHierarchy", remark = "") |
|||
@Operation(summary = "删除层级") |
|||
@RequestMapping(value = "/batchDelete",method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody DeleteLevelHierarchyParam deleteLevelHierarchyParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return levelHierarchyService.batchDelete(deleteLevelHierarchyParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "queryLevelHierarchy", remark = "") |
|||
@Operation(summary = "获取层级列表") |
|||
@RequestMapping(value = "/getListPage",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<LevelHierarchyPageDTO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
PageLevelHierarchySearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<PageInfo<LevelHierarchyPageDTO>> pageResponse = new PageResponse<PageInfo<LevelHierarchyPageDTO>>(); |
|||
try{ |
|||
pageResponse.setData(levelHierarchyService.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("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,127 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.levelhierarchy.DeleteLevelHierarchyRoleParam; |
|||
import com.dongjian.dashboard.back.dto.levelhierarchy.OptLevelHierarchyRoleParam; |
|||
import com.dongjian.dashboard.back.dto.levelhierarchy.PageLevelHierarchyRoleSearchParam; |
|||
import com.dongjian.dashboard.back.service.LevelHierarchyRoleService; |
|||
import com.dongjian.dashboard.back.vo.levelhierarchy.LevelHierarchyRolePageDTO; |
|||
import com.dongjian.dashboard.back.vo.levelhierarchy.LevelHierarchyTreeVO; |
|||
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.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.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/levelHierarchyRole") //http请求路径映射
|
|||
@Tag(name = "支社、支店等层级角色的相关接口",description = "支社、支店等层级角色的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class LevelHierarchyRoleController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(LevelHierarchyRoleController.class); |
|||
|
|||
@Autowired |
|||
private LevelHierarchyRoleService levelHierarchyRoleService; |
|||
|
|||
|
|||
@OperationLog(operation = "addLevelHierarchyRole", remark = "") |
|||
@Operation(summary = "添加角色") |
|||
@RequestMapping(value = "/add",method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody OptLevelHierarchyRoleParam optLevelHierarchyRoleParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return levelHierarchyRoleService.add(optLevelHierarchyRoleParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "editLevelHierarchyRole", remark = "") |
|||
@Operation(summary = "编辑角色") |
|||
@RequestMapping(value = "/edit",method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody OptLevelHierarchyRoleParam optLevelHierarchyRoleParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return levelHierarchyRoleService.edit(optLevelHierarchyRoleParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "deleteLevelHierarchyRole", remark = "") |
|||
@Operation(summary = "删除角色") |
|||
@RequestMapping(value = "/batchDelete",method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody DeleteLevelHierarchyRoleParam deleteLevelHierarchyRoleParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return levelHierarchyRoleService.batchDelete(deleteLevelHierarchyRoleParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "queryLevelHierarchyRole", remark = "") |
|||
@Operation(summary = "获取角色列表") |
|||
@RequestMapping(value = "/getListPage",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<LevelHierarchyRolePageDTO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
PageLevelHierarchyRoleSearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<PageInfo<LevelHierarchyRolePageDTO>> pageResponse = new PageResponse<PageInfo<LevelHierarchyRolePageDTO>>(); |
|||
try{ |
|||
pageResponse.setData(levelHierarchyRoleService.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("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
// @Hidden
|
|||
@GetMapping("/tree/{roleId}") |
|||
@Operation(summary = "查询指定层级角色对应的物件树结构") |
|||
public SimpleDataResponse<List<LevelHierarchyTreeVO>> getHierarchyTree( |
|||
@PathVariable("roleId") Long roleId, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType |
|||
) { |
|||
return levelHierarchyRoleService.getHierarchyTree(roleId, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,105 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.monitoringpointcategory.*; |
|||
import com.dongjian.dashboard.back.service.MonitoringPointCategoryService; |
|||
import com.dongjian.dashboard.back.vo.monitoringpointcategory.MonitoringPointCategoryPageVO; |
|||
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.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.web.bind.annotation.*; |
|||
|
|||
|
|||
@RestController |
|||
@AccessRequired |
|||
@RequestMapping("/monitoringPointCategory") |
|||
@Tag(name = "监视点分类相关接口", description = "监视点分类相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class MonitoringPointCategoryController { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(MonitoringPointCategoryController.class); |
|||
|
|||
@Autowired |
|||
private MonitoringPointCategoryService monitoringPointCategoryService; |
|||
|
|||
@Hidden |
|||
@OperationLog(operation = "addMonitoringPointCategory", remark = "") |
|||
@Operation(summary = "Add monitoringPointCategory") |
|||
@RequestMapping(value = "/add", method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody OptMonitoringPointCategoryParams optMonitoringPointCategoryParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return monitoringPointCategoryService.add(optMonitoringPointCategoryParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@Hidden |
|||
@OperationLog(operation = "editMonitoringPointCategory", remark = "") |
|||
@Operation(summary = "Edit monitoringPointCategory") |
|||
@RequestMapping(value = "/edit", method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody OptMonitoringPointCategoryParams optMonitoringPointCategoryParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return monitoringPointCategoryService.edit(optMonitoringPointCategoryParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@Hidden |
|||
@OperationLog(operation = "deleteMonitoringPointCategory", remark = "") |
|||
@Operation(summary = "Delete monitoringPointCategory") |
|||
@RequestMapping(value = "/batchDelete", method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody DeleteMonitoringPointCategoryParams deleteMonitoringPointCategoryParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return monitoringPointCategoryService.batchDelete(deleteMonitoringPointCategoryParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "queryMonitoringPointCategory", remark = "") |
|||
@Operation(summary = "Get monitoringPointCategory list") |
|||
@RequestMapping(value = "/getListPage", method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<MonitoringPointCategoryPageVO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Time zone offset in minutes from GMT, e.g., +480 for UTC+8", required = true, schema = @Schema(defaultValue = "-480")) @RequestHeader(required = true) Integer UTCOffset, |
|||
MonitoringPointCategorySearchParams pageSearchParam) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
|
|||
PageResponse<PageInfo<MonitoringPointCategoryPageVO>> pageResponse = new PageResponse<>(); |
|||
try { |
|||
pageResponse.setData(monitoringPointCategoryService.getListPage(pageSearchParam, CompanyId, UserId, LanguageType, UTCOffset)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
} catch (Exception e) { |
|||
logger.error("Error querying list", e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,158 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.monitoringpointcategorygroup.*; |
|||
import com.dongjian.dashboard.back.service.MonitoringPointCategoryGroupService; |
|||
import com.dongjian.dashboard.back.vo.device.DeviceVO; |
|||
import com.dongjian.dashboard.back.vo.monitoringpointcategory.MonitoringPointCategoryPageVO; |
|||
import com.dongjian.dashboard.back.vo.monitoringpointcategorygroup.MonitoringPointCategoryGroupPageVO; |
|||
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.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.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
|
|||
@RestController |
|||
@AccessRequired |
|||
@RequestMapping("/monitoringPointCategoryGroup") |
|||
@Tag(name = "监视点分类组别相关接口", description = "监视点分类组别相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class MonitoringPointCategoryGroupController { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(MonitoringPointCategoryGroupController.class); |
|||
|
|||
@Autowired |
|||
private MonitoringPointCategoryGroupService monitoringPointCategoryGroupService; |
|||
|
|||
@OperationLog(operation = "addMonitoringPointCategoryGroup", remark = "") |
|||
@Operation(summary = "Add monitoring point category group") |
|||
@RequestMapping(value = "/add", method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody OptMonitoringPointCategoryGroupParams optMonitoringPointCategoryGroupParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return monitoringPointCategoryGroupService.add(optMonitoringPointCategoryGroupParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "editMonitoringPointCategoryGroup", remark = "") |
|||
@Operation(summary = "Edit monitoring point category group") |
|||
@RequestMapping(value = "/edit", method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody OptMonitoringPointCategoryGroupParams optMonitoringPointCategoryGroupParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return monitoringPointCategoryGroupService.edit(optMonitoringPointCategoryGroupParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "deleteMonitoringPointCategoryGroup", remark = "") |
|||
@Operation(summary = "Delete monitoring point category group") |
|||
@RequestMapping(value = "/batchDelete", method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody DeleteMonitoringPointCategoryGroupParams deleteMonitoringPointCategoryGroupParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return monitoringPointCategoryGroupService.batchDelete(deleteMonitoringPointCategoryGroupParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "queryMonitoringPointCategoryGroup", remark = "") |
|||
@Operation(summary = "Get monitoring point category group list") |
|||
@RequestMapping(value = "/getListPage", method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<MonitoringPointCategoryGroupPageVO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Time zone offset in minutes from GMT, e.g., +480 for UTC+8", required = true, schema = @Schema(defaultValue = "-480")) @RequestHeader(required = true) Integer UTCOffset, |
|||
MonitoringPointCategoryGroupSearchParams pageSearchParam) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
|
|||
PageResponse<PageInfo<MonitoringPointCategoryGroupPageVO>> pageResponse = new PageResponse<>(); |
|||
try { |
|||
pageResponse.setData(monitoringPointCategoryGroupService.getListPage(pageSearchParam, CompanyId, UserId, LanguageType, UTCOffset)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
} catch (Exception e) { |
|||
logger.error("Error querying list", e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
@Hidden |
|||
@OperationLog(operation = "bindGroupForCategory", remark = "") |
|||
@Operation(summary = "给分类绑定监视点分类组") |
|||
@RequestMapping(value = "/bindGroupForCategory", method = RequestMethod.POST) |
|||
public SimpleDataResponse bindGroupForDevice( |
|||
@RequestBody BindGroupForCategoryParams bindGroupForCategoryParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return monitoringPointCategoryGroupService.bindGroupForCategory(bindGroupForCategoryParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "bindCategoryForGroup", remark = "") |
|||
@Operation(summary = "给监视点分类组设置绑定的分类") |
|||
@RequestMapping(value = "/bindCategoryForGroup", method = RequestMethod.POST) |
|||
public SimpleDataResponse bindDeviceForGroup( |
|||
@RequestBody BindCategoryForGroupParams bindCategoryForGroupParams, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return monitoringPointCategoryGroupService.bindCategoryForGroup(bindCategoryForGroupParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@Hidden |
|||
@Operation(summary = "根据分类主键ID获取绑定的监视点分类组") |
|||
@RequestMapping(value = "/getBindedGroupByCategory/{monitoringPointCategoryId}", method = RequestMethod.GET) |
|||
public SimpleDataResponse<List<MonitoringPointCategoryGroupPageVO>> getBindedGroupByDevice( |
|||
@PathVariable Long monitoringPointCategoryId, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return monitoringPointCategoryGroupService.getBindedGroupByCategory(monitoringPointCategoryId, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@Operation(summary = "根据监视点分类组ID获取绑定的分类") |
|||
@RequestMapping(value = "/getBindedCategoryByGroup/{monitoringPointCategoryGroupId}", method = RequestMethod.GET) |
|||
public SimpleDataResponse<List<MonitoringPointCategoryPageVO>> getBindedDeviceByGroup( |
|||
@PathVariable Long monitoringPointCategoryGroupId, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType) { |
|||
return monitoringPointCategoryGroupService.getBindedCategoryByGroup(monitoringPointCategoryGroupId, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,182 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import io.swagger.v3.oas.annotations.Hidden; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.notificationconfig.DeleteSlackParams; |
|||
import com.dongjian.dashboard.back.dto.notificationconfig.DeleteTeamsParams; |
|||
import com.dongjian.dashboard.back.dto.notificationconfig.OptSlackParams; |
|||
import com.dongjian.dashboard.back.dto.notificationconfig.OptTeamsParams; |
|||
import com.dongjian.dashboard.back.dto.notificationconfig.SlackSearchParams; |
|||
import com.dongjian.dashboard.back.dto.notificationconfig.TeamsSearchParams; |
|||
import com.dongjian.dashboard.back.service.NotificationConfigService; |
|||
import com.dongjian.dashboard.back.vo.notificationconfig.SlackPageVO; |
|||
import com.dongjian.dashboard.back.vo.notificationconfig.TeamsPageVO; |
|||
|
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@Hidden |
|||
@RestController |
|||
@AccessRequired |
|||
@RequestMapping("/notificationConfig") |
|||
@Tag(name = "slack、teams等通知设置",description = "slack、teams等通知设置") |
|||
@SuppressWarnings("unchecked") |
|||
public class NotificationConfigController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(NotificationConfigController.class); |
|||
|
|||
@Autowired |
|||
private NotificationConfigService notificationConfigService; |
|||
|
|||
@OperationLog(operation = "addSlack", remark = "") |
|||
@Operation(summary = "Add slack") |
|||
@RequestMapping(value = "/slack/add", method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody OptSlackParams optSlackParams, |
|||
@Parameter(name="LoginName", description ="Login name", required=true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken", description ="Authentication token", required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId", description ="User ID", required=true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId", description ="User's company ID", required=false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name="LanguageType", description ="Language type: 0 - Chinese, 1 - English, 2 - Japanese", required=true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType) { |
|||
return notificationConfigService.add(optSlackParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "editSlack", remark = "") |
|||
@Operation(summary = "Edit notificationConfig") |
|||
@RequestMapping(value = "/slack/edit", method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody OptSlackParams optSlackParams, |
|||
@Parameter(name="LoginName", description ="Login name", required=true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken", description ="Authentication token", required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId", description ="User ID", required=true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId", description ="User's company ID", required=false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name="LanguageType", description ="Language type: 0 - Chinese, 1 - English, 2 - Japanese", required=true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType) { |
|||
return notificationConfigService.edit(optSlackParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "deleteSlack", remark = "") |
|||
@Operation(summary = "Delete notificationConfig") |
|||
@RequestMapping(value = "/slack/batchDelete", method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody DeleteSlackParams deleteSlackParams, |
|||
@Parameter(name="LoginName", description ="Login name", required=true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken", description ="Authentication token", required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId", description ="User ID", required=true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId", description ="User's company ID", required=false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name="LanguageType", description ="Language type: 0 - Chinese, 1 - English, 2 - Japanese", required=true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType) { |
|||
return notificationConfigService.batchDelete(deleteSlackParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "querySlack", remark = "") |
|||
@Operation(summary = "Get slack list") |
|||
@RequestMapping(value = "/slack/getListPage", method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<SlackPageVO>> getListPage( |
|||
@Parameter(name="LoginName", description ="Login name", required=true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken", description ="Authentication token", required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId", description ="User ID", required=true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId", description ="User's company ID", required=false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name="LanguageType", description ="Language type: 0 - Chinese, 1 - English, 2 - Japanese", required=true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
@Parameter(name="UTCOffset", description ="Time zone offset in minutes from GMT, e.g., +480 for UTC+8", required=true, schema = @Schema(defaultValue = "-480")) @RequestHeader(required=true) Integer UTCOffset, |
|||
SlackSearchParams pageSearchParam) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
|
|||
PageResponse<PageInfo<SlackPageVO>> pageResponse = new PageResponse<>(); |
|||
try { |
|||
pageResponse.setData(notificationConfigService.getListPage(pageSearchParam, CompanyId, UserId, LanguageType, UTCOffset)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
} catch (Exception e) { |
|||
logger.error("Error querying list", e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
|
|||
@OperationLog(operation = "addTeams", remark = "") |
|||
@Operation(summary = "Add teams") |
|||
@RequestMapping(value = "/teams/add", method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody OptTeamsParams optTeamsParams, |
|||
@Parameter(name="LoginName", description ="Login name", required=true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken", description ="Authentication token", required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId", description ="User ID", required=true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId", description ="User's company ID", required=false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name="LanguageType", description ="Language type: 0 - Chinese, 1 - English, 2 - Japanese", required=true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType) { |
|||
return notificationConfigService.add(optTeamsParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "editTeams", remark = "") |
|||
@Operation(summary = "Edit notificationConfig") |
|||
@RequestMapping(value = "/teams/edit", method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody OptTeamsParams optTeamsParams, |
|||
@Parameter(name="LoginName", description ="Login name", required=true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken", description ="Authentication token", required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId", description ="User ID", required=true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId", description ="User's company ID", required=false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name="LanguageType", description ="Language type: 0 - Chinese, 1 - English, 2 - Japanese", required=true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType) { |
|||
return notificationConfigService.edit(optTeamsParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "deleteTeams", remark = "") |
|||
@Operation(summary = "Delete notificationConfig") |
|||
@RequestMapping(value = "/teams/batchDelete", method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody DeleteTeamsParams deleteTeamsParams, |
|||
@Parameter(name="LoginName", description ="Login name", required=true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken", description ="Authentication token", required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId", description ="User ID", required=true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId", description ="User's company ID", required=false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name="LanguageType", description ="Language type: 0 - Chinese, 1 - English, 2 - Japanese", required=true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType) { |
|||
return notificationConfigService.batchDelete(deleteTeamsParams, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "queryTeams", remark = "") |
|||
@Operation(summary = "Get notificationConfig list") |
|||
@RequestMapping(value = "/teams/getListPage", method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<TeamsPageVO>> getListPage( |
|||
@Parameter(name="LoginName", description ="Login name", required=true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name="AccessToken", description ="Authentication token", required=true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name="UserId", description ="User ID", required=true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name="CompanyId", description ="User's company ID", required=false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name="LanguageType", description ="Language type: 0 - Chinese, 1 - English, 2 - Japanese", required=true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
@Parameter(name="UTCOffset", description ="Time zone offset in minutes from GMT, e.g., +480 for UTC+8", required=true, schema = @Schema(defaultValue = "-480")) @RequestHeader(required=true) Integer UTCOffset, |
|||
TeamsSearchParams pageSearchParam) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
|
|||
PageResponse<PageInfo<TeamsPageVO>> pageResponse = new PageResponse<>(); |
|||
try { |
|||
pageResponse.setData(notificationConfigService.getListPage(pageSearchParam, CompanyId, UserId, LanguageType, UTCOffset)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
} catch (Exception e) { |
|||
logger.error("Error querying list", e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.operationlog.LogSearchParam; |
|||
import com.dongjian.dashboard.back.service.OperationLogService; |
|||
import com.dongjian.dashboard.back.vo.operationlog.OperationLogPageVO; |
|||
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.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/operationLog") //http请求路径映射
|
|||
@Tag(name = "操作日志的相关接口",description = "操作日志的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class OperationLogController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(OperationLogController.class); |
|||
|
|||
@Autowired |
|||
private OperationLogService operationLogService; |
|||
|
|||
@OperationLog(operation = "queryOperationLog", remark = "") |
|||
@Operation(summary = "获取日志列表") |
|||
@RequestMapping(value = "/getListPage",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<OperationLogPageVO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
LogSearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<PageInfo<OperationLogPageVO>> pageResponse = new PageResponse<PageInfo<OperationLogPageVO>>(); |
|||
try{ |
|||
pageResponse.setData(operationLogService.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("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.service.OverviewService; |
|||
import com.dongjian.dashboard.back.vo.data.OverviewVO; |
|||
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.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
@RestController |
|||
@AccessRequired |
|||
@RequestMapping("/overview") |
|||
@Tag(name = "概览相关接口", description = "概览相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class OverviewController { |
|||
|
|||
private static final Logger logger = LoggerFactory.getLogger(OverviewController.class); |
|||
|
|||
@Autowired |
|||
private OverviewService overviewService; |
|||
|
|||
@Operation(summary = "Get overview information") |
|||
@RequestMapping(value = "/getOverviewInfo", method = RequestMethod.GET) |
|||
public SimpleDataResponse<List<OverviewVO>> getOverviewInfo( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type: 0 - Chinese, 1 - English, 2 - Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Time zone offset in minutes from GMT, e.g., +480 for UTC+8", required = true, schema = @Schema(defaultValue = "-480")) @RequestHeader(required = true) Integer UTCOffset) { |
|||
return overviewService.getOverviewInfo(UserId, CompanyId, LanguageType, UTCOffset); |
|||
} |
|||
} |
|||
@ -0,0 +1,137 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.role.DeleteRoleParam; |
|||
import com.dongjian.dashboard.back.dto.role.OptRoleParam; |
|||
import com.dongjian.dashboard.back.dto.role.PageSearchParam; |
|||
import com.dongjian.dashboard.back.vo.TreeMenusDTO; |
|||
import com.dongjian.dashboard.back.vo.role.RolePageDTO; |
|||
import com.dongjian.dashboard.back.service.RoleService; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/role") //http请求路径映射
|
|||
@Tag(name = "角色权限的相关接口",description = "角色权限的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class RoleController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(RoleController.class); |
|||
|
|||
@Autowired |
|||
private RoleService roleService; |
|||
|
|||
|
|||
@OperationLog(operation = "addRole", remark = "") |
|||
@Operation(summary = "添加角色") |
|||
@RequestMapping(value = "/add",method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody OptRoleParam optRoleParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return roleService.add(optRoleParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "editRole", remark = "") |
|||
@Operation(summary = "编辑角色") |
|||
@RequestMapping(value = "/edit",method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody OptRoleParam optRoleParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return roleService.edit(optRoleParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "deleteRole", remark = "") |
|||
@Operation(summary = "删除角色") |
|||
@RequestMapping(value = "/batchDelete",method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody DeleteRoleParam deleteRoleParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return roleService.batchDelete(deleteRoleParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@OperationLog(operation = "queryRole", remark = "") |
|||
@Operation(summary = "获取角色列表") |
|||
@RequestMapping(value = "/getListPage",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<RolePageDTO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
PageSearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<PageInfo<RolePageDTO>> pageResponse = new PageResponse<PageInfo<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("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
@Operation(summary = "获取当前登录用户拥有的权限菜单树") |
|||
@RequestMapping(value = "/getOwnMenuIds",method = RequestMethod.GET) |
|||
public SimpleDataResponse<List<TreeMenusDTO>> getOwnMenuIds( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @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 = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return roleService.getMenuIdsByRoleId(roleId, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.service.S3FileService; |
|||
import com.dongjian.dashboard.back.vo.s3.TemporaryCredentials; |
|||
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.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
@RestController |
|||
@AccessRequired |
|||
@RequestMapping("/s3") |
|||
@Tag(name = "aws s3相关接口", description = "提供认证等接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class S3FileController { |
|||
|
|||
@Autowired |
|||
private S3FileService s3FileService; |
|||
|
|||
@OperationLog(operation = "getS3Credentials", remark = "") |
|||
@Operation(summary = "获取s3文件操作接口认证token") |
|||
@GetMapping("/aws/credentials") |
|||
public SimpleDataResponse<TemporaryCredentials> getCredentials( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType |
|||
) { |
|||
return s3FileService.getTemporaryCredentials(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,163 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
|
|||
import com.dongjian.dashboard.back.common.exception.BusinessException; |
|||
import com.dongjian.dashboard.back.common.response.PageInfo; |
|||
import com.dongjian.dashboard.back.common.response.PageResponse; |
|||
import com.dongjian.dashboard.back.common.response.ResponseCode; |
|||
import com.dongjian.dashboard.back.common.response.SimpleDataResponse; |
|||
import com.dongjian.dashboard.back.configurator.aspect.OperationLog; |
|||
import com.dongjian.dashboard.back.configurator.interceptor.AccessRequired; |
|||
import com.dongjian.dashboard.back.dto.user.DeleteUserParam; |
|||
import com.dongjian.dashboard.back.dto.user.ModifyPassword; |
|||
import com.dongjian.dashboard.back.dto.user.OptUserParam; |
|||
import com.dongjian.dashboard.back.dto.user.PageSearchParam; |
|||
import com.dongjian.dashboard.back.dto.user.ResetPassword; |
|||
import com.dongjian.dashboard.back.dto.user.SwitchMfaBind; |
|||
import com.dongjian.dashboard.back.service.UserService; |
|||
import com.dongjian.dashboard.back.vo.user.UserPageDTO; |
|||
|
|||
import io.swagger.v3.oas.annotations.Hidden; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
|
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
@RestController//代表返回的是json格式的数据,这个注解是Spring4之后新加的注解
|
|||
//@AccessRequired //注解标识是否需要验证token
|
|||
@RequestMapping("/user") //http请求路径映射
|
|||
@Tag(name = "用户管理的相关接口",description = "用户管理的相关接口") |
|||
@SuppressWarnings("unchecked") |
|||
public class UserController { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(UserController.class); |
|||
|
|||
@Autowired |
|||
private UserService userService; |
|||
|
|||
@AccessRequired |
|||
@OperationLog(operation = "addUser", remark = "") |
|||
@Operation(summary = "添加用户") |
|||
@RequestMapping(value = "/add",method = RequestMethod.POST) |
|||
public SimpleDataResponse add( |
|||
@RequestBody OptUserParam optUserParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return userService.add(optUserParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@OperationLog(operation = "editUser", remark = "") |
|||
@Operation(summary = "编辑用户") |
|||
@RequestMapping(value = "/edit",method = RequestMethod.POST) |
|||
public SimpleDataResponse edit( |
|||
@RequestBody OptUserParam optUserParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return userService.edit(optUserParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@OperationLog(operation = "deleteUser", remark = "") |
|||
@Operation(summary = "删除用户") |
|||
@RequestMapping(value = "/batchDelete",method = RequestMethod.POST) |
|||
public SimpleDataResponse batchDelete( |
|||
@RequestBody DeleteUserParam deleteUserParam, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return userService.batchDelete(deleteUserParam, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@OperationLog(operation = "resetPassword", remark = "") |
|||
@Operation(summary = "重置密码") |
|||
@RequestMapping(value = "/batchResetPassword",method = RequestMethod.POST) |
|||
public SimpleDataResponse batchResetPassword( |
|||
@RequestBody ResetPassword resetPassword, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType){ |
|||
return userService.batchResetPassword(resetPassword, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@OperationLog(operation = "changePassword", remark = "") |
|||
@Operation(summary = "修改密码") |
|||
@RequestMapping(value = "/modifyPassword",method = RequestMethod.POST) |
|||
public SimpleDataResponse modifyPassword( |
|||
@RequestBody ModifyPassword modifyPassword, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType |
|||
) { |
|||
return userService.modifyPassword(modifyPassword, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@Hidden |
|||
@AccessRequired |
|||
@OperationLog(operation = "unbindMFADevice", remark = "") |
|||
@Operation(summary = "解绑MFA设备") |
|||
@RequestMapping(value = "/unbindMfa",method = RequestMethod.POST) |
|||
public SimpleDataResponse unbindMfa( |
|||
@RequestBody SwitchMfaBind switchMfaBind, |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType |
|||
) { |
|||
return userService.unbindMfa(switchMfaBind, CompanyId, UserId, LanguageType); |
|||
} |
|||
|
|||
@AccessRequired |
|||
@OperationLog(operation = "queryUser", remark = "") |
|||
@Operation(summary = "获取用户列表") |
|||
@RequestMapping(value = "/getListPage",method = RequestMethod.GET) |
|||
public PageResponse<PageInfo<UserPageDTO>> getListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required=true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required=true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required=true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "ID of the company to which the user belongs", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required=false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type (0: Chinese, 1: English, 2: Japanese)", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required=true) Integer LanguageType, |
|||
PageSearchParam pageSearchParam |
|||
) throws BusinessException { |
|||
|
|||
pageSearchParam.setUserId(UserId); |
|||
// pageSearchParam.setCompanyId(CompanyId);
|
|||
PageResponse<PageInfo<UserPageDTO>> pageResponse = new PageResponse<PageInfo<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("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
//package com.dongjian.dashboard.back.swagger;
|
|||
//
|
|||
//import org.springframework.beans.factory.annotation.Value;
|
|||
//import org.springframework.context.annotation.Bean;
|
|||
//import org.springframework.context.annotation.Configuration;
|
|||
//import org.springframework.context.annotation.Profile;
|
|||
//import springfox.documentation.builders.ApiInfoBuilder;
|
|||
//import springfox.documentation.builders.PathSelectors;
|
|||
//import springfox.documentation.service.ApiInfo;
|
|||
//import springfox.documentation.service.Contact;
|
|||
//import springfox.documentation.spi.DocumentationType;
|
|||
//import springfox.documentation.spring.web.plugins.Docket;
|
|||
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
|||
//
|
|||
///**
|
|||
// * http://127.0.0.1:20002/swagger-ui.html
|
|||
//* @author 江武元
|
|||
// */
|
|||
//@Configuration
|
|||
//@EnableSwagger2
|
|||
//public class SwaggerConfig {
|
|||
//
|
|||
// @Value("${api.enable:false}")
|
|||
// private boolean enable;
|
|||
//
|
|||
//// @Profile({"dev","stg"})
|
|||
// @Bean
|
|||
// public Docket webApiConfig(){
|
|||
// return new Docket(DocumentationType.SWAGGER_2)
|
|||
// .groupName("webApi")
|
|||
// .apiInfo(webApiInfo())
|
|||
// .select()
|
|||
// //配置显示所有的URL
|
|||
// .paths(PathSelectors.any())
|
|||
// .build()
|
|||
// .enable(enable);
|
|||
// }
|
|||
//
|
|||
// private ApiInfo webApiInfo(){
|
|||
// return new ApiInfoBuilder()
|
|||
// //文档标题
|
|||
// .title("接口文档")
|
|||
// //文档描述
|
|||
// .description("接口文档")
|
|||
// //文档版本
|
|||
// .version("1.0")
|
|||
// .build();
|
|||
// }
|
|||
//}
|
|||
//
|
|||
@ -0,0 +1,59 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<assembly> |
|||
<!-- 最终打包文件的后缀,格式为 ${fileName}-bin --> |
|||
<id>dongjian-dashboard-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,109 @@ |
|||
server.port=${serverPort} |
|||
|
|||
api.enable=${apiEnable} |
|||
|
|||
spring.mvc.pathmatch.matching-strategy= ANT_PATH_MATCHER |
|||
|
|||
mybatis.mapperLocations=classpath:mappers/**/*.xml |
|||
|
|||
spring.datasource.admin.name=data_center_new |
|||
spring.datasource.admin.url=jdbc:mysql://${datasourceDNS}/data_center_new?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=${datasourceTimeZone} |
|||
spring.datasource.admin.username=${datasourceUsername} |
|||
spring.datasource.admin.password=${datasourcePassword} |
|||
#使用druid数据源 |
|||
spring.datasource.admin.type=com.alibaba.druid.pool.DruidDataSource |
|||
spring.datasource.admin.driverClassName=com.mysql.jdbc.Driver |
|||
spring.datasource.admin.hikari.driverClassName=com.mysql.jdbc.Driver |
|||
spring.datasource.admin.hikari.schema=data_center_new |
|||
spring.datasource.admin.hikari.minimum-idle: 5 |
|||
spring.datasource.admin.hikari.maximum-pool-size: ${rdsMaxPool:40} |
|||
spring.datasource.admin.hikari.connection-timeout:10000 |
|||
|
|||
dynamic.jdbc.url=jdbc:mysql://${datasourceDNS:rm-bp11k2zm2fr7864428o.mysql.rds.aliyuncs.com:3306}/%s?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=${datasourceTimeZone} |
|||
|
|||
spring.datasource.url=jdbc:mysql://${datasourceDNS:rm-bp11k2zm2fr7864428o.mysql.rds.aliyuncs.com:3306}/data_center_new?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=${datasourceTimeZone} |
|||
|
|||
|
|||
#配置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=0 |
|||
#配置启动模式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 |
|||
|
|||
mybatis.configuration.map-underscore-to-camel-case=true |
|||
|
|||
server.servlet.session.cookie.http-only=true |
|||
server.servlet.session.cookie.secure=true |
|||
|
|||
springdoc.swagger-ui.doc-expansion=none |
|||
springdoc.swagger-ui.operations-sorter=alpha |
|||
springdoc.swagger-ui.tags-sorter=alpha |
|||
|
|||
web.login.url=${webLoginUrl} |
|||
web.admin.login.url=${webAdminLoginUrl} |
|||
|
|||
amazon.aws.accesskey=${awsAccessKey} |
|||
amazon.aws.secretkey=${awsSecretKey} |
|||
amazon.aws.actionable.region=ap-northeast-1 |
|||
amazon.aws.actionable.bucket=${awsActionableBucket} |
|||
amazon.aws.actionable.directory=${awsActionableDirectory} |
|||
amazon.aws.actionable.roleArn=${awsActionableRoleArn} |
|||
|
|||
@ -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.dongjian.dashboard.back" level="${logging_level}"/> |
|||
<logger name="com.dongjian.dashboard.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,163 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; |
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
|||
|
|||
import com.alibaba.fastjson2.JSONObject; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.dongjian.dashboard.back.common.language.msg.MsgLanguageChange; |
|||
import com.dongjian.dashboard.back.dto.account.LoginParam; |
|||
import com.dongjian.dashboard.back.dto.company.OptCompanyParams; |
|||
import com.dongjian.dashboard.back.util.CommonUtil; |
|||
import com.dongjian.dashboard.back.dto.company.CompanySearchParams; |
|||
|
|||
import org.junit.After; |
|||
import org.junit.Before; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
import org.springframework.test.web.servlet.MockMvc; |
|||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers; |
|||
import org.springframework.web.context.WebApplicationContext; |
|||
|
|||
import jakarta.annotation.Resource; |
|||
|
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest |
|||
@AutoConfigureMockMvc |
|||
public class AdminCompanyControllerTest { |
|||
|
|||
|
|||
@Resource |
|||
private MsgLanguageChange msgLanguageChange; |
|||
|
|||
@Resource |
|||
protected MockMvc mockMvc; |
|||
|
|||
@Autowired |
|||
protected WebApplicationContext wac; |
|||
|
|||
protected HttpHeaders httpHeaders = new HttpHeaders(); |
|||
|
|||
|
|||
private static final String COMPANY_NAME = "junit-test-admin-CompanyName"; |
|||
|
|||
|
|||
@Before() |
|||
public void setup() throws Exception { |
|||
System.out.println("run before......."); |
|||
LoginParam loginParam = new LoginParam(); |
|||
loginParam.setLoginname("admin"); |
|||
loginParam.setPassword("123456"); |
|||
|
|||
String content = (new ObjectMapper()).writeValueAsString(loginParam); |
|||
|
|||
System.out.println(content); |
|||
|
|||
HttpHeaders loginHeaders = new HttpHeaders(); |
|||
loginHeaders.set("LanguageType", "0"); |
|||
String responseString = mockMvc.perform( |
|||
post("/account/login") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(loginHeaders) |
|||
.content(content) |
|||
).andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("setup response:" + responseString); |
|||
|
|||
JSONObject loginRespObject = JSONObject.parseObject(responseString).getJSONObject("data"); |
|||
httpHeaders.set("LoginName", loginRespObject.getString("loginName")); |
|||
httpHeaders.set("AccessToken", loginRespObject.getString("accessToken")); |
|||
httpHeaders.set("UserId", loginRespObject.getString("userId")); |
|||
httpHeaders.set("CompanyId", loginRespObject.getString("companyId")); |
|||
httpHeaders.set("LanguageType", "2"); |
|||
httpHeaders.set("UTCOffset", "-480"); |
|||
} |
|||
|
|||
@After() |
|||
public void after() throws Exception { |
|||
System.out.println("run after......."); |
|||
|
|||
editData(); |
|||
|
|||
} |
|||
|
|||
private String editData() throws Exception { |
|||
|
|||
OptCompanyParams param = new OptCompanyParams(); |
|||
param.setCompanyName(COMPANY_NAME); |
|||
param.setCompanyId(16L); |
|||
param.setParentId(1L); |
|||
param.setMfaSwitch(0); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/company/edit") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
return responseString; |
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void testEdit() throws Exception { |
|||
System.out.println("run testEdit......."); |
|||
|
|||
OptCompanyParams param = new OptCompanyParams(); |
|||
param.setCompanyName(COMPANY_NAME +"-edit"); |
|||
param.setCompanyId(16L); |
|||
param.setParentId(2L); |
|||
param.setMfaSwitch(0); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testEdit params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/company/edit") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testEdit response:" + responseString); |
|||
|
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void testGetListPage() throws Exception { |
|||
System.out.println("run testGetListPage......."); |
|||
|
|||
CompanySearchParams companySearchParams = new CompanySearchParams(); |
|||
companySearchParams.setCompanyName(COMPANY_NAME); |
|||
companySearchParams.setSelfCompanyId(1L); |
|||
|
|||
String pageString = mockMvc.perform( |
|||
get("/company/getListPage") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.queryParams(CommonUtil.convertToMultiValueMap(companySearchParams)) |
|||
) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.data.total").value(1)) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
System.out.println("testGetListPage response:" + pageString); |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,265 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; |
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
|||
|
|||
import com.alibaba.fastjson2.JSONArray; |
|||
import com.alibaba.fastjson2.JSONObject; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.dongjian.dashboard.back.common.language.msg.MsgLanguageChange; |
|||
import com.dongjian.dashboard.back.dto.account.LoginParam; |
|||
import com.dongjian.dashboard.back.dto.project.DeleteProjectParams; |
|||
import com.dongjian.dashboard.back.dto.project.OptProjectParams; |
|||
import com.dongjian.dashboard.back.dto.project.ProjectSearchParams; |
|||
import com.dongjian.dashboard.back.util.CommonUtil; |
|||
|
|||
import org.junit.After; |
|||
import org.junit.Before; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
import org.springframework.test.web.servlet.MockMvc; |
|||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers; |
|||
import org.springframework.web.context.WebApplicationContext; |
|||
|
|||
import jakarta.annotation.Resource; |
|||
|
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest |
|||
@AutoConfigureMockMvc |
|||
public class AdminProjectControllerTest { |
|||
|
|||
|
|||
@Resource |
|||
private MsgLanguageChange msgLanguageChange; |
|||
|
|||
@Resource |
|||
protected MockMvc mockMvc; |
|||
|
|||
@Autowired |
|||
protected WebApplicationContext wac; |
|||
|
|||
protected HttpHeaders httpHeaders = new HttpHeaders(); |
|||
|
|||
|
|||
private static final String PROJECT_NAME = "junit-test-admin-ProjectName"; |
|||
|
|||
|
|||
@Before() |
|||
public void setup() throws Exception { |
|||
System.out.println("run before......."); |
|||
LoginParam loginParam = new LoginParam(); |
|||
loginParam.setLoginname("admin"); |
|||
loginParam.setPassword("123456"); |
|||
|
|||
String content = (new ObjectMapper()).writeValueAsString(loginParam); |
|||
|
|||
System.out.println(content); |
|||
|
|||
HttpHeaders loginHeaders = new HttpHeaders(); |
|||
loginHeaders.set("LanguageType", "0"); |
|||
String responseString = mockMvc.perform( |
|||
post("/account/login") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(loginHeaders) |
|||
.content(content) |
|||
).andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("setup response:" + responseString); |
|||
|
|||
JSONObject loginRespObject = JSONObject.parseObject(responseString).getJSONObject("data"); |
|||
httpHeaders.set("LoginName", loginRespObject.getString("loginName")); |
|||
httpHeaders.set("AccessToken", loginRespObject.getString("accessToken")); |
|||
httpHeaders.set("UserId", loginRespObject.getString("userId")); |
|||
httpHeaders.set("CompanyId", loginRespObject.getString("companyId")); |
|||
httpHeaders.set("LanguageType", "2"); |
|||
httpHeaders.set("UTCOffset", "-480"); |
|||
|
|||
deleteMockData(); |
|||
} |
|||
|
|||
@After() |
|||
public void after() throws Exception { |
|||
System.out.println("run after......."); |
|||
deleteMockData(); |
|||
|
|||
} |
|||
|
|||
private String deleteMockData() throws Exception { |
|||
long projectId = getMockDataId(); |
|||
|
|||
DeleteProjectParams param = new DeleteProjectParams(); |
|||
param.setProjectIds(projectId+""); |
|||
param.setCompanyIds("2"); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/project/batchDelete") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
return responseString; |
|||
} |
|||
|
|||
private void insertMockData() throws Exception { |
|||
System.out.println("run insertMockData......."); |
|||
long projectId = getMockDataId(); |
|||
if (-1 == projectId) { |
|||
OptProjectParams param = createMockData(); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testAdd params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/project/add") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
} |
|||
} |
|||
|
|||
private OptProjectParams createMockData() throws Exception { |
|||
OptProjectParams param = new OptProjectParams(); |
|||
param.setProjectName(PROJECT_NAME); |
|||
param.setCompanyId(2L); |
|||
param.setUdfProjectId("junit-test-amdin-UdfProjectId"); |
|||
return param; |
|||
} |
|||
|
|||
private long getMockDataId() throws Exception { |
|||
ProjectSearchParams projectSearchParams = new ProjectSearchParams(); |
|||
projectSearchParams.setProjectName(PROJECT_NAME); |
|||
projectSearchParams.setCompanyId(2L); |
|||
|
|||
String pageString = mockMvc.perform( |
|||
get("/project/getListPage") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.queryParams(CommonUtil.convertToMultiValueMap(projectSearchParams)) |
|||
) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
System.out.println("getMockDataId :" + pageString); |
|||
JSONObject pageObject = JSONObject.parseObject(pageString); |
|||
|
|||
JSONArray list = pageObject.getJSONObject("data").getJSONArray("list"); |
|||
return list.size() == 0 ? -1L : list.getJSONObject(0).getLongValue("projectId"); |
|||
} |
|||
|
|||
@Test |
|||
public void testAdd() throws Exception { |
|||
System.out.println("run testAdd......."); |
|||
|
|||
OptProjectParams param = createMockData(); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testAdd params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/project/add") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testAdd response:" + responseString); |
|||
|
|||
String responseString2 = mockMvc.perform( |
|||
post("/project/add") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("20001")) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.msg").value( |
|||
msgLanguageChange.getParameterMapByCode(Integer.valueOf(httpHeaders.getFirst("LanguageType")), "projectNameHasExisted") |
|||
)) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testAdd response:" + responseString2); |
|||
|
|||
} |
|||
|
|||
@Test |
|||
public void testEdit() throws Exception { |
|||
System.out.println("run testEdit......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
OptProjectParams param = new OptProjectParams(); |
|||
param.setProjectId(getMockDataId()); |
|||
param.setProjectName(PROJECT_NAME); |
|||
param.setCompanyId(2L); |
|||
param.setUdfProjectId("junit-test-UdfProjectId-edit"); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testEdit params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/project/edit") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testEdit response:" + responseString); |
|||
|
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void testGetListPage() throws Exception { |
|||
System.out.println("run testGetListPage......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
ProjectSearchParams projectSearchParams = new ProjectSearchParams(); |
|||
projectSearchParams.setProjectName(PROJECT_NAME); |
|||
projectSearchParams.setCompanyId(2L); |
|||
|
|||
String pageString = mockMvc.perform( |
|||
get("/project/getListPage") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.queryParams(CommonUtil.convertToMultiValueMap(projectSearchParams)) |
|||
) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.data.total").value(1)) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
System.out.println("testGetListPage response:" + pageString); |
|||
|
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void testDelete() throws Exception { |
|||
System.out.println("run testDelete......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
String responseString = deleteMockData(); |
|||
|
|||
System.out.println("testDelete response:" + responseString); |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,262 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; |
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
|||
|
|||
import com.alibaba.fastjson2.JSONArray; |
|||
import com.alibaba.fastjson2.JSONObject; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.dongjian.dashboard.back.common.language.msg.MsgLanguageChange; |
|||
import com.dongjian.dashboard.back.dto.account.LoginParam; |
|||
import com.dongjian.dashboard.back.dto.role.DeleteRoleParam; |
|||
import com.dongjian.dashboard.back.dto.role.OptRoleParam; |
|||
import com.dongjian.dashboard.back.dto.role.PageSearchParam; |
|||
import com.dongjian.dashboard.back.util.CommonUtil; |
|||
|
|||
import org.junit.After; |
|||
import org.junit.Before; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
import org.springframework.test.web.servlet.MockMvc; |
|||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers; |
|||
import org.springframework.web.context.WebApplicationContext; |
|||
|
|||
import jakarta.annotation.Resource; |
|||
|
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest |
|||
@AutoConfigureMockMvc |
|||
public class AdminRoleControllerTest { |
|||
|
|||
|
|||
@Resource |
|||
private MsgLanguageChange msgLanguageChange; |
|||
|
|||
@Resource |
|||
protected MockMvc mockMvc; |
|||
|
|||
@Autowired |
|||
protected WebApplicationContext wac; |
|||
|
|||
protected HttpHeaders httpHeaders = new HttpHeaders(); |
|||
|
|||
|
|||
private static final String ROLE_NAME = "junit-test-admin-RoleName"; |
|||
|
|||
|
|||
@Before() |
|||
public void setup() throws Exception { |
|||
System.out.println("run before......."); |
|||
LoginParam loginParam = new LoginParam(); |
|||
loginParam.setLoginname("admin"); |
|||
loginParam.setPassword("123456"); |
|||
|
|||
String content = (new ObjectMapper()).writeValueAsString(loginParam); |
|||
|
|||
System.out.println(content); |
|||
|
|||
HttpHeaders loginHeaders = new HttpHeaders(); |
|||
loginHeaders.set("LanguageType", "0"); |
|||
String responseString = mockMvc.perform( |
|||
post("/account/login") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(loginHeaders) |
|||
.content(content) |
|||
).andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("setup response:" + responseString); |
|||
|
|||
JSONObject loginRespObject = JSONObject.parseObject(responseString).getJSONObject("data"); |
|||
httpHeaders.set("LoginName", loginRespObject.getString("loginName")); |
|||
httpHeaders.set("AccessToken", loginRespObject.getString("accessToken")); |
|||
httpHeaders.set("UserId", loginRespObject.getString("userId")); |
|||
httpHeaders.set("CompanyId", loginRespObject.getString("companyId")); |
|||
httpHeaders.set("LanguageType", "2"); |
|||
httpHeaders.set("UTCOffset", "-480"); |
|||
|
|||
deleteMockData(); |
|||
} |
|||
|
|||
@After() |
|||
public void after() throws Exception { |
|||
System.out.println("run after......."); |
|||
deleteMockData(); |
|||
|
|||
} |
|||
|
|||
private String deleteMockData() throws Exception { |
|||
long roleId = getMockDataId(); |
|||
|
|||
DeleteRoleParam param = new DeleteRoleParam(); |
|||
param.setRoleIds(roleId+""); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/role/batchDelete") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
return responseString; |
|||
} |
|||
|
|||
private void insertMockData() throws Exception { |
|||
System.out.println("run insertMockData......."); |
|||
long roleId = getMockDataId(); |
|||
if (-1 == roleId) { |
|||
OptRoleParam param = createMockData(); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testAdd params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/role/add") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
} |
|||
} |
|||
|
|||
private OptRoleParam createMockData() throws Exception { |
|||
OptRoleParam param = new OptRoleParam(); |
|||
param.setRoleName(ROLE_NAME); |
|||
param.setDescription("Description"); |
|||
param.setMenuIds("1,2"); |
|||
return param; |
|||
} |
|||
|
|||
private long getMockDataId() throws Exception { |
|||
PageSearchParam roleSearchParams = new PageSearchParam(); |
|||
roleSearchParams.setRoleName(ROLE_NAME); |
|||
|
|||
String pageString = mockMvc.perform( |
|||
get("/role/getListPage") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.queryParams(CommonUtil.convertToMultiValueMap(roleSearchParams)) |
|||
) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
System.out.println("getMockDataId :" + pageString); |
|||
JSONObject pageObject = JSONObject.parseObject(pageString); |
|||
|
|||
JSONArray list = pageObject.getJSONObject("data").getJSONArray("list"); |
|||
return list.size() == 0 ? -1L : list.getJSONObject(0).getLongValue("roleId"); |
|||
} |
|||
|
|||
@Test |
|||
public void testAdd() throws Exception { |
|||
System.out.println("run testAdd......."); |
|||
|
|||
OptRoleParam param = createMockData(); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testAdd params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/role/add") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testAdd response:" + responseString); |
|||
|
|||
String responseString2 = mockMvc.perform( |
|||
post("/role/add") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("20001")) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.msg").value( |
|||
msgLanguageChange.getParameterMapByCode(Integer.valueOf(httpHeaders.getFirst("LanguageType")), "roleNameExist") |
|||
)) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testAdd response:" + responseString2); |
|||
|
|||
} |
|||
|
|||
@Test |
|||
public void testEdit() throws Exception { |
|||
System.out.println("run testEdit......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
OptRoleParam param = new OptRoleParam(); |
|||
param.setRoleId(getMockDataId()); |
|||
param.setRoleName(ROLE_NAME); |
|||
param.setDescription("Description-edit"); |
|||
param.setMenuIds("1,2,3"); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testEdit params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/role/edit") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testEdit response:" + responseString); |
|||
|
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void testGetListPage() throws Exception { |
|||
System.out.println("run testGetListPage......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
PageSearchParam roleSearchParams = new PageSearchParam(); |
|||
roleSearchParams.setRoleName(ROLE_NAME); |
|||
|
|||
String pageString = mockMvc.perform( |
|||
get("/role/getListPage") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.queryParams(CommonUtil.convertToMultiValueMap(roleSearchParams)) |
|||
) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.data.total").value(1)) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
System.out.println("testGetListPage response:" + pageString); |
|||
|
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void testDelete() throws Exception { |
|||
System.out.println("run testDelete......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
String responseString = deleteMockData(); |
|||
|
|||
System.out.println("testDelete response:" + responseString); |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,356 @@ |
|||
package com.dongjian.dashboard.back.controller; |
|||
|
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; |
|||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; |
|||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
|||
|
|||
import com.alibaba.fastjson2.JSONArray; |
|||
import com.alibaba.fastjson2.JSONObject; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.dongjian.dashboard.back.common.language.msg.MsgLanguageChange; |
|||
import com.dongjian.dashboard.back.dto.account.LoginParam; |
|||
import com.dongjian.dashboard.back.dto.user.DeleteUserParam; |
|||
import com.dongjian.dashboard.back.dto.user.ModifyPassword; |
|||
import com.dongjian.dashboard.back.dto.user.OptUserParam; |
|||
import com.dongjian.dashboard.back.dto.user.PageSearchParam; |
|||
import com.dongjian.dashboard.back.dto.user.ResetPassword; |
|||
import com.dongjian.dashboard.back.dto.user.SwitchMfaBind; |
|||
import com.dongjian.dashboard.back.util.CommonUtil; |
|||
|
|||
import org.junit.After; |
|||
import org.junit.Before; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.http.HttpHeaders; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
import org.springframework.test.web.servlet.MockMvc; |
|||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers; |
|||
import org.springframework.web.context.WebApplicationContext; |
|||
|
|||
import jakarta.annotation.Resource; |
|||
|
|||
|
|||
@RunWith(SpringRunner.class) |
|||
@SpringBootTest |
|||
@AutoConfigureMockMvc |
|||
public class AdminUserControllerTest { |
|||
|
|||
|
|||
@Resource |
|||
private MsgLanguageChange msgLanguageChange; |
|||
|
|||
@Resource |
|||
protected MockMvc mockMvc; |
|||
|
|||
@Autowired |
|||
protected WebApplicationContext wac; |
|||
|
|||
protected HttpHeaders httpHeaders = new HttpHeaders(); |
|||
|
|||
|
|||
private static final String USER_NAME = "junit-test-admin-UserName"; |
|||
|
|||
|
|||
@Before() |
|||
public void setup() throws Exception { |
|||
System.out.println("run before......."); |
|||
LoginParam loginParam = new LoginParam(); |
|||
loginParam.setLoginname("admin"); |
|||
loginParam.setPassword("123456"); |
|||
|
|||
String content = (new ObjectMapper()).writeValueAsString(loginParam); |
|||
|
|||
System.out.println(content); |
|||
|
|||
HttpHeaders loginHeaders = new HttpHeaders(); |
|||
loginHeaders.set("LanguageType", "0"); |
|||
String responseString = mockMvc.perform( |
|||
post("/account/login") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(loginHeaders) |
|||
.content(content) |
|||
).andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("setup response:" + responseString); |
|||
|
|||
JSONObject loginRespObject = JSONObject.parseObject(responseString).getJSONObject("data"); |
|||
httpHeaders.set("LoginName", loginRespObject.getString("loginName")); |
|||
httpHeaders.set("AccessToken", loginRespObject.getString("accessToken")); |
|||
httpHeaders.set("UserId", loginRespObject.getString("userId")); |
|||
httpHeaders.set("CompanyId", loginRespObject.getString("companyId")); |
|||
httpHeaders.set("LanguageType", "2"); |
|||
httpHeaders.set("UTCOffset", "-480"); |
|||
|
|||
deleteMockData(); |
|||
} |
|||
|
|||
@After() |
|||
public void after() throws Exception { |
|||
System.out.println("run after......."); |
|||
deleteMockData(); |
|||
|
|||
} |
|||
|
|||
private String deleteMockData() throws Exception { |
|||
long userId = getMockDataId(); |
|||
|
|||
DeleteUserParam param = new DeleteUserParam(); |
|||
param.setUserIds(userId+""); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/user/batchDelete") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
return responseString; |
|||
} |
|||
|
|||
private void insertMockData() throws Exception { |
|||
System.out.println("run insertMockData......."); |
|||
long userId = getMockDataId(); |
|||
if (-1 == userId) { |
|||
OptUserParam param = createMockData(); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testAdd params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/user/add") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
} |
|||
} |
|||
|
|||
private OptUserParam createMockData() throws Exception { |
|||
OptUserParam param = new OptUserParam(); |
|||
param.setUsername(USER_NAME); |
|||
param.setCompanyId(2L); |
|||
param.setEmail("9386@qq.com"); |
|||
param.setMobileNumber("+86-18766667777"); |
|||
// param.setRoleId(9L);
|
|||
param.setUsername(USER_NAME); |
|||
param.setUserType(2); |
|||
return param; |
|||
} |
|||
|
|||
private long getMockDataId() throws Exception { |
|||
PageSearchParam userSearchParams = new PageSearchParam(); |
|||
userSearchParams.setKeyword(USER_NAME); |
|||
|
|||
String pageString = mockMvc.perform( |
|||
get("/user/getListPage") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.queryParams(CommonUtil.convertToMultiValueMap(userSearchParams)) |
|||
) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
System.out.println("getMockDataId :" + pageString); |
|||
JSONObject pageObject = JSONObject.parseObject(pageString); |
|||
|
|||
JSONArray list = pageObject.getJSONObject("data").getJSONArray("list"); |
|||
return list.size() == 0 ? -1L : list.getJSONObject(0).getLongValue("userId"); |
|||
} |
|||
|
|||
@Test |
|||
public void testAdd() throws Exception { |
|||
System.out.println("run testAdd......."); |
|||
|
|||
OptUserParam param = createMockData(); |
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testAdd params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/user/add") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testAdd response:" + responseString); |
|||
|
|||
String responseString2 = mockMvc.perform( |
|||
post("/user/add") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("20001")) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.msg").value( |
|||
msgLanguageChange.getParameterMapByCode(Integer.valueOf(httpHeaders.getFirst("LanguageType")), "loginNameOrEmailHasExisted") |
|||
)) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testAdd response:" + responseString2); |
|||
|
|||
} |
|||
|
|||
@Test |
|||
public void testEdit() throws Exception { |
|||
System.out.println("run testEdit......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
OptUserParam param = new OptUserParam(); |
|||
param.setUserId(getMockDataId()); |
|||
param.setUsername(USER_NAME); |
|||
param.setCompanyId(2L); |
|||
param.setEmail("938@qq.com"); |
|||
param.setMobileNumber("+86-18766668888"); |
|||
// param.setRoleId(9L);
|
|||
param.setUsername(USER_NAME); |
|||
param.setUserType(2); |
|||
|
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testEdit params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/user/edit") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testEdit response:" + responseString); |
|||
|
|||
} |
|||
|
|||
@Test |
|||
public void testBatchResetPassword() throws Exception { |
|||
System.out.println("run testBatchResetPassword......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
ResetPassword param = new ResetPassword(); |
|||
param.setUserIds(getMockDataId()+""); |
|||
|
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testBatchResetPassword params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/user/batchResetPassword") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testBatchResetPassword response:" + responseString); |
|||
|
|||
} |
|||
|
|||
@Test |
|||
public void testModifyPassword() throws Exception { |
|||
System.out.println("run testModifyPassword......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
ModifyPassword param = new ModifyPassword(); |
|||
param.setOldPassword("123456"); |
|||
param.setNewPassword("123456"); |
|||
|
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testModifyPassword params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/user/modifyPassword") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("20001")) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.msg").value( |
|||
msgLanguageChange.getParameterMapByCode(Integer.valueOf(httpHeaders.getFirst("LanguageType")), "pwdFormatError") |
|||
)) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testModifyPassword response:" + responseString); |
|||
|
|||
} |
|||
|
|||
@Test |
|||
public void testUnbindMfa() throws Exception { |
|||
System.out.println("run testUnbindMfa......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
SwitchMfaBind param = new SwitchMfaBind(); |
|||
param.setUserIds(getMockDataId()+""); |
|||
|
|||
String content = (new ObjectMapper()).writeValueAsString(param); |
|||
|
|||
System.out.println("testUnbindMfa params:"+content); |
|||
|
|||
String responseString = mockMvc.perform( |
|||
post("/user/unbindMfa") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.content(content)) |
|||
.andExpect(MockMvcResultMatchers.status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
|
|||
System.out.println("testUnbindMfa response:" + responseString); |
|||
|
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void testGetListPage() throws Exception { |
|||
System.out.println("run testGetListPage......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
PageSearchParam userSearchParams = new PageSearchParam(); |
|||
userSearchParams.setKeyword(USER_NAME); |
|||
|
|||
String pageString = mockMvc.perform( |
|||
get("/user/getListPage") |
|||
.contentType(MediaType.APPLICATION_JSON) |
|||
.headers(httpHeaders) |
|||
.queryParams(CommonUtil.convertToMultiValueMap(userSearchParams)) |
|||
) |
|||
.andExpect(status().isOk()) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.code").value("200")) |
|||
.andExpect(MockMvcResultMatchers.jsonPath("$.data.total").value(1)) |
|||
.andReturn().getResponse().getContentAsString(); |
|||
System.out.println("testGetListPage response:" + pageString); |
|||
|
|||
} |
|||
|
|||
|
|||
@Test |
|||
public void testDelete() throws Exception { |
|||
System.out.println("run testDelete......."); |
|||
|
|||
insertMockData(); |
|||
|
|||
String responseString = deleteMockData(); |
|||
|
|||
System.out.println("testDelete response:" + responseString); |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,15 @@ |
|||
/target/ |
|||
/logs/ |
|||
/.idea/ |
|||
*.iml |
|||
*.bak |
|||
*.log |
|||
/.settings/ |
|||
*.project |
|||
*.classpath |
|||
*.factorypath |
|||
*.springBeans |
|||
/.apt_generated/ |
|||
/.externalToolBuilders/ |
|||
/bin/ |
|||
application-*.properties |
|||
@ -0,0 +1,70 @@ |
|||
<?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>dongjian-dashboard-back</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</parent> |
|||
<artifactId>dongjian-dashboard-back-dao</artifactId> |
|||
<name>dongjian-dashboard-back-dao</name> |
|||
<url>http://maven.apache.org</url> |
|||
<properties> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
</properties> |
|||
<dependencies> |
|||
|
|||
<dependency> |
|||
<groupId>com.techsor</groupId> |
|||
<artifactId>dongjian-dashboard-back-model</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>junit</groupId> |
|||
<artifactId>junit</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
<build> |
|||
<plugins> |
|||
<plugin> |
|||
<groupId>org.mybatis.generator</groupId> |
|||
<artifactId>mybatis-generator-maven-plugin</artifactId> |
|||
<version>1.3.5</version> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.mybatis.generator</groupId> |
|||
<artifactId>mybatis-generator-core</artifactId> |
|||
<version>1.3.5</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.mysql</groupId> |
|||
<artifactId>mysql-connector-j</artifactId> |
|||
<version>9.3.0</version> |
|||
</dependency> |
|||
</dependencies> |
|||
<executions> |
|||
<execution> |
|||
<id>mybatis generator</id> |
|||
<phase>package</phase> |
|||
<goals> |
|||
<goal>generate</goal> |
|||
</goals> |
|||
</execution> |
|||
</executions> |
|||
<configuration> |
|||
<!--允许移动生成的文件--> |
|||
<verbose>true</verbose> |
|||
<!--允许自动覆盖文件--> |
|||
<overwrite>true</overwrite> |
|||
<configurationFile> |
|||
src/main/resources/mybatis-generator/generatorConfig.xml |
|||
</configurationFile> |
|||
</configuration> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
</project> |
|||
@ -0,0 +1,3 @@ |
|||
|
|||
call mvn mybatis-generator:generate -e |
|||
pause |
|||
@ -0,0 +1 @@ |
|||
mvn mybatis-generator:generate -e |
|||
@ -0,0 +1,120 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.AlertHandleHistory; |
|||
import com.dongjian.dashboard.back.model.AlertHandleHistoryExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface AlertHandleHistoryMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(AlertHandleHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(AlertHandleHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(AlertHandleHistory record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(AlertHandleHistory record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<AlertHandleHistory> selectByExampleWithBLOBs(AlertHandleHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<AlertHandleHistory> selectByExample(AlertHandleHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
AlertHandleHistory selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") AlertHandleHistory record, @Param("example") AlertHandleHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleWithBLOBs(@Param("record") AlertHandleHistory record, @Param("example") AlertHandleHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") AlertHandleHistory record, @Param("example") AlertHandleHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(AlertHandleHistory record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeyWithBLOBs(AlertHandleHistory record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_handle_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(AlertHandleHistory record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.AlertHistory; |
|||
import com.dongjian.dashboard.back.model.AlertHistoryExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface AlertHistoryMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(AlertHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(AlertHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(AlertHistory record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(AlertHistory record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<AlertHistory> selectByExample(AlertHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
AlertHistory selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") AlertHistory record, @Param("example") AlertHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") AlertHistory record, @Param("example") AlertHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(AlertHistory record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table alert_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(AlertHistory record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.BaStatusStatistics; |
|||
import com.dongjian.dashboard.back.model.BaStatusStatisticsExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface BaStatusStatisticsMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(BaStatusStatisticsExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(BaStatusStatisticsExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Integer id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(BaStatusStatistics record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(BaStatusStatistics record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<BaStatusStatistics> selectByExample(BaStatusStatisticsExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
BaStatusStatistics selectByPrimaryKey(Integer id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") BaStatusStatistics record, @Param("example") BaStatusStatisticsExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") BaStatusStatistics record, @Param("example") BaStatusStatisticsExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(BaStatusStatistics record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ba_status_statistics |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(BaStatusStatistics record); |
|||
} |
|||
@ -0,0 +1,120 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.BasicBuilding; |
|||
import com.dongjian.dashboard.back.model.BasicBuildingExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface BasicBuildingMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(BasicBuildingExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(BasicBuildingExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long buildingId); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(BasicBuilding record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(BasicBuilding record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<BasicBuilding> selectByExampleWithBLOBs(BasicBuildingExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<BasicBuilding> selectByExample(BasicBuildingExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
BasicBuilding selectByPrimaryKey(Long buildingId); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") BasicBuilding record, @Param("example") BasicBuildingExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleWithBLOBs(@Param("record") BasicBuilding record, @Param("example") BasicBuildingExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") BasicBuilding record, @Param("example") BasicBuildingExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(BasicBuilding record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeyWithBLOBs(BasicBuilding record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_building |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(BasicBuilding record); |
|||
} |
|||
@ -0,0 +1,120 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.BasicCompany; |
|||
import com.dongjian.dashboard.back.model.BasicCompanyExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface BasicCompanyMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(BasicCompanyExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(BasicCompanyExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(BasicCompany record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(BasicCompany record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<BasicCompany> selectByExampleWithBLOBs(BasicCompanyExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<BasicCompany> selectByExample(BasicCompanyExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
BasicCompany selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") BasicCompany record, @Param("example") BasicCompanyExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleWithBLOBs(@Param("record") BasicCompany record, @Param("example") BasicCompanyExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") BasicCompany record, @Param("example") BasicCompanyExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(BasicCompany record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeyWithBLOBs(BasicCompany record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_company |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(BasicCompany record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.BasicMenu; |
|||
import com.dongjian.dashboard.back.model.BasicMenuExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface BasicMenuMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(BasicMenuExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(BasicMenuExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(BasicMenu record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(BasicMenu record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<BasicMenu> selectByExample(BasicMenuExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
BasicMenu selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") BasicMenu record, @Param("example") BasicMenuExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") BasicMenu record, @Param("example") BasicMenuExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(BasicMenu record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_menu |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(BasicMenu record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.BasicRole; |
|||
import com.dongjian.dashboard.back.model.BasicRoleExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface BasicRoleMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(BasicRoleExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(BasicRoleExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(BasicRole record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(BasicRole record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<BasicRole> selectByExample(BasicRoleExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
BasicRole selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") BasicRole record, @Param("example") BasicRoleExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") BasicRole record, @Param("example") BasicRoleExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(BasicRole record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(BasicRole record); |
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.BasicRoleMenuRelation; |
|||
import com.dongjian.dashboard.back.model.BasicRoleMenuRelationExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface BasicRoleMenuRelationMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_menu_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(BasicRoleMenuRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_menu_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(BasicRoleMenuRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_menu_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(BasicRoleMenuRelation record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_menu_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(BasicRoleMenuRelation record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_menu_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<BasicRoleMenuRelation> selectByExample(BasicRoleMenuRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_menu_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") BasicRoleMenuRelation record, @Param("example") BasicRoleMenuRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_menu_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") BasicRoleMenuRelation record, @Param("example") BasicRoleMenuRelationExample example); |
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.BasicRoleUserRelation; |
|||
import com.dongjian.dashboard.back.model.BasicRoleUserRelationExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface BasicRoleUserRelationMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_user_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(BasicRoleUserRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_user_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(BasicRoleUserRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_user_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(BasicRoleUserRelation record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_user_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(BasicRoleUserRelation record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_user_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<BasicRoleUserRelation> selectByExample(BasicRoleUserRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_user_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") BasicRoleUserRelation record, @Param("example") BasicRoleUserRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_role_user_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") BasicRoleUserRelation record, @Param("example") BasicRoleUserRelationExample example); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.BasicUser; |
|||
import com.dongjian.dashboard.back.model.BasicUserExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface BasicUserMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(BasicUserExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(BasicUserExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(BasicUser record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(BasicUser record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<BasicUser> selectByExample(BasicUserExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
BasicUser selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") BasicUser record, @Param("example") BasicUserExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") BasicUser record, @Param("example") BasicUserExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(BasicUser record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table basic_user |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(BasicUser record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.DashboardLevelRole; |
|||
import com.dongjian.dashboard.back.model.DashboardLevelRoleExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface DashboardLevelRoleMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(DashboardLevelRoleExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(DashboardLevelRoleExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(DashboardLevelRole record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(DashboardLevelRole record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<DashboardLevelRole> selectByExample(DashboardLevelRoleExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
DashboardLevelRole selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") DashboardLevelRole record, @Param("example") DashboardLevelRoleExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") DashboardLevelRole record, @Param("example") DashboardLevelRoleExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(DashboardLevelRole record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_level_role |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(DashboardLevelRole record); |
|||
} |
|||
@ -0,0 +1,120 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.DashboardOperationLog; |
|||
import com.dongjian.dashboard.back.model.DashboardOperationLogExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface DashboardOperationLogMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(DashboardOperationLogExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(DashboardOperationLogExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(DashboardOperationLog record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(DashboardOperationLog record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<DashboardOperationLog> selectByExampleWithBLOBs(DashboardOperationLogExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<DashboardOperationLog> selectByExample(DashboardOperationLogExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
DashboardOperationLog selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") DashboardOperationLog record, @Param("example") DashboardOperationLogExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleWithBLOBs(@Param("record") DashboardOperationLog record, @Param("example") DashboardOperationLogExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") DashboardOperationLog record, @Param("example") DashboardOperationLogExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(DashboardOperationLog record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeyWithBLOBs(DashboardOperationLog record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_operation_log |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(DashboardOperationLog record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.DashboardRealtimeMeasure; |
|||
import com.dongjian.dashboard.back.model.DashboardRealtimeMeasureExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface DashboardRealtimeMeasureMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(DashboardRealtimeMeasureExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(DashboardRealtimeMeasureExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(String deviceId); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(DashboardRealtimeMeasure record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(DashboardRealtimeMeasure record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<DashboardRealtimeMeasure> selectByExample(DashboardRealtimeMeasureExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
DashboardRealtimeMeasure selectByPrimaryKey(String deviceId); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") DashboardRealtimeMeasure record, @Param("example") DashboardRealtimeMeasureExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") DashboardRealtimeMeasure record, @Param("example") DashboardRealtimeMeasureExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(DashboardRealtimeMeasure record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_realtime_measure |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(DashboardRealtimeMeasure record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.DashboardRecordAccumulate; |
|||
import com.dongjian.dashboard.back.model.DashboardRecordAccumulateExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface DashboardRecordAccumulateMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(DashboardRecordAccumulateExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(DashboardRecordAccumulateExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(DashboardRecordAccumulate record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(DashboardRecordAccumulate record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<DashboardRecordAccumulate> selectByExample(DashboardRecordAccumulateExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
DashboardRecordAccumulate selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") DashboardRecordAccumulate record, @Param("example") DashboardRecordAccumulateExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") DashboardRecordAccumulate record, @Param("example") DashboardRecordAccumulateExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(DashboardRecordAccumulate record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table dashboard_record_accumulate |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(DashboardRecordAccumulate record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.DeviceGroup; |
|||
import com.dongjian.dashboard.back.model.DeviceGroupExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface DeviceGroupMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(DeviceGroupExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(DeviceGroupExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(DeviceGroup record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(DeviceGroup record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<DeviceGroup> selectByExample(DeviceGroupExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
DeviceGroup selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") DeviceGroup record, @Param("example") DeviceGroupExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") DeviceGroup record, @Param("example") DeviceGroupExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(DeviceGroup record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(DeviceGroup record); |
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.DeviceGroupRelation; |
|||
import com.dongjian.dashboard.back.model.DeviceGroupRelationExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface DeviceGroupRelationMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(DeviceGroupRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(DeviceGroupRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(DeviceGroupRelation record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(DeviceGroupRelation record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<DeviceGroupRelation> selectByExample(DeviceGroupRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") DeviceGroupRelation record, @Param("example") DeviceGroupRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") DeviceGroupRelation record, @Param("example") DeviceGroupRelationExample example); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.DeviceInfo; |
|||
import com.dongjian.dashboard.back.model.DeviceInfoExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface DeviceInfoMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(DeviceInfoExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(DeviceInfoExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Integer id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(DeviceInfo record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(DeviceInfo record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<DeviceInfo> selectByExample(DeviceInfoExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
DeviceInfo selectByPrimaryKey(Integer id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") DeviceInfo record, @Param("example") DeviceInfoExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") DeviceInfo record, @Param("example") DeviceInfoExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(DeviceInfo record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_info |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(DeviceInfo record); |
|||
} |
|||
@ -0,0 +1,120 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.DeviceRawdataRealtime; |
|||
import com.dongjian.dashboard.back.model.DeviceRawdataRealtimeExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface DeviceRawdataRealtimeMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(DeviceRawdataRealtimeExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(DeviceRawdataRealtimeExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(String deviceId); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(DeviceRawdataRealtime record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(DeviceRawdataRealtime record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<DeviceRawdataRealtime> selectByExampleWithBLOBs(DeviceRawdataRealtimeExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<DeviceRawdataRealtime> selectByExample(DeviceRawdataRealtimeExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
DeviceRawdataRealtime selectByPrimaryKey(String deviceId); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") DeviceRawdataRealtime record, @Param("example") DeviceRawdataRealtimeExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleWithBLOBs(@Param("record") DeviceRawdataRealtime record, @Param("example") DeviceRawdataRealtimeExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") DeviceRawdataRealtime record, @Param("example") DeviceRawdataRealtimeExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(DeviceRawdataRealtime record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeyWithBLOBs(DeviceRawdataRealtime record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table device_rawdata_realtime |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(DeviceRawdataRealtime record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.FavoritedDevice; |
|||
import com.dongjian.dashboard.back.model.FavoritedDeviceExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface FavoritedDeviceMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(FavoritedDeviceExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(FavoritedDeviceExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(String deviceId); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(FavoritedDevice record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(FavoritedDevice record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<FavoritedDevice> selectByExample(FavoritedDeviceExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
FavoritedDevice selectByPrimaryKey(String deviceId); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") FavoritedDevice record, @Param("example") FavoritedDeviceExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") FavoritedDevice record, @Param("example") FavoritedDeviceExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(FavoritedDevice record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table favorited_device |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(FavoritedDevice record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.LoginHistory; |
|||
import com.dongjian.dashboard.back.model.LoginHistoryExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface LoginHistoryMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(LoginHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(LoginHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(LoginHistory record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(LoginHistory record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<LoginHistory> selectByExample(LoginHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
LoginHistory selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") LoginHistory record, @Param("example") LoginHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") LoginHistory record, @Param("example") LoginHistoryExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(LoginHistory record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table login_history |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(LoginHistory record); |
|||
} |
|||
@ -0,0 +1,96 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.MonitoringPointCategoryGroup; |
|||
import com.dongjian.dashboard.back.model.MonitoringPointCategoryGroupExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface MonitoringPointCategoryGroupMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(MonitoringPointCategoryGroupExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(MonitoringPointCategoryGroupExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(MonitoringPointCategoryGroup record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(MonitoringPointCategoryGroup record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<MonitoringPointCategoryGroup> selectByExample(MonitoringPointCategoryGroupExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
MonitoringPointCategoryGroup selectByPrimaryKey(Long id); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") MonitoringPointCategoryGroup record, @Param("example") MonitoringPointCategoryGroupExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") MonitoringPointCategoryGroup record, @Param("example") MonitoringPointCategoryGroupExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(MonitoringPointCategoryGroup record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(MonitoringPointCategoryGroup record); |
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
package com.dongjian.dashboard.back.dao.auto; |
|||
|
|||
import com.dongjian.dashboard.back.model.MonitoringPointCategoryGroupRelation; |
|||
import com.dongjian.dashboard.back.model.MonitoringPointCategoryGroupRelationExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface MonitoringPointCategoryGroupRelationMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(MonitoringPointCategoryGroupRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(MonitoringPointCategoryGroupRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(MonitoringPointCategoryGroupRelation record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(MonitoringPointCategoryGroupRelation record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<MonitoringPointCategoryGroupRelation> selectByExample(MonitoringPointCategoryGroupRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") MonitoringPointCategoryGroupRelation record, @Param("example") MonitoringPointCategoryGroupRelationExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table monitoring_point_category_group_relation |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") MonitoringPointCategoryGroupRelation record, @Param("example") MonitoringPointCategoryGroupRelationExample example); |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue