diff --git a/sql/20210108-dukang.sql b/sql/20210108-dukang.sql new file mode 100644 index 000000000..6c6bfd83c --- /dev/null +++ b/sql/20210108-dukang.sql @@ -0,0 +1,102 @@ + +ALTER TABLE `sys_user` + DROP COLUMN `company_id`; + +CREATE TABLE `company_department` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(32) NOT NULL COMMENT '部门名称' COLLATE 'utf8_general_ci', + `company_id` INT(11) NOT NULL COMMENT '单位id', + `parent_id` INT(11) NULL DEFAULT NULL COMMENT '父级id', + PRIMARY KEY (`id`), + INDEX `FK_company_department_company` (`company_id`), + INDEX `FK_company_department_company_department` (`parent_id`), + CONSTRAINT `FK_company_department_company` FOREIGN KEY (`company_id`) REFERENCES `company` (`id`) ON DELETE CASCADE, + CONSTRAINT `FK_company_department_company_department` FOREIGN KEY (`parent_id`) REFERENCES `company_department` (`id`) ON DELETE SET NULL +) +COMMENT='单位部门信息' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; +CREATE TABLE `company_position` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(32) NOT NULL COMMENT '职位名称' COLLATE 'utf8_general_ci', + `company_id` INT(11) NOT NULL COMMENT '单位id', + PRIMARY KEY (`id`), + INDEX `FK_company_position_company` (`company_id`), + CONSTRAINT `FK_company_position_company` FOREIGN KEY (`company_id`) REFERENCES `company` (`id`) ON DELETE CASCADE +) +COMMENT='单位职位信息' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; +CREATE TABLE `company_user` ( + `company_id` INT(11) NOT NULL COMMENT '公司id', + `user_id` BIGINT(20) NOT NULL COMMENT '用户id', + `admin` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '公司管理员', + UNIQUE INDEX `user_id` (`user_id`), + INDEX `FK_company_user_company` (`company_id`), + CONSTRAINT `FK_company_user_company` FOREIGN KEY (`company_id`) REFERENCES `company` (`id`) ON DELETE CASCADE, + CONSTRAINT `FK_company_user_sys_user` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`id`) ON DELETE CASCADE +) +COMMENT='单位用户关系' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; +CREATE TABLE `department_user` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT, + `user_id` BIGINT(20) NOT NULL COMMENT '用户id', + `department_id` INT(11) NOT NULL COMMENT '部门id', + `position_id` INT(11) NULL DEFAULT NULL COMMENT '职位id', + `manager` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '部门管理员', + `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + INDEX `FK_department_user_company_position` (`position_id`), + INDEX `FK_department_user_sys_user` (`user_id`), + INDEX `FK_department_user_company_department` (`department_id`), + CONSTRAINT `FK_department_user_company_department` FOREIGN KEY (`department_id`) REFERENCES `company_department` (`id`) ON DELETE CASCADE, + CONSTRAINT `FK_department_user_company_position` FOREIGN KEY (`position_id`) REFERENCES `company_position` (`id`) ON DELETE SET NULL, + CONSTRAINT `FK_department_user_sys_user` FOREIGN KEY (`user_id`) REFERENCES `sys_user` (`id`) ON DELETE CASCADE +) +COMMENT='用户、部门关联表' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; +CREATE TABLE `department_lesson` ( + `lesson_id` BIGINT(20) NOT NULL COMMENT '课程id', + `department_id` INT(11) NOT NULL COMMENT '班级id', + INDEX `lesson_id` (`lesson_id`), + INDEX `department_lesson_ibfk_1` (`department_id`), + CONSTRAINT `department_lesson_ibfk_1` FOREIGN KEY (`department_id`) REFERENCES `company_department` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, + CONSTRAINT `department_lesson_ibfk_2` FOREIGN KEY (`lesson_id`) REFERENCES `ls_lesson` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE +) +COMMENT='班级课程表' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; +CREATE TABLE `department_exam` ( + `exam_id` BIGINT(20) NOT NULL, + `department_id` INT(11) NOT NULL, + INDEX `exam_id` (`exam_id`), + INDEX `department_exam_ibfk_2` (`department_id`), + CONSTRAINT `department_exam_ibfk_1` FOREIGN KEY (`exam_id`) REFERENCES `exam_definition` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, + CONSTRAINT `department_exam_ibfk_2` FOREIGN KEY (`department_id`) REFERENCES `company_department` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE +) +COMMENT='学生的试卷和班级关系' +COLLATE='utf8_general_ci' +ENGINE=InnoDB +; + + + +DROP TABLE `user_company_rel`; + +ALTER TABLE `company` + ADD COLUMN `project_code` VARCHAR(64) NULL DEFAULT NULL COMMENT '关联项目' AFTER `phone`; + + + + + + + diff --git a/sql/20210112-dukang.sql b/sql/20210112-dukang.sql new file mode 100644 index 000000000..af9efca74 --- /dev/null +++ b/sql/20210112-dukang.sql @@ -0,0 +1,567 @@ +-- 创建贵装备单位 +INSERT INTO `joylink`.`company` (`id`,`name`, `address`, `create_time`, `project_code`) VALUES ('6','贵州装备', '贵州', '2021-01-11 17:08:06', 'GZB'); + + +-- 创建贵装备班级 +INSERT INTO `company_department` (`id`, `name`, `company_id`) VALUES (14, '19城轨2班', 6); +INSERT INTO `company_department` (`id`, `name`, `company_id`) VALUES (9, '城轨1班', 6); +INSERT INTO `company_department` (`id`, `name`, `company_id`) VALUES (16, '19城轨机电2班', 6); +INSERT INTO `company_department` (`id`, `name`, `company_id`) VALUES (17, '19城轨机电1班', 6); +INSERT INTO `company_department` (`id`, `name`, `company_id`) VALUES (12, '18城市轨道交通机电技术2班', 6); +INSERT INTO `company_department` (`id`, `name`, `company_id`) VALUES (11, '18城市轨道交通机电技术1班', 6); +INSERT INTO `company_department` (`id`, `name`, `company_id`) VALUES (13, '18城市轨道交通机电技术3班', 6); + +-- 创建单位成员 +INSERT INTO `company_user` (`company_id`, `user_id`, `admin`) VALUES (6, 620, 1); +INSERT INTO `company_user` (`company_id`, `user_id`, `admin`) VALUES (6, 628, 1); +INSERT INTO `company_user` (`company_id`, `user_id`, `admin`) VALUES (6, 630, 1); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 842); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 843); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 844); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 884); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 885); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 886); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 887); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 888); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 889); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 890); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 891); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 892); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 893); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 894); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 895); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 896); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 897); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 898); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 899); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 900); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 901); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 902); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 903); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 904); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 905); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 906); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 907); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 908); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 909); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 910); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 911); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 912); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 913); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 914); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 915); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 916); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 917); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 918); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 919); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 920); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 921); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 922); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 923); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 924); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 925); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 926); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 927); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 928); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 929); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 930); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 931); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 932); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 933); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 934); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 935); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 936); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 937); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 938); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 939); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 940); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 941); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 942); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 943); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 944); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 945); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 946); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 947); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 948); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 949); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 950); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 951); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 952); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 953); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 954); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 955); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 956); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 957); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 958); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 959); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 960); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 961); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 962); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 963); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 964); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 965); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 966); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 967); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 968); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 969); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 970); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 971); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 972); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 973); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 974); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 975); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 976); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 977); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 978); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 979); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 980); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 981); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 982); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 983); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 984); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 985); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 986); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 987); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 988); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 989); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 990); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 991); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 992); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 993); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 994); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 995); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 996); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 997); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 998); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 999); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1000); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1001); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1002); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1003); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1004); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1005); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1006); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1007); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1008); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1009); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1010); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1011); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1012); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1013); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1014); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1015); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1016); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 1017); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2654); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2655); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2656); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2658); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2659); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2697); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2698); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2699); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2700); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2701); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2702); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2703); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2704); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2705); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2706); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2707); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2708); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2709); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2710); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2711); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2712); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2713); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2714); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2715); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2716); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2717); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2718); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2719); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2720); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2721); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2722); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2723); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2724); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2725); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2726); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2727); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2728); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2729); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2730); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2731); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2732); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2733); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2734); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2735); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2736); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2737); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2738); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2739); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2740); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2741); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2742); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2743); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2744); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2745); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2746); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2747); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 2748); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3026); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3027); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3028); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3029); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3030); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3031); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3032); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3033); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3034); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3035); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3036); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3037); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3038); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3039); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3040); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3041); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3042); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3043); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3044); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3045); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3046); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3047); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3048); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3049); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3050); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3051); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3052); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3053); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3054); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3055); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3056); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3057); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3058); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3059); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3060); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3061); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3062); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3063); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3064); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3065); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3066); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3067); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3068); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3069); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3070); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3071); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3072); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3073); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3074); +INSERT INTO `company_user` (`company_id`, `user_id`) VALUES (6, 3075); + +-- 创建部门成员关系 +INSERT INTO `department_user` (`department_id`, `user_id`, `manager`) VALUES (9, 620, 1); +INSERT INTO `department_user` (`department_id`, `user_id`, `manager`) VALUES (14, 620, 1); +INSERT INTO `department_user` (`department_id`, `user_id`, `manager`) VALUES (16, 620, 1); +INSERT INTO `department_user` (`department_id`, `user_id`, `manager`) VALUES (17, 628, 1); +INSERT INTO `department_user` (`department_id`, `user_id`, `manager`) VALUES (11, 630, 1); +INSERT INTO `department_user` (`department_id`, `user_id`, `manager`) VALUES (12, 630, 1); +INSERT INTO `department_user` (`department_id`, `user_id`, `manager`) VALUES (13, 630, 1); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (9, 842); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (9, 843); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (9, 844); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 884); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 885); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 886); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 887); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 888); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 889); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 890); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 891); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 892); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 893); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 894); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 895); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 896); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 897); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 898); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 899); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 900); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 901); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 902); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 903); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 904); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 905); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 906); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 907); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 908); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 909); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 910); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 911); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 912); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 913); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 914); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 915); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 916); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 917); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 918); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 919); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 920); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 921); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 922); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 923); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 924); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 925); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 926); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (11, 927); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 928); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 929); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 930); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 931); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 932); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 933); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 934); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 935); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 936); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 937); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 938); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 939); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 940); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 941); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 942); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 943); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 944); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 945); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 946); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 947); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 948); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 949); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 950); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 951); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 952); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 953); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 954); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 955); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 956); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 957); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 958); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 959); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 960); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 961); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 962); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 963); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 964); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 965); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 966); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 967); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 968); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (12, 969); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 970); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 971); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 972); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 973); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 974); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 975); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 976); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 977); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 978); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 979); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 980); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 981); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 982); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 983); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 984); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 985); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 986); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 987); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 988); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 989); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 990); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 991); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 992); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 993); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 994); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 995); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 996); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 997); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 998); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 999); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1000); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1001); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1002); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1003); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1004); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1005); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1006); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1007); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1008); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1009); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1010); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1011); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1012); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1013); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1014); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1015); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1016); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (13, 1017); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (14, 2654); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (14, 2655); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (14, 2656); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (14, 2658); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (14, 2659); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2697); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2698); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2699); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2700); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2701); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2702); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2703); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2704); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2705); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2706); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2707); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2708); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2709); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2710); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2711); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2712); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2713); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2714); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2715); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2716); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2717); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2718); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2719); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2720); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2721); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2722); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2723); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2724); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2725); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2726); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2727); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2728); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2729); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2730); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2731); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2732); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2733); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2734); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2735); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2736); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2737); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2738); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2739); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2740); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2741); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2742); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2743); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2744); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2745); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2746); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2747); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (16, 2748); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3026); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3027); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3028); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3029); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3030); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3031); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3032); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3033); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3034); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3035); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3036); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3037); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3038); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3039); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3040); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3041); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3042); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3043); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3044); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3045); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3046); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3047); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3048); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3049); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3050); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3051); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3052); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3053); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3054); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3055); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3056); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3057); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3058); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3059); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3060); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3061); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3062); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3063); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3064); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3065); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3066); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3067); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3068); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3069); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3070); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3071); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3072); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3073); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3074); +INSERT INTO `department_user` (`department_id`, `user_id`) VALUES (17, 3075); + +-- 部门课程关系 +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (47, 11); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (48, 11); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (47, 12); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (48, 12); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (47, 13); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (48, 13); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (107, 14); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (109, 14); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (110, 14); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (111, 14); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (117, 14); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (115, 16); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (116, 16); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (118, 16); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (123, 16); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (126, 16); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (127, 16); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (119, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (122, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (128, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (129, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (130, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (131, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (132, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (133, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (134, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (135, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (136, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (137, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (138, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (139, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (140, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (141, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (143, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (144, 17); +INSERT INTO `department_lesson` (`lesson_id`, `department_id`) VALUES (145, 17); + + +-- 部门考试关系 +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (172, 16); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (173, 16); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (174, 16); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (177, 16); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (178, 16); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (179, 17); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (180, 17); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (181, 17); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (182, 17); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (183, 17); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (186, 17); +INSERT INTO `department_exam` (`exam_id`, `department_id`) VALUES (187, 17); diff --git a/src/main/java/club/joylink/rtss/constants/CompanyEnum.java b/src/main/java/club/joylink/rtss/constants/CompanyEnum.java new file mode 100644 index 000000000..e243aca1d --- /dev/null +++ b/src/main/java/club/joylink/rtss/constants/CompanyEnum.java @@ -0,0 +1,35 @@ +//package club.joylink.rtss.constants; +// +//import lombok.Getter; +// +///**单位类型枚举*/ +//@Getter +//public enum CompanyEnum { +// +// School{ +// @Override +// public Position getAdmin() { +// return Position.Teacher; +// } +// +// @Override +// public boolean isAdmin(String positionName) { +// return Position.Teacher ==Position.valueOf(positionName) ; +// } +// +// @Override +// public Position getStaff() { +// return Position.Student; +// } +// }; +// +// /**单位职位类型枚举*/ +// @Getter +// public enum Position{ +// Teacher,Student +// } +// public abstract Position getAdmin(); +// public abstract boolean isAdmin(String positionName); +// public abstract Position getStaff(); +// +//} diff --git a/src/main/java/club/joylink/rtss/controller/CompanyController.java b/src/main/java/club/joylink/rtss/controller/CompanyController.java index 073eed7bf..0f73374c4 100644 --- a/src/main/java/club/joylink/rtss/controller/CompanyController.java +++ b/src/main/java/club/joylink/rtss/controller/CompanyController.java @@ -4,9 +4,8 @@ import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.services.ICompanyService; import club.joylink.rtss.vo.UserVO; -import club.joylink.rtss.vo.client.CompanyQueryVO; -import club.joylink.rtss.vo.client.CompanyVO; import club.joylink.rtss.vo.client.PageVO; +import club.joylink.rtss.vo.client.company.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -16,7 +15,7 @@ import springfox.documentation.annotations.ApiIgnore; import java.util.List; -@Api(tags = {"公司单位管理接口"}) +@Api(tags = {"单位成员管理接口"}) @RestController @RequestMapping("/api/company") public class CompanyController { @@ -27,52 +26,178 @@ public class CompanyController { @ApiOperation(value = "添加公司信息") @PostMapping public CompanyVO create(@RequestBody @Validated CompanyVO company) { - CompanyVO vo = this.iCompanyService.create(company); + CompanyVO vo = iCompanyService.create(company); return vo; } @ApiOperation(value = "获取公司列表") @GetMapping public List queryAll() { - List list = this.iCompanyService.queryOrganizations(); + List list = iCompanyService.queryOrganizations(); return list; } @ApiOperation(value = "分页获取公司列表") @GetMapping("paging") public PageVO pagingQueryAll(CompanyQueryVO queryVO) { - PageVO list = this.iCompanyService.queryPageOrganizations(queryVO); + PageVO list = iCompanyService.queryPageOrganizations(queryVO); return list; } @ApiOperation(value = "删除公司信息") @DeleteMapping("{id}") public void delete( @PathVariable Integer id) { - this.iCompanyService.deleteCompanyById(id); + iCompanyService.deleteCompanyById(id); } @ApiOperation(value = "查询公司信息") @GetMapping("{id}") public CompanyVO get( @PathVariable Integer id) { - return this.iCompanyService.getCompanyById(id); + return iCompanyService.getCompanyById(id); } @ApiOperation(value = "更新公司信息") @PutMapping("{id}") public CompanyVO updateCompany(@PathVariable Integer id, @RequestBody @Validated CompanyVO company) { - return this.iCompanyService.updateCompany(id, company); + return iCompanyService.updateCompany(id, company); } - @Role({RoleEnum.Admin, RoleEnum.SuperAdmin}) - @ApiOperation("添加公司管理者") - @PutMapping("/{companyId}/addManager") - public void addManager(@PathVariable Integer companyId, @RequestBody List userIds, @RequestAttribute @ApiIgnore UserVO user) { - iCompanyService.addManager(companyId, userIds, user); - } +// @Role({RoleEnum.Admin, RoleEnum.SuperAdmin}) +// @ApiOperation("添加公司管理者") +// @PutMapping("/{companyId}/addManager") +// public void addManager(@PathVariable Integer companyId, @RequestBody List userIds, @RequestAttribute @ApiIgnore UserVO user) { +// iCompanyService.addManager(companyId, userIds, user); +// } +// +// @Role({RoleEnum.Admin, RoleEnum.SuperAdmin}) +// @ApiOperation("取消公司管理者") +// @PutMapping("/{companyId}/removeManager") +// public void addManager(@PathVariable Integer companyId, @RequestBody List userIds, @RequestAttribute @ApiIgnore UserVO user) { +// iCompanyService.removeManager(companyId, userIds, user); +// } @ApiOperation(value = "微信小程用户绑定单位") @PutMapping(path = "/bind/company") - public void userBindCompany(Long userId, Integer companyId) { - this.iCompanyService.userBindCompany(userId, companyId); + public CompanyVO userScanCodeBindCompany(Long userId, Integer companyId) { + return iCompanyService.userScanCodeBindCompany(userId, companyId); } + + @ApiOperation(value = "添加部门信息") + @PostMapping(path = "/dept") + public DepartmentVO createDepart(@RequestBody @Validated DepartmentVO departmentVO) { + DepartmentVO vo = iCompanyService.createDepart(departmentVO); + return vo; + } + + @ApiOperation(value = "获取单位部门树") + @GetMapping(path = "{companyId}/dept/tree") + public List queryCompanyDepartTree(@PathVariable Integer companyId) { + List list = iCompanyService.getCompanyDepartTree(companyId); + return list; + } + + @ApiOperation(value = "获取单位所有部门") + @GetMapping(path = "{companyId}/dept") + public List queryCompanyDepart(@PathVariable Integer companyId) { + List list =iCompanyService.getCompanyAllDepart(companyId); + return list; + } + + @ApiOperation(value = "获取部门及其子树") + @GetMapping(path = "{companyId}/dept/{deptId}/tree") + public DepartmentVO queryDepartTree(@PathVariable Integer deptId, @PathVariable Integer companyId) { + return iCompanyService.getDepartTree(companyId, deptId); + } + + @ApiOperation(value = "获取部门及其子部门") + @GetMapping(path = "{companyId}/dept/{deptId}") + public List queryDepart(@PathVariable Integer deptId, @PathVariable Integer companyId) { + return iCompanyService.getDepartAndChild(companyId, deptId); + } + + @ApiOperation(value = "删除部门信息") + @DeleteMapping("/dept/{deptId}") + public void deleteDepart( @PathVariable Integer deptId) { + iCompanyService.deleteDepartById(deptId); + } + + @ApiOperation(value = "查询部门信息") + @GetMapping("/dept/{deptId}") + public DepartmentVO getDepart( @PathVariable Integer deptId) { + return iCompanyService.getDepartById(deptId); + } + + @ApiOperation(value = "更新部门信息") + @PutMapping("/dept/{id}") + public void updateDepartInfo(@PathVariable Integer id, @RequestBody @Validated DepartmentVO departmentVO) { + iCompanyService.updateDepartInfo(id, departmentVO); + } + +// @ApiOperation(value = "添加职位信息") +// @PostMapping(path = "/position") +// public PositionVO createPosition(@RequestBody @Validated PositionVO positionVO) { +// PositionVO vo = iCompanyService.createPosition(positionVO); +// return vo; +// } +// +// @ApiOperation(value = "更新职位信息") +// @PutMapping("/position/{id}") +// public void updatePositionInfo(@PathVariable Integer id, @RequestBody @Validated PositionVO positionVO) { +// iCompanyService.updatePositionInfo(id, positionVO); +// } +// +// @ApiOperation(value = "删除职位信息") +// @DeleteMapping("/position/{id}") +// public void deletePosition( @PathVariable Integer id) { +// iCompanyService.deletePositionById(id); +// } +// +// @ApiOperation(value = "查询职位信息") +// @GetMapping("/position/{id}") +// public PositionVO getPositionById( @PathVariable Integer id) { +// return iCompanyService.getPositionById(id); +// } +// +// @ApiOperation(value = "查询单位所属的职位信息") +// @GetMapping("{companyId}/position") +// public List getPositionsByCompanyId(@PathVariable Integer companyId) { +// return iCompanyService.getPositionsByCompanyId(companyId); +// } + + @ApiOperation(value = "添加单位成员关系信息") + @PostMapping("refUserInfo") + public void addCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @RequestBody UserDepartRelVO userDepartRelVO) { + iCompanyService.addDepartUserInfo(user,userDepartRelVO); + } + + @ApiOperation(value = "更新单位成员关系信息") + @PutMapping("refUserInfo") + public void updateCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @RequestBody UserDepartRelVO userDepartRelVO) { + iCompanyService.updateDepartUserInfo(user,userDepartRelVO); + } + + @ApiOperation(value = "取消单位的部门成员关系") + @DeleteMapping("departUserInfo") + public void deleteCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @RequestBody UserDepartRelVO userDepartRelVO) { + iCompanyService.deleteDepartUserInfo(user,userDepartRelVO); + } + + @ApiOperation(value = "分页获取单位部门成员信息") + @GetMapping("/dept/{deptId}/departUserInfo") + public PageVO getCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @PathVariable Integer deptId, CompanyUserQueryVO companyUserQueryVO) { + return iCompanyService.getCompanyDepartUserInfoList(user,deptId,companyUserQueryVO); + } + + @ApiOperation(value = "导入单位成员信息") + @PostMapping("{companyId}/departUserInfo/import") + public void importCompanyUserInfo(@RequestAttribute @ApiIgnore UserVO user, @PathVariable Integer companyId, @RequestBody ImportCompanyUserVO importCompanyUserVO) { + iCompanyService.importCompanyUserInfo(user,companyId,importCompanyUserVO); + } + + @ApiOperation(value = "获取单位用户的部门信息") + @GetMapping("{companyId}/userDeparts") + public List getUserCompanyDeparts(@RequestAttribute @ApiIgnore UserVO user, @PathVariable Integer companyId) { + return iCompanyService.getUserCompanyDeparts(user,companyId); + } + } diff --git a/src/main/java/club/joylink/rtss/controller/publish/ExamController.java b/src/main/java/club/joylink/rtss/controller/publish/ExamController.java index d10e44ca3..b25ddc3e6 100644 --- a/src/main/java/club/joylink/rtss/controller/publish/ExamController.java +++ b/src/main/java/club/joylink/rtss/controller/publish/ExamController.java @@ -31,12 +31,12 @@ public class ExamController { iExamService.create(examDefinitionVO, user); } - @ApiOperation(value = "贵装备创建考试") - @PostMapping(path = "/project/GZB") - public void createGZBExam(@RequestBody @Validated(value = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class}) - ExamDefinitionVO examDefinitionVO, @RequestAttribute @ApiIgnore UserVO user) { - iExamService.createGZBExam(examDefinitionVO, user); - } +// @ApiOperation(value = "贵装备创建考试") +// @PostMapping(path = "/project/GZB") +// public void createGZBExam(@RequestBody @Validated(value = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class}) +// ExamDefinitionVO examDefinitionVO, @RequestAttribute @ApiIgnore UserVO user) { +// iExamService.createGZBExam(examDefinitionVO, user); +// } @ApiOperation(value = "检查分数是否合理") @GetMapping(path = "/checkScore") diff --git a/src/main/java/club/joylink/rtss/controller/publish/LessonController.java b/src/main/java/club/joylink/rtss/controller/publish/LessonController.java index 086317566..f5916463e 100644 --- a/src/main/java/club/joylink/rtss/controller/publish/LessonController.java +++ b/src/main/java/club/joylink/rtss/controller/publish/LessonController.java @@ -2,14 +2,14 @@ package club.joylink.rtss.controller.publish; import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.controller.advice.Role; +import club.joylink.rtss.services.ICompanyService; import club.joylink.rtss.services.ILessonService; -import club.joylink.rtss.services.student.IClassStudentUserService; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.LessonQueryVO; import club.joylink.rtss.vo.client.LessonTreeVO; import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.PageVO; -import club.joylink.rtss.vo.client.student.StudentClassVO; +import club.joylink.rtss.vo.client.company.DepartmentVO; import club.joylink.rtss.vo.client.validGroup.LessonUpdateNameAndRemarksCheck; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -28,7 +28,7 @@ public class LessonController { private ILessonService iLessonService; @Autowired - private IClassStudentUserService iClassStudentUserService; + private ICompanyService iCompanyService; @Autowired public LessonController(ILessonService iLessonService) { @@ -53,16 +53,16 @@ public class LessonController { return this.iLessonService.queryValidLessons(lessonQueryVO); } - @ApiOperation(value = "根据班级获取关联课程列表") - @GetMapping(path = "/class/{classId}") - public List queryLessons(@PathVariable Integer classId) { - return this.iClassStudentUserService.getLessonByClass(classId); + @ApiOperation(value = "根据部门获取关联课程列表") + @GetMapping(path = "/depart/{departId}") + public List queryLessons(@PathVariable Integer departId) { + return this.iCompanyService.getLessonsByDepart(departId); } @ApiOperation(value = "根据课程获取关联班级信息列表") - @GetMapping(path = "/{lessonId}/classes") - public List queryClassByLesson(@PathVariable Long lessonId) { - return this.iClassStudentUserService.getClassesByLesson(lessonId); + @GetMapping(path = "/{lessonId}/departs") + public List queryClassByLesson(@PathVariable Long lessonId) { + return this.iCompanyService.getDepartsByLesson(lessonId); } @ApiOperation(value = "获取课程列表") @@ -85,7 +85,7 @@ public class LessonController { } @Role(RoleEnum.LessonCreater) - @ApiOperation(value = "贵州装备教学实训删除正在使用的发布课程") + @ApiOperation(value = "用户删除教学实训删除自己发布的课程") @DeleteMapping(path = "/usedLesson/{lessonId}") public void deleteUsedLesson(@PathVariable Long lessonId, @RequestAttribute UserVO user) { iLessonService.deleteUsedLesson(lessonId, user); diff --git a/src/main/java/club/joylink/rtss/controller/user/UserController.java b/src/main/java/club/joylink/rtss/controller/user/UserController.java index 7399a7c07..da0bc88ac 100644 --- a/src/main/java/club/joylink/rtss/controller/user/UserController.java +++ b/src/main/java/club/joylink/rtss/controller/user/UserController.java @@ -4,14 +4,12 @@ import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.services.ISysUserService; import club.joylink.rtss.services.local.UserGenerateService; -import club.joylink.rtss.services.student.IClassStudentUserService; +import club.joylink.rtss.services.student.IDepartUserStatisticService; import club.joylink.rtss.vo.UserQueryVO; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.UserConfigVO; import club.joylink.rtss.vo.client.student.ExportStudentInfo; -import club.joylink.rtss.vo.client.student.ImportStudentInfo; -import club.joylink.rtss.vo.client.student.StudentClassVO; import club.joylink.rtss.vo.client.student.StudentInfoExportParam; import club.joylink.rtss.vo.client.user.WeChatBindStatusVO; import club.joylink.rtss.vo.user.UserGenerateConfigVO; @@ -37,7 +35,7 @@ public class UserController { private UserGenerateService userGenerateService; @Autowired - private IClassStudentUserService iClassStudentUserService; + private IDepartUserStatisticService iDepartUserStatisticService; @ApiOperation(value = "更新用户配置") @PostMapping(path = "/config") @@ -111,23 +109,23 @@ public class UserController { return this.iSysUserService.fuzzyQueryPagedUser(fuzzyParam); } - @ApiOperation(value="贵州装备制造导入学生信息接口") - @PostMapping(path="/project/{projectCode}/import/student") - public void importStudents(@PathVariable String projectCode, @Validated @RequestBody ImportStudentInfo importStudentInfo, @RequestAttribute @ApiIgnore UserVO user){ - this.iClassStudentUserService.importStudentInfos(projectCode, importStudentInfo, user); +// @ApiOperation(value="贵州装备制造导入学生信息接口") +// @PostMapping(path="/project/{projectCode}/import/student") +// public void importStudents(@PathVariable String projectCode, @Validated @RequestBody ImportStudentInfo importStudentInfo, @RequestAttribute @ApiIgnore UserVO user){ +// this.iClassStudentUserService.importStudentInfos(projectCode, importStudentInfo, user); +// } + + @ApiOperation(value="导出部门学生信息及成绩接口") + @PutMapping(path="/scores") + public List getStudentSores( @Validated @RequestBody StudentInfoExportParam infoExportParam){ + return this.iDepartUserStatisticService.studentInfoStatistics(infoExportParam); } - @ApiOperation(value="贵州装备制造导出学生信息及成绩接口") - @PutMapping(path="/project/{projectCode}/export/student") - public List importStudents(@PathVariable String projectCode, @Validated @RequestBody StudentInfoExportParam infoExportParam){ - return this.iClassStudentUserService.studentInfoStatistics(infoExportParam); - } - - @ApiOperation(value="贵州装备制造查询对应的班级") - @GetMapping(path="/project/{projectCode}/classes") - public List getClasses(@PathVariable String projectCode){ - return this.iClassStudentUserService.getClassesByProjectCode(projectCode); - } +// @ApiOperation(value="贵州装备制造查询对应的班级") +// @GetMapping(path="/project/{projectCode}/classes") +// public List getClasses(@PathVariable String projectCode){ +// return this.iClassStudentUserService.getClassesByProjectCode(projectCode); +// } @ApiOperation("查询销售人员") @GetMapping("/seller") diff --git a/src/main/java/club/joylink/rtss/dao/CompanyDepartmentDAO.java b/src/main/java/club/joylink/rtss/dao/CompanyDepartmentDAO.java new file mode 100644 index 000000000..6276695d4 --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/CompanyDepartmentDAO.java @@ -0,0 +1,12 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.CompanyDepartment; +import club.joylink.rtss.entity.CompanyDepartmentExample; +import org.springframework.stereotype.Repository; + +/** + * CompanyDepartmentDAO继承基类 + */ +@Repository +public interface CompanyDepartmentDAO extends MyBatisBaseDao { +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/dao/CompanyPositionDAO.java b/src/main/java/club/joylink/rtss/dao/CompanyPositionDAO.java new file mode 100644 index 000000000..7a00d1f4e --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/CompanyPositionDAO.java @@ -0,0 +1,12 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.CompanyPosition; +import club.joylink.rtss.entity.CompanyPositionExample; +import org.springframework.stereotype.Repository; + +/** + * CompanyPositionDAO继承基类 + */ +@Repository +public interface CompanyPositionDAO extends MyBatisBaseDao { +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/dao/CompanyUserDAO.java b/src/main/java/club/joylink/rtss/dao/CompanyUserDAO.java new file mode 100644 index 000000000..6ee818ada --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/CompanyUserDAO.java @@ -0,0 +1,18 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.CompanyUser; +import club.joylink.rtss.entity.CompanyUserExample; +import club.joylink.rtss.entity.RaceQuestionMocksLikes; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * CompanyUserDAO继承基类 + */ +@Repository +public interface CompanyUserDAO extends MyBatisBaseDao { + +} diff --git a/src/main/java/club/joylink/rtss/dao/DepartmentExamDAO.java b/src/main/java/club/joylink/rtss/dao/DepartmentExamDAO.java new file mode 100644 index 000000000..e87b222c4 --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/DepartmentExamDAO.java @@ -0,0 +1,26 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.CompanyDepartment; +import club.joylink.rtss.entity.DepartmentExam; +import club.joylink.rtss.entity.DepartmentExamExample; +import club.joylink.rtss.entity.StudentClass; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * DepartmentExamDAO继承基类 + */ +@Repository +public interface DepartmentExamDAO extends MyBatisBaseDao { + + @Select("") + List getDepartsByExamId(@Param("examId") Long examId); +} diff --git a/src/main/java/club/joylink/rtss/dao/DepartmentLessonDAO.java b/src/main/java/club/joylink/rtss/dao/DepartmentLessonDAO.java new file mode 100644 index 000000000..00fa2ca00 --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/DepartmentLessonDAO.java @@ -0,0 +1,33 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.CompanyDepartment; +import club.joylink.rtss.entity.DepartmentLesson; +import club.joylink.rtss.entity.DepartmentLessonExample; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * DepartmentLessonDAO继承基类 + */ +@Repository +public interface DepartmentLessonDAO extends MyBatisBaseDao { + @Select("") + List getDeparts(@Param("lessonId") Long lessonId); + + @Select("") + List getClassNames(@Param("lessonId") Long lessonId); +} diff --git a/src/main/java/club/joylink/rtss/dao/DepartmentUserDAO.java b/src/main/java/club/joylink/rtss/dao/DepartmentUserDAO.java new file mode 100644 index 000000000..663ff192e --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/DepartmentUserDAO.java @@ -0,0 +1,22 @@ +package club.joylink.rtss.dao; + +import club.joylink.rtss.entity.DepartmentUser; +import club.joylink.rtss.entity.DepartmentUserExample; +import club.joylink.rtss.vo.client.company.CompanyDepartUserVO; +import club.joylink.rtss.vo.client.company.CompanyUserQueryVO; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * DepartmentUserDAO继承基类 + */ +@Repository +public interface DepartmentUserDAO extends MyBatisBaseDao { + + + List getCompanyDepartUsers(CompanyUserQueryVO companyUserQueryVO); + + List getUserCompanyDeparts(@Param("companyId") Integer companyId,@Param("userId") Long userId); +} diff --git a/src/main/java/club/joylink/rtss/dao/LsLessonDAO.java b/src/main/java/club/joylink/rtss/dao/LsLessonDAO.java index 5e03559b7..3eba7dd37 100644 --- a/src/main/java/club/joylink/rtss/dao/LsLessonDAO.java +++ b/src/main/java/club/joylink/rtss/dao/LsLessonDAO.java @@ -66,8 +66,11 @@ public interface LsLessonDAO extends MyBatisBaseDao" + " AND ls_lesson.prd_type = #{prdType}\n" + "" + + "" + + " AND ls_lesson.map_id = #{mapId}\n" + + "" + "ORDER BY\n" + "\tls_lesson.id ASC" + "") - List getValidLesson(List ids, String prdType); + List getValidLesson(Long mapId, List ids, String prdType); } diff --git a/src/main/java/club/joylink/rtss/dao/SysUserDAO.java b/src/main/java/club/joylink/rtss/dao/SysUserDAO.java index cf068da2d..96b15a0af 100644 --- a/src/main/java/club/joylink/rtss/dao/SysUserDAO.java +++ b/src/main/java/club/joylink/rtss/dao/SysUserDAO.java @@ -47,7 +47,9 @@ public interface SysUserDAO extends MyBatisBaseDao") List statisticsDailyRegister(@Param("beginDate") LocalDate beginDate, @Param("endDate") LocalDate endDate); - List pagedQueryWithCompany(UserQueryVO queryVO); + List queryUsersWithCompany(UserQueryVO queryVO); + UserVO queryUserWithCompany(@Param("userId") Long userId); + UserVO queryCompanyUserByAccount(@Param("account") String account,@Param("companyId") Integer companyId); // @Results(value = { // @Result(column = "id", property = "id"), diff --git a/src/main/java/club/joylink/rtss/dao/UserCompanyRelDAO.java b/src/main/java/club/joylink/rtss/dao/UserCompanyRelDAO.java deleted file mode 100644 index cee5ad22a..000000000 --- a/src/main/java/club/joylink/rtss/dao/UserCompanyRelDAO.java +++ /dev/null @@ -1,15 +0,0 @@ -package club.joylink.rtss.dao; - -import club.joylink.rtss.entity.UserCompanyRel; -import club.joylink.rtss.entity.UserCompanyRelExample; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * UserCompanyRelDAO继承基类 - */ -@Repository -public interface UserCompanyRelDAO extends MyBatisBaseDao { - void batchUpdate(List ucrList); -} diff --git a/src/main/java/club/joylink/rtss/entity/Company.java b/src/main/java/club/joylink/rtss/entity/Company.java index b32740636..a9738292f 100644 --- a/src/main/java/club/joylink/rtss/entity/Company.java +++ b/src/main/java/club/joylink/rtss/entity/Company.java @@ -25,6 +25,11 @@ public class Company implements Serializable { */ private String phone; + /** + * 关联项目 + */ + private String projectCode; + /** * 创建时间 */ @@ -69,6 +74,14 @@ public class Company implements Serializable { this.phone = phone; } + public String getProjectCode() { + return projectCode; + } + + public void setProjectCode(String projectCode) { + this.projectCode = projectCode; + } + public LocalDateTime getCreateTime() { return createTime; } @@ -101,6 +114,7 @@ public class Company implements Serializable { && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress())) && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone())) + && (this.getProjectCode() == null ? other.getProjectCode() == null : this.getProjectCode().equals(other.getProjectCode())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); } @@ -113,6 +127,7 @@ public class Company implements Serializable { result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode()); result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode()); + result = prime * result + ((getProjectCode() == null) ? 0 : getProjectCode().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); return result; @@ -128,6 +143,7 @@ public class Company implements Serializable { sb.append(", name=").append(name); sb.append(", address=").append(address); sb.append(", phone=").append(phone); + sb.append(", projectCode=").append(projectCode); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); sb.append(", serialVersionUID=").append(serialVersionUID); diff --git a/src/main/java/club/joylink/rtss/entity/CompanyDepartment.java b/src/main/java/club/joylink/rtss/entity/CompanyDepartment.java new file mode 100644 index 000000000..9a3ab28b3 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyDepartment.java @@ -0,0 +1,104 @@ +package club.joylink.rtss.entity; + +import java.io.Serializable; + +/** + * company_department + * @author + */ +public class CompanyDepartment implements Serializable { + private Integer id; + + /** + * 部门名称 + */ + private String name; + + /** + * 单位id + */ + private Integer companyId; + + /** + * 父级id + */ + private Integer parentId; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getCompanyId() { + return companyId; + } + + public void setCompanyId(Integer companyId) { + this.companyId = companyId; + } + + public Integer getParentId() { + return parentId; + } + + public void setParentId(Integer parentId) { + this.parentId = parentId; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + CompanyDepartment other = (CompanyDepartment) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) + && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) + && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); + result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", name=").append(name); + sb.append(", companyId=").append(companyId); + sb.append(", parentId=").append(parentId); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/CompanyDepartmentExample.java b/src/main/java/club/joylink/rtss/entity/CompanyDepartmentExample.java new file mode 100644 index 000000000..f60b0cd8b --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyDepartmentExample.java @@ -0,0 +1,472 @@ +package club.joylink.rtss.entity; + +import java.util.ArrayList; +import java.util.List; + +public class CompanyDepartmentExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public CompanyDepartmentExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("`name` is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("`name` is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("`name` =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("`name` <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("`name` >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("`name` >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("`name` <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("`name` <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("`name` like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("`name` not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("`name` in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("`name` not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("`name` between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("`name` not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNull() { + addCriterion("company_id is null"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNotNull() { + addCriterion("company_id is not null"); + return (Criteria) this; + } + + public Criteria andCompanyIdEqualTo(Integer value) { + addCriterion("company_id =", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotEqualTo(Integer value) { + addCriterion("company_id <>", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThan(Integer value) { + addCriterion("company_id >", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThanOrEqualTo(Integer value) { + addCriterion("company_id >=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThan(Integer value) { + addCriterion("company_id <", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThanOrEqualTo(Integer value) { + addCriterion("company_id <=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdIn(List values) { + addCriterion("company_id in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotIn(List values) { + addCriterion("company_id not in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdBetween(Integer value1, Integer value2) { + addCriterion("company_id between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotBetween(Integer value1, Integer value2) { + addCriterion("company_id not between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andParentIdIsNull() { + addCriterion("parent_id is null"); + return (Criteria) this; + } + + public Criteria andParentIdIsNotNull() { + addCriterion("parent_id is not null"); + return (Criteria) this; + } + + public Criteria andParentIdEqualTo(Integer value) { + addCriterion("parent_id =", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdNotEqualTo(Integer value) { + addCriterion("parent_id <>", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdGreaterThan(Integer value) { + addCriterion("parent_id >", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdGreaterThanOrEqualTo(Integer value) { + addCriterion("parent_id >=", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdLessThan(Integer value) { + addCriterion("parent_id <", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdLessThanOrEqualTo(Integer value) { + addCriterion("parent_id <=", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdIn(List values) { + addCriterion("parent_id in", values, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdNotIn(List values) { + addCriterion("parent_id not in", values, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdBetween(Integer value1, Integer value2) { + addCriterion("parent_id between", value1, value2, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdNotBetween(Integer value1, Integer value2) { + addCriterion("parent_id not between", value1, value2, "parentId"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/CompanyExample.java b/src/main/java/club/joylink/rtss/entity/CompanyExample.java index 8ce6af38b..137bea53c 100644 --- a/src/main/java/club/joylink/rtss/entity/CompanyExample.java +++ b/src/main/java/club/joylink/rtss/entity/CompanyExample.java @@ -395,6 +395,76 @@ public class CompanyExample { return (Criteria) this; } + public Criteria andProjectCodeIsNull() { + addCriterion("project_code is null"); + return (Criteria) this; + } + + public Criteria andProjectCodeIsNotNull() { + addCriterion("project_code is not null"); + return (Criteria) this; + } + + public Criteria andProjectCodeEqualTo(String value) { + addCriterion("project_code =", value, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeNotEqualTo(String value) { + addCriterion("project_code <>", value, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeGreaterThan(String value) { + addCriterion("project_code >", value, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeGreaterThanOrEqualTo(String value) { + addCriterion("project_code >=", value, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeLessThan(String value) { + addCriterion("project_code <", value, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeLessThanOrEqualTo(String value) { + addCriterion("project_code <=", value, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeLike(String value) { + addCriterion("project_code like", value, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeNotLike(String value) { + addCriterion("project_code not like", value, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeIn(List values) { + addCriterion("project_code in", values, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeNotIn(List values) { + addCriterion("project_code not in", values, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeBetween(String value1, String value2) { + addCriterion("project_code between", value1, value2, "projectCode"); + return (Criteria) this; + } + + public Criteria andProjectCodeNotBetween(String value1, String value2) { + addCriterion("project_code not between", value1, value2, "projectCode"); + return (Criteria) this; + } + public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; diff --git a/src/main/java/club/joylink/rtss/entity/CompanyPosition.java b/src/main/java/club/joylink/rtss/entity/CompanyPosition.java new file mode 100644 index 000000000..a675f4498 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyPosition.java @@ -0,0 +1,88 @@ +package club.joylink.rtss.entity; + +import java.io.Serializable; + +/** + * company_position + * @author + */ +public class CompanyPosition implements Serializable { + private Integer id; + + /** + * 职位名称 + */ + private String name; + + /** + * 单位id + */ + private Integer companyId; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getCompanyId() { + return companyId; + } + + public void setCompanyId(Integer companyId) { + this.companyId = companyId; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + CompanyPosition other = (CompanyPosition) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) + && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", name=").append(name); + sb.append(", companyId=").append(companyId); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/CompanyPositionExample.java b/src/main/java/club/joylink/rtss/entity/CompanyPositionExample.java new file mode 100644 index 000000000..1b87e932e --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyPositionExample.java @@ -0,0 +1,412 @@ +package club.joylink.rtss.entity; + +import java.util.ArrayList; +import java.util.List; + +public class CompanyPositionExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public CompanyPositionExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("`name` is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("`name` is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("`name` =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("`name` <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("`name` >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("`name` >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("`name` <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("`name` <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("`name` like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("`name` not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("`name` in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("`name` not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("`name` between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("`name` not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNull() { + addCriterion("company_id is null"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNotNull() { + addCriterion("company_id is not null"); + return (Criteria) this; + } + + public Criteria andCompanyIdEqualTo(Integer value) { + addCriterion("company_id =", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotEqualTo(Integer value) { + addCriterion("company_id <>", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThan(Integer value) { + addCriterion("company_id >", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThanOrEqualTo(Integer value) { + addCriterion("company_id >=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThan(Integer value) { + addCriterion("company_id <", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThanOrEqualTo(Integer value) { + addCriterion("company_id <=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdIn(List values) { + addCriterion("company_id in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotIn(List values) { + addCriterion("company_id not in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdBetween(Integer value1, Integer value2) { + addCriterion("company_id between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotBetween(Integer value1, Integer value2) { + addCriterion("company_id not between", value1, value2, "companyId"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/CompanyUser.java b/src/main/java/club/joylink/rtss/entity/CompanyUser.java new file mode 100644 index 000000000..355fcad72 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyUser.java @@ -0,0 +1,91 @@ +package club.joylink.rtss.entity; + +import java.io.Serializable; + +/** + * company_user + * @author + */ +public class CompanyUser implements Serializable { + /** + * 公司id + */ + private Integer companyId; + + /** + * 用户id + */ + private Long userId; + + /** + * 公司管理员 + */ + private Boolean admin; + + private static final long serialVersionUID = 1L; + + public Integer getCompanyId() { + return companyId; + } + + public void setCompanyId(Integer companyId) { + this.companyId = companyId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Boolean getAdmin() { + return admin; + } + + public void setAdmin(Boolean admin) { + this.admin = admin; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + CompanyUser other = (CompanyUser) that; + return (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) + && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) + && (this.getAdmin() == null ? other.getAdmin() == null : this.getAdmin().equals(other.getAdmin())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); + result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); + result = prime * result + ((getAdmin() == null) ? 0 : getAdmin().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", companyId=").append(companyId); + sb.append(", userId=").append(userId); + sb.append(", admin=").append(admin); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/CompanyUserExample.java b/src/main/java/club/joylink/rtss/entity/CompanyUserExample.java new file mode 100644 index 000000000..baed3d680 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/CompanyUserExample.java @@ -0,0 +1,402 @@ +package club.joylink.rtss.entity; + +import java.util.ArrayList; +import java.util.List; + +public class CompanyUserExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public CompanyUserExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andCompanyIdIsNull() { + addCriterion("company_id is null"); + return (Criteria) this; + } + + public Criteria andCompanyIdIsNotNull() { + addCriterion("company_id is not null"); + return (Criteria) this; + } + + public Criteria andCompanyIdEqualTo(Integer value) { + addCriterion("company_id =", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotEqualTo(Integer value) { + addCriterion("company_id <>", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThan(Integer value) { + addCriterion("company_id >", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdGreaterThanOrEqualTo(Integer value) { + addCriterion("company_id >=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThan(Integer value) { + addCriterion("company_id <", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdLessThanOrEqualTo(Integer value) { + addCriterion("company_id <=", value, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdIn(List values) { + addCriterion("company_id in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotIn(List values) { + addCriterion("company_id not in", values, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdBetween(Integer value1, Integer value2) { + addCriterion("company_id between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andCompanyIdNotBetween(Integer value1, Integer value2) { + addCriterion("company_id not between", value1, value2, "companyId"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(Long value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(Long value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(Long value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(Long value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(Long value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(Long value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(Long value1, Long value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(Long value1, Long value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andAdminIsNull() { + addCriterion("`admin` is null"); + return (Criteria) this; + } + + public Criteria andAdminIsNotNull() { + addCriterion("`admin` is not null"); + return (Criteria) this; + } + + public Criteria andAdminEqualTo(Boolean value) { + addCriterion("`admin` =", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminNotEqualTo(Boolean value) { + addCriterion("`admin` <>", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminGreaterThan(Boolean value) { + addCriterion("`admin` >", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminGreaterThanOrEqualTo(Boolean value) { + addCriterion("`admin` >=", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminLessThan(Boolean value) { + addCriterion("`admin` <", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminLessThanOrEqualTo(Boolean value) { + addCriterion("`admin` <=", value, "admin"); + return (Criteria) this; + } + + public Criteria andAdminIn(List values) { + addCriterion("`admin` in", values, "admin"); + return (Criteria) this; + } + + public Criteria andAdminNotIn(List values) { + addCriterion("`admin` not in", values, "admin"); + return (Criteria) this; + } + + public Criteria andAdminBetween(Boolean value1, Boolean value2) { + addCriterion("`admin` between", value1, value2, "admin"); + return (Criteria) this; + } + + public Criteria andAdminNotBetween(Boolean value1, Boolean value2) { + addCriterion("`admin` not between", value1, value2, "admin"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/DepartmentExam.java b/src/main/java/club/joylink/rtss/entity/DepartmentExam.java new file mode 100644 index 000000000..bb0b72c6d --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/DepartmentExam.java @@ -0,0 +1,69 @@ +package club.joylink.rtss.entity; + +import java.io.Serializable; + +/** + * department_exam + * @author + */ +public class DepartmentExam implements Serializable { + private Long examId; + + private Integer departmentId; + + private static final long serialVersionUID = 1L; + + public Long getExamId() { + return examId; + } + + public void setExamId(Long examId) { + this.examId = examId; + } + + public Integer getDepartmentId() { + return departmentId; + } + + public void setDepartmentId(Integer departmentId) { + this.departmentId = departmentId; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + DepartmentExam other = (DepartmentExam) that; + return (this.getExamId() == null ? other.getExamId() == null : this.getExamId().equals(other.getExamId())) + && (this.getDepartmentId() == null ? other.getDepartmentId() == null : this.getDepartmentId().equals(other.getDepartmentId())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getExamId() == null) ? 0 : getExamId().hashCode()); + result = prime * result + ((getDepartmentId() == null) ? 0 : getDepartmentId().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", examId=").append(examId); + sb.append(", departmentId=").append(departmentId); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/DepartmentExamExample.java b/src/main/java/club/joylink/rtss/entity/DepartmentExamExample.java new file mode 100644 index 000000000..3d8aaedf1 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/DepartmentExamExample.java @@ -0,0 +1,342 @@ +package club.joylink.rtss.entity; + +import java.util.ArrayList; +import java.util.List; + +public class DepartmentExamExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public DepartmentExamExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andExamIdIsNull() { + addCriterion("exam_id is null"); + return (Criteria) this; + } + + public Criteria andExamIdIsNotNull() { + addCriterion("exam_id is not null"); + return (Criteria) this; + } + + public Criteria andExamIdEqualTo(Long value) { + addCriterion("exam_id =", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdNotEqualTo(Long value) { + addCriterion("exam_id <>", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdGreaterThan(Long value) { + addCriterion("exam_id >", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdGreaterThanOrEqualTo(Long value) { + addCriterion("exam_id >=", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdLessThan(Long value) { + addCriterion("exam_id <", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdLessThanOrEqualTo(Long value) { + addCriterion("exam_id <=", value, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdIn(List values) { + addCriterion("exam_id in", values, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdNotIn(List values) { + addCriterion("exam_id not in", values, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdBetween(Long value1, Long value2) { + addCriterion("exam_id between", value1, value2, "examId"); + return (Criteria) this; + } + + public Criteria andExamIdNotBetween(Long value1, Long value2) { + addCriterion("exam_id not between", value1, value2, "examId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIsNull() { + addCriterion("department_id is null"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIsNotNull() { + addCriterion("department_id is not null"); + return (Criteria) this; + } + + public Criteria andDepartmentIdEqualTo(Integer value) { + addCriterion("department_id =", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotEqualTo(Integer value) { + addCriterion("department_id <>", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdGreaterThan(Integer value) { + addCriterion("department_id >", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdGreaterThanOrEqualTo(Integer value) { + addCriterion("department_id >=", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdLessThan(Integer value) { + addCriterion("department_id <", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdLessThanOrEqualTo(Integer value) { + addCriterion("department_id <=", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIn(List values) { + addCriterion("department_id in", values, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotIn(List values) { + addCriterion("department_id not in", values, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdBetween(Integer value1, Integer value2) { + addCriterion("department_id between", value1, value2, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotBetween(Integer value1, Integer value2) { + addCriterion("department_id not between", value1, value2, "departmentId"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/DepartmentLesson.java b/src/main/java/club/joylink/rtss/entity/DepartmentLesson.java new file mode 100644 index 000000000..62aab28c9 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/DepartmentLesson.java @@ -0,0 +1,75 @@ +package club.joylink.rtss.entity; + +import java.io.Serializable; + +/** + * department_lesson + * @author + */ +public class DepartmentLesson implements Serializable { + /** + * 课程id + */ + private Long lessonId; + + /** + * 班级id + */ + private Integer departmentId; + + private static final long serialVersionUID = 1L; + + public Long getLessonId() { + return lessonId; + } + + public void setLessonId(Long lessonId) { + this.lessonId = lessonId; + } + + public Integer getDepartmentId() { + return departmentId; + } + + public void setDepartmentId(Integer departmentId) { + this.departmentId = departmentId; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + DepartmentLesson other = (DepartmentLesson) that; + return (this.getLessonId() == null ? other.getLessonId() == null : this.getLessonId().equals(other.getLessonId())) + && (this.getDepartmentId() == null ? other.getDepartmentId() == null : this.getDepartmentId().equals(other.getDepartmentId())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getLessonId() == null) ? 0 : getLessonId().hashCode()); + result = prime * result + ((getDepartmentId() == null) ? 0 : getDepartmentId().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", lessonId=").append(lessonId); + sb.append(", departmentId=").append(departmentId); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/DepartmentLessonExample.java b/src/main/java/club/joylink/rtss/entity/DepartmentLessonExample.java new file mode 100644 index 000000000..7f6c05a60 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/DepartmentLessonExample.java @@ -0,0 +1,342 @@ +package club.joylink.rtss.entity; + +import java.util.ArrayList; +import java.util.List; + +public class DepartmentLessonExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public DepartmentLessonExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andLessonIdIsNull() { + addCriterion("lesson_id is null"); + return (Criteria) this; + } + + public Criteria andLessonIdIsNotNull() { + addCriterion("lesson_id is not null"); + return (Criteria) this; + } + + public Criteria andLessonIdEqualTo(Long value) { + addCriterion("lesson_id =", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdNotEqualTo(Long value) { + addCriterion("lesson_id <>", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdGreaterThan(Long value) { + addCriterion("lesson_id >", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdGreaterThanOrEqualTo(Long value) { + addCriterion("lesson_id >=", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdLessThan(Long value) { + addCriterion("lesson_id <", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdLessThanOrEqualTo(Long value) { + addCriterion("lesson_id <=", value, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdIn(List values) { + addCriterion("lesson_id in", values, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdNotIn(List values) { + addCriterion("lesson_id not in", values, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdBetween(Long value1, Long value2) { + addCriterion("lesson_id between", value1, value2, "lessonId"); + return (Criteria) this; + } + + public Criteria andLessonIdNotBetween(Long value1, Long value2) { + addCriterion("lesson_id not between", value1, value2, "lessonId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIsNull() { + addCriterion("department_id is null"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIsNotNull() { + addCriterion("department_id is not null"); + return (Criteria) this; + } + + public Criteria andDepartmentIdEqualTo(Integer value) { + addCriterion("department_id =", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotEqualTo(Integer value) { + addCriterion("department_id <>", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdGreaterThan(Integer value) { + addCriterion("department_id >", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdGreaterThanOrEqualTo(Integer value) { + addCriterion("department_id >=", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdLessThan(Integer value) { + addCriterion("department_id <", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdLessThanOrEqualTo(Integer value) { + addCriterion("department_id <=", value, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdIn(List values) { + addCriterion("department_id in", values, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotIn(List values) { + addCriterion("department_id not in", values, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdBetween(Integer value1, Integer value2) { + addCriterion("department_id between", value1, value2, "departmentId"); + return (Criteria) this; + } + + public Criteria andDepartmentIdNotBetween(Integer value1, Integer value2) { + addCriterion("department_id not between", value1, value2, "departmentId"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/club/joylink/rtss/entity/UserCompanyRel.java b/src/main/java/club/joylink/rtss/entity/DepartmentUser.java similarity index 73% rename from src/main/java/club/joylink/rtss/entity/UserCompanyRel.java rename to src/main/java/club/joylink/rtss/entity/DepartmentUser.java index 58d8437e3..a297534da 100644 --- a/src/main/java/club/joylink/rtss/entity/UserCompanyRel.java +++ b/src/main/java/club/joylink/rtss/entity/DepartmentUser.java @@ -4,10 +4,10 @@ import java.io.Serializable; import java.time.LocalDateTime; /** - * user_company_rel + * department_user * @author */ -public class UserCompanyRel implements Serializable { +public class DepartmentUser implements Serializable { private Long id; /** @@ -16,12 +16,17 @@ public class UserCompanyRel implements Serializable { private Long userId; /** - * 单位id + * 部门id */ - private Integer companyId; + private Integer departmentId; /** - * 是否管理员 + * 职位id + */ + private Integer positionId; + + /** + * 部门管理员 */ private Boolean manager; @@ -53,12 +58,20 @@ public class UserCompanyRel implements Serializable { this.userId = userId; } - public Integer getCompanyId() { - return companyId; + public Integer getDepartmentId() { + return departmentId; } - public void setCompanyId(Integer companyId) { - this.companyId = companyId; + public void setDepartmentId(Integer departmentId) { + this.departmentId = departmentId; + } + + public Integer getPositionId() { + return positionId; + } + + public void setPositionId(Integer positionId) { + this.positionId = positionId; } public Boolean getManager() { @@ -96,10 +109,11 @@ public class UserCompanyRel implements Serializable { if (getClass() != that.getClass()) { return false; } - UserCompanyRel other = (UserCompanyRel) that; + DepartmentUser other = (DepartmentUser) that; return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) - && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) + && (this.getDepartmentId() == null ? other.getDepartmentId() == null : this.getDepartmentId().equals(other.getDepartmentId())) + && (this.getPositionId() == null ? other.getPositionId() == null : this.getPositionId().equals(other.getPositionId())) && (this.getManager() == null ? other.getManager() == null : this.getManager().equals(other.getManager())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); @@ -111,7 +125,8 @@ public class UserCompanyRel implements Serializable { int result = 1; result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); - result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); + result = prime * result + ((getDepartmentId() == null) ? 0 : getDepartmentId().hashCode()); + result = prime * result + ((getPositionId() == null) ? 0 : getPositionId().hashCode()); result = prime * result + ((getManager() == null) ? 0 : getManager().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); @@ -126,7 +141,8 @@ public class UserCompanyRel implements Serializable { sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", userId=").append(userId); - sb.append(", companyId=").append(companyId); + sb.append(", departmentId=").append(departmentId); + sb.append(", positionId=").append(positionId); sb.append(", manager=").append(manager); sb.append(", createTime=").append(createTime); sb.append(", updateTime=").append(updateTime); diff --git a/src/main/java/club/joylink/rtss/entity/UserCompanyRelExample.java b/src/main/java/club/joylink/rtss/entity/DepartmentUserExample.java similarity index 80% rename from src/main/java/club/joylink/rtss/entity/UserCompanyRelExample.java rename to src/main/java/club/joylink/rtss/entity/DepartmentUserExample.java index 8ae625b99..b23a11291 100644 --- a/src/main/java/club/joylink/rtss/entity/UserCompanyRelExample.java +++ b/src/main/java/club/joylink/rtss/entity/DepartmentUserExample.java @@ -4,7 +4,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; -public class UserCompanyRelExample { +public class DepartmentUserExample { protected String orderByClause; protected boolean distinct; @@ -15,7 +15,7 @@ public class UserCompanyRelExample { private Long offset; - public UserCompanyRelExample() { + public DepartmentUserExample() { oredCriteria = new ArrayList(); } @@ -245,63 +245,123 @@ public class UserCompanyRelExample { return (Criteria) this; } - public Criteria andCompanyIdIsNull() { - addCriterion("company_id is null"); + public Criteria andDepartmentIdIsNull() { + addCriterion("department_id is null"); return (Criteria) this; } - public Criteria andCompanyIdIsNotNull() { - addCriterion("company_id is not null"); + public Criteria andDepartmentIdIsNotNull() { + addCriterion("department_id is not null"); return (Criteria) this; } - public Criteria andCompanyIdEqualTo(Integer value) { - addCriterion("company_id =", value, "companyId"); + public Criteria andDepartmentIdEqualTo(Integer value) { + addCriterion("department_id =", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdNotEqualTo(Integer value) { - addCriterion("company_id <>", value, "companyId"); + public Criteria andDepartmentIdNotEqualTo(Integer value) { + addCriterion("department_id <>", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdGreaterThan(Integer value) { - addCriterion("company_id >", value, "companyId"); + public Criteria andDepartmentIdGreaterThan(Integer value) { + addCriterion("department_id >", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdGreaterThanOrEqualTo(Integer value) { - addCriterion("company_id >=", value, "companyId"); + public Criteria andDepartmentIdGreaterThanOrEqualTo(Integer value) { + addCriterion("department_id >=", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdLessThan(Integer value) { - addCriterion("company_id <", value, "companyId"); + public Criteria andDepartmentIdLessThan(Integer value) { + addCriterion("department_id <", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdLessThanOrEqualTo(Integer value) { - addCriterion("company_id <=", value, "companyId"); + public Criteria andDepartmentIdLessThanOrEqualTo(Integer value) { + addCriterion("department_id <=", value, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdIn(List values) { - addCriterion("company_id in", values, "companyId"); + public Criteria andDepartmentIdIn(List values) { + addCriterion("department_id in", values, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdNotIn(List values) { - addCriterion("company_id not in", values, "companyId"); + public Criteria andDepartmentIdNotIn(List values) { + addCriterion("department_id not in", values, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdBetween(Integer value1, Integer value2) { - addCriterion("company_id between", value1, value2, "companyId"); + public Criteria andDepartmentIdBetween(Integer value1, Integer value2) { + addCriterion("department_id between", value1, value2, "departmentId"); return (Criteria) this; } - public Criteria andCompanyIdNotBetween(Integer value1, Integer value2) { - addCriterion("company_id not between", value1, value2, "companyId"); + public Criteria andDepartmentIdNotBetween(Integer value1, Integer value2) { + addCriterion("department_id not between", value1, value2, "departmentId"); + return (Criteria) this; + } + + public Criteria andPositionIdIsNull() { + addCriterion("position_id is null"); + return (Criteria) this; + } + + public Criteria andPositionIdIsNotNull() { + addCriterion("position_id is not null"); + return (Criteria) this; + } + + public Criteria andPositionIdEqualTo(Integer value) { + addCriterion("position_id =", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdNotEqualTo(Integer value) { + addCriterion("position_id <>", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdGreaterThan(Integer value) { + addCriterion("position_id >", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdGreaterThanOrEqualTo(Integer value) { + addCriterion("position_id >=", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdLessThan(Integer value) { + addCriterion("position_id <", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdLessThanOrEqualTo(Integer value) { + addCriterion("position_id <=", value, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdIn(List values) { + addCriterion("position_id in", values, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdNotIn(List values) { + addCriterion("position_id not in", values, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdBetween(Integer value1, Integer value2) { + addCriterion("position_id between", value1, value2, "positionId"); + return (Criteria) this; + } + + public Criteria andPositionIdNotBetween(Integer value1, Integer value2) { + addCriterion("position_id not between", value1, value2, "positionId"); return (Criteria) this; } diff --git a/src/main/java/club/joylink/rtss/services/CompanyService.java b/src/main/java/club/joylink/rtss/services/CompanyService.java index bd0158738..ac651a125 100644 --- a/src/main/java/club/joylink/rtss/services/CompanyService.java +++ b/src/main/java/club/joylink/rtss/services/CompanyService.java @@ -1,26 +1,24 @@ package club.joylink.rtss.services; -import club.joylink.rtss.dao.CompanyDAO; -import club.joylink.rtss.dao.UserCompanyRelDAO; +import club.joylink.rtss.dao.*; import club.joylink.rtss.entity.*; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.completition.IRaceQuestionsRuleService; import club.joylink.rtss.vo.UserVO; -import club.joylink.rtss.vo.client.CompanyQueryVO; -import club.joylink.rtss.vo.client.CompanyVO; +import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.PageVO; +import club.joylink.rtss.vo.client.company.*; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; -import lombok.NonNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; @Service @@ -29,6 +27,12 @@ public class CompanyService implements ICompanyService { @Autowired private CompanyDAO companyDAO; + @Autowired + private CompanyUserDAO companyUserDAO; + + @Autowired + private CompanyDepartmentDAO departmentDAO; + @Autowired private IRaceQuestionsRuleService IRaceQuestionsRuleService; @@ -36,8 +40,15 @@ public class CompanyService implements ICompanyService { private ISysUserService iSysUserService; @Autowired - private UserCompanyRelDAO userCompanyRelDAO; + private DepartmentUserDAO departmentUserDAO; + @Autowired + private DepartmentLessonDAO departmentLessonDAO; + @Autowired + private DepartmentExamDAO departmentExamDAO; + @Autowired + private ILessonService lessonService; + //************************************单位管理********************************************** @Override public List queryOrganizations() { CompanyExample example = new CompanyExample(); @@ -55,61 +66,13 @@ public class CompanyService implements ICompanyService { criteria.andNameLike(String.format("%%%s%%", queryVO.getName())); } Page page = (Page) companyDAO.selectByExample(example); - List voList = page.getResult().stream().map(company -> { - List managers; - List ucrList = findUserCompanyRelEntity(company.getId(), true); - if (CollectionUtils.isEmpty(ucrList)) { - managers = new ArrayList<>(); - } else { - List managerIds = ucrList.stream().map(UserCompanyRel::getUserId).collect(Collectors.toList()); - managers = iSysUserService.findEntity(managerIds); - } - List managerVOs = UserVO.convert2BaseInfoVO(managers); - return CompanyVO.convertFromDB(company, managerVOs); - }).collect(Collectors.toList()); + List voList =CompanyVO.convert2VOList(page.getResult()); return PageVO.convert(page, voList); } @Override - public void addManager(Integer companyId, List userIds, UserVO user) { - iSysUserService.confirmAdmin(user); - List ucrList = getUserCompanyRelEntity(userIds); - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(ucrList.stream().allMatch(ucr -> ucr.getCompanyId().equals(companyId)), - "有的用户不属于该公司"); - LocalDateTime now = LocalDateTime.now(); - ucrList.forEach(ucr -> { - ucr.setManager(true); - ucr.setUpdateTime(now); - }); - userCompanyRelDAO.batchUpdate(ucrList); - } - - @Override - public void userBindCompany(Long userId, Integer companyId) { - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(companyId, - "绑定的公司id不能为null"); - createOrUpdateUserCompanyRel(userId, companyId); - } - - @Override - public List findUserCompanyRelEntity(List userIds) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andUserIdIn(userIds); - return userCompanyRelDAO.selectByExample(example); - } - - @Override - public void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin) { - iSysUserService.confirmSuperAdmin(superAdmin.getId()); - iSysUserService.confirmExist(userId); - createOrUpdateUserCompanyRel(userId, companyId); - } - - @Override - public void deleteUserCompanyRel(Long userId) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andUserIdEqualTo(userId); - userCompanyRelDAO.deleteByExample(example); + public CompanyVO userScanCodeBindCompany(Long userId, Integer companyId) { + return iSysUserService.userScanCodeBindCompany(userId, companyId); } @Override @@ -130,7 +93,6 @@ public class CompanyService implements ICompanyService { @Transactional @Override public void deleteCompanyById(Integer companyId) { - companyDAO.deleteByPrimaryKey(companyId); IRaceQuestionsRuleService.deleteByCompanyId(companyId); } @@ -142,6 +104,24 @@ public class CompanyService implements ICompanyService { String.format("id为[%s]的公司不存在", companyId)); return new CompanyVO(entity); } +// +// @Override +// public void addManager(Integer companyId, List userIds, UserVO user) { +// CompanyUserExample e = new CompanyUserExample(); +// e.createCriteria().andCompanyIdEqualTo(companyId).andUserIdIn(userIds); +// CompanyUser cu =new CompanyUser(); +// cu.setAdmin(true); +// companyUserDAO.updateByExampleSelective(cu,e); +// } +// +// @Override +// public void removeManager(Integer companyId, List userIds, UserVO user) { +// CompanyUserExample e = new CompanyUserExample(); +// e.createCriteria().andCompanyIdEqualTo(companyId).andUserIdIn(userIds); +// CompanyUser cu =new CompanyUser(); +// cu.setAdmin(false); +// companyUserDAO.updateByExampleSelective(cu,e); +// } @Override public boolean isExist(Integer companyId) { @@ -153,62 +133,402 @@ public class CompanyService implements ICompanyService { private Company getCompanyEntity(Integer id) { Company company = companyDAO.selectByPrimaryKey(id); - BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company,String.format("单位[%s]不存在",id)); return company; } - private List findUserCompanyRelEntity(Integer companyId, boolean manager) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andCompanyIdEqualTo(companyId).andManagerEqualTo(manager); - return userCompanyRelDAO.selectByExample(example); + @Override + public boolean isCompanyUser(Long userId) { + CompanyUserExample e = new CompanyUserExample(); + e.createCriteria().andUserIdEqualTo(userId); + return companyUserDAO.countByExample(e)>0; + + } - private List getUserCompanyRelEntity(@NonNull List userIds) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andUserIdIn(userIds); - List ucrList = userCompanyRelDAO.selectByExample(example); - BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(ucrList, "这些用户不属于任何公司"); - return ucrList; + //************************************部门管理********************************************** + + /** + * 增加部门 + */ + @Override + public DepartmentVO createDepart(DepartmentVO departmentVO) { + BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(departmentIsExist(departmentVO), "同级部门信息重复"); + CompanyDepartment entity = departmentVO.toDB(); + departmentDAO.insert(entity); + departmentVO.setId(entity.getId()); + return departmentVO; } - private List findUserCompanyRelEntity(Integer companyId) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andCompanyIdEqualTo(companyId); - return userCompanyRelDAO.selectByExample(example); + /** + * 修改部门 + */ + @Override + public void updateDepartInfo(Integer deptId, DepartmentVO departmentVO) { + CompanyDepartment entity = departmentVO.toDB(); + entity.setId(deptId); + entity.setCompanyId(null); + departmentDAO.updateByPrimaryKeySelective(entity); } - private UserCompanyRel getUserCompanyRelEntity(Long userId) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andUserIdEqualTo(userId); - List ucrs = userCompanyRelDAO.selectByExample(example); - BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(ucrs); - return ucrs.get(0); + /** + * 删除部门 + */ + @Override + public void deleteDepartById(Integer deptId) { + departmentDAO.deleteByPrimaryKey(deptId); } - private UserCompanyRel findUserCompanyRelEntity(Long userId) { - UserCompanyRelExample example = new UserCompanyRelExample(); - example.createCriteria().andUserIdEqualTo(userId); - List ucrs = userCompanyRelDAO.selectByExample(example); - if (CollectionUtils.isEmpty(ucrs)) { + /** + * 查询部门信息 + */ + @Override + public DepartmentVO getDepartById(Integer deptId) { + CompanyDepartment entity = departmentDAO.selectByPrimaryKey(deptId); + if (Objects.isNull(entity)) { return null; } + return new DepartmentVO(entity); + } + + /** + * 根据单位id查询部门及其子部门信息 + */ + @Override + public List getCompanyDepartTree(Integer companyId) { + CompanyDepartmentExample example = new CompanyDepartmentExample(); + example.createCriteria().andCompanyIdEqualTo(companyId); + List companyDepartments = departmentDAO.selectByExample(example); + return DepartmentVO.buildDeptTree(DepartmentVO.convert2VOList(companyDepartments)); + } + + @Override + public List getCompanyAllDepart(Integer companyId) { + CompanyDepartmentExample example = new CompanyDepartmentExample(); + example.createCriteria().andCompanyIdEqualTo(companyId); + List companyDepartments = departmentDAO.selectByExample(example); + return DepartmentVO.convert2VOList(companyDepartments); + } + + @Override + public DepartmentVO getDepartTree(Integer companyId, Integer deptId) { + CompanyDepartment companyDepartment = departmentDAO.selectByPrimaryKey(deptId); + CompanyDepartmentExample example = new CompanyDepartmentExample(); + example.createCriteria().andCompanyIdEqualTo(companyId); + List companyDepartments = departmentDAO.selectByExample(example); + List childDept = DepartmentVO.getChildDept(deptId, DepartmentVO.convert2VOList(companyDepartments)); + DepartmentVO departmentVO = new DepartmentVO(companyDepartment); + departmentVO.setChildDept(childDept); + return departmentVO; + } + + @Override + public List getDepartAndChild(Integer companyId, Integer deptId) { + var example = new CompanyDepartmentExample(); + example.createCriteria().andCompanyIdEqualTo(companyId); + var companyDepartments = departmentDAO.selectByExample(example); + var childDept = DepartmentVO.getChildDeptList(deptId, DepartmentVO.convert2VOList(companyDepartments)); + var companyDepartment = departmentDAO.selectByPrimaryKey(deptId); + childDept.add(new DepartmentVO(companyDepartment)); + return childDept; + } + + + private boolean departmentIsExist(DepartmentVO departmentVO) { + var example = new CompanyDepartmentExample(); + CompanyDepartmentExample.Criteria criteria = example.createCriteria() + .andCompanyIdEqualTo(departmentVO.getCompanyId()) + .andNameEqualTo(departmentVO.getName()); + if (Objects.isNull(departmentVO.getParentId())) { + criteria + .andParentIdIsNull(); + } else { + criteria + .andParentIdEqualTo(departmentVO.getParentId()); + } + + if (departmentDAO.countByExample(example) == 0) { + return false; + } + return true; + } + + + //************************************职位管理********************************************** + +// /** +// * 增加职位 +// */ +// @Override +// public PositionVO createPosition(PositionVO positionVO) { +// BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(positionIsExist(positionVO), "相同的职位信息"); +// var entity = positionVO.toDB(); +// positionDAO.insert(entity); +// positionVO.setId(entity.getId()); +// return positionVO; +// } +// +// private boolean positionIsExist(PositionVO positionVO) { +// var example = new CompanyPositionExample(); +// example.createCriteria() +// .andCompanyIdEqualTo(positionVO.getCompanyId()) +// .andNameEqualTo(positionVO.getName()); +// if (positionDAO.countByExample(example) == 0) { +// return false; +// } +// return true; +// } +// +// /** +// * 修改职位 +// */ +// @Override +// public void updatePositionInfo(Integer positionId, PositionVO positionVO) { +// var entity = positionVO.toDB(); +// entity.setId(positionId); +// entity.setCompanyId(null); +// positionDAO.updateByPrimaryKeySelective(entity); +// } +// +// /** +// * 删除职位 +// */ +// @Override +// public void deletePositionById(Integer positionId) { +// positionDAO.deleteByPrimaryKey(positionId); +// } +// +// /** +// * 查询职位信息 +// */ +// @Override +// public PositionVO getPositionById(Integer positionId) { +// var entity = positionDAO.selectByPrimaryKey(positionId); +// if (Objects.isNull(entity)) { +// return null; +// } +// return new PositionVO(entity); +// } +// +// /** +// * 查询单位所有职位信息 +// */ +// @Override +// public List getPositionsByCompanyId(Integer companyId) { +// var example = new CompanyPositionExample(); +// example.createCriteria() +// .andCompanyIdEqualTo(companyId); +// List companyPositions = positionDAO.selectByExample(example); +// return PositionVO.convert2VOList(companyPositions); +// } + + //************************************单位-部门-职位-用户 关系********************************************** + + + private DepartmentUser getDepartUseRelEntity(Long userId, Integer departId) { + DepartmentUserExample example = new DepartmentUserExample(); + example.createCriteria() + .andUserIdEqualTo(userId) + .andDepartmentIdEqualTo(departId); + List ucrs = departmentUserDAO.selectByExample(example); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(ucrs, "非部门" + departId + "内部用户"); return ucrs.get(0); } - private void createOrUpdateUserCompanyRel(Long userId, Integer companyId) { - UserVO user = iSysUserService.getUserById(userId); - Company company = getCompanyEntity(companyId); - UserCompanyRel ucr = findUserCompanyRelEntity(userId); - if (ucr == null) { - UserCompanyRel newUcr = new UserCompanyRel(); - newUcr.setUserId(user.getId()); - newUcr.setCompanyId(company.getId()); - newUcr.setCreateTime(LocalDateTime.now()); - userCompanyRelDAO.insert(newUcr); - } else { - ucr.setCompanyId(companyId); - userCompanyRelDAO.updateByPrimaryKey(ucr); - } + @Override + public List getDepartRefByUserId(Long userId) { + DepartmentUserExample e = new DepartmentUserExample(); + e.createCriteria().andUserIdEqualTo(userId); + List departmentUserRefs = this.departmentUserDAO.selectByExample(e); + return UserDepartRelVO.convert2VOList(departmentUserRefs); + } + /**添加部门-职位-用户关系*/ + @Override + public void addDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO) { + var userRel = getDepartUseRelEntity(user.getId(), userDepartRelVO.getDepartmentId()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(userRel, "非本部门无法操作"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(userRel.getManager(), "非部门管理员无法操作"); + DepartmentUser departmentUser = getDepartUseRelEntity(userDepartRelVO.getUserId(), userDepartRelVO.getDepartmentId()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNull(departmentUser, "已存在的部门成员"); + departmentUserDAO.insertSelective(userDepartRelVO.toDB()); } + /**更新部门-职位-用户关系*/ + @Override + public void updateDepartUserInfo(UserVO user,UserDepartRelVO userDepartRelVO) { + var userRel = getDepartUseRelEntity(user.getId(), userDepartRelVO.getDepartmentId()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(userRel, "非本部门无法操作"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(userRel.getManager(), "非部门管理员无法操作"); + DepartmentUser departmentUser = getDepartUseRelEntity(userDepartRelVO.getUserId(), userDepartRelVO.getDepartmentId()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(departmentUser, "不存在的部门成员"); + departmentUser.setPositionId(userDepartRelVO.getPositionId()); + departmentUser.setManager(userDepartRelVO.isManager()); + } + + /** 删除部门-职位-用户关系*/ + @Override + public void deleteDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO) { + DepartmentUser userRel = getDepartUseRelEntity(user.getId(), userDepartRelVO.getDepartmentId()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(userRel, "非本部门成员"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(userRel.getManager(), "非部门管理员无法操作"); + DepartmentUserExample example = new DepartmentUserExample(); + example.createCriteria().andDepartmentIdEqualTo(userDepartRelVO.getDepartmentId()).andUserIdEqualTo(userDepartRelVO.getUserId()); + departmentUserDAO.deleteByExample(example); + } + + @Override + public List getUserCompanyDeparts(UserVO user, Integer companyId) { + //根据公司id和用户id查询用户企业详细信息 + return departmentUserDAO.getUserCompanyDeparts(companyId,user.getId()); + } + + @Override + public PageVO getCompanyDepartUserInfoList(UserVO user, Integer departId, CompanyUserQueryVO companyUserQueryVO) { + + //根据部门id查询部门成员 + companyUserQueryVO.setDepartmentId(departId); + PageHelper.startPage(companyUserQueryVO.getPageNum(), companyUserQueryVO.getPageSize()); + Page page = (Page) departmentUserDAO.getCompanyDepartUsers(companyUserQueryVO); + return PageVO.convert(page); + } + + @Transactional + @Override + public void importCompanyUserInfo(UserVO user, Integer companyId, ImportCompanyUserVO importCompanyUserVO) { + + //验证操作人员 + Company company = getCompanyEntity(companyId); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(company, "单位不存在"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertEquals(user.getCompanyId(), companyId, "非同单位成员无法操作"); + + //验证是否存在并导入新的年级和班级 + var departmentExample = new CompanyDepartmentExample(); + departmentExample.createCriteria() + .andCompanyIdEqualTo(companyId) + .andNameEqualTo(importCompanyUserVO.getParentDepart()); + List importParentDepart = departmentDAO.selectByExample(departmentExample); + DepartmentVO parentDepart; + DepartmentVO childDepart; + if (CollectionUtils.isEmpty(importParentDepart)) { + parentDepart = new DepartmentVO(importCompanyUserVO.getParentDepart(), companyId, null); + createDepart(parentDepart); + childDepart = new DepartmentVO(importCompanyUserVO.getDepart(), companyId, parentDepart.getId()); + createDepart(childDepart); + UserDepartRelVO userDepartRelVO = new UserDepartRelVO(user.getId(), childDepart.getId(), null, true); + departmentUserDAO.insertSelective(userDepartRelVO.toDB()); + } else { + parentDepart = new DepartmentVO(importParentDepart.get(0)); + departmentExample.clear(); + CompanyDepartmentExample.Criteria criteria = departmentExample.createCriteria() + .andCompanyIdEqualTo(companyId) + .andNameEqualTo(importCompanyUserVO.getDepart()); + if (Objects.isNull(parentDepart.getParentId())) { + criteria + .andParentIdIsNull(); + } else { + + criteria + .andParentIdEqualTo(parentDepart.getParentId()); + } + List importChildDepart = departmentDAO.selectByExample(departmentExample); + if (CollectionUtils.isEmpty(importChildDepart)) { + childDepart = new DepartmentVO(importCompanyUserVO.getDepart(), companyId, parentDepart.getId()); + createDepart(childDepart); + UserDepartRelVO userDepartRelVO = new UserDepartRelVO(user.getId(), childDepart.getId(), null, true); + departmentUserDAO.insertSelective(userDepartRelVO.toDB()); + } else { + childDepart = new DepartmentVO(importChildDepart.get(0)); + DepartmentUserExample departmentUserExample = new DepartmentUserExample(); + departmentUserExample.createCriteria().andUserIdEqualTo(user.getId()).andDepartmentIdEqualTo(childDepart.getId()); + List departmentUsers = departmentUserDAO.selectByExample(departmentUserExample); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertCollectionEmpty(departmentUsers, "非部门成员/导入部门信息重复"); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(departmentUsers.get(0).getManager(), "非部门管理员"); + } + } + + //构建系统用户对象 + List sysUsers = CompanyUserVO.convert2DBList(importCompanyUserVO.getCompanyUsers()); + sysUsers.forEach(sysUser -> { + UserVO userVO = iSysUserService.queryCompanyUserByAccount(companyId, sysUser.getAccount()); + if (Objects.isNull(userVO)) { + iSysUserService.createUser(sysUser); + userVO = new UserVO(sysUser); + iSysUserService.userBindCompany(userVO, companyId,false); + UserDepartRelVO userDepartRelVO = new UserDepartRelVO(userVO.getId(), childDepart.getId(), null, false); + departmentUserDAO.insertSelective(userDepartRelVO.toDB()); + } else { + DepartmentUserExample departmentUserExample = new DepartmentUserExample(); + departmentUserExample.createCriteria().andUserIdEqualTo(userVO.getId()).andDepartmentIdEqualTo(childDepart.getId()); + List userDeparts = departmentUserDAO.selectByExample(departmentUserExample); + if (CollectionUtils.isEmpty(userDeparts)) { + UserDepartRelVO userDepartRelVO = new UserDepartRelVO(userVO.getId(), childDepart.getId(), null, false); + departmentUserDAO.insertSelective(userDepartRelVO.toDB()); + } + } + }); + } + + //---------------------------课程 / 考试 / 部门----------------------------------------- + + @Override + public List getDepartsByLesson(Long lessonId) { + List classes = this.departmentLessonDAO.getDeparts(lessonId); + return DepartmentVO.convert2VOList(classes); + } + + @Override + public List getDepartsByExamId(Long examId) { + DepartmentExamExample example = new DepartmentExamExample(); + example.createCriteria().andExamIdEqualTo(examId); + List classes = this.departmentExamDAO.getDepartsByExamId(examId); + return DepartmentVO.convert2VOList(classes); + } + + @Override + public List getExamIdsByDepartId(Integer departId) { + DepartmentExamExample example = new DepartmentExamExample(); + example.createCriteria().andDepartmentIdEqualTo(departId); + List departmentExamRefs = this.departmentExamDAO.selectByExample(example); + return departmentExamRefs.stream().map(DepartmentExam::getExamId).collect(Collectors.toList()); + } + // + @Override + public void deleteDepartsExam(Long examId) { + DepartmentExamExample example = new DepartmentExamExample(); + example.createCriteria().andExamIdEqualTo(examId); + departmentExamDAO.deleteByExample(example); + } + + //TODO 判是否存在 + @Override + public void addDepartExam(Long examId, Integer departId) { + DepartmentExam departmentExam = new DepartmentExam(); + departmentExam.setExamId(examId); + departmentExam.setDepartmentId(departId); + departmentExamDAO.insert(departmentExam); + } + + @Override + public List getDepartLessonRefs(Integer departId) { + DepartmentLessonExample example = new DepartmentLessonExample(); + example.createCriteria().andDepartmentIdEqualTo(departId); + List departmentLessonRef = this.departmentLessonDAO.selectByExample(example); + return departmentLessonRef; + } + + @Override + public List getLessonsByDepart(Integer departId) { + List lessonIds = getDepartLessonRefs(departId).stream().map(DepartmentLesson::getLessonId).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(lessonIds)) return new ArrayList<>(); + return lessonService.getValidLesson(null,lessonIds, null); + } + + @Override + public List getDepartNamesByLesson(Long LessonId) { + List classes = this.departmentLessonDAO.getClassNames(LessonId); + return classes; + } + + + } diff --git a/src/main/java/club/joylink/rtss/services/DraftMapService.java b/src/main/java/club/joylink/rtss/services/DraftMapService.java index 25d8e08aa..0f8b0be9e 100644 --- a/src/main/java/club/joylink/rtss/services/DraftMapService.java +++ b/src/main/java/club/joylink/rtss/services/DraftMapService.java @@ -207,8 +207,7 @@ public class DraftMapService implements IDraftMapService { // 插入新副本 draftMapDAO.insert(draftMap); if (draftMap.getDrawWay()) { - - saveMapLogicDataNew(draftMap.getId(), getMapLogicDataNew(id)); + saveMapLogicDataNew(draftMap, getMapLogicDataNew(id)); } else { saveMapLogicData(draftMap.getId(), getMapLogicData(id)); @@ -385,7 +384,7 @@ public class DraftMapService implements IDraftMapService { iRealLineService.create(skinVO, userVO); } if (mapVO.isDrawWay()) { - saveMapLogicDataNew(draftMap.getId(), mapVO.getLogicDataNew()); + saveMapLogicDataNew(draftMap, mapVO.getLogicDataNew()); } else { saveMapLogicData(draftMap.getId(), mapVO.getLogicData()); } @@ -970,7 +969,8 @@ public class DraftMapService implements IDraftMapService { } } - private void saveMapLogicDataNew(Long id, MapLogicDataNewVO logicDataVO) { + private void saveMapLogicDataNew(DraftMapWithBLOBs draftMap, MapLogicDataNewVO logicDataVO) { + Long id = draftMap.getId(); if (Objects.isNull(logicDataVO)) { return; } @@ -989,7 +989,8 @@ public class DraftMapService implements IDraftMapService { }); } if (!CollectionUtils.isEmpty(logicDataVO.getDestinationCodeDefinitionList())) { - + draftMap.setLogicData(JsonUtils.writeValueAsString(logicDataVO.getDestinationCodeDefinitionList())); + draftMapDAO.updateByPrimaryKeyWithBLOBs(draftMap); } if (!CollectionUtils.isEmpty(logicDataVO.getRoutingList())) { logicDataVO.getRoutingList().forEach(routingVO -> { diff --git a/src/main/java/club/joylink/rtss/services/ExamService.java b/src/main/java/club/joylink/rtss/services/ExamService.java index 43196e86d..b85a44205 100644 --- a/src/main/java/club/joylink/rtss/services/ExamService.java +++ b/src/main/java/club/joylink/rtss/services/ExamService.java @@ -4,10 +4,12 @@ import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.dao.*; import club.joylink.rtss.entity.*; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; -import club.joylink.rtss.services.student.IClassStudentUserService; +import club.joylink.rtss.simulation.cbtc.GroupSimulationService; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.*; -import club.joylink.rtss.vo.client.student.StudentClassVO; +import club.joylink.rtss.vo.client.company.DepartmentVO; +import club.joylink.rtss.vo.client.company.UserDepartRelVO; +import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.userPermission.UserPermissionVO; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; @@ -54,7 +56,13 @@ public class ExamService implements IExamService{ private ExamDefinitionRulesDAO examDefinitionRulesDAO; @Autowired - private IClassStudentUserService iClassStudentUserService; + private ICompanyService iCompanyService; + + @Autowired + private IMapService iMapService; + + @Autowired + private GroupSimulationService groupSimulationService; /** * 创建考试定义 @@ -65,7 +73,7 @@ public class ExamService implements IExamService{ //检查分数是否合理 BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO)); //检查考试名称和考试规则是否唯一 - checkExam(examDefinitionVO); + checkName(examDefinitionVO); //插入考试定义表数据 ExamDefinition examDefinition = examDefinitionVO.toDB(); examDefinition.setCreateTime(LocalDateTime.now()); @@ -77,7 +85,10 @@ public class ExamService implements IExamService{ examDefinition.setTrial(false); } examDefinitionDAO.insert(examDefinition); - + //插入试卷班级关系 + if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { + examDefinitionVO.getClasses().forEach(departmentVO -> iCompanyService.addDepartExam(examDefinition.getId(),departmentVO.getId())); + } //插入试题规则表数据 List examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList(); examDefinitionRulesVOList.forEach(examDefinitionRulesVO -> { @@ -133,41 +144,41 @@ public class ExamService implements IExamService{ } } - /** - * GZB创建考试定义 - */ - @Transactional - @Override - public void createGZBExam(ExamDefinitionVO examDefinitionVO, UserVO userVO) { - examDefinitionVO.setCreatorId(userVO.getId()); - - //检查分数是否合理 - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO)); - //检查考试名称和考试规则是否唯一 - checkName(examDefinitionVO); - //插入考试定义表数据 - ExamDefinition examDefinition = examDefinitionVO.toDB(); - examDefinition.setCreateTime(LocalDateTime.now()); - examDefinition.setStatus(BusinessConsts.STATUS_USE); - // 判断是否是管理员并设置试用 - if(this.iSysUserService.isAdmin(userVO) && examDefinitionVO.getTrial()) { - examDefinition.setTrial(true); - }else { - examDefinition.setTrial(false); - } - examDefinitionDAO.insert(examDefinition); - //插入试卷班级关系 - if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { - examDefinitionVO.getClasses().forEach(studentClassVO -> iClassStudentUserService.addExamRelClass(examDefinition.getId(),studentClassVO.getId())); - } - //插入试题规则表数据 - List examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList(); - examDefinitionRulesVOList.forEach(examDefinitionRulesVO -> { - ExamDefinitionRules examDefinitionRules = examDefinitionRulesVO.toDB(); - examDefinitionRules.setExamId(examDefinition.getId()); - definitionRulesDAO.insert(examDefinitionRules); - }); - } +// /** +// * GZB创建考试定义 +// */ +// @Transactional +// @Override +// public void createGZBExam(ExamDefinitionVO examDefinitionVO, UserVO userVO) { +// examDefinitionVO.setCreatorId(userVO.getId()); +// +// //检查分数是否合理 +// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO)); +// //检查考试名称和考试规则是否唯一 +// checkName(examDefinitionVO); +// //插入考试定义表数据 +// ExamDefinition examDefinition = examDefinitionVO.toDB(); +// examDefinition.setCreateTime(LocalDateTime.now()); +// examDefinition.setStatus(BusinessConsts.STATUS_USE); +// // 判断是否是管理员并设置试用 +// if(this.iSysUserService.isAdmin(userVO) && examDefinitionVO.getTrial()) { +// examDefinition.setTrial(true); +// }else { +// examDefinition.setTrial(false); +// } +// examDefinitionDAO.insert(examDefinition); +// //插入试卷班级关系 +// if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { +// examDefinitionVO.getClasses().forEach(departmentVO -> iCompanyService.addDepartExam(examDefinition.getId(),departmentVO.getId())); +// } +// //插入试题规则表数据 +// List examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList(); +// examDefinitionRulesVOList.forEach(examDefinitionRulesVO -> { +// ExamDefinitionRules examDefinitionRules = examDefinitionRulesVO.toDB(); +// examDefinitionRules.setExamId(examDefinition.getId()); +// definitionRulesDAO.insert(examDefinitionRules); +// }); +// } private void checkName(ExamDefinitionVO examDefinitionVO) { //一个课程下考试名称查重 ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); @@ -266,7 +277,7 @@ public class ExamService implements IExamService{ examDefinitionRulesVOList.add(examDefinitionRulesVO); }); ExamDefinitionVO examDefinitionVO = new ExamDefinitionVO(examDefinition); - examDefinitionVO.setClasses(iClassStudentUserService.getClassesByExamId(examId)); + examDefinitionVO.setClasses(iCompanyService.getDepartsByExamId(examId)); examDefinitionVO.setExamDefinitionRulesVOList(examDefinitionRulesVOList); return examDefinitionVO; @@ -280,12 +291,18 @@ public class ExamService implements IExamService{ //查询课程信息 LessonVO lessonVO = iLessonService.getLessonInfo(lessonId); + MapVO mapVO = iMapService.findMapBaseInfoById(lessonVO.getMapId()); + BusinessConsts.Lesson.PrdInfo prdInfo = BusinessConsts.Lesson.PrdInfo.getBy(lessonVO.getPrdType()); + String defaultLessonName = String.join("-", mapVO.getName(), prdInfo.getName()); + lessonVO.setSystemFault(Objects.equals(lessonVO.getName(),defaultLessonName)); // 如果用户关联班级 查找班级关联试卷 - List studentRelIdClasses = this.iClassStudentUserService.getRelClassByUser(userVO.getId()); - List examIds = null; - if (!CollectionUtils.isEmpty(studentRelIdClasses)) { - Integer classId = studentRelIdClasses.get(0).getClassId(); - examIds = iClassStudentUserService.getRelExamIdsByClassId(classId); + List userDepartRelVOS = this.iCompanyService.getDepartRefByUserId(userVO.getId()); + List examIds =null; + if (!CollectionUtils.isEmpty(userDepartRelVOS)) { + examIds = new ArrayList<>(); + for (UserDepartRelVO udr : userDepartRelVOS) { + examIds.addAll(iCompanyService.getExamIdsByDepartId(udr.getDepartmentId())); + } } //查询课程下的试题信息 ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); @@ -299,7 +316,7 @@ public class ExamService implements IExamService{ if (null != exam.getEndTime() && now.isAfter(exam.getEndTime())) { this.offLine(exam.getId(), userVO); iterator.remove(); - } else if (Objects.nonNull(examIds) && !examIds.contains(exam.getId())) { + } else if (Objects.nonNull(examIds) && !Objects.equals(exam.getName(),defaultLessonName+"试卷") && !examIds.contains(exam.getId())) { iterator.remove(); } } @@ -309,18 +326,18 @@ public class ExamService implements IExamService{ examDefinitionList.forEach(examDefinition -> { ExamDefinitionVO exam = new ExamDefinitionVO(examDefinition); // 试卷存在班级关系,获取班级列表 - List classes = iClassStudentUserService.getClassesByExamId(examDefinition.getId()); - if (!CollectionUtils.isEmpty(classes)) { - exam.setClasses(classes); + List departs = iCompanyService.getDepartsByExamId(examDefinition.getId()); + if (!CollectionUtils.isEmpty(departs)) { + exam.setClasses(departs); } examDefinitionVOList.add(exam); }); examsLessonVO.setExamDefinitionList(examDefinitionVOList); // 设置权限 -// List voList = userPermissionService.findTeachVOByMapIdAndUserId(lessonVO.getMapId(), userVO.getId()); - List examPermissions = this.iUserPermissionService.getExamUserPermission(userVO, - lessonVO.getMapId(), lessonVO.getPrdType(), lessonId); - examsLessonVO.setPermissionList(examPermissions); + examsLessonVO.setAvailable(groupSimulationService.hasPermission(userVO, lessonVO.getMapId(), lessonVO.getPrdType())); +// List examPermissions = this.iUserPermissionService.getExamUserPermission(userVO, +// lessonVO.getMapId(), lessonVO.getPrdType(), lessonId); +// examsLessonVO.setPermissionList(examPermissions); return examsLessonVO; } @@ -397,7 +414,7 @@ public class ExamService implements IExamService{ //判断是否已有用户参与考试,如果有,不能删除考试定义 UserExamExample userExamExample = new UserExamExample(); userExamExample.createCriteria().andExamIdEqualTo(Long.parseLong(id)); - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(userExamMapper.countByExample(userExamExample) < 0, + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(userExamMapper.countByExample(userExamExample) > 0, String.format("试卷[%s]已被使用", id)); //删除考试信息和规则信息 @@ -476,9 +493,11 @@ public class ExamService implements IExamService{ public void update(Long id, ExamDefinitionVO examDefinitionVO) { ExamDefinition examDefinition = this.examDefinitionDAO.selectByPrimaryKey(id); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(examDefinition); - iClassStudentUserService.getClassesByExamId(id).forEach(studentClassVO -> iClassStudentUserService.deleteExamRelClass(id)); - if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())){ - examDefinitionVO.getClasses().forEach(studentClassVO -> iClassStudentUserService.addExamRelClass(id, studentClassVO.getId())); + if (!CollectionUtils.isEmpty(iCompanyService.getDepartsByExamId(id))) { + iCompanyService.deleteDepartsExam(id); + } + if (!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { + examDefinitionVO.getClasses().forEach(departmentVO -> iCompanyService.addDepartExam(id, departmentVO.getId())); } //考试名称查重 String name = examDefinitionVO.getName(); @@ -488,6 +507,8 @@ public class ExamService implements IExamService{ BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertCollectionEmpty(examDefinitionList); examDefinition.setName(examDefinitionVO.getName()); examDefinition.setTrial(examDefinitionVO.getTrial()); + examDefinition.setStartTime(examDefinitionVO.getStartTime()); + examDefinition.setEndTime(examDefinitionVO.getEndTime()); this.examDefinitionDAO.updateByPrimaryKey(examDefinition); } diff --git a/src/main/java/club/joylink/rtss/services/ICompanyService.java b/src/main/java/club/joylink/rtss/services/ICompanyService.java index a20c8534a..a8dba8a6b 100644 --- a/src/main/java/club/joylink/rtss/services/ICompanyService.java +++ b/src/main/java/club/joylink/rtss/services/ICompanyService.java @@ -1,10 +1,10 @@ package club.joylink.rtss.services; -import club.joylink.rtss.entity.UserCompanyRel; +import club.joylink.rtss.entity.DepartmentLesson; import club.joylink.rtss.vo.UserVO; -import club.joylink.rtss.vo.client.CompanyQueryVO; -import club.joylink.rtss.vo.client.CompanyVO; +import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.PageVO; +import club.joylink.rtss.vo.client.company.*; import java.util.List; @@ -20,32 +20,93 @@ public interface ICompanyService { CompanyVO getCompanyById(Integer companyId); +// void removeManager(Integer companyId, List userIds, UserVO user); + boolean isExist(Integer companyId); PageVO queryPageOrganizations(CompanyQueryVO queryVO); - - /** - * 添加公司管理员 - */ - void addManager(Integer companyId, List userIds, UserVO user); +// +// /** +// * 添加公司管理员 +// */ +// void addManager(Integer companyId, List userIds, UserVO user); /** * 用户绑定单位 */ - void userBindCompany(Long userId, Integer companyId); + CompanyVO userScanCodeBindCompany(Long userId, Integer companyId); - /** - * 查询用户公司关联关系 - */ - List findUserCompanyRelEntity(List collect); +// /** +// * 查询用户公司关联关系 +// */ +// List findUserCompanyRelEntity(List collect); +// +// /** +// * 超管修改用户的单位 +// */ +// void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin); +// +// /** +// * 删除用户和公司的关联关系 +// */ +// void deleteUserCompanyRel(Long userId); - /** - * 超管修改用户的单位 - */ - void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin); + boolean isCompanyUser(Long userId); - /** - * 删除用户和公司的关联关系 - */ - void deleteUserCompanyRel(Long userId); + DepartmentVO createDepart(DepartmentVO departmentVO); + + void updateDepartInfo(Integer id, DepartmentVO departmentVO); + + void deleteDepartById(Integer deptId); + + DepartmentVO getDepartById(Integer deptId); + + List getCompanyDepartTree(Integer companyId); + + List getCompanyAllDepart(Integer companyId); + + DepartmentVO getDepartTree(Integer companyId, Integer deptId); + + List getDepartAndChild(Integer companyId, Integer deptId); + +// PositionVO createPosition(PositionVO positionVO); +// +// void updatePositionInfo(Integer positionId, PositionVO positionVO); +// +// void deletePositionById(Integer positionId); +// +// PositionVO getPositionById(Integer positionId); +// +// List getPositionsByCompanyId(Integer companyId); + + List getDepartRefByUserId(Long userId); + + void addDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO); + + void updateDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO); + + void deleteDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO); + + + List getUserCompanyDeparts(UserVO user, Integer companyId); + + PageVO getCompanyDepartUserInfoList(UserVO user, Integer companyId, CompanyUserQueryVO companyUserQueryVO); + + void importCompanyUserInfo(UserVO user, Integer companyId, ImportCompanyUserVO importCompanyUserVO); + + List getDepartsByLesson(Long lessonId); + + List getDepartsByExamId(Long examId); + + List getExamIdsByDepartId(Integer departId); + + void deleteDepartsExam(Long examId); + + void addDepartExam(Long examId, Integer departId); + + List getDepartLessonRefs(Integer departId); + + List getLessonsByDepart(Integer departId); + + List getDepartNamesByLesson(Long LessonId); } diff --git a/src/main/java/club/joylink/rtss/services/IExamService.java b/src/main/java/club/joylink/rtss/services/IExamService.java index 6dbd24a9a..cc34b892d 100644 --- a/src/main/java/club/joylink/rtss/services/IExamService.java +++ b/src/main/java/club/joylink/rtss/services/IExamService.java @@ -16,7 +16,7 @@ public interface IExamService { */ void create(ExamDefinitionVO examDefinitionVO, UserVO userVO); - void createGZBExam(ExamDefinitionVO examDefinitionVO, UserVO userVO); +// void createGZBExam(ExamDefinitionVO examDefinitionVO, UserVO userVO); /** * 检查分数定义是否合理 diff --git a/src/main/java/club/joylink/rtss/services/ILessonService.java b/src/main/java/club/joylink/rtss/services/ILessonService.java index 1b661a676..33c3161dc 100644 --- a/src/main/java/club/joylink/rtss/services/ILessonService.java +++ b/src/main/java/club/joylink/rtss/services/ILessonService.java @@ -149,7 +149,7 @@ public interface ILessonService { /** * 获取有效的课程 */ - List getValidLesson(List ids, String prdType); + List getValidLesson(Long mapId,List ids, String prdType); /** * 删除并添加章节-实训关联关系 diff --git a/src/main/java/club/joylink/rtss/services/ISysUserService.java b/src/main/java/club/joylink/rtss/services/ISysUserService.java index 320d1ab71..38d263ab6 100644 --- a/src/main/java/club/joylink/rtss/services/ISysUserService.java +++ b/src/main/java/club/joylink/rtss/services/ISysUserService.java @@ -5,13 +5,18 @@ import club.joylink.rtss.vo.UserQueryVO; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.UserConfigVO; +import club.joylink.rtss.vo.client.company.CompanyVO; import club.joylink.rtss.vo.client.user.*; import club.joylink.rtss.vo.wx.WmUserSession; +import org.springframework.transaction.annotation.Transactional; import java.util.List; public interface ISysUserService { + + UserVO queryCompanyUserByAccount(Integer companyId, String account); + /** * 根据openId查询用户 * @param openid @@ -139,6 +144,11 @@ public interface ISysUserService { */ UserVO createUserOfWechatMicro(WmUserSession wmUserSession); + @Transactional + void batchCreateUser(List newSysUsers); + + void createUser(SysUser sysUser); + /** * 更新用户微信小程序openid * @param id @@ -273,7 +283,7 @@ public interface ISysUserService { */ void userBindWm(String code, Long userId); - void userBindCompany(Long userId, Integer companyId); + CompanyVO userScanCodeBindCompany(Long userId, Integer companyId); UserVO getUserBaseInfoById(Long id); @@ -292,8 +302,12 @@ public interface ISysUserService { void superAdminUpdateUserInfo(UserVO updateUser, UserVO superAdmin); + void userBindCompany(UserVO userVO, Integer companyId,boolean companyAdmin); + /** * 查询所有的销售人员 */ List querySellers(); + + void deleteById(Long id); } diff --git a/src/main/java/club/joylink/rtss/services/LessonService.java b/src/main/java/club/joylink/rtss/services/LessonService.java index 6d1be8576..fd04e5252 100644 --- a/src/main/java/club/joylink/rtss/services/LessonService.java +++ b/src/main/java/club/joylink/rtss/services/LessonService.java @@ -1,12 +1,14 @@ package club.joylink.rtss.services; import club.joylink.rtss.constants.BusinessConsts; +import club.joylink.rtss.constants.MapPrdTypeEnum; import club.joylink.rtss.constants.MapStatus; import club.joylink.rtss.dao.*; import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.LsLessonExample.Criteria; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.training.ITrainingV1Service; +import club.joylink.rtss.simulation.cbtc.GroupSimulationService; import club.joylink.rtss.util.VersionUtil; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.*; @@ -24,6 +26,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import org.springframework.validation.annotation.Validated; +import javax.validation.constraints.NotEmpty; import java.time.LocalDateTime; import java.util.*; import java.util.function.Function; @@ -70,10 +73,13 @@ public class LessonService implements ILessonService { private ITrainingV1Service iTrainingV1Service; @Autowired - private StudentRelLessonClassDAO studentRelLessonClassDAO; + private IExamService iExamService; @Autowired - private IExamService iExamService; + private DepartmentLessonDAO departmentLessonDAO; + + @Autowired + private GroupSimulationService groupSimulationService; @Override public LessonTreeVO getLessonTree(Long id, UserVO userVO) { @@ -104,13 +110,10 @@ public class LessonService implements ILessonService { trainingVOList = iTrainingV1Service.queryByIds(trainingIds); } // 查询权限 -// List voList = userPermissionService.findTeachVOByMapIdAndUserId(lessonVO.getMapId(), userVO.getId()); - List permissionVOList = iUserPermissionService.getLessonUserPermission(userVO, - lessonVO.getMapId(), lessonVO.getPrdType(), lessonVO.getId()); - boolean valid = !CollectionUtils.isEmpty(permissionVOList); + boolean valid = groupSimulationService.hasPermission(userVO, lessonVO.getMapId(), lessonVO.getPrdType()); // 生成tree lessonTreeVO.setTree(TreeNode.buildValidLessonTrainingTree(lessonVO, chapterVOList, trainingVOList, relVOList, valid)); - lessonTreeVO.setPermissionList(permissionVOList); +// lessonTreeVO.setPermissionList(permissionVOList); return lessonTreeVO; } @@ -207,30 +210,34 @@ public class LessonService implements ILessonService { // // 自动创建商品 // iGoodsService.autoCreateTeachAndExamGoods(newLesson); } else { + //默认课程 + MapVO mapVO = iMapService.findMapBaseInfoById(publishVO.getMapId()); + BusinessConsts.Lesson.PrdInfo prdInfo = BusinessConsts.Lesson.PrdInfo.getBy(publishVO.getPrdType()); + String defaultLessonName = String.join("-", mapVO.getName(), prdInfo.getName()); + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(Objects.equals(publishVO.getName(),defaultLessonName),"与系统默认课程重名,请修改名称"); // 更新 newLesson.setId(publishedLesson.getId()); this.lessonDAO.updateByPrimaryKey(newLesson); //课程存在,预备检查与班级的关系 - StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample(); - relLessonClassExample.createCriteria().andLessonIdEqualTo(publishedLesson.getId()); - List studentRelLessonClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample); + DepartmentLessonExample departmentLessonExample = new DepartmentLessonExample(); + departmentLessonExample.createCriteria().andLessonIdEqualTo(publishedLesson.getId()); + List departmentLessonRefs = this.departmentLessonDAO.selectByExample(departmentLessonExample); if (!CollectionUtils.isEmpty(publishVO.getClassIdList())) { - //目前GZB项目带班级发布 - if (!CollectionUtils.isEmpty(studentRelLessonClasses)) { - List existedClassIds = studentRelLessonClasses.stream().map(StudentRelLessonClass::getClassId).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(departmentLessonRefs)) { + List existedClassIds = departmentLessonRefs.stream().map(DepartmentLesson::getDepartmentId).collect(Collectors.toList()); Collections.sort(existedClassIds); Collections.sort(publishVO.getClassIdList()); if (!existedClassIds.equals(publishVO.getClassIdList())) { //清除现有课程班级关系 - this.studentRelLessonClassDAO.deleteByExample(relLessonClassExample); + this.departmentLessonDAO.deleteByExample(departmentLessonExample); addRelLessonClass(publishVO, publishedLesson.getId()); } } else { addRelLessonClass(publishVO, publishedLesson.getId()); } } else { - if (!CollectionUtils.isEmpty(studentRelLessonClasses)) { - this.studentRelLessonClassDAO.deleteByExample(relLessonClassExample); + if (!CollectionUtils.isEmpty(departmentLessonRefs)) { + this.departmentLessonDAO.deleteByExample(departmentLessonExample); } } // if(!lessonVo.getName().equals(publishedLesson.getName())) { @@ -518,7 +525,7 @@ public class LessonService implements ILessonService { @Transactional @Override public void generateLessonAndExam(List mapIds, UserVO userVO) { - if (CollectionUtils.isEmpty(mapIds)) return; + BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(CollectionUtils.isEmpty(mapIds),"请选择地图后生成"); mapIds.parallelStream().forEach(mapId -> { MapVO mapVO = iMapService.findMapBaseInfoById(mapId); if (Objects.isNull(mapVO)) return; @@ -533,8 +540,8 @@ public class LessonService implements ILessonService { } @Override - public List getValidLesson(@NonNull List ids, String prdType) { - return lessonDAO.getValidLesson(ids, prdType); + public List getValidLesson(Long mapId, @NotEmpty List ids, String prdType) { + return lessonDAO.getValidLesson(mapId,ids, prdType); } @Override @@ -778,10 +785,10 @@ public class LessonService implements ILessonService { */ private void addRelLessonClass(LessonPublishVO publishVO, Long id) { publishVO.getClassIdList().forEach(classId -> { - StudentRelLessonClass relLessonClass = new StudentRelLessonClass(); - relLessonClass.setClassId(classId); - relLessonClass.setLessonId(id); - this.studentRelLessonClassDAO.insert(relLessonClass); + DepartmentLesson departmentLesson = new DepartmentLesson(); + departmentLesson.setDepartmentId(classId); + departmentLesson.setLessonId(id); + this.departmentLessonDAO.insert(departmentLesson); }); } diff --git a/src/main/java/club/joylink/rtss/services/MapSystemService.java b/src/main/java/club/joylink/rtss/services/MapSystemService.java index 4a13ffcab..7c9e89826 100644 --- a/src/main/java/club/joylink/rtss/services/MapSystemService.java +++ b/src/main/java/club/joylink/rtss/services/MapSystemService.java @@ -2,17 +2,16 @@ package club.joylink.rtss.services; import club.joylink.rtss.constants.*; import club.joylink.rtss.dao.MapSystemDAO; +import club.joylink.rtss.entity.DepartmentLesson; import club.joylink.rtss.entity.MapSystem; import club.joylink.rtss.entity.MapSystemExample; -import club.joylink.rtss.entity.StudentRelIdClass; -import club.joylink.rtss.entity.StudentRelLessonClass; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; -import club.joylink.rtss.services.student.IClassStudentUserService; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.TreeNode; +import club.joylink.rtss.vo.client.company.UserDepartRelVO; import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.runplan.RunPlanVO; import club.joylink.rtss.vo.client.sub.MapSystemDetailVO; @@ -56,7 +55,7 @@ public class MapSystemService implements IMapSystemService { private ISysUserService iSysUserService; @Autowired - private IClassStudentUserService iClassStudentUserService; + private ICompanyService iCompanyService; @Override @Transactional @@ -206,8 +205,9 @@ public class MapSystemService implements IMapSystemService { public MapSystemDetailVO getMapSystemDetail(Long id, LoginUserInfoVO loginInfo) { UserVO userVO = loginInfo.getUserVO(); MapSystem mapSystem = getEntity(id); + MapVO mapVO = iMapService.findMapBaseInfoById(mapSystem.getMapId()); MapSystemDetailVO mapSystemDetailVO = new MapSystemDetailVO(mapSystem); - + mapSystemDetailVO.setCityCode(mapVO.getCityCode()); if (MapSystemType.Simulation.name().equals(mapSystem.getType())) { List permissionVOList = iUserPermissionService.getSimulationUserPermission(userVO, mapSystem.getMapId(), mapSystem.getPrdType()); @@ -217,36 +217,42 @@ public class MapSystemService implements IMapSystemService { || MapSystemType.Exam.name().equals(mapSystem.getType())) { List lessonVOList = new ArrayList<>(); - //用户存在班级关系时,根据班级课程关系查询课程,目前仅GZB使用 - List studentRelIdClasses = this.iClassStudentUserService.getRelClassByUser(userVO.getId()); - if(loginInfo.getProject().equals(Project.GZB) && !CollectionUtils.isEmpty(studentRelIdClasses)){ - Integer classId = studentRelIdClasses.get(0).getClassId();//学生只关联一个班 - List relLessonsByClass = this.iClassStudentUserService.getRelLessonsByClass(classId); - if(!CollectionUtils.isEmpty(relLessonsByClass)){ - lessonVOList = iLessonService.getValidLesson(relLessonsByClass.stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()), mapSystem.getPrdType()); - } - //默认课程展示 - MapVO mapVO = iMapService.findMapBaseInfoById(mapSystem.getMapId()); - BusinessConsts.Lesson.PrdInfo prdInfo = BusinessConsts.Lesson.PrdInfo.getBy(mapSystem.getPrdType()); - if (Objects.nonNull(prdInfo)) { - String defaultLessonName = String.join("-", mapVO.getName(), prdInfo.getName()); - LessonVO existedDefaultLesson = iLessonService.findByMapAndNameAndPrdType(mapSystem.getMapId(), defaultLessonName, mapSystem.getPrdType()); - if (Objects.nonNull(existedDefaultLesson)) { - if (lessonVOList.stream().noneMatch(lessonVO -> lessonVO.getId().equals(existedDefaultLesson.getId()))) { - lessonVOList.add(existedDefaultLesson); - } + //用户存在部门关系时,根据部门课程关系查询课程 + if(iCompanyService.isCompanyUser(userVO.getId())){ + List userDepartRelVOS = this.iCompanyService.getDepartRefByUserId(userVO.getId()); + if(!CollectionUtils.isEmpty(userDepartRelVOS)){ + List departLessonRefs = userDepartRelVOS.stream() + .flatMap(userDepartRelVO -> this.iCompanyService.getDepartLessonRefs(userDepartRelVO.getDepartmentId()).stream()).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(departLessonRefs)){ + lessonVOList = iLessonService.getValidLesson( mapSystem.getMapId(),departLessonRefs.stream().map(DepartmentLesson::getLessonId).collect(Collectors.toList()), mapSystem.getPrdType()); } } - }else{ + } else{ lessonVOList = iLessonService.getByMapIdAndPrdType(mapSystem.getMapId(), mapSystem.getPrdType()); + + } + + //默认课程展示 + BusinessConsts.Lesson.PrdInfo prdInfo = BusinessConsts.Lesson.PrdInfo.getBy(mapSystem.getPrdType()); + if (Objects.nonNull(prdInfo)) { + String defaultLessonName = String.join("-", mapVO.getName(), prdInfo.getName()); + LessonVO existedDefaultLesson = iLessonService.findByMapAndNameAndPrdType(mapSystem.getMapId(), defaultLessonName, mapSystem.getPrdType()); + if (Objects.nonNull(existedDefaultLesson)) { + if (lessonVOList.stream().noneMatch(lessonVO -> lessonVO.getId().equals(existedDefaultLesson.getId()))) { + existedDefaultLesson.setSystemFault(true); + lessonVOList.add(existedDefaultLesson); + }else{ + lessonVOList.stream().filter(lessonVO -> lessonVO.getId().equals(existedDefaultLesson.getId())).findAny().ifPresent(lessonVO ->lessonVO.setSystemFault(true) ); + } + } } if (CollectionUtils.isEmpty(lessonVOList)) { - return null; + return mapSystemDetailVO; } //查询课程关联的班级列表 lessonVOList.forEach(lessonVO -> { - List classNames = this.iClassStudentUserService.getRelclassByLessonId(lessonVO.getId()); + List classNames = this.iCompanyService.getDepartNamesByLesson(lessonVO.getId()); if(!CollectionUtils.isEmpty(classNames)){ lessonVO.setClassNames(classNames); } diff --git a/src/main/java/club/joylink/rtss/services/SysUserService.java b/src/main/java/club/joylink/rtss/services/SysUserService.java index bcfbf4c42..a33cec11d 100644 --- a/src/main/java/club/joylink/rtss/services/SysUserService.java +++ b/src/main/java/club/joylink/rtss/services/SysUserService.java @@ -15,6 +15,7 @@ import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.VdCode; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.UserConfigVO; +import club.joylink.rtss.vo.client.company.CompanyVO; import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.user.*; import club.joylink.rtss.vo.wx.WmUserSession; @@ -84,7 +85,11 @@ public class SysUserService implements ISysUserService { private CompanyDAO companyDAO; @Autowired - private ICompanyService iCompanyService; + private CompanyUserDAO companyUserDAO; + + @Autowired + private DepartmentUserDAO departmentUserDAO; + @Override public UserVO findUserByAccountAndPassword(String account, String password) { @@ -94,7 +99,9 @@ public class SysUserService implements ISysUserService { example.or().andEmailEqualTo(account).andPasswordEqualTo(password); // 邮箱 List users = this.sysUserDAO.selectByExample(example); if(!CollectionUtils.isEmpty(users)) { - return new UserVO(users.get(0)); + UserVO userVO = sysUserDAO.queryUserWithCompany(users.get(0).getId()); + userVO.setRolesByString(); + return userVO; } return null; } @@ -109,6 +116,12 @@ public class SysUserService implements ISysUserService { return UserVO.convertFromDB(list); } + + @Override + public UserVO queryCompanyUserByAccount(Integer companyId, String account) { + return this.sysUserDAO.queryCompanyUserByAccount(account, companyId); + } + @Override public UserVO getUserByWxOpenId(String openid) { SysUserExample example = new SysUserExample(); @@ -217,7 +230,7 @@ public class SysUserService implements ISysUserService { @Override public PageVO queryPagedUser(UserQueryVO queryVO) { PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); - Page page = (Page) sysUserDAO.pagedQueryWithCompany(queryVO); + Page page = (Page) sysUserDAO.queryUsersWithCompany(queryVO); page.getResult().forEach(UserVO::forClient); return PageVO.convert(page); // SysUserExample example = new SysUserExample(); @@ -334,24 +347,27 @@ public class SysUserService implements ISysUserService { @Override @Transactional - public void userBindCompany(Long userId, Integer companyId) { - iCompanyService.userBindCompany(userId, companyId); + public CompanyVO userScanCodeBindCompany(Long userId, Integer companyId) { + Company company = companyDAO.selectByPrimaryKey(companyId); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company, "不存在此单位"); + SysUser sysUser = sysUserDAO.selectByPrimaryKey(userId); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sysUser, "不存在的用户"); + UserVO userVO = new UserVO(sysUser); + userBindCompany(userVO, companyId,true); + this.loginSessionManager.updateLoginUser(userVO); + return new CompanyVO(company); } @Override public UserVO getUserBaseInfoById(Long id) { - SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(id); - BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sysUser, "不存在的用户"); - UserVO userVO = new UserVO(); - userVO.setId(sysUser.getId()); - userVO.setAccount(sysUser.getAccount()); - userVO.setName(sysUser.getName()); - userVO.setNickname(sysUser.getNickname()); - userVO.setAvatarPath(sysUser.getAvatarPath()); - userVO.setRolesByString(sysUser.getRoles()); - userVO.setEmail(sysUser.getEmail()); - userVO.setStatus(sysUser.getStatus()); - userVO.setCreateTime(sysUser.getCreateTime()); + UserVO userVO = this.sysUserDAO.queryUserWithCompany(id); + BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(userVO, "不存在的用户"); + userVO.setRolesByString(); + userVO.setWmOpenId(null); + userVO.setWxId(null); + userVO.setWxUnionId(null); + userVO.setNationcode(null); + userVO.setPassword(null); return userVO; } @@ -407,7 +423,9 @@ public class SysUserService implements ISysUserService { if(CollectionUtils.isEmpty(list)) { return null; } - return new UserVO(list.get(0)); + UserVO userVO = sysUserDAO.queryUserWithCompany(list.get(0).getId()); + userVO.setRolesByString(); + return userVO; } @Override @@ -417,7 +435,9 @@ public class SysUserService implements ISysUserService { example.createCriteria().andWmOpenIdEqualTo(wmOpenId); List userList = this.sysUserDAO.selectByExample(example); if(!CollectionUtils.isEmpty(userList)) { - return new UserVO(userList.get(0)); + UserVO userVO = sysUserDAO.queryUserWithCompany(userList.get(0).getId()); + userVO.setRolesByString(); + return userVO; } return null; } @@ -451,6 +471,17 @@ public class SysUserService implements ISysUserService { return new UserVO(user); } + @Override + @Transactional + public void batchCreateUser(List newSysUsers) { + this.sysUserDAO.batchInsert(newSysUsers); + } + + @Override + public void createUser(SysUser newSysUser) { + this.sysUserDAO.insert(newSysUser); + } + private String generateNickname() { return String.format("用户_%s", RandomGenerator.getByLen(5)); } @@ -482,20 +513,6 @@ public class SysUserService implements ISysUserService { } } - /** - * 根据wxOpenId查询系统用户 - * @param openId - * @return - */ - public SysUser findSysUserByWxOpenId(String openId) { - SysUserExample example = new SysUserExample(); - example.createCriteria().andWxIdEqualTo(openId); - List list = this.sysUserDAO.selectByExample(example); - if(!CollectionUtils.isEmpty(list)) { - SysUser user = list.get(0); - } - return null; - } @Override public void wxSubscribeEventHandle(String wxId) { @@ -548,7 +565,9 @@ public class SysUserService implements ISysUserService { user.setName(name); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - this.loginSessionManager.updateLoginUser(new UserVO(user)); + UserVO userVO = sysUserDAO.queryUserWithCompany(id); + userVO.setRolesByString(); + this.loginSessionManager.updateLoginUser(userVO); } } @@ -561,7 +580,9 @@ public class SysUserService implements ISysUserService { user.setNickname(nickname); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - this.loginSessionManager.updateLoginUser(new UserVO(user)); + UserVO userVO = sysUserDAO.queryUserWithCompany(id); + userVO.setRolesByString(); + this.loginSessionManager.updateLoginUser(userVO); } } @@ -572,7 +593,9 @@ public class SysUserService implements ISysUserService { user.setAvatarPath(avatarPath); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - this.loginSessionManager.updateLoginUser(new UserVO(user)); + UserVO userVO = sysUserDAO.queryUserWithCompany(id); + userVO.setRolesByString(); + this.loginSessionManager.updateLoginUser(userVO); } } @@ -589,7 +612,9 @@ public class SysUserService implements ISysUserService { user.setMobile(updateMobileVO.getMobile()); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - this.loginSessionManager.updateLoginUser(new UserVO(user)); + UserVO userVO = sysUserDAO.queryUserWithCompany(id); + userVO.setRolesByString(); + this.loginSessionManager.updateLoginUser(userVO); } } @@ -605,7 +630,9 @@ public class SysUserService implements ISysUserService { user.setEmail(updateEmailVO.getEmail()); user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); - this.loginSessionManager.updateLoginUser(new UserVO(user)); + UserVO userVO = sysUserDAO.queryUserWithCompany(id); + userVO.setRolesByString(); + this.loginSessionManager.updateLoginUser(userVO); } } @@ -732,14 +759,55 @@ public class SysUserService implements ISysUserService { SysUser user = getEntity(userId); if(!user.getRoles().equals(updateUserVO.getRolesStr())) { user.setRoles(updateUserVO.getRolesStr()); + user.setUpdateTime(LocalDateTime.now()); this.sysUserDAO.updateByPrimaryKey(user); } //更新所属公司 - if (updateUserVO.getCompanyId() != null) { - iCompanyService.superAdminUpdateUserCompanyRel(userId, updateUserVO.getCompanyId(), superAdmin); + Integer companyId = updateUserVO.getCompanyId(); + UserVO userVO = new UserVO(user); + userBindCompany(userVO, companyId,false); + this.loginSessionManager.updateLoginUser(userVO); + } + + @Override + public void userBindCompany(UserVO userVO, Integer companyId, boolean companyAdmin) { + CompanyUserExample e = new CompanyUserExample(); + e.createCriteria().andUserIdEqualTo(userVO.getId()); + userVO.setCompanyId(companyId); + userVO.setCompanyAdmin(companyAdmin); + if (Objects.nonNull(companyId)) { + List companyUsers = companyUserDAO.selectByExample(e); + if(CollectionUtils.isEmpty(companyUsers)){ + CompanyUser companyUser = new CompanyUser(); + companyUser.setCompanyId(companyId); + companyUser.setUserId(userVO.getId()); + companyUser.setAdmin(companyAdmin); + companyUserDAO.insertSelective(companyUser); + }else{ + CompanyUser companyUser =companyUsers.get(0); + companyUser.setCompanyId(companyId); + companyUser.setUserId(userVO.getId()); + companyUser.setAdmin(companyAdmin); + companyUserDAO.updateByExampleSelective(companyUser,e); + if(!Objects.equals(companyUser.getCompanyId(),companyId)){ + DepartmentUserExample ue =new DepartmentUserExample(); + ue.createCriteria().andUserIdEqualTo(userVO.getId()); + departmentUserDAO.deleteByExample(ue); + } + } + String companyName = companyDAO.selectByPrimaryKey(companyId).getName(); + userVO.setCompanyName(companyName); + } else { - iCompanyService.deleteUserCompanyRel(userId); + companyUserDAO.deleteByExample(e); + DepartmentUserExample ue =new DepartmentUserExample(); + ue.createCriteria().andUserIdEqualTo(userVO.getId()); + departmentUserDAO.deleteByExample(ue); + userVO.setCompanyAdmin(null); } + + + } @Override @@ -756,4 +824,9 @@ public class SysUserService implements ISysUserService { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(user, String.format("id为[%s]的用户不存在", id)); return user; } + + @Override + public void deleteById(Long id) { + sysUserDAO.deleteByPrimaryKey(id); + } } diff --git a/src/main/java/club/joylink/rtss/services/UserExamService.java b/src/main/java/club/joylink/rtss/services/UserExamService.java index 68d4f2e6a..923bb7f7e 100644 --- a/src/main/java/club/joylink/rtss/services/UserExamService.java +++ b/src/main/java/club/joylink/rtss/services/UserExamService.java @@ -5,6 +5,7 @@ import club.joylink.rtss.dao.*; import club.joylink.rtss.entity.*; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.training.ITrainingV1Service; +import club.joylink.rtss.simulation.cbtc.GroupSimulationService; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.*; import club.joylink.rtss.vo.client.training.TrainingResultVO; @@ -50,6 +51,9 @@ public class UserExamService implements IUserExamService { @Autowired private LsLessonDAO lessonDAO; + @Autowired + private GroupSimulationService groupSimulationService; + @Override @Transactional public UserExamVO generateExamInstance(long examId, UserVO userVO) { @@ -63,8 +67,9 @@ public class UserExamService implements IUserExamService { calendar.setTime(new Date()); calendar.add(Calendar.SECOND, examDef.getDuration()); LsLesson lesson = this.lessonDAO.selectByPrimaryKey(examDef.getLessonId()); - List examPermission = iUserPermissionService.getExamUserPermission(userVO, lesson.getMapId(), lesson.getPrdType(), lesson.getId()); - BusinessExceptionAssertEnum.SIMULATION_PERMISSION_NOT_AVAILABLE.assertCollectionNotEmpty(examPermission); + groupSimulationService.confirmHasPermission(userVO, lesson.getMapId(), lesson.getPrdType()); +// List examPermission = iUserPermissionService.getExamUserPermission(userVO, lesson.getMapId(), lesson.getPrdType(), lesson.getId()); +// BusinessExceptionAssertEnum.SIMULATION_PERMISSION_NOT_AVAILABLE.assertCollectionNotEmpty(examPermission); } // 判断是否在考试时间之内 if (examDef.getStartTime() != null) { diff --git a/src/main/java/club/joylink/rtss/services/student/ClassStudentUserServiceImpl.java b/src/main/java/club/joylink/rtss/services/student/DepartUserStaticServiceImpl.java similarity index 73% rename from src/main/java/club/joylink/rtss/services/student/ClassStudentUserServiceImpl.java rename to src/main/java/club/joylink/rtss/services/student/DepartUserStaticServiceImpl.java index d4981daa2..9e863fcd8 100644 --- a/src/main/java/club/joylink/rtss/services/student/ClassStudentUserServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/student/DepartUserStaticServiceImpl.java @@ -6,7 +6,6 @@ import club.joylink.rtss.entity.*; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.*; import club.joylink.rtss.vo.UserVO; -import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.goods.GoodsVO; import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.order.OrderCreateVO; @@ -34,7 +33,7 @@ import java.util.stream.Collectors; */ @Slf4j @Service -public class ClassStudentUserServiceImpl implements IClassStudentUserService { +public class DepartUserStaticServiceImpl implements IDepartUserStatisticService { @Autowired private SysUserDAO sysUserDAO; @@ -89,7 +88,10 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService { @Autowired private IOrderService iOrderService; + @Autowired + private DepartmentUserDAO departmentUserDAO; + //TODO 迁移学生权限分发 @Override @Transactional public void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator) { @@ -168,70 +170,70 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService { distributePermissions2ZJ(good.getId(), userIds, usersWithPermissions); } - @Override - public List getClassesByProjectCode(String projectCode) { - StudentClassExample classExample = new StudentClassExample(); - classExample.createCriteria().andProjectCodeEqualTo(projectCode); - List studentClasses = this.studentClassDAO.selectByExample(classExample); - return StudentClassVO.convertFromDBList(studentClasses); - } +// @Override +// public List getClassesByProjectCode(String projectCode) { +// StudentClassExample classExample = new StudentClassExample(); +// classExample.createCriteria().andProjectCodeEqualTo(projectCode); +// List studentClasses = this.studentClassDAO.selectByExample(classExample); +// return StudentClassVO.convertFromDBList(studentClasses); +// } - @Override - public List getClassesByLesson(Long lessonId) { - List classes = this.studentClassDAO.getClasses(lessonId); - return StudentClassVO.convertFromDBList(classes); - } +// @Override +// public List getClassesByLesson(Long lessonId) { +// List classes = this.studentClassDAO.getClasses(lessonId); +// return StudentClassVO.convertFromDBList(classes); +// } - @Override - public List getClassesByExamId(Long examId) { - StudentRelExamClassExample example = new StudentRelExamClassExample(); - example.createCriteria().andExamIdEqualTo(examId); - List classes = this.studentClassDAO.getClassesByExamId(examId); - return StudentClassVO.convertFromDBList(classes); - } +// @Override +// public List getClassesByExamId(Long examId) { +// StudentRelExamClassExample example = new StudentRelExamClassExample(); +// example.createCriteria().andExamIdEqualTo(examId); +// List classes = this.studentClassDAO.getClassesByExamId(examId); +// return StudentClassVO.convertFromDBList(classes); +// } - @Override - public List getRelLessonsByClass(Integer classId) { - StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample(); - relLessonClassExample.createCriteria().andClassIdEqualTo(classId); - List studentClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample); - return studentClasses; - } +// @Override +// public List getRelLessonsByClass(Integer classId) { +// StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample(); +// relLessonClassExample.createCriteria().andClassIdEqualTo(classId); +// List studentClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample); +// return studentClasses; +// } - @Override - public List getRelclassByLessonId(Long LessonId) { - List classes = this.studentRelLessonClassDAO.getClassNames(LessonId); - return classes; - } +// @Override +// public List getRelclassByLessonId(Long LessonId) { +// List classes = this.studentRelLessonClassDAO.getClassNames(LessonId); +// return classes; +// } - @Override - public List getRelExamIdsByClassId(Integer classId) { - StudentRelExamClassExample example = new StudentRelExamClassExample(); - example.createCriteria().andClassIdEqualTo(classId); - List classes = this.studentRelExamClassDAO.selectByExample(example); - return classes.stream().map(StudentRelExamClass::getExamId).collect(Collectors.toList()); - } +// @Override +// public List getRelExamIdsByClassId(Integer classId) { +// StudentRelExamClassExample example = new StudentRelExamClassExample(); +// example.createCriteria().andClassIdEqualTo(classId); +// List classes = this.studentRelExamClassDAO.selectByExample(example); +// return classes.stream().map(StudentRelExamClass::getExamId).collect(Collectors.toList()); +// } +// +// @Override +// public List getLessonByClass(Integer classId) { +// List lessonIds = getRelLessonsByClass(classId).stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()); +// return lessonService.getValidLesson(lessonIds, null); +// } - @Override - public List getLessonByClass(Integer classId) { - List lessonIds = getRelLessonsByClass(classId).stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()); - return lessonService.getValidLesson(lessonIds, null); - } - - @Override - public List getRelClassByUser(Long userId) { - StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample(); - relIdClassExample.createCriteria().andStudentUserIdEqualTo(userId); - List studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample); - return studentRelIdClasses; - } +// @Override +// public List getRelClassByUser(Long userId) { +// StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample(); +// relIdClassExample.createCriteria().andStudentUserIdEqualTo(userId); +// List studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample); +// return studentRelIdClasses; +// } @Override public List studentInfoStatistics(StudentInfoExportParam infoExportParam) { //根据班级id查询对应学生信息 - StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample(); - relIdClassExample.createCriteria().andClassIdEqualTo(infoExportParam.getClassId()); - List studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample); + DepartmentUserExample departmentUserExample = new DepartmentUserExample(); + departmentUserExample.createCriteria().andDepartmentIdEqualTo(infoExportParam.getClassId()).andManagerEqualTo(false); + List departmentUsers = this.departmentUserDAO.selectByExample(departmentUserExample); //课程关联实训数 Map prd2TrainNums = infoExportParam.getPrdParams().stream().collect(Collectors.toMap(prdParam -> prdParam.getPrdType(), prdParam -> { LsRelChapterTrainingExample lsRelChapterTrainingExample = new LsRelChapterTrainingExample(); @@ -243,27 +245,27 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService { this.examDefinitionDAO.selectByPrimaryKey(prdParam.getExamPaperId()).getFullPoint() )); //根据本学期日期始末,针对每个学生查询 出勤天数、根据课程id查询测验模式通过个数、根据考试id查询成绩 - return studentRelIdClasses.stream().map(studentRelIdClass -> { + return departmentUsers.stream().map(departmentUser -> { ExportStudentInfo exportStudentInfo = new ExportStudentInfo(); - SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(studentRelIdClass.getStudentUserId()); + SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(departmentUser.getUserId()); exportStudentInfo.setName(sysUser.getName()); exportStudentInfo.setStudentID(sysUser.getAccount()); //查询出勤天数 - Integer days = this.sysUserLoginDAO.loginDays(studentRelIdClass.getStudentUserId(), Client.Joylink.getName(), infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); + Integer days = this.sysUserLoginDAO.loginDays(departmentUser.getUserId(), Client.Joylink.getName(), infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); //出勤率 exportStudentInfo.setAttendance((float) Math.round((Objects.isNull(days) ? 0 : (days > infoExportParam.getAttendanceDays() ? infoExportParam.getAttendanceDays() : days)) * 100 / infoExportParam.getAttendanceDays()) / 100); infoExportParam.getPrdParams().forEach(prdParam -> { PrdStudentScoretInfo prdStudentScoretInfo = new PrdStudentScoretInfo(); prdStudentScoretInfo.setPrdType(prdParam.getPrdType()); //查询课程下不同实训的测验通过数 - Integer passedNum = this.userTrainingStatsMapper.countBy(studentRelIdClass.getStudentUserId(), prdParam.getLessonId(), 0, BusinessConsts.Training.Mode.Mode04, 1, infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); + Integer passedNum = this.userTrainingStatsMapper.countBy(departmentUser.getUserId(), prdParam.getLessonId(), 0, BusinessConsts.Training.Mode.Mode04, 1, infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); //技能操作通过率 if (prd2TrainNums.get(prdParam.getPrdType()) != 0) { prdStudentScoretInfo.setLessonPassRate((float) Math.round((Objects.isNull(passedNum) ? 0 : passedNum) * 100 / prd2TrainNums.get(prdParam.getPrdType())) / 100); } //查询考试得分 - Integer maxScore = this.userExamMapper.getMaxScoreBy(studentRelIdClass.getStudentUserId(), prdParam.getExamPaperId(), infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); + Integer maxScore = this.userExamMapper.getMaxScoreBy(departmentUser.getUserId(), prdParam.getExamPaperId(), infoExportParam.getTermBeginDate(), infoExportParam.getTermEndDate()); //考试成绩占总分比 prdStudentScoretInfo.setExamSocreRadio((float) Math.round((Objects.isNull(maxScore) ? 0 : maxScore) * 100 / prd2Fullpoint.get(prdParam.getPrdType())) / 100); exportStudentInfo.getScores().add(prdStudentScoretInfo); @@ -272,20 +274,20 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService { }).collect(Collectors.toList()); } - @Override - public void addExamRelClass(Long examId, Integer classId) { - StudentRelExamClass studentRelExamClass = new StudentRelExamClass(); - studentRelExamClass.setExamId(examId); - studentRelExamClass.setClassId(classId); - studentRelExamClassDAO.insert(studentRelExamClass); - } +// @Override +// public void addExamRelClass(Long examId, Integer classId) { +// StudentRelExamClass studentRelExamClass = new StudentRelExamClass(); +// studentRelExamClass.setExamId(examId); +// studentRelExamClass.setClassId(classId); +// studentRelExamClassDAO.insert(studentRelExamClass); +// } - @Override - public void deleteExamRelClass(Long examId) { - StudentRelExamClassExample example = new StudentRelExamClassExample(); - example.createCriteria().andExamIdEqualTo(examId); - studentRelExamClassDAO.deleteByExample(example); - } +// @Override +// public void deleteExamRelClass(Long examId) { +// StudentRelExamClassExample example = new StudentRelExamClassExample(); +// example.createCriteria().andExamIdEqualTo(examId); +// studentRelExamClassDAO.deleteByExample(example); +// } /** * 创建权限分发给赵杰,再从赵杰的权限创建权限分发给学生领取 diff --git a/src/main/java/club/joylink/rtss/services/student/IClassStudentUserService.java b/src/main/java/club/joylink/rtss/services/student/IDepartUserStatisticService.java similarity index 57% rename from src/main/java/club/joylink/rtss/services/student/IClassStudentUserService.java rename to src/main/java/club/joylink/rtss/services/student/IDepartUserStatisticService.java index fb1aa62f2..9902da864 100644 --- a/src/main/java/club/joylink/rtss/services/student/IClassStudentUserService.java +++ b/src/main/java/club/joylink/rtss/services/student/IDepartUserStatisticService.java @@ -11,10 +11,8 @@ import club.joylink.rtss.vo.client.student.StudentInfoExportParam; import java.util.List; -/** - * 班级学生用户接口 - */ -public interface IClassStudentUserService { + +public interface IDepartUserStatisticService { /** * 导入学生用户及班级信息 @@ -24,36 +22,36 @@ public interface IClassStudentUserService { */ void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator); - /** - * 根据项目查询班级 - * @param projectCode - * @return - */ - List getClassesByProjectCode(String projectCode); +// /** +// * 根据项目查询班级 +// * @param projectCode +// * @return +// */ +// List getClassesByProjectCode(String projectCode); - List getClassesByLesson(Long lessonId); +// List getClassesByLesson(Long lessonId); - List getClassesByExamId(Long examId); +// List getClassesByExamId(Long examId); - /**根据班级查询课程关系*/ - List getRelLessonsByClass(Integer classId); +// /**根据班级查询课程关系*/ +// List getRelLessonsByClass(Integer classId); /**根据课程查询关联的班级名字列表*/ - List getRelclassByLessonId(Long LessonId); +// List getRelclassByLessonId(Long LessonId); - List getRelExamIdsByClassId(Integer classId); +// List getRelExamIdsByClassId(Integer classId); - List getLessonByClass(Integer classId); +// List getLessonByClass(Integer classId); /**根据用户id查询关联的班级关系*/ - List getRelClassByUser(Long userId); +// List getRelClassByUser(Long userId); /**统计学生成绩信息*/ List studentInfoStatistics(StudentInfoExportParam infoExportParam); - void addExamRelClass(Long examId, Integer classId); +// void addExamRelClass(Long examId, Integer classId); - void deleteExamRelClass(Long examId); +// void deleteExamRelClass(Long examId); /**关联课程及班级信息*/ } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/StandService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/StandService.java index e3b48e3cd..e9882be17 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/StandService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/StandService.java @@ -41,7 +41,9 @@ public class StandService { ControllableDevice ctrlMsg = new PsdSwitch(vrPsd, open); SimulationDeviceControlEvent event = new SimulationDeviceControlEvent(this, simulation, ctrlMsg); this.applicationContext.publishEvent(event); - vrPsd.startSetting(open); + if (!vrPsd.isPslControl()) { + vrPsd.startSetting(open); + } } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationService.java index bad172e52..1c34e46df 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationService.java @@ -275,4 +275,8 @@ public interface GroupSimulationService { PageVO getLog(String group, SimulationLogPagedQueryVO queryVO); void changePassengerFlow(String group, Long passengerFlowId); + + void confirmHasPermission(UserVO userVO, Long mapId, String prdType); + + boolean hasPermission(UserVO userVO, Long mapId, String prdType); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java index 2545beb8b..79093c288 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java @@ -41,6 +41,7 @@ import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.client.*; +import club.joylink.rtss.vo.client.company.CompanyVO; import club.joylink.rtss.vo.client.factory.SocketMessageFactory; import club.joylink.rtss.vo.client.fault.FaultRuleVO; import club.joylink.rtss.vo.client.map.MapVO; @@ -52,6 +53,7 @@ import club.joylink.rtss.vo.client.schedulingNew.SchedulingPlanNewVO; import club.joylink.rtss.vo.client.script.ScriptVO; import club.joylink.rtss.vo.client.simulationv1.*; import club.joylink.rtss.vo.client.training.TrainingNewVO; +import club.joylink.rtss.vo.client.userPermission.UserPermissionVO; import club.joylink.rtss.websocket.StompMessageService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -137,6 +139,12 @@ public class GroupSimulationServiceImpl implements GroupSimulationService { @Autowired private PassengerFlowSimulateService passengerFlowSimulateService; + @Autowired + private ICompanyService iCompanyService; + + @Autowired + private IUserPermissionService iUserPermissionService; + /** * 创建仿真并进行缓存 * @@ -283,6 +291,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService { @Override public String simulation(Long mapId, String prodCode, LoginUserInfoVO loginUserInfoVO) { + confirmHasPermission(loginUserInfoVO.getUserVO(), mapId, prodCode); + MapPrdTypeEnum prdType = MapPrdTypeEnum.getMapPrdTypeEnumByCode(prodCode); Simulation simulation = this.create(loginUserInfoVO, mapId, prdType, @@ -783,10 +793,13 @@ public class GroupSimulationServiceImpl implements GroupSimulationService { @Override public List getRealDeviceList(String group) { Simulation simulation = this.getSimulationByGroup(group); - Set displayDeviceTypes = - new HashSet<>(List.of(ProjectDeviceType.PSD, ProjectDeviceType.SWITCH, ProjectDeviceType.SIGNAL, ProjectDeviceType.PLC_GATEWAY)); - List realDeviceList = simulation.getRealDeviceList() - .stream().filter(device -> displayDeviceTypes.contains(device.getDeviceType())).collect(Collectors.toList()); + List realDeviceList = simulation.getRealDeviceList(); + if (!CollectionUtils.isEmpty(realDeviceList)) { + Set displayDeviceTypes = + new HashSet<>(List.of(ProjectDeviceType.PSD, ProjectDeviceType.SWITCH, ProjectDeviceType.SIGNAL, ProjectDeviceType.PLC_GATEWAY)); + realDeviceList = realDeviceList + .stream().filter(device -> displayDeviceTypes.contains(device.getDeviceType())).collect(Collectors.toList()); + } // List showList = null; // if (!CollectionUtils.isEmpty(realDeviceList)) { // showList = realDeviceList.stream() @@ -935,4 +948,39 @@ public class GroupSimulationServiceImpl implements GroupSimulationService { } return pageVO; } + + /** + * 确认该用户有权限进入该仿真 + */ + @Override + public void confirmHasPermission(UserVO userVO, Long mapId, String prdType) { + BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertTrue(hasPermission(userVO, mapId, prdType)); + } + + /** + * 该用户是否有权限进入该仿真 + */ + @Override + public boolean hasPermission(UserVO userVO, Long mapId, String prdType) { + MapVO mapDetail = iMapService.getMapDetail(mapId); + if (userVO.getCompanyId() != null) { + CompanyVO company = iCompanyService.getCompanyById(userVO.getCompanyId()); + String mapProject = mapDetail.getProjectCode(); + String companyProject = company.getProjectCode(); + if (StringUtils.hasText(mapProject) && mapProject.equals(companyProject)) { + return true; + } + } + List ups = iUserPermissionService.getSimulationUserPermission(userVO, mapId, prdType); + if (!CollectionUtils.isEmpty(ups)) { + if (!MapPrdTypeEnum.JOINT.getCode().equals(prdType)) { + return true; + } else { + long upNum = ups.stream().mapToInt(UserPermissionVO::getRemains).sum(); + if (upNum >= 3) + return true; + } + } + return false; + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java index bf56a11b4..2246f328f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java @@ -491,6 +491,13 @@ public class Simulation { logs.add(log); } + public List getRealDeviceByType(ProjectDeviceType type) { + if (CollectionUtils.isEmpty(realDeviceList)) { + return new ArrayList<>(); + } + return realDeviceList.stream().filter(device -> Objects.equals(type, device.getDeviceType())).collect(Collectors.toList()); + } + /** * 仿真功能类型 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/communication/Joylink3DMessageService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/communication/Joylink3DMessageService.java index 568b50ade..4a47471b5 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/communication/Joylink3DMessageService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/communication/Joylink3DMessageService.java @@ -21,10 +21,12 @@ import club.joylink.rtss.vo.client.WebSocketMessageType; import club.joylink.rtss.vo.client.factory.SocketMessageFactory; import club.joylink.rtss.websocket.StompMessageService; import lombok.extern.slf4j.Slf4j; +import org.aspectj.runtime.internal.cflowstack.ThreadStackImpl11; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import java.util.*; import java.util.stream.Collectors; @@ -315,6 +317,13 @@ public class Joylink3DMessageService { if (Objects.isNull(member)) { return; } + if (member.getDevice() != null && member.getDevice() instanceof VirtualRealityTrain) { + String groupNumber = ((VirtualRealityTrain) member.getDevice()).getGroupNumber(); + TrainHmiDisplay trainHmi = simulation.getRepository().queryTrainHmi(groupNumber); + if (trainHmi != null && StringUtils.hasText(member.getUserIdStr())) { + this.stompMessageService.sendToUser(member.getUserIdStr(), SocketMessageFactory.buildHmiMessage(simulation.getGroup(), trainHmi)); + } + } this.collectAndSend3DInitDeviceList(simulation, Arrays.asList(event.getUserId().toString())); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityScreenDoor.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityScreenDoor.java index e8488c7c4..0d4f4cb80 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityScreenDoor.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityScreenDoor.java @@ -47,6 +47,11 @@ public class VirtualRealityScreenDoor extends VirtualRealityDevice { */ private boolean commandOpen; + /** + * 正处于psl盘控制下 + */ + private boolean pslControl; + private Fault fault; public VirtualRealityScreenDoor(String code, String name) { @@ -63,6 +68,7 @@ public class VirtualRealityScreenDoor extends VirtualRealityDevice { this.interlockRelease = false; this.setting = false; this.remainTime = null; + this.pslControl = false; this.fault = null; } @@ -76,8 +82,6 @@ public class VirtualRealityScreenDoor extends VirtualRealityDevice { /** * 开始开/关门过程 - * - * @param open */ public synchronized void startSetting(boolean open) { if (this.fault != null) { @@ -138,9 +142,6 @@ public class VirtualRealityScreenDoor extends VirtualRealityDevice { /** * 全部关门 - * - * @param close - * @param lock */ public void updateLockAndClose(boolean close, boolean lock) { this.open2End = false; @@ -188,14 +189,16 @@ public class VirtualRealityScreenDoor extends VirtualRealityDevice { @Override public void apply(VirtualRealityScreenDoor door) { door.setFault(this); - door.updateOpen2End(true); + door.startSetting(true); +// door.updateOpen2End(true); } }, CANNOT_BE_OPENED { @Override public void apply(VirtualRealityScreenDoor door) { door.setFault(this); - door.updateLockAndClose(true, true); + door.startSetting(false); +// door.updateLockAndClose(true, true); } }; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPsdConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPsdConfig.java index 7d19447f1..ed7bfc210 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPsdConfig.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPsdConfig.java @@ -5,16 +5,78 @@ import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.vo.client.project.ProjectDeviceVO; import club.joylink.rtss.vo.client.project.sdy.SdyPsdConfigVO; import lombok.Getter; +import lombok.Setter; + +import java.time.LocalDateTime; @Getter public class SdyPsdConfig extends RealDeviceConfig { private SdyPsdConfigVO configVO; + /** + * 开门到位 + */ + @Setter + private Boolean r_km; + + /** + * 蜂鸣器响起的时间(为null表示蜂鸣器当前没响)(同时作为开关门流程的开始标志) + */ + private LocalDateTime buzzerRingingTime; + + /** + * 是否触发过开关门控制 + */ + @Setter + private boolean triggerOpenOrClose; + + /** + * 开关门过程中(即非开/关门到位状态) + */ + private boolean running; + public SdyPsdConfig(ProjectDeviceVO projectDevice) { super(projectDevice); if (projectDevice != null) { this.configVO = JsonUtils.read(projectDevice.getConfig(), SdyPsdConfigVO.class); } } + + public void reset() { + this.r_km = null; + this.buzzerRingingTime = null; + this.triggerOpenOrClose = false; + this.running = false; + } + + public void buzzerRinging(LocalDateTime time) { + this.buzzerRingingTime = time; + } + + /** + * 开始开/关门 + */ + public void run() { + this.running = true; + this.triggerOpenOrClose = false; //门已经开始移动,触发状态可以去掉了 + } + + /** + * 开/关门结束 + */ + public void finishRunning() { + if (running) { + this.buzzerRingingTime = null; + this.running = false; + } + } + + /** + * 取消控制门的流程 + */ + public void cancelControl() { + this.buzzerRingingTime = null; + this.triggerOpenOrClose = false; + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPsdServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPsdServiceImpl.java index b5babd6e8..36f2b40d0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPsdServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPsdServiceImpl.java @@ -1,6 +1,8 @@ package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.sdy; import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.data.map.MapElement; +import club.joylink.rtss.simulation.cbtc.data.map.PSD; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayService; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService; @@ -13,6 +15,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.time.LocalDateTime; + @Slf4j @Component public class SdyPsdServiceImpl implements RealDeviceService { @@ -28,48 +32,116 @@ public class SdyPsdServiceImpl implements RealDeviceService { @Override public void init(Simulation simulation, RealDeviceConfig deviceConfig) { PlcGateway plcGateway = simulation.getPlcGateway(); - SdyPsdConfigVO configVO = ((SdyPsdConfig) deviceConfig).getConfigVO(); + SdyPsdConfig config = (SdyPsdConfig) deviceConfig; + SdyPsdConfigVO configVO = config.getConfigVO(); Channel channel = plcGateway.getChannel(); int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr(); - plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_kgm(), false, channel); //关门 + + this.plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_jb(), false, channel); //关响铃 + VirtualRealityScreenDoor vrPsd = (VirtualRealityScreenDoor) config.getMapElement(); + if (vrPsd != null) { + vrPsd.startSetting(false); + } +// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_jb(), false, channel); //关警报 +// if (config.getR_km() != null && config.getR_km()) { //确保关门 +// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_kgm(), false, channel); +// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_kgm(), true, channel); +// } + config.reset(); } @Override public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) { - VirtualRealityScreenDoor vrPsd = (VirtualRealityScreenDoor) deviceConfig.getMapElement(); - if (vrPsd == null) - return; - PlcGateway plcGateway = simulation.queryPlcGatewayDevice(); - if (plcGateway == null) { - log.error(String.format("仿真[%s]没有plc", simulation.getGroup())); - return; - } - SdyPsdConfig config = (SdyPsdConfig) deviceConfig; SdyPsdConfigVO configVO = config.getConfigVO(); ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(), configVO.getQuantity()); boolean km = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_km()); boolean gm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_gm()); boolean w_kgm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_kgm()); + boolean w_jb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_jb()); + config.setR_km(km); + PlcGateway plcGateway = simulation.queryPlcGatewayDevice(); + if (plcGateway == null) { + log.error(String.format("仿真[%s]没有plc", simulation.getGroup())); + return; + } int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr(); Channel channel = plcGateway.getChannel(); - if (vrPsd.isSettingClose()) { - if (!gm && km) { - this.plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_kgm(), w_kgm, false, channel); - } - } - if (vrPsd.isSettingOpen()) { - if (!km && gm) { - this.plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_kgm(), w_kgm, true, channel); + this.openOrCloseLoop(config, km, gm, baseAddr, w_kgm, channel); + + if (!km && !gm) { + config.run(); + } else { + if (config.isRunning()) { + this.plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_jb(), false, channel); + this.plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getConfigVO().getW_kgm(), w_kgm, false, channel); + config.finishRunning(); } } - if (!km && !gm) - vrPsd.turning(); - if (km && !gm) - vrPsd.updateOpen2End(true); - if (gm && !km) - vrPsd.updateLockAndClose(true, true); + VirtualRealityScreenDoor vrPsd = (VirtualRealityScreenDoor) deviceConfig.getMapElement(); + if (vrPsd != null) { + //控制realDevice + if (vrPsd.isSettingClose()) { + if (km && !gm) { + this.openOrClose(config, km, gm, baseAddr, channel); + } + } + if (vrPsd.isSettingOpen()) { + if (!km && gm) { + this.openOrClose(config, km, gm, baseAddr, channel); + } + } + //从realDevice读取并更新状态 + if (!km && !gm) { + vrPsd.turning(); + } + if (km && !gm) { + vrPsd.updateOpen2End(true); + } + if (gm && !km) { + vrPsd.updateLockAndClose(true, true); + } + } + } + + /** + * 触发开关门流程 + */ + public void openOrClose(SdyPsdConfig config, boolean km, boolean gm, int baseAddr, Channel channel) { + LocalDateTime buzzerRingingTime = config.getBuzzerRingingTime(); + if (buzzerRingingTime != null) { //说明正在开关门流程中 + return; + } + if ((km || gm)) { + this.plcGatewayService.writeSingleCoil(baseAddr, config.getConfigVO().getW_jb(), true, channel); + config.buzzerRinging(LocalDateTime.now()); + } + } + + /** + * 开关门循环逻辑(响铃3秒,然后开/关门。如果响铃超过6秒门还是没有开始移动(有人卡着屏蔽门,导致无法关闭),中断开关门流程) + */ + public void openOrCloseLoop(SdyPsdConfig config, boolean km, boolean gm, int baseAddr, boolean w_kgm, Channel channel) { + LocalDateTime buzzerRingingTime = config.getBuzzerRingingTime(); + if (buzzerRingingTime == null) { + return; + } + if (config.isRunning()) + return; + LocalDateTime now = LocalDateTime.now(); + if (now.isAfter(buzzerRingingTime.plusSeconds(1))) { //蜂鸣器响了超过3秒 + if ((km || gm) && !config.isTriggerOpenOrClose()) { + this.plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getConfigVO().getW_kgm(), w_kgm, true, channel); + config.setTriggerOpenOrClose(true); + } + if (now.isAfter(buzzerRingingTime.plusSeconds(3))) { //如果响铃超过该时长门还没有进入运动状态,取消触发状态 +// this.plcGatewayService.writeSingleCoil(baseAddr, config.getConfigVO().getW_jb(), false, channel); +// config.cancelControl(); + this.plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getConfigVO().getW_kgm(), w_kgm, false, channel); + config.setTriggerOpenOrClose(false); + } + } } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPslServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPslServiceImpl.java index e25d18d01..342e67ad0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPslServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/sdy/SdyPslServiceImpl.java @@ -25,6 +25,9 @@ public class SdyPslServiceImpl implements RealDeviceService { @Autowired private PlcGatewayService plcGatewayService; + @Autowired + private SdyPsdServiceImpl sdyPsdService; + @Override public boolean canHandle(RealDeviceConfig deviceConfig) { return deviceConfig instanceof SdyPslConfig; @@ -69,18 +72,24 @@ public class SdyPslServiceImpl implements RealDeviceService { realPsd = (SdyPsdConfig) optional.get(); if (realPsd != null) vrPsd = (VirtualRealityScreenDoor) realPsd.getMapElement(); - //真实屏蔽门的状态等 + //收集真实屏蔽门的状态等 SdyPsdConfigVO psdConfigVO = null; Integer psdBaseAddr = null; + Boolean psd_r_km = null; Boolean psd_r_gm = null; Boolean psd_w_kgm = null; if (realPsd != null) { psdConfigVO = realPsd.getConfigVO(); psdBaseAddr = plcGateway.getConfig().getAddr() + psdConfigVO.getAddr(); ByteBuf psdStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, psdConfigVO.getAddr(), psdConfigVO.getQuantity()); + psd_r_km = RealDeviceConfig.getBitOf(psdStatus, psdConfigVO.getR_km()); psd_r_gm = RealDeviceConfig.getBitOf(psdStatus, psdConfigVO.getR_gm()); psd_w_kgm = RealDeviceConfig.getBitOf(psdStatus, psdConfigVO.getW_kgm()); } + //更新虚拟真实屏蔽门的控制状态 + if (vrPsd != null) { + vrPsd.setPslControl(r_yxjz_key); + } //所有灯的状态控制 if (r_sd_button) { //试灯按钮按下 plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_gm_light(), w_gm_light, true, channel); @@ -101,25 +110,27 @@ public class SdyPslServiceImpl implements RealDeviceService { //互锁解除灯 plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_hsjc_light(), w_hsjc_light, r_hsjc_key, channel); } - //psl操作灯和开关门按钮 + //允许禁止钥匙处于允许位 if (r_yxjz_key) { - if (vrPsd != null) { - if (r_gm_button && !r_km_button) { - if (!vrPsd.isSettingClose() && !vrPsd.isClose()) { - vrPsd.startSetting(false); + if (psd_r_km || psd_r_gm) { //屏蔽门处于开门/关门到位,控制才生效 + if (vrPsd != null) { + if (r_gm_button && !r_km_button) { + if (!vrPsd.isSettingClose() && !vrPsd.isClose()) { + vrPsd.startSetting(false); + } } - } - if (r_km_button && !r_gm_button) { - if (!vrPsd.isOpen2End()) { - vrPsd.startSetting(true); + if (r_km_button && !r_gm_button) { + if (!vrPsd.isOpen2End()) { + vrPsd.startSetting(true); + } + } + } else if (realPsd != null) { + if (r_gm_button && !r_km_button && psd_r_km) { + sdyPsdService.openOrClose(realPsd, psd_r_km, psd_r_gm, psdBaseAddr, channel); + } + if (r_km_button && !r_gm_button && psd_r_gm) { + sdyPsdService.openOrClose(realPsd, psd_r_km, psd_r_gm, psdBaseAddr, channel); } - } - } else if (realPsd != null) { - if (r_gm_button && !r_km_button) { - plcGatewayService.checkEqualAndWriteSingleCoil(psdBaseAddr, psdConfigVO.getW_kgm(), psd_w_kgm, false, channel); - } - if (r_km_button && !r_gm_button) { - plcGatewayService.checkEqualAndWriteSingleCoil(psdBaseAddr, psdConfigVO.getW_kgm(), psd_w_kgm, true, channel); } } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/SpeedCurve.java b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/SpeedCurve.java index 483cac6b9..1cea6d9bb 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/SpeedCurve.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/SpeedCurve.java @@ -11,6 +11,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.extern.slf4j.Slf4j; +import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; @@ -172,6 +173,20 @@ public class SpeedCurve { while (Objects.nonNull(base) && count < 20) { ++count; Float limitSpeed1 = base.getNeedLimitSpeed(); + if (limitSpeed1 == null && !CollectionUtils.isEmpty(base.getLogicList())) { //兼容逻辑区段设置限速 + float distanceBetweenLogicAndPhysical = 0; //逻辑区段距物理区段端点的距离(同向端点) + for (Section section : base.getLogicList()) { + limitSpeed1 = section.getNeedLimitSpeed(); + if (limitSpeed1 != null) { + float offsetOfLogicSectionOnPhysicalSection = distanceBetweenLogicAndPhysical + (right ? section.getLen() : 0); //逻辑区段的端点在物理区段上的偏移量 + SectionPosition logicSectionPosition = new SectionPosition(base, offsetOfLogicSectionOnPhysicalSection); + if (logicSectionPosition.isAheadOf(tailPosition, right)) { + break; + } + } + distanceBetweenLogicAndPhysical += section.getLen(); + } + } if (Objects.nonNull(limitSpeed1)) { if (ahead) { // 车头前方 diff --git a/src/main/java/club/joylink/rtss/vo/UserVO.java b/src/main/java/club/joylink/rtss/vo/UserVO.java index 3ea46566c..b1aa77ab3 100644 --- a/src/main/java/club/joylink/rtss/vo/UserVO.java +++ b/src/main/java/club/joylink/rtss/vo/UserVO.java @@ -83,6 +83,7 @@ public class UserVO implements Serializable { /** * 数据库的roles字段 */ + @JsonIgnore private String dbRoles; /** @@ -105,10 +106,14 @@ public class UserVO implements Serializable { */ private LocalDateTime createTime; + //单位信息 private Integer companyId; private String companyName; + private Boolean companyAdmin; + + public UserVO() {} public UserVO(SysUser sysUser) { @@ -175,6 +180,14 @@ public class UserVO implements Serializable { } } + public void setRolesByString() { + if(StringUtils.hasText(dbRoles)) { + String[] splits = dbRoles.split(","); + this.roles = new ArrayList<>(); + Collections.addAll(this.roles, splits); + } + } + @Override public String toString() { return "UserVO [id=" + id + ", name=" + name + ", nickname=" + nickname + ", mobile=" + mobile + ", email=" + email +", nationcode=" @@ -223,6 +236,7 @@ public class UserVO implements Serializable { * 是否管理员 * @return */ + @JsonIgnore public boolean isAdmin() { return !CollectionUtils.isEmpty(this.roles) && (this.roles.contains(BusinessConsts.ROLE_04) || this.roles.contains(BusinessConsts.ROLE_05)); @@ -232,6 +246,7 @@ public class UserVO implements Serializable { * 是否超级管理员 * @return */ + @JsonIgnore public boolean isSuperAdmin() { return !CollectionUtils.isEmpty(this.roles) && (this.roles.contains(BusinessConsts.ROLE_05)); diff --git a/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java b/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java index b690f0fce..2849dd8ee 100644 --- a/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/ExamDefinitionVO.java @@ -1,13 +1,13 @@ package club.joylink.rtss.vo.client; +import club.joylink.rtss.entity.ExamDefinition; +import club.joylink.rtss.vo.client.company.DepartmentVO; +import club.joylink.rtss.vo.client.validGroup.ExamDefinitionCheck; +import club.joylink.rtss.vo.client.validGroup.ExamDefinitionRulesCheck; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import club.joylink.rtss.entity.ExamDefinition; -import club.joylink.rtss.vo.client.student.StudentClassVO; -import club.joylink.rtss.vo.client.validGroup.ExamDefinitionCheck; -import club.joylink.rtss.vo.client.validGroup.ExamDefinitionRulesCheck; import io.swagger.annotations.ApiModel; import lombok.Getter; import lombok.NoArgsConstructor; @@ -121,7 +121,7 @@ public class ExamDefinitionVO { private Boolean trial; /**关联班级列表*/ - private List classes; + private List classes; @Valid @NotNull(message = "考试规则不能为空", groups = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class}) diff --git a/src/main/java/club/joylink/rtss/vo/client/ExamsLessonVO.java b/src/main/java/club/joylink/rtss/vo/client/ExamsLessonVO.java index 44a4a3415..9d82d9fe6 100644 --- a/src/main/java/club/joylink/rtss/vo/client/ExamsLessonVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/ExamsLessonVO.java @@ -73,6 +73,11 @@ public class ExamsLessonVO { */ private List permissionList; + private boolean systemFault; + + /** 用户是否有权使用改考试 */ + private boolean available; + public ExamsLessonVO(LessonVO lessonVO) { this.id = lessonVO.getId(); this.name = lessonVO.getName(); @@ -82,5 +87,6 @@ public class ExamsLessonVO { this.authorId = lessonVO.getAuthorId(); this.updateTime = lessonVO.getUpdateTime(); this.creatorId = lessonVO.getCreatorId(); + this.systemFault = lessonVO.isSystemFault(); } } diff --git a/src/main/java/club/joylink/rtss/vo/client/LessonVO.java b/src/main/java/club/joylink/rtss/vo/client/LessonVO.java index 50423f6cc..180b15c30 100644 --- a/src/main/java/club/joylink/rtss/vo/client/LessonVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/LessonVO.java @@ -112,6 +112,8 @@ public class LessonVO { private String explanation; + private boolean systemFault; + public LessonVO(LsDraftLesson lesson) { this.id = lesson.getId(); this.name = lesson.getName(); diff --git a/src/main/java/club/joylink/rtss/vo/client/company/CompanyDepartUserVO.java b/src/main/java/club/joylink/rtss/vo/client/company/CompanyDepartUserVO.java new file mode 100644 index 000000000..1232b0ada --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/CompanyDepartUserVO.java @@ -0,0 +1,35 @@ +package club.joylink.rtss.vo.client.company; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class CompanyDepartUserVO{ + +// private Long id; + + private Long userId; + + private String account; + + + private String name; + +// private String nickname; + + + private Integer companyId; + private String companyName; + + private Integer departmentId; + private String departmentName; + + private Integer positionId; + private String positionName; + + private boolean manager; + +} diff --git a/src/main/java/club/joylink/rtss/vo/client/CompanyQueryVO.java b/src/main/java/club/joylink/rtss/vo/client/company/CompanyQueryVO.java similarity index 60% rename from src/main/java/club/joylink/rtss/vo/client/CompanyQueryVO.java rename to src/main/java/club/joylink/rtss/vo/client/company/CompanyQueryVO.java index fd7fcaf51..20874a2a0 100644 --- a/src/main/java/club/joylink/rtss/vo/client/CompanyQueryVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/company/CompanyQueryVO.java @@ -1,5 +1,6 @@ -package club.joylink.rtss.vo.client; +package club.joylink.rtss.vo.client.company; +import club.joylink.rtss.vo.client.PageQueryVO; import lombok.Getter; import lombok.Setter; @@ -10,4 +11,5 @@ public class CompanyQueryVO extends PageQueryVO { private String name; + } diff --git a/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserQueryVO.java b/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserQueryVO.java new file mode 100644 index 000000000..d160e4a31 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserQueryVO.java @@ -0,0 +1,22 @@ +package club.joylink.rtss.vo.client.company; + +import club.joylink.rtss.vo.client.PageQueryVO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class CompanyUserQueryVO extends PageQueryVO { + + + @ApiModelProperty(value = "真实姓名") + private String name; + + private String account; + + @ApiModelProperty(value = "部门id",hidden = true) + private Integer departmentId; + + +} diff --git a/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserVO.java b/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserVO.java new file mode 100644 index 000000000..4a2b72645 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/CompanyUserVO.java @@ -0,0 +1,49 @@ +package club.joylink.rtss.vo.client.company; + +import club.joylink.rtss.constants.BusinessConsts; +import club.joylink.rtss.entity.SysUser; +import club.joylink.rtss.util.EncryptUtil; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +@Getter +@Setter +@NoArgsConstructor +public class CompanyUserVO { + + + @ApiModelProperty(value = "用户姓名") + @NotBlank(message = "用户姓名不能为空") + private String name; + + @ApiModelProperty(value = "用户账号") + @NotBlank(message = "用户账号不能为空") + private String account; + + + public static SysUser convert2DB(CompanyUserVO companyUserVO) { + SysUser user = new SysUser(); + user.setName(companyUserVO.name); + user.setAccount(companyUserVO.account); + user.setNickname(companyUserVO.name); + user.setPassword(EncryptUtil.md5(BusinessConsts.GZB_DEFAULT_PASSWORD)); + user.setStatus(BusinessConsts.STATUS_USE); + user.setRoles(BusinessConsts.ROLE_01); + user.setCreateTime(LocalDateTime.now()); + return user; + } + + public static List convert2DBList(List companyUserVOS){ + return companyUserVOS.stream().map(CompanyUserVO::convert2DB).collect(Collectors.toList()); + } +} + + diff --git a/src/main/java/club/joylink/rtss/vo/client/CompanyVO.java b/src/main/java/club/joylink/rtss/vo/client/company/CompanyVO.java similarity index 83% rename from src/main/java/club/joylink/rtss/vo/client/CompanyVO.java rename to src/main/java/club/joylink/rtss/vo/client/company/CompanyVO.java index 800584a07..b2e929607 100644 --- a/src/main/java/club/joylink/rtss/vo/client/CompanyVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/company/CompanyVO.java @@ -1,7 +1,6 @@ -package club.joylink.rtss.vo.client; +package club.joylink.rtss.vo.client.company; import club.joylink.rtss.entity.Company; -import club.joylink.rtss.vo.UserVO; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Getter; @@ -31,13 +30,14 @@ public class CompanyVO { /**联系方式*/ private String phone = ""; - private List managers; + private String projectCode; public CompanyVO(Company entity) { this.id = entity.getId(); this.name = entity.getName(); this.address = entity.getAddress(); this.phone = entity.getPhone(); + this.projectCode = entity.getProjectCode(); } public static List convert2VOList(List dataList) { @@ -48,19 +48,16 @@ public class CompanyVO { return voList; } - public static CompanyVO convertFromDB(Company company, List managers) { - CompanyVO vo = new CompanyVO(company); - vo.setManagers(managers); - return vo; - } - public Company toDB() { Company entity = new Company(); entity.setId(this.id); entity.setName(this.name); entity.setAddress(this.address); entity.setPhone(this.phone); + entity.setProjectCode(this.projectCode); entity.setCreateTime(LocalDateTime.now()); return entity; } + + } diff --git a/src/main/java/club/joylink/rtss/vo/client/company/DepartmentVO.java b/src/main/java/club/joylink/rtss/vo/client/company/DepartmentVO.java new file mode 100644 index 000000000..ca6aeada7 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/DepartmentVO.java @@ -0,0 +1,105 @@ +package club.joylink.rtss.vo.client.company; + +import club.joylink.rtss.entity.CompanyDepartment; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +@Getter +@Setter +@NoArgsConstructor +public class DepartmentVO { + + @JsonSerialize(using = ToStringSerializer.class) + private Integer id; + + @NotBlank(message = "部门名称不能为空") + private String name; + + private Integer companyId; + + @JsonIgnore + private Integer parentId; + + private List childDept; + + public DepartmentVO(CompanyDepartment entity) { + this.id = entity.getId(); + this.name = entity.getName(); + this.companyId = entity.getCompanyId(); + this.parentId = entity.getParentId(); + } + + public DepartmentVO(String name, Integer companyId, Integer parentId) { + this.name = name; + this.companyId = companyId; + this.parentId = parentId; + } + + public static List convert2VOList(List dataList) { + List voList = new ArrayList<>(); + for (CompanyDepartment entity : dataList) { + voList.add(new DepartmentVO(entity)); + } + return voList; + } + + public CompanyDepartment toDB() { + CompanyDepartment entity = new CompanyDepartment(); + entity.setId(this.id); + entity.setName(this.name); + entity.setCompanyId(this.companyId); + entity.setParentId(this.parentId); + return entity; + } + + public static List buildDeptTree(List voList) { + List rootDeparts = new ArrayList<>(); + voList.forEach(d -> { + if (Objects.isNull(d.getParentId())) { + d.setChildDept(getChildDept(d.getId(), voList)); + rootDeparts.add(d); + } + }); + return rootDeparts; + } + + public static List getChildDept(Integer parentId, List list) { + List child = new ArrayList<>(); + list.forEach(c -> { + if (parentId == c.getParentId()) { + child.add(c); + + } + }); + var list1 = new ArrayList<>(list); + list1.removeAll(child); + child.forEach(c -> { + c.setChildDept(getChildDept(c.getId(), list1)); + }); + return child; + } + + public static List getChildDeptList(Integer parentId, List list) { + List child = new ArrayList<>(); + list.forEach(c -> { + if (parentId == c.getParentId()) { + child.add(c); + } + }); + var list1 = new ArrayList<>(list); + list1.removeAll(child); + child.forEach(c -> { + child.addAll(getChildDept(c.getId(), list1)); + }); + return child; + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/company/ImportCompanyUserVO.java b/src/main/java/club/joylink/rtss/vo/client/company/ImportCompanyUserVO.java new file mode 100644 index 000000000..ea53a1d9a --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/ImportCompanyUserVO.java @@ -0,0 +1,23 @@ +package club.joylink.rtss.vo.client.company; + +import lombok.Getter; +import lombok.Setter; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; + +@Getter +@Setter +public class ImportCompanyUserVO { + + @NotBlank + private String parentDepart; + @NotBlank + private String depart; + + @NotEmpty + @Valid + private List companyUsers; +} diff --git a/src/main/java/club/joylink/rtss/vo/client/company/PositionVO.java b/src/main/java/club/joylink/rtss/vo/client/company/PositionVO.java new file mode 100644 index 000000000..fe993aaea --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/PositionVO.java @@ -0,0 +1,48 @@ +package club.joylink.rtss.vo.client.company; + +import club.joylink.rtss.entity.CompanyPosition; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.validation.constraints.NotBlank; +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +public class PositionVO { + + @JsonSerialize(using = ToStringSerializer.class) + private Integer id; + + @NotBlank(message = "职位名称不能为空") + private String name; + + private Integer companyId; + + public PositionVO(CompanyPosition entity) { + this.id = entity.getId(); + this.name = entity.getName(); + this.companyId = entity.getCompanyId(); + } + + public static List convert2VOList(List dataList) { + List voList = new ArrayList<>(); + for (CompanyPosition entity : dataList) { + voList.add(new PositionVO(entity)); + } + return voList; + } + + public CompanyPosition toDB() { + CompanyPosition entity = new CompanyPosition(); + entity.setId(this.id); + entity.setName(this.name); + entity.setCompanyId(this.companyId); + return entity; + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/company/UserDepartRelVO.java b/src/main/java/club/joylink/rtss/vo/client/company/UserDepartRelVO.java new file mode 100644 index 000000000..35213769a --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/UserDepartRelVO.java @@ -0,0 +1,62 @@ +package club.joylink.rtss.vo.client.company; + +import club.joylink.rtss.entity.DepartmentUser; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Getter +@Setter +@NoArgsConstructor +public class UserDepartRelVO { + + + private Long userId; + +// private UserVO userVO; + +// private Integer companyId; +// private String companyName; + + private Integer departmentId; +// private String departmentName; + + private Integer positionId; + private boolean manager; + + public UserDepartRelVO(Long userId, Integer departmentId, Integer positionId, boolean manager) { + this.userId = userId; + this.departmentId = departmentId; + this.positionId = positionId; + this.manager = manager; + } + + public UserDepartRelVO(DepartmentUser departmentUser) { + this.userId = departmentUser.getUserId(); + this.departmentId = departmentUser.getDepartmentId(); + this.positionId = departmentUser.getPositionId(); + this.manager = departmentUser.getManager(); + } + + public DepartmentUser toDB() { + DepartmentUser entity = new DepartmentUser(); + entity.setDepartmentId(departmentId); + entity.setPositionId(positionId); + entity.setUserId(userId); + entity.setManager(manager); + return entity; + } + + public static List convert2VOList(List departmentUsers){ + if(CollectionUtils.isEmpty(departmentUsers)){ + return new ArrayList<>(); + } + return departmentUsers.stream().map(UserDepartRelVO::new).collect(Collectors.toList()); + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/company/UserDepartVO.java b/src/main/java/club/joylink/rtss/vo/client/company/UserDepartVO.java new file mode 100644 index 000000000..da1dce245 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/company/UserDepartVO.java @@ -0,0 +1,15 @@ +package club.joylink.rtss.vo.client.company; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class UserDepartVO{ + + private Integer departmentId; + private String departmentName; + private boolean manager; +} diff --git a/src/main/java/club/joylink/rtss/vo/client/sub/MapSystemDetailVO.java b/src/main/java/club/joylink/rtss/vo/client/sub/MapSystemDetailVO.java index 7eea13b54..145fb551c 100644 --- a/src/main/java/club/joylink/rtss/vo/client/sub/MapSystemDetailVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/sub/MapSystemDetailVO.java @@ -34,6 +34,7 @@ public class MapSystemDetailVO { private String remarks; private String status; + private String cityCode; @ApiModelProperty(value = "课程") private List lessonList; diff --git a/src/main/resources/mybatis/mapper/CompanyDAO.xml b/src/main/resources/mybatis/mapper/CompanyDAO.xml index 9da08f14c..d52520555 100644 --- a/src/main/resources/mybatis/mapper/CompanyDAO.xml +++ b/src/main/resources/mybatis/mapper/CompanyDAO.xml @@ -6,6 +6,7 @@ + @@ -68,7 +69,7 @@ - id, `name`, address, phone, create_time, update_time + id, `name`, address, phone, project_code, create_time, update_time + select + + distinct + + + from company_department + + + + + order by ${orderByClause} + + + + limit ${offset}, ${limit} + + + limit ${limit} + + + + + + delete from company_department + where id = #{id,jdbcType=INTEGER} + + + delete from company_department + + + + + + insert into company_department (`name`, company_id, parent_id + ) + values (#{name,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER} + ) + + + insert into company_department + + + `name`, + + + company_id, + + + parent_id, + + + + + #{name,jdbcType=VARCHAR}, + + + #{companyId,jdbcType=INTEGER}, + + + #{parentId,jdbcType=INTEGER}, + + + + + + update company_department + + + id = #{record.id,jdbcType=INTEGER}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + company_id = #{record.companyId,jdbcType=INTEGER}, + + + parent_id = #{record.parentId,jdbcType=INTEGER}, + + + + + + + + update company_department + set id = #{record.id,jdbcType=INTEGER}, + `name` = #{record.name,jdbcType=VARCHAR}, + company_id = #{record.companyId,jdbcType=INTEGER}, + parent_id = #{record.parentId,jdbcType=INTEGER} + + + + + + update company_department + + + `name` = #{name,jdbcType=VARCHAR}, + + + company_id = #{companyId,jdbcType=INTEGER}, + + + parent_id = #{parentId,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update company_department + set `name` = #{name,jdbcType=VARCHAR}, + company_id = #{companyId,jdbcType=INTEGER}, + parent_id = #{parentId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/CompanyPositionDAO.xml b/src/main/resources/mybatis/mapper/CompanyPositionDAO.xml new file mode 100644 index 000000000..cf57ccc3c --- /dev/null +++ b/src/main/resources/mybatis/mapper/CompanyPositionDAO.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, `name`, company_id + + + + + delete from company_position + where id = #{id,jdbcType=INTEGER} + + + delete from company_position + + + + + + insert into company_position (`name`, company_id) + values (#{name,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}) + + + insert into company_position + + + `name`, + + + company_id, + + + + + #{name,jdbcType=VARCHAR}, + + + #{companyId,jdbcType=INTEGER}, + + + + + + update company_position + + + id = #{record.id,jdbcType=INTEGER}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + company_id = #{record.companyId,jdbcType=INTEGER}, + + + + + + + + update company_position + set id = #{record.id,jdbcType=INTEGER}, + `name` = #{record.name,jdbcType=VARCHAR}, + company_id = #{record.companyId,jdbcType=INTEGER} + + + + + + update company_position + + + `name` = #{name,jdbcType=VARCHAR}, + + + company_id = #{companyId,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update company_position + set `name` = #{name,jdbcType=VARCHAR}, + company_id = #{companyId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/CompanyUserDAO.xml b/src/main/resources/mybatis/mapper/CompanyUserDAO.xml new file mode 100644 index 000000000..da49eed5b --- /dev/null +++ b/src/main/resources/mybatis/mapper/CompanyUserDAO.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + company_id, user_id, `admin` + + + + delete from company_user + + + + + + insert into company_user (company_id, user_id, `admin` + ) + values (#{companyId,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT}, #{admin,jdbcType=BIT} + ) + + + insert into company_user + + + company_id, + + + user_id, + + + `admin`, + + + + + #{companyId,jdbcType=INTEGER}, + + + #{userId,jdbcType=BIGINT}, + + + #{admin,jdbcType=BIT}, + + + + + + update company_user + + + company_id = #{record.companyId,jdbcType=INTEGER}, + + + user_id = #{record.userId,jdbcType=BIGINT}, + + + `admin` = #{record.admin,jdbcType=BIT}, + + + + + + + + update company_user + set company_id = #{record.companyId,jdbcType=INTEGER}, + user_id = #{record.userId,jdbcType=BIGINT}, + `admin` = #{record.admin,jdbcType=BIT} + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/DepartmentExamDAO.xml b/src/main/resources/mybatis/mapper/DepartmentExamDAO.xml new file mode 100644 index 000000000..c38015626 --- /dev/null +++ b/src/main/resources/mybatis/mapper/DepartmentExamDAO.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + exam_id, department_id + + + + delete from department_exam + + + + + + insert into department_exam (exam_id, department_id) + values (#{examId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER}) + + + insert into department_exam + + + exam_id, + + + department_id, + + + + + #{examId,jdbcType=BIGINT}, + + + #{departmentId,jdbcType=INTEGER}, + + + + + + update department_exam + + + exam_id = #{record.examId,jdbcType=BIGINT}, + + + department_id = #{record.departmentId,jdbcType=INTEGER}, + + + + + + + + update department_exam + set exam_id = #{record.examId,jdbcType=BIGINT}, + department_id = #{record.departmentId,jdbcType=INTEGER} + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/DepartmentLessonDAO.xml b/src/main/resources/mybatis/mapper/DepartmentLessonDAO.xml new file mode 100644 index 000000000..c0b9bc152 --- /dev/null +++ b/src/main/resources/mybatis/mapper/DepartmentLessonDAO.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + lesson_id, department_id + + + + delete from department_lesson + + + + + + insert into department_lesson (lesson_id, department_id) + values (#{lessonId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER}) + + + insert into department_lesson + + + lesson_id, + + + department_id, + + + + + #{lessonId,jdbcType=BIGINT}, + + + #{departmentId,jdbcType=INTEGER}, + + + + + + update department_lesson + + + lesson_id = #{record.lessonId,jdbcType=BIGINT}, + + + department_id = #{record.departmentId,jdbcType=INTEGER}, + + + + + + + + update department_lesson + set lesson_id = #{record.lessonId,jdbcType=BIGINT}, + department_id = #{record.departmentId,jdbcType=INTEGER} + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/UserCompanyRelDAO.xml b/src/main/resources/mybatis/mapper/DepartmentUserDAO.xml similarity index 58% rename from src/main/resources/mybatis/mapper/UserCompanyRelDAO.xml rename to src/main/resources/mybatis/mapper/DepartmentUserDAO.xml index fd4a7eda6..b24c4f7aa 100644 --- a/src/main/resources/mybatis/mapper/UserCompanyRelDAO.xml +++ b/src/main/resources/mybatis/mapper/DepartmentUserDAO.xml @@ -1,10 +1,11 @@ - - + + - + + @@ -68,15 +69,15 @@ - id, user_id, company_id, manager, create_time, update_time + id, user_id, department_id, position_id, manager, create_time, update_time - select distinct - from user_company_rel + from department_user @@ -95,33 +96,38 @@ - delete from user_company_rel + delete from department_user where id = #{id,jdbcType=BIGINT} - - delete from user_company_rel + + delete from department_user - - insert into user_company_rel (user_id, company_id, manager, - create_time, update_time) - values (#{userId,jdbcType=BIGINT}, #{companyId,jdbcType=INTEGER}, #{manager,jdbcType=BIT}, - #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) + + insert into department_user (user_id, department_id, position_id, + manager, create_time, update_time + ) + values (#{userId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER}, #{positionId,jdbcType=INTEGER}, + #{manager,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} + ) - - insert into user_company_rel + + insert into department_user user_id, - - company_id, + + department_id, + + + position_id, manager, @@ -137,8 +143,11 @@ #{userId,jdbcType=BIGINT}, - - #{companyId,jdbcType=INTEGER}, + + #{departmentId,jdbcType=INTEGER}, + + + #{positionId,jdbcType=INTEGER}, #{manager,jdbcType=BIT}, @@ -151,14 +160,14 @@ - + select count(*) from department_user - update user_company_rel + update department_user id = #{record.id,jdbcType=BIGINT}, @@ -166,8 +175,11 @@ user_id = #{record.userId,jdbcType=BIGINT}, - - company_id = #{record.companyId,jdbcType=INTEGER}, + + department_id = #{record.departmentId,jdbcType=INTEGER}, + + + position_id = #{record.positionId,jdbcType=INTEGER}, manager = #{record.manager,jdbcType=BIT}, @@ -184,10 +196,11 @@ - update user_company_rel + update department_user set id = #{record.id,jdbcType=BIGINT}, user_id = #{record.userId,jdbcType=BIGINT}, - company_id = #{record.companyId,jdbcType=INTEGER}, + department_id = #{record.departmentId,jdbcType=INTEGER}, + position_id = #{record.positionId,jdbcType=INTEGER}, manager = #{record.manager,jdbcType=BIT}, create_time = #{record.createTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP} @@ -195,14 +208,17 @@ - - update user_company_rel + + update department_user user_id = #{userId,jdbcType=BIGINT}, - - company_id = #{companyId,jdbcType=INTEGER}, + + department_id = #{departmentId,jdbcType=INTEGER}, + + + position_id = #{positionId,jdbcType=INTEGER}, manager = #{manager,jdbcType=BIT}, @@ -216,24 +232,67 @@ where id = #{id,jdbcType=BIGINT} - - update user_company_rel + + update department_user set user_id = #{userId,jdbcType=BIGINT}, - company_id = #{companyId,jdbcType=INTEGER}, + department_id = #{departmentId,jdbcType=INTEGER}, + position_id = #{positionId,jdbcType=INTEGER}, manager = #{manager,jdbcType=BIT}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} - - - update user_company_rel set - - user_id = #{record.userId,jdbcType=BIGINT}, - company_id = #{record.companyId,jdbcType=INTEGER}, - manager = #{record.manager,jdbcType=BIT}, - create_time = #{record.createTime,jdbcType=TIMESTAMP}, - update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mybatis/mapper/SysUserDAO.xml b/src/main/resources/mybatis/mapper/SysUserDAO.xml index 130bad963..b58072214 100644 --- a/src/main/resources/mybatis/mapper/SysUserDAO.xml +++ b/src/main/resources/mybatis/mapper/SysUserDAO.xml @@ -415,7 +415,6 @@ update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} - @@ -435,30 +434,49 @@ + - + SELECT + s.id as userId, account, s.`name` as userName, nickname, avatar_path, `password`, mobile, nationcode, email, + wx_id, wx_union_id, wm_open_id, `status`, roles, `offline`, s.create_time, update_user_id, + s.update_time, c.id as companyId, c.`name` as companyName,cu.admin as admin + FROM sys_user s LEFT JOIN company_user cu ON s.id=cu.user_id LEFT JOIN company c ON c.id = cu.company_id - and sys_user.`name` like concat('%', #{name}, '%') + and s.`name` like concat('%', #{name}, '%') - and sys_user.`nickname` like concat('%', #{nickname}, '%') + and s.`nickname` like concat('%', #{nickname}, '%') - and sys_user.`mobile` like concat('%', #{mobile}, '%') + and s.`mobile` like concat('%', #{mobile}, '%') - and sys_user.`roles` like concat('%', #{rolesStr}, '%') + and s.`roles` like concat('%', #{rolesStr}, '%') - and company.id = #{companyId} + and c.id = #{companyId} - order by sys_user.id + order by s.id + + + + +