Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
sheng 2021-01-12 23:53:15 +08:00
commit ca313ad48c
76 changed files with 6163 additions and 611 deletions

102
sql/20210108-dukang.sql Normal file
View File

@ -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`;

567
sql/20210112-dukang.sql Normal file
View File

@ -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);

View File

@ -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();
//
//}

View File

@ -4,9 +4,8 @@ import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.ICompanyService; import club.joylink.rtss.services.ICompanyService;
import club.joylink.rtss.vo.UserVO; 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.PageVO;
import club.joylink.rtss.vo.client.company.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -16,7 +15,7 @@ import springfox.documentation.annotations.ApiIgnore;
import java.util.List; import java.util.List;
@Api(tags = {"公司单位管理接口"}) @Api(tags = {"单位成员管理接口"})
@RestController @RestController
@RequestMapping("/api/company") @RequestMapping("/api/company")
public class CompanyController { public class CompanyController {
@ -27,52 +26,178 @@ public class CompanyController {
@ApiOperation(value = "添加公司信息") @ApiOperation(value = "添加公司信息")
@PostMapping @PostMapping
public CompanyVO create(@RequestBody @Validated CompanyVO company) { public CompanyVO create(@RequestBody @Validated CompanyVO company) {
CompanyVO vo = this.iCompanyService.create(company); CompanyVO vo = iCompanyService.create(company);
return vo; return vo;
} }
@ApiOperation(value = "获取公司列表") @ApiOperation(value = "获取公司列表")
@GetMapping @GetMapping
public List<CompanyVO> queryAll() { public List<CompanyVO> queryAll() {
List<CompanyVO> list = this.iCompanyService.queryOrganizations(); List<CompanyVO> list = iCompanyService.queryOrganizations();
return list; return list;
} }
@ApiOperation(value = "分页获取公司列表") @ApiOperation(value = "分页获取公司列表")
@GetMapping("paging") @GetMapping("paging")
public PageVO<CompanyVO> pagingQueryAll(CompanyQueryVO queryVO) { public PageVO<CompanyVO> pagingQueryAll(CompanyQueryVO queryVO) {
PageVO<CompanyVO> list = this.iCompanyService.queryPageOrganizations(queryVO); PageVO<CompanyVO> list = iCompanyService.queryPageOrganizations(queryVO);
return list; return list;
} }
@ApiOperation(value = "删除公司信息") @ApiOperation(value = "删除公司信息")
@DeleteMapping("{id}") @DeleteMapping("{id}")
public void delete( @PathVariable Integer id) { public void delete( @PathVariable Integer id) {
this.iCompanyService.deleteCompanyById(id); iCompanyService.deleteCompanyById(id);
} }
@ApiOperation(value = "查询公司信息") @ApiOperation(value = "查询公司信息")
@GetMapping("{id}") @GetMapping("{id}")
public CompanyVO get( @PathVariable Integer id) { public CompanyVO get( @PathVariable Integer id) {
return this.iCompanyService.getCompanyById(id); return iCompanyService.getCompanyById(id);
} }
@ApiOperation(value = "更新公司信息") @ApiOperation(value = "更新公司信息")
@PutMapping("{id}") @PutMapping("{id}")
public CompanyVO updateCompany(@PathVariable Integer id, @RequestBody @Validated CompanyVO company) { 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}) // @Role({RoleEnum.Admin, RoleEnum.SuperAdmin})
@ApiOperation("添加公司管理者") // @ApiOperation("添加公司管理者")
@PutMapping("/{companyId}/addManager") // @PutMapping("/{companyId}/addManager")
public void addManager(@PathVariable Integer companyId, @RequestBody List<Long> userIds, @RequestAttribute @ApiIgnore UserVO user) { // public void addManager(@PathVariable Integer companyId, @RequestBody List<Long> userIds, @RequestAttribute @ApiIgnore UserVO user) {
iCompanyService.addManager(companyId, userIds, user); // iCompanyService.addManager(companyId, userIds, user);
} // }
//
// @Role({RoleEnum.Admin, RoleEnum.SuperAdmin})
// @ApiOperation("取消公司管理者")
// @PutMapping("/{companyId}/removeManager")
// public void addManager(@PathVariable Integer companyId, @RequestBody List<Long> userIds, @RequestAttribute @ApiIgnore UserVO user) {
// iCompanyService.removeManager(companyId, userIds, user);
// }
@ApiOperation(value = "微信小程用户绑定单位") @ApiOperation(value = "微信小程用户绑定单位")
@PutMapping(path = "/bind/company") @PutMapping(path = "/bind/company")
public void userBindCompany(Long userId, Integer companyId) { public CompanyVO userScanCodeBindCompany(Long userId, Integer companyId) {
this.iCompanyService.userBindCompany(userId, 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<DepartmentVO> queryCompanyDepartTree(@PathVariable Integer companyId) {
List<DepartmentVO> list = iCompanyService.getCompanyDepartTree(companyId);
return list;
}
@ApiOperation(value = "获取单位所有部门")
@GetMapping(path = "{companyId}/dept")
public List<DepartmentVO> queryCompanyDepart(@PathVariable Integer companyId) {
List<DepartmentVO> 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<DepartmentVO> 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<PositionVO> 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<CompanyDepartUserVO> 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<CompanyDepartUserVO> getUserCompanyDeparts(@RequestAttribute @ApiIgnore UserVO user, @PathVariable Integer companyId) {
return iCompanyService.getUserCompanyDeparts(user,companyId);
}
} }

View File

@ -31,12 +31,12 @@ public class ExamController {
iExamService.create(examDefinitionVO, user); iExamService.create(examDefinitionVO, user);
} }
@ApiOperation(value = "贵装备创建考试") // @ApiOperation(value = "贵装备创建考试")
@PostMapping(path = "/project/GZB") // @PostMapping(path = "/project/GZB")
public void createGZBExam(@RequestBody @Validated(value = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class}) // public void createGZBExam(@RequestBody @Validated(value = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class})
ExamDefinitionVO examDefinitionVO, @RequestAttribute @ApiIgnore UserVO user) { // ExamDefinitionVO examDefinitionVO, @RequestAttribute @ApiIgnore UserVO user) {
iExamService.createGZBExam(examDefinitionVO, user); // iExamService.createGZBExam(examDefinitionVO, user);
} // }
@ApiOperation(value = "检查分数是否合理") @ApiOperation(value = "检查分数是否合理")
@GetMapping(path = "/checkScore") @GetMapping(path = "/checkScore")

View File

@ -2,14 +2,14 @@ package club.joylink.rtss.controller.publish;
import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.ICompanyService;
import club.joylink.rtss.services.ILessonService; import club.joylink.rtss.services.ILessonService;
import club.joylink.rtss.services.student.IClassStudentUserService;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.LessonQueryVO; import club.joylink.rtss.vo.client.LessonQueryVO;
import club.joylink.rtss.vo.client.LessonTreeVO; import club.joylink.rtss.vo.client.LessonTreeVO;
import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.LessonVO;
import club.joylink.rtss.vo.client.PageVO; 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 club.joylink.rtss.vo.client.validGroup.LessonUpdateNameAndRemarksCheck;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -28,7 +28,7 @@ public class LessonController {
private ILessonService iLessonService; private ILessonService iLessonService;
@Autowired @Autowired
private IClassStudentUserService iClassStudentUserService; private ICompanyService iCompanyService;
@Autowired @Autowired
public LessonController(ILessonService iLessonService) { public LessonController(ILessonService iLessonService) {
@ -53,16 +53,16 @@ public class LessonController {
return this.iLessonService.queryValidLessons(lessonQueryVO); return this.iLessonService.queryValidLessons(lessonQueryVO);
} }
@ApiOperation(value = "根据班级获取关联课程列表") @ApiOperation(value = "根据部门获取关联课程列表")
@GetMapping(path = "/class/{classId}") @GetMapping(path = "/depart/{departId}")
public List<LessonVO> queryLessons(@PathVariable Integer classId) { public List<LessonVO> queryLessons(@PathVariable Integer departId) {
return this.iClassStudentUserService.getLessonByClass(classId); return this.iCompanyService.getLessonsByDepart(departId);
} }
@ApiOperation(value = "根据课程获取关联班级信息列表") @ApiOperation(value = "根据课程获取关联班级信息列表")
@GetMapping(path = "/{lessonId}/classes") @GetMapping(path = "/{lessonId}/departs")
public List<StudentClassVO> queryClassByLesson(@PathVariable Long lessonId) { public List<DepartmentVO> queryClassByLesson(@PathVariable Long lessonId) {
return this.iClassStudentUserService.getClassesByLesson(lessonId); return this.iCompanyService.getDepartsByLesson(lessonId);
} }
@ApiOperation(value = "获取课程列表") @ApiOperation(value = "获取课程列表")
@ -85,7 +85,7 @@ public class LessonController {
} }
@Role(RoleEnum.LessonCreater) @Role(RoleEnum.LessonCreater)
@ApiOperation(value = "贵州装备教学实训删除正在使用的发布课程") @ApiOperation(value = "用户删除教学实训删除自己发布的课程")
@DeleteMapping(path = "/usedLesson/{lessonId}") @DeleteMapping(path = "/usedLesson/{lessonId}")
public void deleteUsedLesson(@PathVariable Long lessonId, @RequestAttribute UserVO user) { public void deleteUsedLesson(@PathVariable Long lessonId, @RequestAttribute UserVO user) {
iLessonService.deleteUsedLesson(lessonId, user); iLessonService.deleteUsedLesson(lessonId, user);

View File

@ -4,14 +4,12 @@ import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.ISysUserService; import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.services.local.UserGenerateService; 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.UserQueryVO;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.UserConfigVO; import club.joylink.rtss.vo.client.UserConfigVO;
import club.joylink.rtss.vo.client.student.ExportStudentInfo; 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.student.StudentInfoExportParam;
import club.joylink.rtss.vo.client.user.WeChatBindStatusVO; import club.joylink.rtss.vo.client.user.WeChatBindStatusVO;
import club.joylink.rtss.vo.user.UserGenerateConfigVO; import club.joylink.rtss.vo.user.UserGenerateConfigVO;
@ -37,7 +35,7 @@ public class UserController {
private UserGenerateService userGenerateService; private UserGenerateService userGenerateService;
@Autowired @Autowired
private IClassStudentUserService iClassStudentUserService; private IDepartUserStatisticService iDepartUserStatisticService;
@ApiOperation(value = "更新用户配置") @ApiOperation(value = "更新用户配置")
@PostMapping(path = "/config") @PostMapping(path = "/config")
@ -111,23 +109,23 @@ public class UserController {
return this.iSysUserService.fuzzyQueryPagedUser(fuzzyParam); return this.iSysUserService.fuzzyQueryPagedUser(fuzzyParam);
} }
@ApiOperation(value="贵州装备制造导入学生信息接口") // @ApiOperation(value="贵州装备制造导入学生信息接口")
@PostMapping(path="/project/{projectCode}/import/student") // @PostMapping(path="/project/{projectCode}/import/student")
public void importStudents(@PathVariable String projectCode, @Validated @RequestBody ImportStudentInfo importStudentInfo, @RequestAttribute @ApiIgnore UserVO user){ // public void importStudents(@PathVariable String projectCode, @Validated @RequestBody ImportStudentInfo importStudentInfo, @RequestAttribute @ApiIgnore UserVO user){
this.iClassStudentUserService.importStudentInfos(projectCode, importStudentInfo, user); // this.iClassStudentUserService.importStudentInfos(projectCode, importStudentInfo, user);
// }
@ApiOperation(value="导出部门学生信息及成绩接口")
@PutMapping(path="/scores")
public List<ExportStudentInfo> getStudentSores( @Validated @RequestBody StudentInfoExportParam infoExportParam){
return this.iDepartUserStatisticService.studentInfoStatistics(infoExportParam);
} }
@ApiOperation(value="贵州装备制造导出学生信息及成绩接口") // @ApiOperation(value="贵州装备制造查询对应的班级")
@PutMapping(path="/project/{projectCode}/export/student") // @GetMapping(path="/project/{projectCode}/classes")
public List<ExportStudentInfo> importStudents(@PathVariable String projectCode, @Validated @RequestBody StudentInfoExportParam infoExportParam){ // public List<StudentClassVO> getClasses(@PathVariable String projectCode){
return this.iClassStudentUserService.studentInfoStatistics(infoExportParam); // return this.iClassStudentUserService.getClassesByProjectCode(projectCode);
} // }
@ApiOperation(value="贵州装备制造查询对应的班级")
@GetMapping(path="/project/{projectCode}/classes")
public List<StudentClassVO> getClasses(@PathVariable String projectCode){
return this.iClassStudentUserService.getClassesByProjectCode(projectCode);
}
@ApiOperation("查询销售人员") @ApiOperation("查询销售人员")
@GetMapping("/seller") @GetMapping("/seller")

View File

@ -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<CompanyDepartment, Integer, CompanyDepartmentExample> {
}

View File

@ -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<CompanyPosition, Integer, CompanyPositionExample> {
}

View File

@ -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<CompanyUser, CompanyUser, CompanyUserExample> {
}

View File

@ -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<DepartmentExam, DepartmentExam, DepartmentExamExample> {
@Select("<script>" +
"SELECT c.* " +
"FROM company_department c INNER JOIN department_exam " +
"ON id = department_id " +
"AND exam_id = #{examId} " +
"</script>")
List<CompanyDepartment> getDepartsByExamId(@Param("examId") Long examId);
}

View File

@ -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<DepartmentLesson, DepartmentLesson, DepartmentLessonExample> {
@Select("<script>" +
"SELECT cd.* " +
"FROM company_department cd INNER JOIN department_lesson dl " +
"ON cd.id = dl.department_id " +
"AND lesson_id = #{lessonId} " +
"</script>")
List<CompanyDepartment> getDeparts(@Param("lessonId") Long lessonId);
@Select("<script>" +
"SELECT `name` " +
"FROM company_department " +
"INNER JOIN department_lesson " +
"ON id = department_id " +
"AND lesson_id = #{lessonId} " +
"</script>")
List<String> getClassNames(@Param("lessonId") Long lessonId);
}

View File

@ -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<DepartmentUser, Long, DepartmentUserExample> {
List<CompanyDepartUserVO> getCompanyDepartUsers(CompanyUserQueryVO companyUserQueryVO);
List<CompanyDepartUserVO> getUserCompanyDeparts(@Param("companyId") Integer companyId,@Param("userId") Long userId);
}

View File

@ -66,8 +66,11 @@ public interface LsLessonDAO extends MyBatisBaseDao<LsLesson, Long, LsLessonExam
"<if test=\"prdType != null\">" + "<if test=\"prdType != null\">" +
" AND ls_lesson.prd_type = #{prdType}\n" + " AND ls_lesson.prd_type = #{prdType}\n" +
"</if>" + "</if>" +
"<if test=\"mapId != null\">" +
" AND ls_lesson.map_id = #{mapId}\n" +
"</if>" +
"ORDER BY\n" + "ORDER BY\n" +
"\tls_lesson.id ASC" + "\tls_lesson.id ASC" +
"</script>") "</script>")
List<LessonVO> getValidLesson(List<Long> ids, String prdType); List<LessonVO> getValidLesson(Long mapId, List<Long> ids, String prdType);
} }

View File

@ -47,7 +47,9 @@ public interface SysUserDAO extends MyBatisBaseDao<SysUser, Long, SysUserExample
"</script>") "</script>")
List<DailyLiveQuantityVO> statisticsDailyRegister(@Param("beginDate") LocalDate beginDate, @Param("endDate") LocalDate endDate); List<DailyLiveQuantityVO> statisticsDailyRegister(@Param("beginDate") LocalDate beginDate, @Param("endDate") LocalDate endDate);
List<UserVO> pagedQueryWithCompany(UserQueryVO queryVO); List<UserVO> queryUsersWithCompany(UserQueryVO queryVO);
UserVO queryUserWithCompany(@Param("userId") Long userId);
UserVO queryCompanyUserByAccount(@Param("account") String account,@Param("companyId") Integer companyId);
// @Results(value = { // @Results(value = {
// @Result(column = "id", property = "id"), // @Result(column = "id", property = "id"),

View File

@ -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<UserCompanyRel, Long, UserCompanyRelExample> {
void batchUpdate(List<UserCompanyRel> ucrList);
}

View File

@ -25,6 +25,11 @@ public class Company implements Serializable {
*/ */
private String phone; private String phone;
/**
* 关联项目
*/
private String projectCode;
/** /**
* 创建时间 * 创建时间
*/ */
@ -69,6 +74,14 @@ public class Company implements Serializable {
this.phone = phone; this.phone = phone;
} }
public String getProjectCode() {
return projectCode;
}
public void setProjectCode(String projectCode) {
this.projectCode = projectCode;
}
public LocalDateTime getCreateTime() { public LocalDateTime getCreateTime() {
return createTime; return createTime;
} }
@ -101,6 +114,7 @@ public class Company implements Serializable {
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress())) && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress()))
&& (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone())) && (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.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); && (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 + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode()); result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
result = prime * result + ((getPhone() == null) ? 0 : getPhone().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 + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
return result; return result;
@ -128,6 +143,7 @@ public class Company implements Serializable {
sb.append(", name=").append(name); sb.append(", name=").append(name);
sb.append(", address=").append(address); sb.append(", address=").append(address);
sb.append(", phone=").append(phone); sb.append(", phone=").append(phone);
sb.append(", projectCode=").append(projectCode);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);

View File

@ -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();
}
}

View File

@ -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<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public CompanyDepartmentExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> 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<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> 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<Integer> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andCompanyIdNotIn(List<Integer> 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<Integer> values) {
addCriterion("parent_id in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotIn(List<Integer> 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);
}
}
}

View File

@ -395,6 +395,76 @@ public class CompanyExample {
return (Criteria) this; 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<String> values) {
addCriterion("project_code in", values, "projectCode");
return (Criteria) this;
}
public Criteria andProjectCodeNotIn(List<String> 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() { public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null"); addCriterion("create_time is null");
return (Criteria) this; return (Criteria) this;

View File

@ -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();
}
}

View File

@ -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<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public CompanyPositionExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> 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<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> 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<Integer> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andCompanyIdNotIn(List<Integer> 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);
}
}
}

View File

@ -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();
}
}

View File

@ -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<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public CompanyUserExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Integer> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andCompanyIdNotIn(List<Integer> 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<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> 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<Boolean> values) {
addCriterion("`admin` in", values, "admin");
return (Criteria) this;
}
public Criteria andAdminNotIn(List<Boolean> 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);
}
}
}

View File

@ -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();
}
}

View File

@ -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<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public DepartmentExamExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Long> values) {
addCriterion("exam_id in", values, "examId");
return (Criteria) this;
}
public Criteria andExamIdNotIn(List<Long> 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<Integer> values) {
addCriterion("department_id in", values, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdNotIn(List<Integer> 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);
}
}
}

View File

@ -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();
}
}

View File

@ -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<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public DepartmentLessonExample() {
oredCriteria = new ArrayList<Criteria>();
}
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<Criteria> 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<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> 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<Long> values) {
addCriterion("lesson_id in", values, "lessonId");
return (Criteria) this;
}
public Criteria andLessonIdNotIn(List<Long> 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<Integer> values) {
addCriterion("department_id in", values, "departmentId");
return (Criteria) this;
}
public Criteria andDepartmentIdNotIn(List<Integer> 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);
}
}
}

View File

@ -4,10 +4,10 @@ import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
* user_company_rel * department_user
* @author * @author
*/ */
public class UserCompanyRel implements Serializable { public class DepartmentUser implements Serializable {
private Long id; private Long id;
/** /**
@ -16,12 +16,17 @@ public class UserCompanyRel implements Serializable {
private Long userId; private Long userId;
/** /**
* 单位id * 部门id
*/ */
private Integer companyId; private Integer departmentId;
/** /**
* 是否管理员 * 职位id
*/
private Integer positionId;
/**
* 部门管理员
*/ */
private Boolean manager; private Boolean manager;
@ -53,12 +58,20 @@ public class UserCompanyRel implements Serializable {
this.userId = userId; this.userId = userId;
} }
public Integer getCompanyId() { public Integer getDepartmentId() {
return companyId; return departmentId;
} }
public void setCompanyId(Integer companyId) { public void setDepartmentId(Integer departmentId) {
this.companyId = companyId; this.departmentId = departmentId;
}
public Integer getPositionId() {
return positionId;
}
public void setPositionId(Integer positionId) {
this.positionId = positionId;
} }
public Boolean getManager() { public Boolean getManager() {
@ -96,10 +109,11 @@ public class UserCompanyRel implements Serializable {
if (getClass() != that.getClass()) { if (getClass() != that.getClass()) {
return false; return false;
} }
UserCompanyRel other = (UserCompanyRel) that; DepartmentUser other = (DepartmentUser) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) && (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.getManager() == null ? other.getManager() == null : this.getManager().equals(other.getManager()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
@ -111,7 +125,8 @@ public class UserCompanyRel implements Serializable {
int result = 1; int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().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 + ((getManager() == null) ? 0 : getManager().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().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("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", userId=").append(userId); 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(", manager=").append(manager);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);

View File

@ -4,7 +4,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class UserCompanyRelExample { public class DepartmentUserExample {
protected String orderByClause; protected String orderByClause;
protected boolean distinct; protected boolean distinct;
@ -15,7 +15,7 @@ public class UserCompanyRelExample {
private Long offset; private Long offset;
public UserCompanyRelExample() { public DepartmentUserExample() {
oredCriteria = new ArrayList<Criteria>(); oredCriteria = new ArrayList<Criteria>();
} }
@ -245,63 +245,123 @@ public class UserCompanyRelExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdIsNull() { public Criteria andDepartmentIdIsNull() {
addCriterion("company_id is null"); addCriterion("department_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdIsNotNull() { public Criteria andDepartmentIdIsNotNull() {
addCriterion("company_id is not null"); addCriterion("department_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdEqualTo(Integer value) { public Criteria andDepartmentIdEqualTo(Integer value) {
addCriterion("company_id =", value, "companyId"); addCriterion("department_id =", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdNotEqualTo(Integer value) { public Criteria andDepartmentIdNotEqualTo(Integer value) {
addCriterion("company_id <>", value, "companyId"); addCriterion("department_id <>", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdGreaterThan(Integer value) { public Criteria andDepartmentIdGreaterThan(Integer value) {
addCriterion("company_id >", value, "companyId"); addCriterion("department_id >", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdGreaterThanOrEqualTo(Integer value) { public Criteria andDepartmentIdGreaterThanOrEqualTo(Integer value) {
addCriterion("company_id >=", value, "companyId"); addCriterion("department_id >=", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdLessThan(Integer value) { public Criteria andDepartmentIdLessThan(Integer value) {
addCriterion("company_id <", value, "companyId"); addCriterion("department_id <", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdLessThanOrEqualTo(Integer value) { public Criteria andDepartmentIdLessThanOrEqualTo(Integer value) {
addCriterion("company_id <=", value, "companyId"); addCriterion("department_id <=", value, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdIn(List<Integer> values) { public Criteria andDepartmentIdIn(List<Integer> values) {
addCriterion("company_id in", values, "companyId"); addCriterion("department_id in", values, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdNotIn(List<Integer> values) { public Criteria andDepartmentIdNotIn(List<Integer> values) {
addCriterion("company_id not in", values, "companyId"); addCriterion("department_id not in", values, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdBetween(Integer value1, Integer value2) { public Criteria andDepartmentIdBetween(Integer value1, Integer value2) {
addCriterion("company_id between", value1, value2, "companyId"); addCriterion("department_id between", value1, value2, "departmentId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCompanyIdNotBetween(Integer value1, Integer value2) { public Criteria andDepartmentIdNotBetween(Integer value1, Integer value2) {
addCriterion("company_id not between", value1, value2, "companyId"); 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<Integer> values) {
addCriterion("position_id in", values, "positionId");
return (Criteria) this;
}
public Criteria andPositionIdNotIn(List<Integer> 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; return (Criteria) this;
} }

View File

@ -1,26 +1,24 @@
package club.joylink.rtss.services; package club.joylink.rtss.services;
import club.joylink.rtss.dao.CompanyDAO; import club.joylink.rtss.dao.*;
import club.joylink.rtss.dao.UserCompanyRelDAO;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.completition.IRaceQuestionsRuleService; import club.joylink.rtss.services.completition.IRaceQuestionsRuleService;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.CompanyQueryVO; import club.joylink.rtss.vo.client.LessonVO;
import club.joylink.rtss.vo.client.CompanyVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.company.*;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import lombok.NonNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -29,6 +27,12 @@ public class CompanyService implements ICompanyService {
@Autowired @Autowired
private CompanyDAO companyDAO; private CompanyDAO companyDAO;
@Autowired
private CompanyUserDAO companyUserDAO;
@Autowired
private CompanyDepartmentDAO departmentDAO;
@Autowired @Autowired
private IRaceQuestionsRuleService IRaceQuestionsRuleService; private IRaceQuestionsRuleService IRaceQuestionsRuleService;
@ -36,8 +40,15 @@ public class CompanyService implements ICompanyService {
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@Autowired @Autowired
private UserCompanyRelDAO userCompanyRelDAO; private DepartmentUserDAO departmentUserDAO;
@Autowired
private DepartmentLessonDAO departmentLessonDAO;
@Autowired
private DepartmentExamDAO departmentExamDAO;
@Autowired
private ILessonService lessonService;
//************************************单位管理**********************************************
@Override @Override
public List<CompanyVO> queryOrganizations() { public List<CompanyVO> queryOrganizations() {
CompanyExample example = new CompanyExample(); CompanyExample example = new CompanyExample();
@ -55,61 +66,13 @@ public class CompanyService implements ICompanyService {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName())); criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
} }
Page<Company> page = (Page<Company>) companyDAO.selectByExample(example); Page<Company> page = (Page<Company>) companyDAO.selectByExample(example);
List<CompanyVO> voList = page.getResult().stream().map(company -> { List<CompanyVO> voList =CompanyVO.convert2VOList(page.getResult());
List<SysUser> managers;
List<UserCompanyRel> ucrList = findUserCompanyRelEntity(company.getId(), true);
if (CollectionUtils.isEmpty(ucrList)) {
managers = new ArrayList<>();
} else {
List<Long> managerIds = ucrList.stream().map(UserCompanyRel::getUserId).collect(Collectors.toList());
managers = iSysUserService.findEntity(managerIds);
}
List<UserVO> managerVOs = UserVO.convert2BaseInfoVO(managers);
return CompanyVO.convertFromDB(company, managerVOs);
}).collect(Collectors.toList());
return PageVO.convert(page, voList); return PageVO.convert(page, voList);
} }
@Override @Override
public void addManager(Integer companyId, List<Long> userIds, UserVO user) { public CompanyVO userScanCodeBindCompany(Long userId, Integer companyId) {
iSysUserService.confirmAdmin(user); return iSysUserService.userScanCodeBindCompany(userId, companyId);
List<UserCompanyRel> 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<UserCompanyRel> findUserCompanyRelEntity(List<Long> 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);
} }
@Override @Override
@ -130,7 +93,6 @@ public class CompanyService implements ICompanyService {
@Transactional @Transactional
@Override @Override
public void deleteCompanyById(Integer companyId) { public void deleteCompanyById(Integer companyId) {
companyDAO.deleteByPrimaryKey(companyId); companyDAO.deleteByPrimaryKey(companyId);
IRaceQuestionsRuleService.deleteByCompanyId(companyId); IRaceQuestionsRuleService.deleteByCompanyId(companyId);
} }
@ -142,6 +104,24 @@ public class CompanyService implements ICompanyService {
String.format("id为[%s]的公司不存在", companyId)); String.format("id为[%s]的公司不存在", companyId));
return new CompanyVO(entity); return new CompanyVO(entity);
} }
//
// @Override
// public void addManager(Integer companyId, List<Long> 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<Long> 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 @Override
public boolean isExist(Integer companyId) { public boolean isExist(Integer companyId) {
@ -153,62 +133,402 @@ public class CompanyService implements ICompanyService {
private Company getCompanyEntity(Integer id) { private Company getCompanyEntity(Integer id) {
Company company = companyDAO.selectByPrimaryKey(id); Company company = companyDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(company,String.format("单位[%s]不存在",id));
return company; return company;
} }
private List<UserCompanyRel> findUserCompanyRelEntity(Integer companyId, boolean manager) { @Override
UserCompanyRelExample example = new UserCompanyRelExample(); public boolean isCompanyUser(Long userId) {
example.createCriteria().andCompanyIdEqualTo(companyId).andManagerEqualTo(manager); CompanyUserExample e = new CompanyUserExample();
return userCompanyRelDAO.selectByExample(example); e.createCriteria().andUserIdEqualTo(userId);
return companyUserDAO.countByExample(e)>0;
} }
private List<UserCompanyRel> getUserCompanyRelEntity(@NonNull List<Long> userIds) { //************************************部门管理**********************************************
UserCompanyRelExample example = new UserCompanyRelExample();
example.createCriteria().andUserIdIn(userIds); /**
List<UserCompanyRel> 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<UserCompanyRel> 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<UserCompanyRel> ucrs = userCompanyRelDAO.selectByExample(example); @Override
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(ucrs); public void deleteDepartById(Integer deptId) {
return ucrs.get(0); departmentDAO.deleteByPrimaryKey(deptId);
} }
private UserCompanyRel findUserCompanyRelEntity(Long userId) { /**
UserCompanyRelExample example = new UserCompanyRelExample(); * 查询部门信息
example.createCriteria().andUserIdEqualTo(userId); */
List<UserCompanyRel> ucrs = userCompanyRelDAO.selectByExample(example); @Override
if (CollectionUtils.isEmpty(ucrs)) { public DepartmentVO getDepartById(Integer deptId) {
CompanyDepartment entity = departmentDAO.selectByPrimaryKey(deptId);
if (Objects.isNull(entity)) {
return null; return null;
} }
return new DepartmentVO(entity);
}
/**
* 根据单位id查询部门及其子部门信息
*/
@Override
public List<DepartmentVO> getCompanyDepartTree(Integer companyId) {
CompanyDepartmentExample example = new CompanyDepartmentExample();
example.createCriteria().andCompanyIdEqualTo(companyId);
List<CompanyDepartment> companyDepartments = departmentDAO.selectByExample(example);
return DepartmentVO.buildDeptTree(DepartmentVO.convert2VOList(companyDepartments));
}
@Override
public List<DepartmentVO> getCompanyAllDepart(Integer companyId) {
CompanyDepartmentExample example = new CompanyDepartmentExample();
example.createCriteria().andCompanyIdEqualTo(companyId);
List<CompanyDepartment> 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<CompanyDepartment> companyDepartments = departmentDAO.selectByExample(example);
List<DepartmentVO> childDept = DepartmentVO.getChildDept(deptId, DepartmentVO.convert2VOList(companyDepartments));
DepartmentVO departmentVO = new DepartmentVO(companyDepartment);
departmentVO.setChildDept(childDept);
return departmentVO;
}
@Override
public List<DepartmentVO> 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<PositionVO> getPositionsByCompanyId(Integer companyId) {
// var example = new CompanyPositionExample();
// example.createCriteria()
// .andCompanyIdEqualTo(companyId);
// List<CompanyPosition> 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<DepartmentUser> ucrs = departmentUserDAO.selectByExample(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(ucrs, "非部门" + departId + "内部用户");
return ucrs.get(0); return ucrs.get(0);
} }
private void createOrUpdateUserCompanyRel(Long userId, Integer companyId) { @Override
UserVO user = iSysUserService.getUserById(userId); public List<UserDepartRelVO> getDepartRefByUserId(Long userId) {
Company company = getCompanyEntity(companyId); DepartmentUserExample e = new DepartmentUserExample();
UserCompanyRel ucr = findUserCompanyRelEntity(userId); e.createCriteria().andUserIdEqualTo(userId);
if (ucr == null) { List<DepartmentUser> departmentUserRefs = this.departmentUserDAO.selectByExample(e);
UserCompanyRel newUcr = new UserCompanyRel(); return UserDepartRelVO.convert2VOList(departmentUserRefs);
newUcr.setUserId(user.getId()); }
newUcr.setCompanyId(company.getId()); /**添加部门-职位-用户关系*/
newUcr.setCreateTime(LocalDateTime.now()); @Override
userCompanyRelDAO.insert(newUcr); public void addDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO) {
} else { var userRel = getDepartUseRelEntity(user.getId(), userDepartRelVO.getDepartmentId());
ucr.setCompanyId(companyId); BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(userRel, "非本部门无法操作");
userCompanyRelDAO.updateByPrimaryKey(ucr); 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<CompanyDepartUserVO> getUserCompanyDeparts(UserVO user, Integer companyId) {
//根据公司id和用户id查询用户企业详细信息
return departmentUserDAO.getUserCompanyDeparts(companyId,user.getId());
}
@Override
public PageVO<CompanyDepartUserVO> getCompanyDepartUserInfoList(UserVO user, Integer departId, CompanyUserQueryVO companyUserQueryVO) {
//根据部门id查询部门成员
companyUserQueryVO.setDepartmentId(departId);
PageHelper.startPage(companyUserQueryVO.getPageNum(), companyUserQueryVO.getPageSize());
Page<CompanyDepartUserVO> page = (Page<CompanyDepartUserVO>) 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<CompanyDepartment> 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<CompanyDepartment> 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<DepartmentUser> departmentUsers = departmentUserDAO.selectByExample(departmentUserExample);
BusinessExceptionAssertEnum.INVALID_OPERATION.assertCollectionEmpty(departmentUsers, "非部门成员/导入部门信息重复");
BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(departmentUsers.get(0).getManager(), "非部门管理员");
}
}
//构建系统用户对象
List<SysUser> 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<DepartmentUser> 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<DepartmentVO> getDepartsByLesson(Long lessonId) {
List<CompanyDepartment> classes = this.departmentLessonDAO.getDeparts(lessonId);
return DepartmentVO.convert2VOList(classes);
}
@Override
public List<DepartmentVO> getDepartsByExamId(Long examId) {
DepartmentExamExample example = new DepartmentExamExample();
example.createCriteria().andExamIdEqualTo(examId);
List<CompanyDepartment> classes = this.departmentExamDAO.getDepartsByExamId(examId);
return DepartmentVO.convert2VOList(classes);
}
@Override
public List<Long> getExamIdsByDepartId(Integer departId) {
DepartmentExamExample example = new DepartmentExamExample();
example.createCriteria().andDepartmentIdEqualTo(departId);
List<DepartmentExam> 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<DepartmentLesson> getDepartLessonRefs(Integer departId) {
DepartmentLessonExample example = new DepartmentLessonExample();
example.createCriteria().andDepartmentIdEqualTo(departId);
List<DepartmentLesson> departmentLessonRef = this.departmentLessonDAO.selectByExample(example);
return departmentLessonRef;
}
@Override
public List<LessonVO> getLessonsByDepart(Integer departId) {
List<Long> 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<String> getDepartNamesByLesson(Long LessonId) {
List<String> classes = this.departmentLessonDAO.getClassNames(LessonId);
return classes;
}
} }

View File

@ -207,8 +207,7 @@ public class DraftMapService implements IDraftMapService {
// 插入新副本 // 插入新副本
draftMapDAO.insert(draftMap); draftMapDAO.insert(draftMap);
if (draftMap.getDrawWay()) { if (draftMap.getDrawWay()) {
saveMapLogicDataNew(draftMap, getMapLogicDataNew(id));
saveMapLogicDataNew(draftMap.getId(), getMapLogicDataNew(id));
} else { } else {
saveMapLogicData(draftMap.getId(), getMapLogicData(id)); saveMapLogicData(draftMap.getId(), getMapLogicData(id));
@ -385,7 +384,7 @@ public class DraftMapService implements IDraftMapService {
iRealLineService.create(skinVO, userVO); iRealLineService.create(skinVO, userVO);
} }
if (mapVO.isDrawWay()) { if (mapVO.isDrawWay()) {
saveMapLogicDataNew(draftMap.getId(), mapVO.getLogicDataNew()); saveMapLogicDataNew(draftMap, mapVO.getLogicDataNew());
} else { } else {
saveMapLogicData(draftMap.getId(), mapVO.getLogicData()); 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)) { if (Objects.isNull(logicDataVO)) {
return; return;
} }
@ -989,7 +989,8 @@ public class DraftMapService implements IDraftMapService {
}); });
} }
if (!CollectionUtils.isEmpty(logicDataVO.getDestinationCodeDefinitionList())) { if (!CollectionUtils.isEmpty(logicDataVO.getDestinationCodeDefinitionList())) {
draftMap.setLogicData(JsonUtils.writeValueAsString(logicDataVO.getDestinationCodeDefinitionList()));
draftMapDAO.updateByPrimaryKeyWithBLOBs(draftMap);
} }
if (!CollectionUtils.isEmpty(logicDataVO.getRoutingList())) { if (!CollectionUtils.isEmpty(logicDataVO.getRoutingList())) {
logicDataVO.getRoutingList().forEach(routingVO -> { logicDataVO.getRoutingList().forEach(routingVO -> {

View File

@ -4,10 +4,12 @@ import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.*; import club.joylink.rtss.dao.*;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; 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.UserVO;
import club.joylink.rtss.vo.client.*; 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 club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -54,7 +56,13 @@ public class ExamService implements IExamService{
private ExamDefinitionRulesDAO examDefinitionRulesDAO; private ExamDefinitionRulesDAO examDefinitionRulesDAO;
@Autowired @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)); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO));
//检查考试名称和考试规则是否唯一 //检查考试名称和考试规则是否唯一
checkExam(examDefinitionVO); checkName(examDefinitionVO);
//插入考试定义表数据 //插入考试定义表数据
ExamDefinition examDefinition = examDefinitionVO.toDB(); ExamDefinition examDefinition = examDefinitionVO.toDB();
examDefinition.setCreateTime(LocalDateTime.now()); examDefinition.setCreateTime(LocalDateTime.now());
@ -77,7 +85,10 @@ public class ExamService implements IExamService{
examDefinition.setTrial(false); examDefinition.setTrial(false);
} }
examDefinitionDAO.insert(examDefinition); examDefinitionDAO.insert(examDefinition);
//插入试卷班级关系
if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) {
examDefinitionVO.getClasses().forEach(departmentVO -> iCompanyService.addDepartExam(examDefinition.getId(),departmentVO.getId()));
}
//插入试题规则表数据 //插入试题规则表数据
List<ExamDefinitionRulesVO> examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList(); List<ExamDefinitionRulesVO> examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList();
examDefinitionRulesVOList.forEach(examDefinitionRulesVO -> { examDefinitionRulesVOList.forEach(examDefinitionRulesVO -> {
@ -133,41 +144,41 @@ public class ExamService implements IExamService{
} }
} }
/** // /**
* GZB创建考试定义 // * GZB创建考试定义
*/ // */
@Transactional // @Transactional
@Override // @Override
public void createGZBExam(ExamDefinitionVO examDefinitionVO, UserVO userVO) { // public void createGZBExam(ExamDefinitionVO examDefinitionVO, UserVO userVO) {
examDefinitionVO.setCreatorId(userVO.getId()); // examDefinitionVO.setCreatorId(userVO.getId());
//
//检查分数是否合理 // //检查分数是否合理
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO)); // BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO));
//检查考试名称和考试规则是否唯一 // //检查考试名称和考试规则是否唯一
checkName(examDefinitionVO); // checkName(examDefinitionVO);
//插入考试定义表数据 // //插入考试定义表数据
ExamDefinition examDefinition = examDefinitionVO.toDB(); // ExamDefinition examDefinition = examDefinitionVO.toDB();
examDefinition.setCreateTime(LocalDateTime.now()); // examDefinition.setCreateTime(LocalDateTime.now());
examDefinition.setStatus(BusinessConsts.STATUS_USE); // examDefinition.setStatus(BusinessConsts.STATUS_USE);
// 判断是否是管理员并设置试用 // // 判断是否是管理员并设置试用
if(this.iSysUserService.isAdmin(userVO) && examDefinitionVO.getTrial()) { // if(this.iSysUserService.isAdmin(userVO) && examDefinitionVO.getTrial()) {
examDefinition.setTrial(true); // examDefinition.setTrial(true);
}else { // }else {
examDefinition.setTrial(false); // examDefinition.setTrial(false);
} // }
examDefinitionDAO.insert(examDefinition); // examDefinitionDAO.insert(examDefinition);
//插入试卷班级关系 // //插入试卷班级关系
if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) { // if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) {
examDefinitionVO.getClasses().forEach(studentClassVO -> iClassStudentUserService.addExamRelClass(examDefinition.getId(),studentClassVO.getId())); // examDefinitionVO.getClasses().forEach(departmentVO -> iCompanyService.addDepartExam(examDefinition.getId(),departmentVO.getId()));
} // }
//插入试题规则表数据 // //插入试题规则表数据
List<ExamDefinitionRulesVO> examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList(); // List<ExamDefinitionRulesVO> examDefinitionRulesVOList = examDefinitionVO.getExamDefinitionRulesVOList();
examDefinitionRulesVOList.forEach(examDefinitionRulesVO -> { // examDefinitionRulesVOList.forEach(examDefinitionRulesVO -> {
ExamDefinitionRules examDefinitionRules = examDefinitionRulesVO.toDB(); // ExamDefinitionRules examDefinitionRules = examDefinitionRulesVO.toDB();
examDefinitionRules.setExamId(examDefinition.getId()); // examDefinitionRules.setExamId(examDefinition.getId());
definitionRulesDAO.insert(examDefinitionRules); // definitionRulesDAO.insert(examDefinitionRules);
}); // });
} // }
private void checkName(ExamDefinitionVO examDefinitionVO) { private void checkName(ExamDefinitionVO examDefinitionVO) {
//一个课程下考试名称查重 //一个课程下考试名称查重
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
@ -266,7 +277,7 @@ public class ExamService implements IExamService{
examDefinitionRulesVOList.add(examDefinitionRulesVO); examDefinitionRulesVOList.add(examDefinitionRulesVO);
}); });
ExamDefinitionVO examDefinitionVO = new ExamDefinitionVO(examDefinition); ExamDefinitionVO examDefinitionVO = new ExamDefinitionVO(examDefinition);
examDefinitionVO.setClasses(iClassStudentUserService.getClassesByExamId(examId)); examDefinitionVO.setClasses(iCompanyService.getDepartsByExamId(examId));
examDefinitionVO.setExamDefinitionRulesVOList(examDefinitionRulesVOList); examDefinitionVO.setExamDefinitionRulesVOList(examDefinitionRulesVOList);
return examDefinitionVO; return examDefinitionVO;
@ -280,12 +291,18 @@ public class ExamService implements IExamService{
//查询课程信息 //查询课程信息
LessonVO lessonVO = iLessonService.getLessonInfo(lessonId); 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<StudentRelIdClass> studentRelIdClasses = this.iClassStudentUserService.getRelClassByUser(userVO.getId()); List<UserDepartRelVO> userDepartRelVOS = this.iCompanyService.getDepartRefByUserId(userVO.getId());
List<Long> examIds = null; List<Long> examIds =null;
if (!CollectionUtils.isEmpty(studentRelIdClasses)) { if (!CollectionUtils.isEmpty(userDepartRelVOS)) {
Integer classId = studentRelIdClasses.get(0).getClassId(); examIds = new ArrayList<>();
examIds = iClassStudentUserService.getRelExamIdsByClassId(classId); for (UserDepartRelVO udr : userDepartRelVOS) {
examIds.addAll(iCompanyService.getExamIdsByDepartId(udr.getDepartmentId()));
}
} }
//查询课程下的试题信息 //查询课程下的试题信息
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
@ -299,7 +316,7 @@ public class ExamService implements IExamService{
if (null != exam.getEndTime() && now.isAfter(exam.getEndTime())) { if (null != exam.getEndTime() && now.isAfter(exam.getEndTime())) {
this.offLine(exam.getId(), userVO); this.offLine(exam.getId(), userVO);
iterator.remove(); 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(); iterator.remove();
} }
} }
@ -309,18 +326,18 @@ public class ExamService implements IExamService{
examDefinitionList.forEach(examDefinition -> { examDefinitionList.forEach(examDefinition -> {
ExamDefinitionVO exam = new ExamDefinitionVO(examDefinition); ExamDefinitionVO exam = new ExamDefinitionVO(examDefinition);
// 试卷存在班级关系获取班级列表 // 试卷存在班级关系获取班级列表
List<StudentClassVO> classes = iClassStudentUserService.getClassesByExamId(examDefinition.getId()); List<DepartmentVO> departs = iCompanyService.getDepartsByExamId(examDefinition.getId());
if (!CollectionUtils.isEmpty(classes)) { if (!CollectionUtils.isEmpty(departs)) {
exam.setClasses(classes); exam.setClasses(departs);
} }
examDefinitionVOList.add(exam); examDefinitionVOList.add(exam);
}); });
examsLessonVO.setExamDefinitionList(examDefinitionVOList); examsLessonVO.setExamDefinitionList(examDefinitionVOList);
// 设置权限 // 设置权限
// List<UserPermissionVO> voList = userPermissionService.findTeachVOByMapIdAndUserId(lessonVO.getMapId(), userVO.getId()); examsLessonVO.setAvailable(groupSimulationService.hasPermission(userVO, lessonVO.getMapId(), lessonVO.getPrdType()));
List<UserPermissionVO> examPermissions = this.iUserPermissionService.getExamUserPermission(userVO, // List<UserPermissionVO> examPermissions = this.iUserPermissionService.getExamUserPermission(userVO,
lessonVO.getMapId(), lessonVO.getPrdType(), lessonId); // lessonVO.getMapId(), lessonVO.getPrdType(), lessonId);
examsLessonVO.setPermissionList(examPermissions); // examsLessonVO.setPermissionList(examPermissions);
return examsLessonVO; return examsLessonVO;
} }
@ -397,7 +414,7 @@ public class ExamService implements IExamService{
//判断是否已有用户参与考试如果有不能删除考试定义 //判断是否已有用户参与考试如果有不能删除考试定义
UserExamExample userExamExample = new UserExamExample(); UserExamExample userExamExample = new UserExamExample();
userExamExample.createCriteria().andExamIdEqualTo(Long.parseLong(id)); 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)); String.format("试卷[%s]已被使用", id));
//删除考试信息和规则信息 //删除考试信息和规则信息
@ -476,9 +493,11 @@ public class ExamService implements IExamService{
public void update(Long id, ExamDefinitionVO examDefinitionVO) { public void update(Long id, ExamDefinitionVO examDefinitionVO) {
ExamDefinition examDefinition = this.examDefinitionDAO.selectByPrimaryKey(id); ExamDefinition examDefinition = this.examDefinitionDAO.selectByPrimaryKey(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(examDefinition); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(examDefinition);
iClassStudentUserService.getClassesByExamId(id).forEach(studentClassVO -> iClassStudentUserService.deleteExamRelClass(id)); if (!CollectionUtils.isEmpty(iCompanyService.getDepartsByExamId(id))) {
if(!CollectionUtils.isEmpty(examDefinitionVO.getClasses())){ iCompanyService.deleteDepartsExam(id);
examDefinitionVO.getClasses().forEach(studentClassVO -> iClassStudentUserService.addExamRelClass(id, studentClassVO.getId())); }
if (!CollectionUtils.isEmpty(examDefinitionVO.getClasses())) {
examDefinitionVO.getClasses().forEach(departmentVO -> iCompanyService.addDepartExam(id, departmentVO.getId()));
} }
//考试名称查重 //考试名称查重
String name = examDefinitionVO.getName(); String name = examDefinitionVO.getName();
@ -488,6 +507,8 @@ public class ExamService implements IExamService{
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertCollectionEmpty(examDefinitionList); BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertCollectionEmpty(examDefinitionList);
examDefinition.setName(examDefinitionVO.getName()); examDefinition.setName(examDefinitionVO.getName());
examDefinition.setTrial(examDefinitionVO.getTrial()); examDefinition.setTrial(examDefinitionVO.getTrial());
examDefinition.setStartTime(examDefinitionVO.getStartTime());
examDefinition.setEndTime(examDefinitionVO.getEndTime());
this.examDefinitionDAO.updateByPrimaryKey(examDefinition); this.examDefinitionDAO.updateByPrimaryKey(examDefinition);
} }

View File

@ -1,10 +1,10 @@
package club.joylink.rtss.services; 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.UserVO;
import club.joylink.rtss.vo.client.CompanyQueryVO; import club.joylink.rtss.vo.client.LessonVO;
import club.joylink.rtss.vo.client.CompanyVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.company.*;
import java.util.List; import java.util.List;
@ -20,32 +20,93 @@ public interface ICompanyService {
CompanyVO getCompanyById(Integer companyId); CompanyVO getCompanyById(Integer companyId);
// void removeManager(Integer companyId, List<Long> userIds, UserVO user);
boolean isExist(Integer companyId); boolean isExist(Integer companyId);
PageVO<CompanyVO> queryPageOrganizations(CompanyQueryVO queryVO); PageVO<CompanyVO> queryPageOrganizations(CompanyQueryVO queryVO);
//
/** // /**
* 添加公司管理员 // * 添加公司管理员
*/ // */
void addManager(Integer companyId, List<Long> userIds, UserVO user); // void addManager(Integer companyId, List<Long> userIds, UserVO user);
/** /**
* 用户绑定单位 * 用户绑定单位
*/ */
void userBindCompany(Long userId, Integer companyId); CompanyVO userScanCodeBindCompany(Long userId, Integer companyId);
/** // /**
* 查询用户公司关联关系 // * 查询用户公司关联关系
*/ // */
List<UserCompanyRel> findUserCompanyRelEntity(List<Long> collect); // List<UserCompanyRel> findUserCompanyRelEntity(List<Long> collect);
//
// /**
// * 超管修改用户的单位
// */
// void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin);
//
// /**
// * 删除用户和公司的关联关系
// */
// void deleteUserCompanyRel(Long userId);
/** boolean isCompanyUser(Long userId);
* 超管修改用户的单位
*/
void superAdminUpdateUserCompanyRel(Long userId, Integer companyId, UserVO superAdmin);
/** DepartmentVO createDepart(DepartmentVO departmentVO);
* 删除用户和公司的关联关系
*/ void updateDepartInfo(Integer id, DepartmentVO departmentVO);
void deleteUserCompanyRel(Long userId);
void deleteDepartById(Integer deptId);
DepartmentVO getDepartById(Integer deptId);
List<DepartmentVO> getCompanyDepartTree(Integer companyId);
List<DepartmentVO> getCompanyAllDepart(Integer companyId);
DepartmentVO getDepartTree(Integer companyId, Integer deptId);
List<DepartmentVO> getDepartAndChild(Integer companyId, Integer deptId);
// PositionVO createPosition(PositionVO positionVO);
//
// void updatePositionInfo(Integer positionId, PositionVO positionVO);
//
// void deletePositionById(Integer positionId);
//
// PositionVO getPositionById(Integer positionId);
//
// List<PositionVO> getPositionsByCompanyId(Integer companyId);
List<UserDepartRelVO> getDepartRefByUserId(Long userId);
void addDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO);
void updateDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO);
void deleteDepartUserInfo(UserVO user, UserDepartRelVO userDepartRelVO);
List<CompanyDepartUserVO> getUserCompanyDeparts(UserVO user, Integer companyId);
PageVO<CompanyDepartUserVO> getCompanyDepartUserInfoList(UserVO user, Integer companyId, CompanyUserQueryVO companyUserQueryVO);
void importCompanyUserInfo(UserVO user, Integer companyId, ImportCompanyUserVO importCompanyUserVO);
List<DepartmentVO> getDepartsByLesson(Long lessonId);
List<DepartmentVO> getDepartsByExamId(Long examId);
List<Long> getExamIdsByDepartId(Integer departId);
void deleteDepartsExam(Long examId);
void addDepartExam(Long examId, Integer departId);
List<DepartmentLesson> getDepartLessonRefs(Integer departId);
List<LessonVO> getLessonsByDepart(Integer departId);
List<String> getDepartNamesByLesson(Long LessonId);
} }

View File

@ -16,7 +16,7 @@ public interface IExamService {
*/ */
void create(ExamDefinitionVO examDefinitionVO, UserVO userVO); void create(ExamDefinitionVO examDefinitionVO, UserVO userVO);
void createGZBExam(ExamDefinitionVO examDefinitionVO, UserVO userVO); // void createGZBExam(ExamDefinitionVO examDefinitionVO, UserVO userVO);
/** /**
* 检查分数定义是否合理 * 检查分数定义是否合理

View File

@ -149,7 +149,7 @@ public interface ILessonService {
/** /**
* 获取有效的课程 * 获取有效的课程
*/ */
List<LessonVO> getValidLesson(List<Long> ids, String prdType); List<LessonVO> getValidLesson(Long mapId,List<Long> ids, String prdType);
/** /**
* 删除并添加章节-实训关联关系 * 删除并添加章节-实训关联关系

View File

@ -5,13 +5,18 @@ import club.joylink.rtss.vo.UserQueryVO;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.UserConfigVO; 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.client.user.*;
import club.joylink.rtss.vo.wx.WmUserSession; import club.joylink.rtss.vo.wx.WmUserSession;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
public interface ISysUserService { public interface ISysUserService {
UserVO queryCompanyUserByAccount(Integer companyId, String account);
/** /**
* 根据openId查询用户 * 根据openId查询用户
* @param openid * @param openid
@ -139,6 +144,11 @@ public interface ISysUserService {
*/ */
UserVO createUserOfWechatMicro(WmUserSession wmUserSession); UserVO createUserOfWechatMicro(WmUserSession wmUserSession);
@Transactional
void batchCreateUser(List<SysUser> newSysUsers);
void createUser(SysUser sysUser);
/** /**
* 更新用户微信小程序openid * 更新用户微信小程序openid
* @param id * @param id
@ -273,7 +283,7 @@ public interface ISysUserService {
*/ */
void userBindWm(String code, Long userId); void userBindWm(String code, Long userId);
void userBindCompany(Long userId, Integer companyId); CompanyVO userScanCodeBindCompany(Long userId, Integer companyId);
UserVO getUserBaseInfoById(Long id); UserVO getUserBaseInfoById(Long id);
@ -292,8 +302,12 @@ public interface ISysUserService {
void superAdminUpdateUserInfo(UserVO updateUser, UserVO superAdmin); void superAdminUpdateUserInfo(UserVO updateUser, UserVO superAdmin);
void userBindCompany(UserVO userVO, Integer companyId,boolean companyAdmin);
/** /**
* 查询所有的销售人员 * 查询所有的销售人员
*/ */
List<UserVO> querySellers(); List<UserVO> querySellers();
void deleteById(Long id);
} }

View File

@ -1,12 +1,14 @@
package club.joylink.rtss.services; package club.joylink.rtss.services;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.constants.MapStatus; import club.joylink.rtss.constants.MapStatus;
import club.joylink.rtss.dao.*; import club.joylink.rtss.dao.*;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.entity.LsLessonExample.Criteria; import club.joylink.rtss.entity.LsLessonExample.Criteria;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.training.ITrainingV1Service; import club.joylink.rtss.services.training.ITrainingV1Service;
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.util.VersionUtil; import club.joylink.rtss.util.VersionUtil;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.*; import club.joylink.rtss.vo.client.*;
@ -24,6 +26,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotEmpty;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
@ -70,10 +73,13 @@ public class LessonService implements ILessonService {
private ITrainingV1Service iTrainingV1Service; private ITrainingV1Service iTrainingV1Service;
@Autowired @Autowired
private StudentRelLessonClassDAO studentRelLessonClassDAO; private IExamService iExamService;
@Autowired @Autowired
private IExamService iExamService; private DepartmentLessonDAO departmentLessonDAO;
@Autowired
private GroupSimulationService groupSimulationService;
@Override @Override
public LessonTreeVO getLessonTree(Long id, UserVO userVO) { public LessonTreeVO getLessonTree(Long id, UserVO userVO) {
@ -104,13 +110,10 @@ public class LessonService implements ILessonService {
trainingVOList = iTrainingV1Service.queryByIds(trainingIds); trainingVOList = iTrainingV1Service.queryByIds(trainingIds);
} }
// 查询权限 // 查询权限
// List<UserPermissionVO> voList = userPermissionService.findTeachVOByMapIdAndUserId(lessonVO.getMapId(), userVO.getId()); boolean valid = groupSimulationService.hasPermission(userVO, lessonVO.getMapId(), lessonVO.getPrdType());
List<UserPermissionVO> permissionVOList = iUserPermissionService.getLessonUserPermission(userVO,
lessonVO.getMapId(), lessonVO.getPrdType(), lessonVO.getId());
boolean valid = !CollectionUtils.isEmpty(permissionVOList);
// 生成tree // 生成tree
lessonTreeVO.setTree(TreeNode.buildValidLessonTrainingTree(lessonVO, chapterVOList, trainingVOList, relVOList, valid)); lessonTreeVO.setTree(TreeNode.buildValidLessonTrainingTree(lessonVO, chapterVOList, trainingVOList, relVOList, valid));
lessonTreeVO.setPermissionList(permissionVOList); // lessonTreeVO.setPermissionList(permissionVOList);
return lessonTreeVO; return lessonTreeVO;
} }
@ -207,30 +210,34 @@ public class LessonService implements ILessonService {
// // 自动创建商品 // // 自动创建商品
// iGoodsService.autoCreateTeachAndExamGoods(newLesson); // iGoodsService.autoCreateTeachAndExamGoods(newLesson);
} else { } 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()); newLesson.setId(publishedLesson.getId());
this.lessonDAO.updateByPrimaryKey(newLesson); this.lessonDAO.updateByPrimaryKey(newLesson);
//课程存在,预备检查与班级的关系 //课程存在,预备检查与班级的关系
StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample(); DepartmentLessonExample departmentLessonExample = new DepartmentLessonExample();
relLessonClassExample.createCriteria().andLessonIdEqualTo(publishedLesson.getId()); departmentLessonExample.createCriteria().andLessonIdEqualTo(publishedLesson.getId());
List<StudentRelLessonClass> studentRelLessonClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample); List<DepartmentLesson> departmentLessonRefs = this.departmentLessonDAO.selectByExample(departmentLessonExample);
if (!CollectionUtils.isEmpty(publishVO.getClassIdList())) { if (!CollectionUtils.isEmpty(publishVO.getClassIdList())) {
//目前GZB项目带班级发布 if (!CollectionUtils.isEmpty(departmentLessonRefs)) {
if (!CollectionUtils.isEmpty(studentRelLessonClasses)) { List<Integer> existedClassIds = departmentLessonRefs.stream().map(DepartmentLesson::getDepartmentId).collect(Collectors.toList());
List<Integer> existedClassIds = studentRelLessonClasses.stream().map(StudentRelLessonClass::getClassId).collect(Collectors.toList());
Collections.sort(existedClassIds); Collections.sort(existedClassIds);
Collections.sort(publishVO.getClassIdList()); Collections.sort(publishVO.getClassIdList());
if (!existedClassIds.equals(publishVO.getClassIdList())) { if (!existedClassIds.equals(publishVO.getClassIdList())) {
//清除现有课程班级关系 //清除现有课程班级关系
this.studentRelLessonClassDAO.deleteByExample(relLessonClassExample); this.departmentLessonDAO.deleteByExample(departmentLessonExample);
addRelLessonClass(publishVO, publishedLesson.getId()); addRelLessonClass(publishVO, publishedLesson.getId());
} }
} else { } else {
addRelLessonClass(publishVO, publishedLesson.getId()); addRelLessonClass(publishVO, publishedLesson.getId());
} }
} else { } else {
if (!CollectionUtils.isEmpty(studentRelLessonClasses)) { if (!CollectionUtils.isEmpty(departmentLessonRefs)) {
this.studentRelLessonClassDAO.deleteByExample(relLessonClassExample); this.departmentLessonDAO.deleteByExample(departmentLessonExample);
} }
} }
// if(!lessonVo.getName().equals(publishedLesson.getName())) { // if(!lessonVo.getName().equals(publishedLesson.getName())) {
@ -518,7 +525,7 @@ public class LessonService implements ILessonService {
@Transactional @Transactional
@Override @Override
public void generateLessonAndExam(List<Long> mapIds, UserVO userVO) { public void generateLessonAndExam(List<Long> mapIds, UserVO userVO) {
if (CollectionUtils.isEmpty(mapIds)) return; BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotTrue(CollectionUtils.isEmpty(mapIds),"请选择地图后生成");
mapIds.parallelStream().forEach(mapId -> { mapIds.parallelStream().forEach(mapId -> {
MapVO mapVO = iMapService.findMapBaseInfoById(mapId); MapVO mapVO = iMapService.findMapBaseInfoById(mapId);
if (Objects.isNull(mapVO)) return; if (Objects.isNull(mapVO)) return;
@ -533,8 +540,8 @@ public class LessonService implements ILessonService {
} }
@Override @Override
public List<LessonVO> getValidLesson(@NonNull List<Long> ids, String prdType) { public List<LessonVO> getValidLesson(Long mapId, @NotEmpty List<Long> ids, String prdType) {
return lessonDAO.getValidLesson(ids, prdType); return lessonDAO.getValidLesson(mapId,ids, prdType);
} }
@Override @Override
@ -778,10 +785,10 @@ public class LessonService implements ILessonService {
*/ */
private void addRelLessonClass(LessonPublishVO publishVO, Long id) { private void addRelLessonClass(LessonPublishVO publishVO, Long id) {
publishVO.getClassIdList().forEach(classId -> { publishVO.getClassIdList().forEach(classId -> {
StudentRelLessonClass relLessonClass = new StudentRelLessonClass(); DepartmentLesson departmentLesson = new DepartmentLesson();
relLessonClass.setClassId(classId); departmentLesson.setDepartmentId(classId);
relLessonClass.setLessonId(id); departmentLesson.setLessonId(id);
this.studentRelLessonClassDAO.insert(relLessonClass); this.departmentLessonDAO.insert(departmentLesson);
}); });
} }

View File

@ -2,17 +2,16 @@ package club.joylink.rtss.services;
import club.joylink.rtss.constants.*; import club.joylink.rtss.constants.*;
import club.joylink.rtss.dao.MapSystemDAO; import club.joylink.rtss.dao.MapSystemDAO;
import club.joylink.rtss.entity.DepartmentLesson;
import club.joylink.rtss.entity.MapSystem; import club.joylink.rtss.entity.MapSystem;
import club.joylink.rtss.entity.MapSystemExample; 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.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.student.IClassStudentUserService;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.LessonVO; import club.joylink.rtss.vo.client.LessonVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.TreeNode; 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.map.MapVO;
import club.joylink.rtss.vo.client.runplan.RunPlanVO; import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.client.sub.MapSystemDetailVO; import club.joylink.rtss.vo.client.sub.MapSystemDetailVO;
@ -56,7 +55,7 @@ public class MapSystemService implements IMapSystemService {
private ISysUserService iSysUserService; private ISysUserService iSysUserService;
@Autowired @Autowired
private IClassStudentUserService iClassStudentUserService; private ICompanyService iCompanyService;
@Override @Override
@Transactional @Transactional
@ -206,8 +205,9 @@ public class MapSystemService implements IMapSystemService {
public MapSystemDetailVO getMapSystemDetail(Long id, LoginUserInfoVO loginInfo) { public MapSystemDetailVO getMapSystemDetail(Long id, LoginUserInfoVO loginInfo) {
UserVO userVO = loginInfo.getUserVO(); UserVO userVO = loginInfo.getUserVO();
MapSystem mapSystem = getEntity(id); MapSystem mapSystem = getEntity(id);
MapVO mapVO = iMapService.findMapBaseInfoById(mapSystem.getMapId());
MapSystemDetailVO mapSystemDetailVO = new MapSystemDetailVO(mapSystem); MapSystemDetailVO mapSystemDetailVO = new MapSystemDetailVO(mapSystem);
mapSystemDetailVO.setCityCode(mapVO.getCityCode());
if (MapSystemType.Simulation.name().equals(mapSystem.getType())) { if (MapSystemType.Simulation.name().equals(mapSystem.getType())) {
List<UserPermissionVO> permissionVOList = iUserPermissionService.getSimulationUserPermission(userVO, List<UserPermissionVO> permissionVOList = iUserPermissionService.getSimulationUserPermission(userVO,
mapSystem.getMapId(), mapSystem.getPrdType()); mapSystem.getMapId(), mapSystem.getPrdType());
@ -217,36 +217,42 @@ public class MapSystemService implements IMapSystemService {
|| MapSystemType.Exam.name().equals(mapSystem.getType())) { || MapSystemType.Exam.name().equals(mapSystem.getType())) {
List<LessonVO> lessonVOList = new ArrayList<>(); List<LessonVO> lessonVOList = new ArrayList<>();
//用户存在班级关系时根据班级课程关系查询课程目前仅GZB使用 //用户存在部门关系时根据部门课程关系查询课程
List<StudentRelIdClass> studentRelIdClasses = this.iClassStudentUserService.getRelClassByUser(userVO.getId()); if(iCompanyService.isCompanyUser(userVO.getId())){
if(loginInfo.getProject().equals(Project.GZB) && !CollectionUtils.isEmpty(studentRelIdClasses)){ List<UserDepartRelVO> userDepartRelVOS = this.iCompanyService.getDepartRefByUserId(userVO.getId());
Integer classId = studentRelIdClasses.get(0).getClassId();//学生只关联一个班 if(!CollectionUtils.isEmpty(userDepartRelVOS)){
List<StudentRelLessonClass> relLessonsByClass = this.iClassStudentUserService.getRelLessonsByClass(classId); List<DepartmentLesson> departLessonRefs = userDepartRelVOS.stream()
if(!CollectionUtils.isEmpty(relLessonsByClass)){ .flatMap(userDepartRelVO -> this.iCompanyService.getDepartLessonRefs(userDepartRelVO.getDepartmentId()).stream()).collect(Collectors.toList());
lessonVOList = iLessonService.getValidLesson(relLessonsByClass.stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()), mapSystem.getPrdType()); if(!CollectionUtils.isEmpty(departLessonRefs)){
} lessonVOList = iLessonService.getValidLesson( mapSystem.getMapId(),departLessonRefs.stream().map(DepartmentLesson::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);
}
} }
} }
}else{ } else{
lessonVOList = iLessonService.getByMapIdAndPrdType(mapSystem.getMapId(), mapSystem.getPrdType()); 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)) { if (CollectionUtils.isEmpty(lessonVOList)) {
return null; return mapSystemDetailVO;
} }
//查询课程关联的班级列表 //查询课程关联的班级列表
lessonVOList.forEach(lessonVO -> { lessonVOList.forEach(lessonVO -> {
List<String> classNames = this.iClassStudentUserService.getRelclassByLessonId(lessonVO.getId()); List<String> classNames = this.iCompanyService.getDepartNamesByLesson(lessonVO.getId());
if(!CollectionUtils.isEmpty(classNames)){ if(!CollectionUtils.isEmpty(classNames)){
lessonVO.setClassNames(classNames); lessonVO.setClassNames(classNames);
} }

View File

@ -15,6 +15,7 @@ import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.VdCode; import club.joylink.rtss.vo.VdCode;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.UserConfigVO; 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.map.MapVO;
import club.joylink.rtss.vo.client.user.*; import club.joylink.rtss.vo.client.user.*;
import club.joylink.rtss.vo.wx.WmUserSession; import club.joylink.rtss.vo.wx.WmUserSession;
@ -84,7 +85,11 @@ public class SysUserService implements ISysUserService {
private CompanyDAO companyDAO; private CompanyDAO companyDAO;
@Autowired @Autowired
private ICompanyService iCompanyService; private CompanyUserDAO companyUserDAO;
@Autowired
private DepartmentUserDAO departmentUserDAO;
@Override @Override
public UserVO findUserByAccountAndPassword(String account, String password) { public UserVO findUserByAccountAndPassword(String account, String password) {
@ -94,7 +99,9 @@ public class SysUserService implements ISysUserService {
example.or().andEmailEqualTo(account).andPasswordEqualTo(password); // 邮箱 example.or().andEmailEqualTo(account).andPasswordEqualTo(password); // 邮箱
List<SysUser> users = this.sysUserDAO.selectByExample(example); List<SysUser> users = this.sysUserDAO.selectByExample(example);
if(!CollectionUtils.isEmpty(users)) { if(!CollectionUtils.isEmpty(users)) {
return new UserVO(users.get(0)); UserVO userVO = sysUserDAO.queryUserWithCompany(users.get(0).getId());
userVO.setRolesByString();
return userVO;
} }
return null; return null;
} }
@ -109,6 +116,12 @@ public class SysUserService implements ISysUserService {
return UserVO.convertFromDB(list); return UserVO.convertFromDB(list);
} }
@Override
public UserVO queryCompanyUserByAccount(Integer companyId, String account) {
return this.sysUserDAO.queryCompanyUserByAccount(account, companyId);
}
@Override @Override
public UserVO getUserByWxOpenId(String openid) { public UserVO getUserByWxOpenId(String openid) {
SysUserExample example = new SysUserExample(); SysUserExample example = new SysUserExample();
@ -217,7 +230,7 @@ public class SysUserService implements ISysUserService {
@Override @Override
public PageVO<UserVO> queryPagedUser(UserQueryVO queryVO) { public PageVO<UserVO> queryPagedUser(UserQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize()); PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
Page<UserVO> page = (Page<UserVO>) sysUserDAO.pagedQueryWithCompany(queryVO); Page<UserVO> page = (Page<UserVO>) sysUserDAO.queryUsersWithCompany(queryVO);
page.getResult().forEach(UserVO::forClient); page.getResult().forEach(UserVO::forClient);
return PageVO.convert(page); return PageVO.convert(page);
// SysUserExample example = new SysUserExample(); // SysUserExample example = new SysUserExample();
@ -334,24 +347,27 @@ public class SysUserService implements ISysUserService {
@Override @Override
@Transactional @Transactional
public void userBindCompany(Long userId, Integer companyId) { public CompanyVO userScanCodeBindCompany(Long userId, Integer companyId) {
iCompanyService.userBindCompany(userId, 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 @Override
public UserVO getUserBaseInfoById(Long id) { public UserVO getUserBaseInfoById(Long id) {
SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(id); UserVO userVO = this.sysUserDAO.queryUserWithCompany(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sysUser, "不存在的用户"); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(userVO, "不存在的用户");
UserVO userVO = new UserVO(); userVO.setRolesByString();
userVO.setId(sysUser.getId()); userVO.setWmOpenId(null);
userVO.setAccount(sysUser.getAccount()); userVO.setWxId(null);
userVO.setName(sysUser.getName()); userVO.setWxUnionId(null);
userVO.setNickname(sysUser.getNickname()); userVO.setNationcode(null);
userVO.setAvatarPath(sysUser.getAvatarPath()); userVO.setPassword(null);
userVO.setRolesByString(sysUser.getRoles());
userVO.setEmail(sysUser.getEmail());
userVO.setStatus(sysUser.getStatus());
userVO.setCreateTime(sysUser.getCreateTime());
return userVO; return userVO;
} }
@ -407,7 +423,9 @@ public class SysUserService implements ISysUserService {
if(CollectionUtils.isEmpty(list)) { if(CollectionUtils.isEmpty(list)) {
return null; return null;
} }
return new UserVO(list.get(0)); UserVO userVO = sysUserDAO.queryUserWithCompany(list.get(0).getId());
userVO.setRolesByString();
return userVO;
} }
@Override @Override
@ -417,7 +435,9 @@ public class SysUserService implements ISysUserService {
example.createCriteria().andWmOpenIdEqualTo(wmOpenId); example.createCriteria().andWmOpenIdEqualTo(wmOpenId);
List<SysUser> userList = this.sysUserDAO.selectByExample(example); List<SysUser> userList = this.sysUserDAO.selectByExample(example);
if(!CollectionUtils.isEmpty(userList)) { if(!CollectionUtils.isEmpty(userList)) {
return new UserVO(userList.get(0)); UserVO userVO = sysUserDAO.queryUserWithCompany(userList.get(0).getId());
userVO.setRolesByString();
return userVO;
} }
return null; return null;
} }
@ -451,6 +471,17 @@ public class SysUserService implements ISysUserService {
return new UserVO(user); return new UserVO(user);
} }
@Override
@Transactional
public void batchCreateUser(List<SysUser> newSysUsers) {
this.sysUserDAO.batchInsert(newSysUsers);
}
@Override
public void createUser(SysUser newSysUser) {
this.sysUserDAO.insert(newSysUser);
}
private String generateNickname() { private String generateNickname() {
return String.format("用户_%s", RandomGenerator.getByLen(5)); 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<SysUser> list = this.sysUserDAO.selectByExample(example);
if(!CollectionUtils.isEmpty(list)) {
SysUser user = list.get(0);
}
return null;
}
@Override @Override
public void wxSubscribeEventHandle(String wxId) { public void wxSubscribeEventHandle(String wxId) {
@ -548,7 +565,9 @@ public class SysUserService implements ISysUserService {
user.setName(name); user.setName(name);
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); 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.setNickname(nickname);
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); 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.setAvatarPath(avatarPath);
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); 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.setMobile(updateMobileVO.getMobile());
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); 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.setEmail(updateEmailVO.getEmail());
user.setUpdateTime(LocalDateTime.now()); user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); 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); SysUser user = getEntity(userId);
if(!user.getRoles().equals(updateUserVO.getRolesStr())) { if(!user.getRoles().equals(updateUserVO.getRolesStr())) {
user.setRoles(updateUserVO.getRolesStr()); user.setRoles(updateUserVO.getRolesStr());
user.setUpdateTime(LocalDateTime.now());
this.sysUserDAO.updateByPrimaryKey(user); this.sysUserDAO.updateByPrimaryKey(user);
} }
//更新所属公司 //更新所属公司
if (updateUserVO.getCompanyId() != null) { Integer companyId = updateUserVO.getCompanyId();
iCompanyService.superAdminUpdateUserCompanyRel(userId, updateUserVO.getCompanyId(), superAdmin); 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<CompanyUser> 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 { } else {
iCompanyService.deleteUserCompanyRel(userId); companyUserDAO.deleteByExample(e);
DepartmentUserExample ue =new DepartmentUserExample();
ue.createCriteria().andUserIdEqualTo(userVO.getId());
departmentUserDAO.deleteByExample(ue);
userVO.setCompanyAdmin(null);
} }
} }
@Override @Override
@ -756,4 +824,9 @@ public class SysUserService implements ISysUserService {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(user, String.format("id为[%s]的用户不存在", id)); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(user, String.format("id为[%s]的用户不存在", id));
return user; return user;
} }
@Override
public void deleteById(Long id) {
sysUserDAO.deleteByPrimaryKey(id);
}
} }

View File

@ -5,6 +5,7 @@ import club.joylink.rtss.dao.*;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.training.ITrainingV1Service; 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.UserVO;
import club.joylink.rtss.vo.client.*; import club.joylink.rtss.vo.client.*;
import club.joylink.rtss.vo.client.training.TrainingResultVO; import club.joylink.rtss.vo.client.training.TrainingResultVO;
@ -50,6 +51,9 @@ public class UserExamService implements IUserExamService {
@Autowired @Autowired
private LsLessonDAO lessonDAO; private LsLessonDAO lessonDAO;
@Autowired
private GroupSimulationService groupSimulationService;
@Override @Override
@Transactional @Transactional
public UserExamVO generateExamInstance(long examId, UserVO userVO) { public UserExamVO generateExamInstance(long examId, UserVO userVO) {
@ -63,8 +67,9 @@ public class UserExamService implements IUserExamService {
calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.add(Calendar.SECOND, examDef.getDuration()); calendar.add(Calendar.SECOND, examDef.getDuration());
LsLesson lesson = this.lessonDAO.selectByPrimaryKey(examDef.getLessonId()); LsLesson lesson = this.lessonDAO.selectByPrimaryKey(examDef.getLessonId());
List<UserPermissionVO> examPermission = iUserPermissionService.getExamUserPermission(userVO, lesson.getMapId(), lesson.getPrdType(), lesson.getId()); groupSimulationService.confirmHasPermission(userVO, lesson.getMapId(), lesson.getPrdType());
BusinessExceptionAssertEnum.SIMULATION_PERMISSION_NOT_AVAILABLE.assertCollectionNotEmpty(examPermission); // List<UserPermissionVO> examPermission = iUserPermissionService.getExamUserPermission(userVO, lesson.getMapId(), lesson.getPrdType(), lesson.getId());
// BusinessExceptionAssertEnum.SIMULATION_PERMISSION_NOT_AVAILABLE.assertCollectionNotEmpty(examPermission);
} }
// 判断是否在考试时间之内 // 判断是否在考试时间之内
if (examDef.getStartTime() != null) { if (examDef.getStartTime() != null) {

View File

@ -6,7 +6,6 @@ import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.*; import club.joylink.rtss.services.*;
import club.joylink.rtss.vo.UserVO; 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.goods.GoodsVO;
import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.order.OrderCreateVO; import club.joylink.rtss.vo.client.order.OrderCreateVO;
@ -34,7 +33,7 @@ import java.util.stream.Collectors;
*/ */
@Slf4j @Slf4j
@Service @Service
public class ClassStudentUserServiceImpl implements IClassStudentUserService { public class DepartUserStaticServiceImpl implements IDepartUserStatisticService {
@Autowired @Autowired
private SysUserDAO sysUserDAO; private SysUserDAO sysUserDAO;
@ -89,7 +88,10 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
@Autowired @Autowired
private IOrderService iOrderService; private IOrderService iOrderService;
@Autowired
private DepartmentUserDAO departmentUserDAO;
//TODO 迁移学生权限分发
@Override @Override
@Transactional @Transactional
public void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator) { public void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator) {
@ -168,70 +170,70 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
distributePermissions2ZJ(good.getId(), userIds, usersWithPermissions); distributePermissions2ZJ(good.getId(), userIds, usersWithPermissions);
} }
@Override // @Override
public List<StudentClassVO> getClassesByProjectCode(String projectCode) { // public List<StudentClassVO> getClassesByProjectCode(String projectCode) {
StudentClassExample classExample = new StudentClassExample(); // StudentClassExample classExample = new StudentClassExample();
classExample.createCriteria().andProjectCodeEqualTo(projectCode); // classExample.createCriteria().andProjectCodeEqualTo(projectCode);
List<StudentClass> studentClasses = this.studentClassDAO.selectByExample(classExample); // List<StudentClass> studentClasses = this.studentClassDAO.selectByExample(classExample);
return StudentClassVO.convertFromDBList(studentClasses); // return StudentClassVO.convertFromDBList(studentClasses);
} // }
@Override // @Override
public List<StudentClassVO> getClassesByLesson(Long lessonId) { // public List<StudentClassVO> getClassesByLesson(Long lessonId) {
List<StudentClass> classes = this.studentClassDAO.getClasses(lessonId); // List<StudentClass> classes = this.studentClassDAO.getClasses(lessonId);
return StudentClassVO.convertFromDBList(classes); // return StudentClassVO.convertFromDBList(classes);
} // }
@Override // @Override
public List<StudentClassVO> getClassesByExamId(Long examId) { // public List<StudentClassVO> getClassesByExamId(Long examId) {
StudentRelExamClassExample example = new StudentRelExamClassExample(); // StudentRelExamClassExample example = new StudentRelExamClassExample();
example.createCriteria().andExamIdEqualTo(examId); // example.createCriteria().andExamIdEqualTo(examId);
List<StudentClass> classes = this.studentClassDAO.getClassesByExamId(examId); // List<StudentClass> classes = this.studentClassDAO.getClassesByExamId(examId);
return StudentClassVO.convertFromDBList(classes); // return StudentClassVO.convertFromDBList(classes);
} // }
@Override // @Override
public List<StudentRelLessonClass> getRelLessonsByClass(Integer classId) { // public List<StudentRelLessonClass> getRelLessonsByClass(Integer classId) {
StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample(); // StudentRelLessonClassExample relLessonClassExample = new StudentRelLessonClassExample();
relLessonClassExample.createCriteria().andClassIdEqualTo(classId); // relLessonClassExample.createCriteria().andClassIdEqualTo(classId);
List<StudentRelLessonClass> studentClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample); // List<StudentRelLessonClass> studentClasses = this.studentRelLessonClassDAO.selectByExample(relLessonClassExample);
return studentClasses; // return studentClasses;
} // }
@Override // @Override
public List<String> getRelclassByLessonId(Long LessonId) { // public List<String> getRelclassByLessonId(Long LessonId) {
List<String> classes = this.studentRelLessonClassDAO.getClassNames(LessonId); // List<String> classes = this.studentRelLessonClassDAO.getClassNames(LessonId);
return classes; // return classes;
} // }
@Override // @Override
public List<Long> getRelExamIdsByClassId(Integer classId) { // public List<Long> getRelExamIdsByClassId(Integer classId) {
StudentRelExamClassExample example = new StudentRelExamClassExample(); // StudentRelExamClassExample example = new StudentRelExamClassExample();
example.createCriteria().andClassIdEqualTo(classId); // example.createCriteria().andClassIdEqualTo(classId);
List<StudentRelExamClass> classes = this.studentRelExamClassDAO.selectByExample(example); // List<StudentRelExamClass> classes = this.studentRelExamClassDAO.selectByExample(example);
return classes.stream().map(StudentRelExamClass::getExamId).collect(Collectors.toList()); // return classes.stream().map(StudentRelExamClass::getExamId).collect(Collectors.toList());
} // }
//
// @Override
// public List<LessonVO> getLessonByClass(Integer classId) {
// List<Long> lessonIds = getRelLessonsByClass(classId).stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList());
// return lessonService.getValidLesson(lessonIds, null);
// }
@Override // @Override
public List<LessonVO> getLessonByClass(Integer classId) { // public List<StudentRelIdClass> getRelClassByUser(Long userId) {
List<Long> lessonIds = getRelLessonsByClass(classId).stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()); // StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample();
return lessonService.getValidLesson(lessonIds, null); // relIdClassExample.createCriteria().andStudentUserIdEqualTo(userId);
} // List<StudentRelIdClass> studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample);
// return studentRelIdClasses;
@Override // }
public List<StudentRelIdClass> getRelClassByUser(Long userId) {
StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample();
relIdClassExample.createCriteria().andStudentUserIdEqualTo(userId);
List<StudentRelIdClass> studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample);
return studentRelIdClasses;
}
@Override @Override
public List<ExportStudentInfo> studentInfoStatistics(StudentInfoExportParam infoExportParam) { public List<ExportStudentInfo> studentInfoStatistics(StudentInfoExportParam infoExportParam) {
//根据班级id查询对应学生信息 //根据班级id查询对应学生信息
StudentRelIdClassExample relIdClassExample = new StudentRelIdClassExample(); DepartmentUserExample departmentUserExample = new DepartmentUserExample();
relIdClassExample.createCriteria().andClassIdEqualTo(infoExportParam.getClassId()); departmentUserExample.createCriteria().andDepartmentIdEqualTo(infoExportParam.getClassId()).andManagerEqualTo(false);
List<StudentRelIdClass> studentRelIdClasses = this.studentRelIdClassDAO.selectByExample(relIdClassExample); List<DepartmentUser> departmentUsers = this.departmentUserDAO.selectByExample(departmentUserExample);
//课程关联实训数 //课程关联实训数
Map<String, Long> prd2TrainNums = infoExportParam.getPrdParams().stream().collect(Collectors.toMap(prdParam -> prdParam.getPrdType(), prdParam -> { Map<String, Long> prd2TrainNums = infoExportParam.getPrdParams().stream().collect(Collectors.toMap(prdParam -> prdParam.getPrdType(), prdParam -> {
LsRelChapterTrainingExample lsRelChapterTrainingExample = new LsRelChapterTrainingExample(); LsRelChapterTrainingExample lsRelChapterTrainingExample = new LsRelChapterTrainingExample();
@ -243,27 +245,27 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
this.examDefinitionDAO.selectByPrimaryKey(prdParam.getExamPaperId()).getFullPoint() this.examDefinitionDAO.selectByPrimaryKey(prdParam.getExamPaperId()).getFullPoint()
)); ));
//根据本学期日期始末针对每个学生查询 出勤天数根据课程id查询测验模式通过个数根据考试id查询成绩 //根据本学期日期始末针对每个学生查询 出勤天数根据课程id查询测验模式通过个数根据考试id查询成绩
return studentRelIdClasses.stream().map(studentRelIdClass -> { return departmentUsers.stream().map(departmentUser -> {
ExportStudentInfo exportStudentInfo = new ExportStudentInfo(); ExportStudentInfo exportStudentInfo = new ExportStudentInfo();
SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(studentRelIdClass.getStudentUserId()); SysUser sysUser = this.sysUserDAO.selectByPrimaryKey(departmentUser.getUserId());
exportStudentInfo.setName(sysUser.getName()); exportStudentInfo.setName(sysUser.getName());
exportStudentInfo.setStudentID(sysUser.getAccount()); 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); exportStudentInfo.setAttendance((float) Math.round((Objects.isNull(days) ? 0 : (days > infoExportParam.getAttendanceDays() ? infoExportParam.getAttendanceDays() : days)) * 100 / infoExportParam.getAttendanceDays()) / 100);
infoExportParam.getPrdParams().forEach(prdParam -> { infoExportParam.getPrdParams().forEach(prdParam -> {
PrdStudentScoretInfo prdStudentScoretInfo = new PrdStudentScoretInfo(); PrdStudentScoretInfo prdStudentScoretInfo = new PrdStudentScoretInfo();
prdStudentScoretInfo.setPrdType(prdParam.getPrdType()); 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) { if (prd2TrainNums.get(prdParam.getPrdType()) != 0) {
prdStudentScoretInfo.setLessonPassRate((float) Math.round((Objects.isNull(passedNum) ? 0 : passedNum) * 100 / prd2TrainNums.get(prdParam.getPrdType())) / 100); 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); prdStudentScoretInfo.setExamSocreRadio((float) Math.round((Objects.isNull(maxScore) ? 0 : maxScore) * 100 / prd2Fullpoint.get(prdParam.getPrdType())) / 100);
exportStudentInfo.getScores().add(prdStudentScoretInfo); exportStudentInfo.getScores().add(prdStudentScoretInfo);
@ -272,20 +274,20 @@ public class ClassStudentUserServiceImpl implements IClassStudentUserService {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@Override // @Override
public void addExamRelClass(Long examId, Integer classId) { // public void addExamRelClass(Long examId, Integer classId) {
StudentRelExamClass studentRelExamClass = new StudentRelExamClass(); // StudentRelExamClass studentRelExamClass = new StudentRelExamClass();
studentRelExamClass.setExamId(examId); // studentRelExamClass.setExamId(examId);
studentRelExamClass.setClassId(classId); // studentRelExamClass.setClassId(classId);
studentRelExamClassDAO.insert(studentRelExamClass); // studentRelExamClassDAO.insert(studentRelExamClass);
} // }
@Override // @Override
public void deleteExamRelClass(Long examId) { // public void deleteExamRelClass(Long examId) {
StudentRelExamClassExample example = new StudentRelExamClassExample(); // StudentRelExamClassExample example = new StudentRelExamClassExample();
example.createCriteria().andExamIdEqualTo(examId); // example.createCriteria().andExamIdEqualTo(examId);
studentRelExamClassDAO.deleteByExample(example); // studentRelExamClassDAO.deleteByExample(example);
} // }
/** /**
* 创建权限分发给赵杰再从赵杰的权限创建权限分发给学生领取 * 创建权限分发给赵杰再从赵杰的权限创建权限分发给学生领取

View File

@ -11,10 +11,8 @@ import club.joylink.rtss.vo.client.student.StudentInfoExportParam;
import java.util.List; import java.util.List;
/**
* 班级学生用户接口 public interface IDepartUserStatisticService {
*/
public interface IClassStudentUserService {
/** /**
* 导入学生用户及班级信息 * 导入学生用户及班级信息
@ -24,36 +22,36 @@ public interface IClassStudentUserService {
*/ */
void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator); void importStudentInfos(String projectCode, ImportStudentInfo importStudentInfo, UserVO creator);
/** // /**
* 根据项目查询班级 // * 根据项目查询班级
* @param projectCode // * @param projectCode
* @return // * @return
*/ // */
List<StudentClassVO> getClassesByProjectCode(String projectCode); // List<StudentClassVO> getClassesByProjectCode(String projectCode);
List<StudentClassVO> getClassesByLesson(Long lessonId); // List<StudentClassVO> getClassesByLesson(Long lessonId);
List<StudentClassVO> getClassesByExamId(Long examId); // List<StudentClassVO> getClassesByExamId(Long examId);
/**根据班级查询课程关系*/ // /**根据班级查询课程关系*/
List<StudentRelLessonClass> getRelLessonsByClass(Integer classId); // List<StudentRelLessonClass> getRelLessonsByClass(Integer classId);
/**根据课程查询关联的班级名字列表*/ /**根据课程查询关联的班级名字列表*/
List<String> getRelclassByLessonId(Long LessonId); // List<String> getRelclassByLessonId(Long LessonId);
List<Long> getRelExamIdsByClassId(Integer classId); // List<Long> getRelExamIdsByClassId(Integer classId);
List<LessonVO> getLessonByClass(Integer classId); // List<LessonVO> getLessonByClass(Integer classId);
/**根据用户id查询关联的班级关系*/ /**根据用户id查询关联的班级关系*/
List<StudentRelIdClass> getRelClassByUser(Long userId); // List<StudentRelIdClass> getRelClassByUser(Long userId);
/**统计学生成绩信息*/ /**统计学生成绩信息*/
List<ExportStudentInfo> studentInfoStatistics(StudentInfoExportParam infoExportParam); List<ExportStudentInfo> studentInfoStatistics(StudentInfoExportParam infoExportParam);
void addExamRelClass(Long examId, Integer classId); // void addExamRelClass(Long examId, Integer classId);
void deleteExamRelClass(Long examId); // void deleteExamRelClass(Long examId);
/**关联课程及班级信息*/ /**关联课程及班级信息*/
} }

View File

@ -41,7 +41,9 @@ public class StandService {
ControllableDevice ctrlMsg = new PsdSwitch(vrPsd, open); ControllableDevice ctrlMsg = new PsdSwitch(vrPsd, open);
SimulationDeviceControlEvent event = new SimulationDeviceControlEvent(this, simulation, ctrlMsg); SimulationDeviceControlEvent event = new SimulationDeviceControlEvent(this, simulation, ctrlMsg);
this.applicationContext.publishEvent(event); this.applicationContext.publishEvent(event);
vrPsd.startSetting(open); if (!vrPsd.isPslControl()) {
vrPsd.startSetting(open);
}
} }
/** /**

View File

@ -275,4 +275,8 @@ public interface GroupSimulationService {
PageVO<SimulationLog> getLog(String group, SimulationLogPagedQueryVO queryVO); PageVO<SimulationLog> getLog(String group, SimulationLogPagedQueryVO queryVO);
void changePassengerFlow(String group, Long passengerFlowId); void changePassengerFlow(String group, Long passengerFlowId);
void confirmHasPermission(UserVO userVO, Long mapId, String prdType);
boolean hasPermission(UserVO userVO, Long mapId, String prdType);
} }

View File

@ -41,6 +41,7 @@ import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO; import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.*; 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.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.fault.FaultRuleVO; import club.joylink.rtss.vo.client.fault.FaultRuleVO;
import club.joylink.rtss.vo.client.map.MapVO; 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.script.ScriptVO;
import club.joylink.rtss.vo.client.simulationv1.*; import club.joylink.rtss.vo.client.simulationv1.*;
import club.joylink.rtss.vo.client.training.TrainingNewVO; import club.joylink.rtss.vo.client.training.TrainingNewVO;
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
import club.joylink.rtss.websocket.StompMessageService; import club.joylink.rtss.websocket.StompMessageService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -137,6 +139,12 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
@Autowired @Autowired
private PassengerFlowSimulateService passengerFlowSimulateService; private PassengerFlowSimulateService passengerFlowSimulateService;
@Autowired
private ICompanyService iCompanyService;
@Autowired
private IUserPermissionService iUserPermissionService;
/** /**
* 创建仿真并进行缓存 * 创建仿真并进行缓存
* *
@ -283,6 +291,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
@Override @Override
public String simulation(Long mapId, String prodCode, LoginUserInfoVO loginUserInfoVO) { public String simulation(Long mapId, String prodCode, LoginUserInfoVO loginUserInfoVO) {
confirmHasPermission(loginUserInfoVO.getUserVO(), mapId, prodCode);
MapPrdTypeEnum prdType = MapPrdTypeEnum.getMapPrdTypeEnumByCode(prodCode); MapPrdTypeEnum prdType = MapPrdTypeEnum.getMapPrdTypeEnumByCode(prodCode);
Simulation simulation = this.create(loginUserInfoVO, mapId, Simulation simulation = this.create(loginUserInfoVO, mapId,
prdType, prdType,
@ -783,10 +793,13 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
@Override @Override
public List<RealDeviceVO> getRealDeviceList(String group) { public List<RealDeviceVO> getRealDeviceList(String group) {
Simulation simulation = this.getSimulationByGroup(group); Simulation simulation = this.getSimulationByGroup(group);
Set<ProjectDeviceType> displayDeviceTypes = List<RealDeviceConfig> realDeviceList = simulation.getRealDeviceList();
new HashSet<>(List.of(ProjectDeviceType.PSD, ProjectDeviceType.SWITCH, ProjectDeviceType.SIGNAL, ProjectDeviceType.PLC_GATEWAY)); if (!CollectionUtils.isEmpty(realDeviceList)) {
List<RealDeviceConfig> realDeviceList = simulation.getRealDeviceList() Set<ProjectDeviceType> displayDeviceTypes =
.stream().filter(device -> displayDeviceTypes.contains(device.getDeviceType())).collect(Collectors.toList()); 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<RealDevice> showList = null; // List<RealDevice> showList = null;
// if (!CollectionUtils.isEmpty(realDeviceList)) { // if (!CollectionUtils.isEmpty(realDeviceList)) {
// showList = realDeviceList.stream() // showList = realDeviceList.stream()
@ -935,4 +948,39 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
} }
return pageVO; 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<UserPermissionVO> 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;
}
} }

View File

@ -491,6 +491,13 @@ public class Simulation {
logs.add(log); logs.add(log);
} }
public List<RealDeviceConfig> getRealDeviceByType(ProjectDeviceType type) {
if (CollectionUtils.isEmpty(realDeviceList)) {
return new ArrayList<>();
}
return realDeviceList.stream().filter(device -> Objects.equals(type, device.getDeviceType())).collect(Collectors.toList());
}
/** /**
* 仿真功能类型 * 仿真功能类型
*/ */

View File

@ -21,10 +21,12 @@ import club.joylink.rtss.vo.client.WebSocketMessageType;
import club.joylink.rtss.vo.client.factory.SocketMessageFactory; import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.websocket.StompMessageService; import club.joylink.rtss.websocket.StompMessageService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.aspectj.runtime.internal.cflowstack.ThreadStackImpl11;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -315,6 +317,13 @@ public class Joylink3DMessageService {
if (Objects.isNull(member)) { if (Objects.isNull(member)) {
return; 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())); this.collectAndSend3DInitDeviceList(simulation, Arrays.asList(event.getUserId().toString()));
} }

View File

@ -47,6 +47,11 @@ public class VirtualRealityScreenDoor extends VirtualRealityDevice {
*/ */
private boolean commandOpen; private boolean commandOpen;
/**
* 正处于psl盘控制下
*/
private boolean pslControl;
private Fault fault; private Fault fault;
public VirtualRealityScreenDoor(String code, String name) { public VirtualRealityScreenDoor(String code, String name) {
@ -63,6 +68,7 @@ public class VirtualRealityScreenDoor extends VirtualRealityDevice {
this.interlockRelease = false; this.interlockRelease = false;
this.setting = false; this.setting = false;
this.remainTime = null; this.remainTime = null;
this.pslControl = false;
this.fault = null; this.fault = null;
} }
@ -76,8 +82,6 @@ public class VirtualRealityScreenDoor extends VirtualRealityDevice {
/** /**
* 开始开/关门过程 * 开始开/关门过程
*
* @param open
*/ */
public synchronized void startSetting(boolean open) { public synchronized void startSetting(boolean open) {
if (this.fault != null) { if (this.fault != null) {
@ -138,9 +142,6 @@ public class VirtualRealityScreenDoor extends VirtualRealityDevice {
/** /**
* 全部关门 * 全部关门
*
* @param close
* @param lock
*/ */
public void updateLockAndClose(boolean close, boolean lock) { public void updateLockAndClose(boolean close, boolean lock) {
this.open2End = false; this.open2End = false;
@ -188,14 +189,16 @@ public class VirtualRealityScreenDoor extends VirtualRealityDevice {
@Override @Override
public void apply(VirtualRealityScreenDoor door) { public void apply(VirtualRealityScreenDoor door) {
door.setFault(this); door.setFault(this);
door.updateOpen2End(true); door.startSetting(true);
// door.updateOpen2End(true);
} }
}, },
CANNOT_BE_OPENED { CANNOT_BE_OPENED {
@Override @Override
public void apply(VirtualRealityScreenDoor door) { public void apply(VirtualRealityScreenDoor door) {
door.setFault(this); door.setFault(this);
door.updateLockAndClose(true, true); door.startSetting(false);
// door.updateLockAndClose(true, true);
} }
}; };

View File

@ -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.ProjectDeviceVO;
import club.joylink.rtss.vo.client.project.sdy.SdyPsdConfigVO; import club.joylink.rtss.vo.client.project.sdy.SdyPsdConfigVO;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter @Getter
public class SdyPsdConfig extends RealDeviceConfig { public class SdyPsdConfig extends RealDeviceConfig {
private SdyPsdConfigVO configVO; private SdyPsdConfigVO configVO;
/**
* 开门到位
*/
@Setter
private Boolean r_km;
/**
* 蜂鸣器响起的时间为null表示蜂鸣器当前没响同时作为开关门流程的开始标志
*/
private LocalDateTime buzzerRingingTime;
/**
* 是否触发过开关门控制
*/
@Setter
private boolean triggerOpenOrClose;
/**
* 开关门过程中即非开/关门到位状态
*/
private boolean running;
public SdyPsdConfig(ProjectDeviceVO projectDevice) { public SdyPsdConfig(ProjectDeviceVO projectDevice) {
super(projectDevice); super(projectDevice);
if (projectDevice != null) { if (projectDevice != null) {
this.configVO = JsonUtils.read(projectDevice.getConfig(), SdyPsdConfigVO.class); 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;
}
} }

View File

@ -1,6 +1,8 @@
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.sdy; package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.sdy;
import club.joylink.rtss.simulation.cbtc.Simulation; 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.data.vr.VirtualRealityScreenDoor;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayService; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayService;
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
@Slf4j @Slf4j
@Component @Component
public class SdyPsdServiceImpl implements RealDeviceService { public class SdyPsdServiceImpl implements RealDeviceService {
@ -28,48 +32,116 @@ public class SdyPsdServiceImpl implements RealDeviceService {
@Override @Override
public void init(Simulation simulation, RealDeviceConfig deviceConfig) { public void init(Simulation simulation, RealDeviceConfig deviceConfig) {
PlcGateway plcGateway = simulation.getPlcGateway(); PlcGateway plcGateway = simulation.getPlcGateway();
SdyPsdConfigVO configVO = ((SdyPsdConfig) deviceConfig).getConfigVO(); SdyPsdConfig config = (SdyPsdConfig) deviceConfig;
SdyPsdConfigVO configVO = config.getConfigVO();
Channel channel = plcGateway.getChannel(); Channel channel = plcGateway.getChannel();
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr(); 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 @Override
public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) { 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; SdyPsdConfig config = (SdyPsdConfig) deviceConfig;
SdyPsdConfigVO configVO = config.getConfigVO(); SdyPsdConfigVO configVO = config.getConfigVO();
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(), configVO.getQuantity()); ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(), configVO.getQuantity());
boolean km = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_km()); boolean km = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_km());
boolean gm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_gm()); boolean gm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_gm());
boolean w_kgm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_kgm()); 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(); int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
Channel channel = plcGateway.getChannel(); Channel channel = plcGateway.getChannel();
if (vrPsd.isSettingClose()) { this.openOrCloseLoop(config, km, gm, baseAddr, w_kgm, channel);
if (!gm && km) {
this.plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_kgm(), w_kgm, false, channel); if (!km && !gm) {
} config.run();
} } else {
if (vrPsd.isSettingOpen()) { if (config.isRunning()) {
if (!km && gm) { this.plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_jb(), false, channel);
this.plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_kgm(), w_kgm, true, channel); this.plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getConfigVO().getW_kgm(), w_kgm, false, channel);
config.finishRunning();
} }
} }
if (!km && !gm) VirtualRealityScreenDoor vrPsd = (VirtualRealityScreenDoor) deviceConfig.getMapElement();
vrPsd.turning(); if (vrPsd != null) {
if (km && !gm) //控制realDevice
vrPsd.updateOpen2End(true); if (vrPsd.isSettingClose()) {
if (gm && !km) if (km && !gm) {
vrPsd.updateLockAndClose(true, true); 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);
}
}
} }
} }

View File

@ -25,6 +25,9 @@ public class SdyPslServiceImpl implements RealDeviceService {
@Autowired @Autowired
private PlcGatewayService plcGatewayService; private PlcGatewayService plcGatewayService;
@Autowired
private SdyPsdServiceImpl sdyPsdService;
@Override @Override
public boolean canHandle(RealDeviceConfig deviceConfig) { public boolean canHandle(RealDeviceConfig deviceConfig) {
return deviceConfig instanceof SdyPslConfig; return deviceConfig instanceof SdyPslConfig;
@ -69,18 +72,24 @@ public class SdyPslServiceImpl implements RealDeviceService {
realPsd = (SdyPsdConfig) optional.get(); realPsd = (SdyPsdConfig) optional.get();
if (realPsd != null) if (realPsd != null)
vrPsd = (VirtualRealityScreenDoor) realPsd.getMapElement(); vrPsd = (VirtualRealityScreenDoor) realPsd.getMapElement();
//真实屏蔽门的状态等 //收集真实屏蔽门的状态等
SdyPsdConfigVO psdConfigVO = null; SdyPsdConfigVO psdConfigVO = null;
Integer psdBaseAddr = null; Integer psdBaseAddr = null;
Boolean psd_r_km = null;
Boolean psd_r_gm = null; Boolean psd_r_gm = null;
Boolean psd_w_kgm = null; Boolean psd_w_kgm = null;
if (realPsd != null) { if (realPsd != null) {
psdConfigVO = realPsd.getConfigVO(); psdConfigVO = realPsd.getConfigVO();
psdBaseAddr = plcGateway.getConfig().getAddr() + psdConfigVO.getAddr(); psdBaseAddr = plcGateway.getConfig().getAddr() + psdConfigVO.getAddr();
ByteBuf psdStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, psdConfigVO.getAddr(), psdConfigVO.getQuantity()); 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_r_gm = RealDeviceConfig.getBitOf(psdStatus, psdConfigVO.getR_gm());
psd_w_kgm = RealDeviceConfig.getBitOf(psdStatus, psdConfigVO.getW_kgm()); psd_w_kgm = RealDeviceConfig.getBitOf(psdStatus, psdConfigVO.getW_kgm());
} }
//更新虚拟真实屏蔽门的控制状态
if (vrPsd != null) {
vrPsd.setPslControl(r_yxjz_key);
}
//所有灯的状态控制 //所有灯的状态控制
if (r_sd_button) { //试灯按钮按下 if (r_sd_button) { //试灯按钮按下
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_gm_light(), w_gm_light, true, channel); 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); plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_hsjc_light(), w_hsjc_light, r_hsjc_key, channel);
} }
//psl操作灯和开关门按钮 //允许禁止钥匙处于允许位
if (r_yxjz_key) { if (r_yxjz_key) {
if (vrPsd != null) { if (psd_r_km || psd_r_gm) { //屏蔽门处于开门/关门到位控制才生效
if (r_gm_button && !r_km_button) { if (vrPsd != null) {
if (!vrPsd.isSettingClose() && !vrPsd.isClose()) { if (r_gm_button && !r_km_button) {
vrPsd.startSetting(false); if (!vrPsd.isSettingClose() && !vrPsd.isClose()) {
vrPsd.startSetting(false);
}
} }
} if (r_km_button && !r_gm_button) {
if (r_km_button && !r_gm_button) { if (!vrPsd.isOpen2End()) {
if (!vrPsd.isOpen2End()) { vrPsd.startSetting(true);
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);
} }
} }
} }

View File

@ -11,6 +11,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -172,6 +173,20 @@ public class SpeedCurve {
while (Objects.nonNull(base) && count < 20) { while (Objects.nonNull(base) && count < 20) {
++count; ++count;
Float limitSpeed1 = base.getNeedLimitSpeed(); 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 (Objects.nonNull(limitSpeed1)) {
if (ahead) { if (ahead) {
// 车头前方 // 车头前方

View File

@ -83,6 +83,7 @@ public class UserVO implements Serializable {
/** /**
* 数据库的roles字段 * 数据库的roles字段
*/ */
@JsonIgnore
private String dbRoles; private String dbRoles;
/** /**
@ -105,10 +106,14 @@ public class UserVO implements Serializable {
*/ */
private LocalDateTime createTime; private LocalDateTime createTime;
//单位信息
private Integer companyId; private Integer companyId;
private String companyName; private String companyName;
private Boolean companyAdmin;
public UserVO() {} public UserVO() {}
public UserVO(SysUser sysUser) { 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 @Override
public String toString() { public String toString() {
return "UserVO [id=" + id + ", name=" + name + ", nickname=" + nickname + ", mobile=" + mobile + ", email=" + email +", nationcode=" return "UserVO [id=" + id + ", name=" + name + ", nickname=" + nickname + ", mobile=" + mobile + ", email=" + email +", nationcode="
@ -223,6 +236,7 @@ public class UserVO implements Serializable {
* 是否管理员 * 是否管理员
* @return * @return
*/ */
@JsonIgnore
public boolean isAdmin() { public boolean isAdmin() {
return !CollectionUtils.isEmpty(this.roles) return !CollectionUtils.isEmpty(this.roles)
&& (this.roles.contains(BusinessConsts.ROLE_04) || this.roles.contains(BusinessConsts.ROLE_05)); && (this.roles.contains(BusinessConsts.ROLE_04) || this.roles.contains(BusinessConsts.ROLE_05));
@ -232,6 +246,7 @@ public class UserVO implements Serializable {
* 是否超级管理员 * 是否超级管理员
* @return * @return
*/ */
@JsonIgnore
public boolean isSuperAdmin() { public boolean isSuperAdmin() {
return !CollectionUtils.isEmpty(this.roles) return !CollectionUtils.isEmpty(this.roles)
&& (this.roles.contains(BusinessConsts.ROLE_05)); && (this.roles.contains(BusinessConsts.ROLE_05));

View File

@ -1,13 +1,13 @@
package club.joylink.rtss.vo.client; 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.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 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 io.swagger.annotations.ApiModel;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -121,7 +121,7 @@ public class ExamDefinitionVO {
private Boolean trial; private Boolean trial;
/**关联班级列表*/ /**关联班级列表*/
private List<StudentClassVO> classes; private List<DepartmentVO> classes;
@Valid @Valid
@NotNull(message = "考试规则不能为空", groups = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class}) @NotNull(message = "考试规则不能为空", groups = {ExamDefinitionCheck.class, ExamDefinitionRulesCheck.class})

View File

@ -73,6 +73,11 @@ public class ExamsLessonVO {
*/ */
private List<UserPermissionVO> permissionList; private List<UserPermissionVO> permissionList;
private boolean systemFault;
/** 用户是否有权使用改考试 */
private boolean available;
public ExamsLessonVO(LessonVO lessonVO) { public ExamsLessonVO(LessonVO lessonVO) {
this.id = lessonVO.getId(); this.id = lessonVO.getId();
this.name = lessonVO.getName(); this.name = lessonVO.getName();
@ -82,5 +87,6 @@ public class ExamsLessonVO {
this.authorId = lessonVO.getAuthorId(); this.authorId = lessonVO.getAuthorId();
this.updateTime = lessonVO.getUpdateTime(); this.updateTime = lessonVO.getUpdateTime();
this.creatorId = lessonVO.getCreatorId(); this.creatorId = lessonVO.getCreatorId();
this.systemFault = lessonVO.isSystemFault();
} }
} }

View File

@ -112,6 +112,8 @@ public class LessonVO {
private String explanation; private String explanation;
private boolean systemFault;
public LessonVO(LsDraftLesson lesson) { public LessonVO(LsDraftLesson lesson) {
this.id = lesson.getId(); this.id = lesson.getId();
this.name = lesson.getName(); this.name = lesson.getName();

View File

@ -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;
}

View File

@ -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.Getter;
import lombok.Setter; import lombok.Setter;
@ -10,4 +11,5 @@ public class CompanyQueryVO extends PageQueryVO {
private String name; private String name;
} }

View File

@ -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;
}

View File

@ -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<SysUser> convert2DBList(List<CompanyUserVO> companyUserVOS){
return companyUserVOS.stream().map(CompanyUserVO::convert2DB).collect(Collectors.toList());
}
}

View File

@ -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.entity.Company;
import club.joylink.rtss.vo.UserVO;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter; import lombok.Getter;
@ -31,13 +30,14 @@ public class CompanyVO {
/**联系方式*/ /**联系方式*/
private String phone = ""; private String phone = "";
private List<UserVO> managers; private String projectCode;
public CompanyVO(Company entity) { public CompanyVO(Company entity) {
this.id = entity.getId(); this.id = entity.getId();
this.name = entity.getName(); this.name = entity.getName();
this.address = entity.getAddress(); this.address = entity.getAddress();
this.phone = entity.getPhone(); this.phone = entity.getPhone();
this.projectCode = entity.getProjectCode();
} }
public static List<CompanyVO> convert2VOList(List<Company> dataList) { public static List<CompanyVO> convert2VOList(List<Company> dataList) {
@ -48,19 +48,16 @@ public class CompanyVO {
return voList; return voList;
} }
public static CompanyVO convertFromDB(Company company, List<UserVO> managers) {
CompanyVO vo = new CompanyVO(company);
vo.setManagers(managers);
return vo;
}
public Company toDB() { public Company toDB() {
Company entity = new Company(); Company entity = new Company();
entity.setId(this.id); entity.setId(this.id);
entity.setName(this.name); entity.setName(this.name);
entity.setAddress(this.address); entity.setAddress(this.address);
entity.setPhone(this.phone); entity.setPhone(this.phone);
entity.setProjectCode(this.projectCode);
entity.setCreateTime(LocalDateTime.now()); entity.setCreateTime(LocalDateTime.now());
return entity; return entity;
} }
} }

View File

@ -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<DepartmentVO> 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<DepartmentVO> convert2VOList(List<CompanyDepartment> dataList) {
List<DepartmentVO> 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<DepartmentVO> buildDeptTree(List<DepartmentVO> voList) {
List<DepartmentVO> 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<DepartmentVO> getChildDept(Integer parentId, List<DepartmentVO> list) {
List<DepartmentVO> 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<DepartmentVO> getChildDeptList(Integer parentId, List<DepartmentVO> list) {
List<DepartmentVO> 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;
}
}

View File

@ -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<CompanyUserVO> companyUsers;
}

View File

@ -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<PositionVO> convert2VOList(List<CompanyPosition> dataList) {
List<PositionVO> 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;
}
}

View File

@ -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<UserDepartRelVO> convert2VOList(List<DepartmentUser> departmentUsers){
if(CollectionUtils.isEmpty(departmentUsers)){
return new ArrayList<>();
}
return departmentUsers.stream().map(UserDepartRelVO::new).collect(Collectors.toList());
}
}

View File

@ -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;
}

View File

@ -34,6 +34,7 @@ public class MapSystemDetailVO {
private String remarks; private String remarks;
private String status; private String status;
private String cityCode;
@ApiModelProperty(value = "课程") @ApiModelProperty(value = "课程")
private List<LessonVO> lessonList; private List<LessonVO> lessonList;

View File

@ -6,6 +6,7 @@
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="address" jdbcType="VARCHAR" property="address" /> <result column="address" jdbcType="VARCHAR" property="address" />
<result column="phone" jdbcType="VARCHAR" property="phone" /> <result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap> </resultMap>
@ -68,7 +69,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, `name`, address, phone, create_time, update_time id, `name`, address, phone, project_code, create_time, update_time
</sql> </sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyExample" resultMap="BaseResultMap">
select select
@ -110,9 +111,11 @@
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company" useGeneratedKeys="true"> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company" useGeneratedKeys="true">
insert into company (`name`, address, phone, insert into company (`name`, address, phone,
create_time, update_time) project_code, create_time, update_time
)
values (#{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, values (#{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) #{projectCode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.Company" useGeneratedKeys="true">
insert into company insert into company
@ -126,6 +129,9 @@
<if test="phone != null"> <if test="phone != null">
phone, phone,
</if> </if>
<if test="projectCode != null">
project_code,
</if>
<if test="createTime != null"> <if test="createTime != null">
create_time, create_time,
</if> </if>
@ -143,6 +149,9 @@
<if test="phone != null"> <if test="phone != null">
#{phone,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
</if> </if>
<if test="projectCode != null">
#{projectCode,jdbcType=VARCHAR},
</if>
<if test="createTime != null"> <if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
</if> </if>
@ -172,6 +181,9 @@
<if test="record.phone != null"> <if test="record.phone != null">
phone = #{record.phone,jdbcType=VARCHAR}, phone = #{record.phone,jdbcType=VARCHAR},
</if> </if>
<if test="record.projectCode != null">
project_code = #{record.projectCode,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null"> <if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if> </if>
@ -189,6 +201,7 @@
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
address = #{record.address,jdbcType=VARCHAR}, address = #{record.address,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR}, phone = #{record.phone,jdbcType=VARCHAR},
project_code = #{record.projectCode,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP} update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null"> <if test="_parameter != null">
@ -207,6 +220,9 @@
<if test="phone != null"> <if test="phone != null">
phone = #{phone,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR},
</if> </if>
<if test="projectCode != null">
project_code = #{projectCode,jdbcType=VARCHAR},
</if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
</if> </if>
@ -221,6 +237,7 @@
set `name` = #{name,jdbcType=VARCHAR}, set `name` = #{name,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR}, address = #{address,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR},
project_code = #{projectCode,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}

View File

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.CompanyDepartmentDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.CompanyDepartment">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="company_id" jdbcType="INTEGER" property="companyId" />
<result column="parent_id" jdbcType="INTEGER" property="parentId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, company_id, parent_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyDepartmentExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from company_department
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from company_department
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from company_department
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompanyDepartmentExample">
delete from company_department
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CompanyDepartment" useGeneratedKeys="true">
insert into company_department (`name`, company_id, parent_id
)
values (#{name,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CompanyDepartment" useGeneratedKeys="true">
insert into company_department
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
`name`,
</if>
<if test="companyId != null">
company_id,
</if>
<if test="parentId != null">
parent_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
<if test="parentId != null">
#{parentId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompanyDepartmentExample" resultType="java.lang.Long">
select count(*) from company_department
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update company_department
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=INTEGER},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
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}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.CompanyDepartment">
update company_department
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
company_id = #{companyId,jdbcType=INTEGER},
</if>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.CompanyDepartment">
update company_department
set `name` = #{name,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=INTEGER},
parent_id = #{parentId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.CompanyPositionDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.CompanyPosition">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="company_id" jdbcType="INTEGER" property="companyId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, company_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyPositionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from company_position
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from company_position
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from company_position
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompanyPositionExample">
delete from company_position
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CompanyPosition" useGeneratedKeys="true">
insert into company_position (`name`, company_id)
values (#{name,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.CompanyPosition" useGeneratedKeys="true">
insert into company_position
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
`name`,
</if>
<if test="companyId != null">
company_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompanyPositionExample" resultType="java.lang.Long">
select count(*) from company_position
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update company_position
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update company_position
set id = #{record.id,jdbcType=INTEGER},
`name` = #{record.name,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.CompanyPosition">
update company_position
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
company_id = #{companyId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.CompanyPosition">
update company_position
set `name` = #{name,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.CompanyUserDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.CompanyUser">
<result column="company_id" jdbcType="INTEGER" property="companyId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="admin" jdbcType="BIT" property="admin" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
company_id, user_id, `admin`
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.CompanyUserExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from company_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.CompanyUserExample">
delete from company_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.CompanyUser">
insert into company_user (company_id, user_id, `admin`
)
values (#{companyId,jdbcType=INTEGER}, #{userId,jdbcType=BIGINT}, #{admin,jdbcType=BIT}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.CompanyUser">
insert into company_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyId != null">
company_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="admin != null">
`admin`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="admin != null">
#{admin,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.CompanyUserExample" resultType="java.lang.Long">
select count(*) from company_user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update company_user
<set>
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=INTEGER},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.admin != null">
`admin` = #{record.admin,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update company_user
set company_id = #{record.companyId,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=BIGINT},
`admin` = #{record.admin,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.DepartmentExamDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.DepartmentExam">
<result column="exam_id" jdbcType="BIGINT" property="examId" />
<result column="department_id" jdbcType="INTEGER" property="departmentId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
exam_id, department_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.DepartmentExamExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from department_exam
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DepartmentExamExample">
delete from department_exam
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.DepartmentExam">
insert into department_exam (exam_id, department_id)
values (#{examId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.DepartmentExam">
insert into department_exam
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="examId != null">
exam_id,
</if>
<if test="departmentId != null">
department_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="examId != null">
#{examId,jdbcType=BIGINT},
</if>
<if test="departmentId != null">
#{departmentId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.DepartmentExamExample" resultType="java.lang.Long">
select count(*) from department_exam
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update department_exam
<set>
<if test="record.examId != null">
exam_id = #{record.examId,jdbcType=BIGINT},
</if>
<if test="record.departmentId != null">
department_id = #{record.departmentId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update department_exam
set exam_id = #{record.examId,jdbcType=BIGINT},
department_id = #{record.departmentId,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.DepartmentLessonDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.DepartmentLesson">
<result column="lesson_id" jdbcType="BIGINT" property="lessonId" />
<result column="department_id" jdbcType="INTEGER" property="departmentId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
lesson_id, department_id
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.DepartmentLessonExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from department_lesson
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DepartmentLessonExample">
delete from department_lesson
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.DepartmentLesson">
insert into department_lesson (lesson_id, department_id)
values (#{lessonId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.DepartmentLesson">
insert into department_lesson
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="lessonId != null">
lesson_id,
</if>
<if test="departmentId != null">
department_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="lessonId != null">
#{lessonId,jdbcType=BIGINT},
</if>
<if test="departmentId != null">
#{departmentId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.DepartmentLessonExample" resultType="java.lang.Long">
select count(*) from department_lesson
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update department_lesson
<set>
<if test="record.lessonId != null">
lesson_id = #{record.lessonId,jdbcType=BIGINT},
</if>
<if test="record.departmentId != null">
department_id = #{record.departmentId,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update department_lesson
set lesson_id = #{record.lessonId,jdbcType=BIGINT},
department_id = #{record.departmentId,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.UserCompanyRelDAO"> <mapper namespace="club.joylink.rtss.dao.DepartmentUserDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.UserCompanyRel"> <resultMap id="BaseResultMap" type="club.joylink.rtss.entity.DepartmentUser">
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" /> <result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="company_id" jdbcType="INTEGER" property="companyId" /> <result column="department_id" jdbcType="INTEGER" property="departmentId" />
<result column="position_id" jdbcType="INTEGER" property="positionId" />
<result column="manager" jdbcType="BIT" property="manager" /> <result column="manager" jdbcType="BIT" property="manager" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
@ -68,15 +69,15 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, user_id, company_id, manager, create_time, update_time id, user_id, department_id, position_id, manager, create_time, update_time
</sql> </sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.UserCompanyRelExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="club.joylink.rtss.entity.DepartmentUserExample" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from user_company_rel from department_user
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
@ -95,33 +96,38 @@
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from user_company_rel from department_user
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from user_company_rel delete from department_user
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</delete> </delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.UserCompanyRelExample"> <delete id="deleteByExample" parameterType="club.joylink.rtss.entity.DepartmentUserExample">
delete from user_company_rel delete from department_user
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.UserCompanyRel" useGeneratedKeys="true"> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DepartmentUser" useGeneratedKeys="true">
insert into user_company_rel (user_id, company_id, manager, insert into department_user (user_id, department_id, position_id,
create_time, update_time) manager, create_time, update_time
values (#{userId,jdbcType=BIGINT}, #{companyId,jdbcType=INTEGER}, #{manager,jdbcType=BIT}, )
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) values (#{userId,jdbcType=BIGINT}, #{departmentId,jdbcType=INTEGER}, #{positionId,jdbcType=INTEGER},
#{manager,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.UserCompanyRel" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DepartmentUser" useGeneratedKeys="true">
insert into user_company_rel insert into department_user
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null"> <if test="userId != null">
user_id, user_id,
</if> </if>
<if test="companyId != null"> <if test="departmentId != null">
company_id, department_id,
</if>
<if test="positionId != null">
position_id,
</if> </if>
<if test="manager != null"> <if test="manager != null">
manager, manager,
@ -137,8 +143,11 @@
<if test="userId != null"> <if test="userId != null">
#{userId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT},
</if> </if>
<if test="companyId != null"> <if test="departmentId != null">
#{companyId,jdbcType=INTEGER}, #{departmentId,jdbcType=INTEGER},
</if>
<if test="positionId != null">
#{positionId,jdbcType=INTEGER},
</if> </if>
<if test="manager != null"> <if test="manager != null">
#{manager,jdbcType=BIT}, #{manager,jdbcType=BIT},
@ -151,14 +160,14 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.UserCompanyRelExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="club.joylink.rtss.entity.DepartmentUserExample" resultType="java.lang.Long">
select count(*) from user_company_rel select count(*) from department_user
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update user_company_rel update department_user
<set> <set>
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=BIGINT}, id = #{record.id,jdbcType=BIGINT},
@ -166,8 +175,11 @@
<if test="record.userId != null"> <if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT}, user_id = #{record.userId,jdbcType=BIGINT},
</if> </if>
<if test="record.companyId != null"> <if test="record.departmentId != null">
company_id = #{record.companyId,jdbcType=INTEGER}, department_id = #{record.departmentId,jdbcType=INTEGER},
</if>
<if test="record.positionId != null">
position_id = #{record.positionId,jdbcType=INTEGER},
</if> </if>
<if test="record.manager != null"> <if test="record.manager != null">
manager = #{record.manager,jdbcType=BIT}, manager = #{record.manager,jdbcType=BIT},
@ -184,10 +196,11 @@
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update user_company_rel update department_user
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,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}, manager = #{record.manager,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP} update_time = #{record.updateTime,jdbcType=TIMESTAMP}
@ -195,14 +208,17 @@
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.UserCompanyRel"> <update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.DepartmentUser">
update user_company_rel update department_user
<set> <set>
<if test="userId != null"> <if test="userId != null">
user_id = #{userId,jdbcType=BIGINT}, user_id = #{userId,jdbcType=BIGINT},
</if> </if>
<if test="companyId != null"> <if test="departmentId != null">
company_id = #{companyId,jdbcType=INTEGER}, department_id = #{departmentId,jdbcType=INTEGER},
</if>
<if test="positionId != null">
position_id = #{positionId,jdbcType=INTEGER},
</if> </if>
<if test="manager != null"> <if test="manager != null">
manager = #{manager,jdbcType=BIT}, manager = #{manager,jdbcType=BIT},
@ -216,24 +232,67 @@
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.UserCompanyRel"> <update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.DepartmentUser">
update user_company_rel update department_user
set user_id = #{userId,jdbcType=BIGINT}, 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}, manager = #{manager,jdbcType=BIT},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<!-- 额外添加 -->
<update id="batchUpdate" parameterType="list">
update user_company_rel set <!-- <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="list" useGeneratedKeys="true">
<foreach collection="ucrList" item="record" open="(" separator="," close=")"> insert into department_user (user_id, department_id,
user_id = #{record.userId,jdbcType=BIGINT}, position_id, manager,
company_id = #{record.companyId,jdbcType=INTEGER}, create_time, update_time)
manager = #{record.manager,jdbcType=BIT}, values
create_time = #{record.createTime,jdbcType=TIMESTAMP}, <foreach collection="list" item="item" separator=",">
update_time = #{record.updateTime,jdbcType=TIMESTAMP} (#{item.userId,jdbcType=BIGINT}, #{item.departmentId,jdbcType=INTEGER},
#{item.positionId,jdbcType=INTEGER}, #{item.manager,jdbcType=BIT})
</foreach> </foreach>
</update> </insert>-->
<resultMap id="CompanyUserInfo" type="club.joylink.rtss.vo.client.company.CompanyDepartUserVO">
<!-- <id column="id" jdbcType="BIGINT" property="id"/>-->
<result column="companyId" jdbcType="INTEGER" property="companyId"/>
<result column="companyName" jdbcType="VARCHAR" property="companyName"/>
<result column="departmentId" jdbcType="INTEGER" property="departmentId"/>
<result column="departmentName" jdbcType="VARCHAR" property="departmentName"/>
<result column="manager" jdbcType="BIT" property="manager"/>
<result column="userId" jdbcType="BIGINT" property="userId"/>
<result column="account" jdbcType="VARCHAR" property="account"/>
<result column="userName" jdbcType="VARCHAR" property="name"/>
</resultMap>
<select id="getCompanyDepartUsers" parameterType="club.joylink.rtss.vo.client.company.CompanyUserQueryVO" resultMap ="CompanyUserInfo">
select
ucr.user_id as userId, account, su.`name` as userName, nickname, mobile,
c.id as companyId, c.`name` as companyName,
cd.id as departmentId, cd.`name` as departmentName,
ucr.manager as manager
from department_user ucr join sys_user su on su.id = ucr.user_id and ucr.manager = false
left join company_department cd on cd.id = ucr.department_id
left join company c on cd.company_id = c.id
<where>
<if test="name != null and name != ''">
and su.`name` like concat('%', #{name}, '%')
</if>
<if test="account != null and account != ''">
and su.`account` = #{account}
</if>
<if test="departmentId != null and departmentId != ''">
and cd.id = #{departmentId}
</if>
</where>
</select>
<select id="getUserCompanyDeparts" resultMap="CompanyUserInfo">
SELECT du.department_id as departmentId,cd.name as departmentName,du.manager FROM department_user du JOIN company_department cd ON du.department_id = cd.id WHERE cd.company_id = #{companyId} AND du.user_id = #{userId}
</select>
</mapper> </mapper>

View File

@ -415,7 +415,6 @@
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<!--额外添加--> <!--额外添加-->
<resultMap id="WithCompanyMap" type="club.joylink.rtss.vo.UserVO"> <resultMap id="WithCompanyMap" type="club.joylink.rtss.vo.UserVO">
<id column="userId" jdbcType="BIGINT" property="id" /> <id column="userId" jdbcType="BIGINT" property="id" />
@ -435,30 +434,49 @@
<result column="sys_user.create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="sys_user.create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="companyId" property="companyId"/> <result column="companyId" property="companyId"/>
<result column="companyName" property="companyName"/> <result column="companyName" property="companyName"/>
<result column="admin" property="companyAdmin"/>
</resultMap> </resultMap>
<select id="pagedQueryWithCompany" parameterType="club.joylink.rtss.vo.UserQueryVO" resultMap="WithCompanyMap"> <select id="queryUsersWithCompany" parameterType="club.joylink.rtss.vo.UserQueryVO" resultMap="WithCompanyMap">
select SELECT
sys_user.id as userId, account, sys_user.`name` as userName, nickname, avatar_path, `password`, mobile, nationcode, email, 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`, sys_user.create_time, update_user_id, wx_id, wx_union_id, wm_open_id, `status`, roles, `offline`, s.create_time, update_user_id,
sys_user.update_time, company.id as companyId, company.`name` as companyName s.update_time, c.id as companyId, c.`name` as companyName,cu.admin as admin
from sys_user left join user_company_rel ucr on sys_user.id = ucr.user_id left join company on ucr.company_id = company.id 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
<where> <where>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and sys_user.`name` like concat('%', #{name}, '%') and s.`name` like concat('%', #{name}, '%')
</if> </if>
<if test="nickname != null and nickname != ''"> <if test="nickname != null and nickname != ''">
and sys_user.`nickname` like concat('%', #{nickname}, '%') and s.`nickname` like concat('%', #{nickname}, '%')
</if> </if>
<if test="mobile != null and mobile != ''"> <if test="mobile != null and mobile != ''">
and sys_user.`mobile` like concat('%', #{mobile}, '%') and s.`mobile` like concat('%', #{mobile}, '%')
</if> </if>
<if test="rolesStr != null and rolesStr != ''"> <if test="rolesStr != null and rolesStr != ''">
and sys_user.`roles` like concat('%', #{rolesStr}, '%') and s.`roles` like concat('%', #{rolesStr}, '%')
</if> </if>
<if test="companyId != null"> <if test="companyId != null">
and company.id = #{companyId} and c.id = #{companyId}
</if> </if>
</where> </where>
order by sys_user.id order by s.id
</select>
<select id="queryUserWithCompany" resultMap="WithCompanyMap">
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
where s.id = #{userId}
</select>
<select id="queryCompanyUserByAccount" resultMap="WithCompanyMap">
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
where s.account = #{account} and c.id = #{companyId}
</select> </select>
</mapper> </mapper>