From dcae9d58eaa90faea4a4c095ed1bfb34bed1414a Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期二, 21 十月 2025 15:53:49 +0800
Subject: [PATCH] 新增
---
multi-system/src/main/java/com/gkhy/exam/system/mapper/CourseEffectivenMapper.java | 13 +
multi-system/src/main/java/com/gkhy/exam/system/domain/CourseEffectiven.java | 115 ++++++++++++++++
multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/CourseEffectivenController.java | 70 ++++++++++
multi-system/src/main/java/com/gkhy/exam/system/service/CourseEffectivenService.java | 16 ++
multi-system/src/main/java/com/gkhy/exam/system/service/impl/CourseEffectivenServiceImpl.java | 103 ++++++++++++++
multi-system/src/main/resources/mapper/system/CourseEffectivenMapper.xml | 45 ++++++
6 files changed, 362 insertions(+), 0 deletions(-)
diff --git a/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/CourseEffectivenController.java b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/CourseEffectivenController.java
new file mode 100644
index 0000000..0b1dbd5
--- /dev/null
+++ b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/CourseEffectivenController.java
@@ -0,0 +1,70 @@
+package com.gkhy.exam.admin.controller.web;
+
+import com.gkhy.exam.common.api.CommonResult;
+import com.gkhy.exam.system.domain.CourseEffectiven;
+import com.gkhy.exam.system.domain.InternalAuditPlan;
+import com.gkhy.exam.system.service.CourseEffectivenService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/effectiven")
+@Api(tags = "课程有效性评价管理")
+public class CourseEffectivenController {
+
+ @Autowired
+ private CourseEffectivenService courseEffectivenService;
+
+ /**
+ * 课程有效性评价列表
+ * @param courseEffectiven
+ * @return
+ */
+ @ApiOperation(value = "课程有效性评价列表(分页)")
+ @ApiImplicitParams({
+ @ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
+ @ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10"),
+ })
+ @GetMapping("/list")
+ public CommonResult listCourseEffectiven(CourseEffectiven courseEffectiven){
+ return CommonResult.success(courseEffectivenService.selectCourseEffectivenList(courseEffectiven));
+ }
+
+
+ /**
+ * 课程有效性评价新增
+ * @param courseEffectiven
+ * @return
+ */
+ @ApiOperation(value = "课程有效性评价新增")
+ @PostMapping("/insert")
+ public CommonResult insertCourseEffectiven(@RequestBody CourseEffectiven courseEffectiven){
+ return courseEffectivenService.insertCourseEffectiven(courseEffectiven);
+ }
+
+ /**
+ * 课程有效性评价修改
+ * @param courseEffectiven
+ * @return
+ */
+ @ApiOperation(value = "课程有效性评价修改")
+ @PostMapping("/update")
+ public CommonResult updateCourseEffectiven(@RequestBody CourseEffectiven courseEffectiven){
+ return courseEffectivenService.updateCourseEffectiven(courseEffectiven);
+ }
+
+ /**
+ * 课程有效性评价删除
+ * @param effectivenId
+ * @return
+ */
+ @ApiOperation(value = "课程有效性评价删除")
+ @GetMapping("/deleted")
+ public CommonResult deletedCourseEffectiven(@RequestParam("effectivenId") Integer effectivenId){
+ return courseEffectivenService.deletedCourseEffectiven(effectivenId);
+ }
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/domain/CourseEffectiven.java b/multi-system/src/main/java/com/gkhy/exam/system/domain/CourseEffectiven.java
new file mode 100644
index 0000000..df1176e
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/domain/CourseEffectiven.java
@@ -0,0 +1,115 @@
+package com.gkhy.exam.system.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+@Getter
+@Setter
+@TableName("course_effectiven")
+@ApiModel(value = "CourseEffectiven", description = "课程有效性评价")
+public class CourseEffectiven implements Serializable {
+
+ @ApiModelProperty("主键")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @ApiModelProperty(value = "企业id")
+ @TableField("company_id")
+ private Long companyId;
+
+ @TableField(exist = false)
+ private String companyName;
+
+ @ApiModelProperty(value = "计划id")
+ @TableField("plan_id")
+ private Integer planId;
+
+ @TableField(exist = false)
+ private String planName;
+
+ @ApiModelProperty(value = "讲师id")
+ @TableField("teacher_id")
+ private Integer teacherId;
+
+ @TableField(exist = false)
+ private String teacherName;
+
+ @ApiModelProperty(value = "所属部门id")
+ @TableField("dept_id")
+ private Integer deptId;
+
+ @TableField(exist = false)
+ private String deptName;
+
+ @ApiModelProperty(value = "开课日期id")
+ @TableField("open_time")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate openTime;
+
+ @ApiModelProperty(value = "员工")
+ @TableField("staffs")
+ private String staffs;
+
+ @TableField(exist = false)
+ private String staffsNames;
+
+ @ApiModelProperty(value = "个人素养")
+ @TableField("personal_quality")
+ private String personalQuality;
+
+ @ApiModelProperty(value = "授课准备")
+ @TableField("preparatory")
+ private String preparatory;
+
+ @ApiModelProperty(value = "课程内容")
+ @TableField("course_content")
+ private String courseContent;
+
+ @ApiModelProperty(value = "你的建议")
+ @TableField("suggest")
+ private String suggest;
+
+ @ApiModelProperty(value = "关于讲师")
+ @TableField("about_teacher")
+ private String aboutTeacher;
+
+ @ApiModelProperty(value = "关于内容")
+ @TableField("about_content")
+ private String aboutContent;
+
+ @ApiModelProperty(value = "关于授课方式")
+ @TableField("teach_form")
+ private String teachForm;
+
+ @ApiModelProperty(value = "其他")
+ @TableField("other")
+ private String other;
+
+ @TableField("del_flag")
+ private Integer delFlag;
+
+ @TableField("create_by")
+ private String createBy;
+
+ @TableField("create_time")
+ private LocalDateTime createTime;
+
+ @TableField("update_by")
+ private String updateBy;
+
+ @TableField("update_time")
+ private LocalDateTime updateTime;
+
+
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/mapper/CourseEffectivenMapper.java b/multi-system/src/main/java/com/gkhy/exam/system/mapper/CourseEffectivenMapper.java
new file mode 100644
index 0000000..60f6373
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/mapper/CourseEffectivenMapper.java
@@ -0,0 +1,13 @@
+package com.gkhy.exam.system.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gkhy.exam.system.domain.CourseEffectiven;
+import org.mapstruct.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface CourseEffectivenMapper extends BaseMapper<CourseEffectiven> {
+ List<CourseEffectiven> selectEffectivenList(CourseEffectiven courseEffectiven);
+
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/CourseEffectivenService.java b/multi-system/src/main/java/com/gkhy/exam/system/service/CourseEffectivenService.java
new file mode 100644
index 0000000..64a2023
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/CourseEffectivenService.java
@@ -0,0 +1,16 @@
+package com.gkhy.exam.system.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gkhy.exam.common.api.CommonPage;
+import com.gkhy.exam.common.api.CommonResult;
+import com.gkhy.exam.system.domain.CourseEffectiven;
+
+public interface CourseEffectivenService extends IService<CourseEffectiven> {
+ CommonPage selectCourseEffectivenList(CourseEffectiven courseEffectiven);
+
+ CommonResult insertCourseEffectiven(CourseEffectiven courseEffectiven);
+
+ CommonResult updateCourseEffectiven(CourseEffectiven courseEffectiven);
+
+ CommonResult deletedCourseEffectiven(Integer effectivenId);
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/CourseEffectivenServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/CourseEffectivenServiceImpl.java
new file mode 100644
index 0000000..f8337d8
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/CourseEffectivenServiceImpl.java
@@ -0,0 +1,103 @@
+package com.gkhy.exam.system.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gkhy.exam.common.api.CommonPage;
+import com.gkhy.exam.common.api.CommonResult;
+import com.gkhy.exam.common.domain.entity.SysUser;
+import com.gkhy.exam.common.utils.PageUtils;
+import com.gkhy.exam.common.utils.SecurityUtils;
+import com.gkhy.exam.system.domain.CourseEffectiven;
+import com.gkhy.exam.system.mapper.CourseEffectivenMapper;
+import com.gkhy.exam.system.mapper.SysUserMapper;
+import com.gkhy.exam.system.service.CourseEffectivenService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+@Service
+public class CourseEffectivenServiceImpl extends ServiceImpl<CourseEffectivenMapper, CourseEffectiven> implements CourseEffectivenService {
+
+ @Autowired
+ private CourseEffectivenMapper courseEffectivenMapper;
+
+ @Autowired
+ private SysUserMapper sysUserMapper;
+
+ @Override
+ public CommonPage selectCourseEffectivenList(CourseEffectiven courseEffectiven) {
+ if (!SecurityUtils.adminUser() && courseEffectiven.getCompanyId() == null){
+ throw new RuntimeException("非管理员操作,企业查询不可为空");
+ }
+ PageUtils.startPage();
+ List<CourseEffectiven> courseEffectivens = courseEffectivenMapper.selectEffectivenList(courseEffectiven);
+ Set<Integer> allUserIds = courseEffectivens.stream()
+ .map(CourseEffectiven::getStaffs)
+ .filter(Objects::nonNull)
+ .flatMap(staffs -> Arrays.stream(staffs.split(",")))
+ .map(String::trim)
+ .filter(s -> !s.isEmpty())
+ .map(Integer::valueOf)
+ .collect(Collectors.toSet());
+
+ if (!allUserIds.isEmpty()) {
+ // 批量查询用户信息
+ Map<Long, String> userMap = sysUserMapper.selectBatchIds(new ArrayList<>(allUserIds)).stream()
+ .collect(Collectors.toMap(SysUser::getId, SysUser::getName));
+
+ // 设置用户姓名
+ courseEffectivens.forEach(item -> {
+ if (item.getStaffs() != null) {
+ String staffNames = Arrays.stream(item.getStaffs().split(","))
+ .map(String::trim)
+ .filter(s -> !s.isEmpty())
+ .map(Long::valueOf)
+ .map(userMap::get)
+ .filter(Objects::nonNull)
+ .collect(Collectors.joining(","));
+ item.setStaffsNames(staffNames);
+ }
+ });
+ }
+ return CommonPage.restPage(courseEffectivens);
+ }
+
+ @Override
+ public CommonResult insertCourseEffectiven(CourseEffectiven courseEffectiven) {
+ courseEffectiven.setCreateBy(SecurityUtils.getUsername());
+ courseEffectiven.setCreateTime(LocalDateTime.now());
+ int insert = courseEffectivenMapper.insert(courseEffectiven);
+ if (insert>0){
+ return CommonResult.success();
+ }
+ return CommonResult.failed();
+ }
+
+ @Override
+ public CommonResult updateCourseEffectiven(CourseEffectiven courseEffectiven) {
+ courseEffectiven.setUpdateBy(SecurityUtils.getUsername());
+ courseEffectiven.setUpdateTime(LocalDateTime.now());
+ int update = courseEffectivenMapper.updateById(courseEffectiven);
+ if (update>0){
+ return CommonResult.success();
+ }
+ return CommonResult.failed();
+ }
+
+ @Override
+ public CommonResult deletedCourseEffectiven(Integer effectivenId) {
+ CourseEffectiven courseEffectiven = new CourseEffectiven();
+ courseEffectiven.setId(effectivenId);
+ courseEffectiven.setUpdateBy(SecurityUtils.getUsername());
+ courseEffectiven.setUpdateTime(LocalDateTime.now());
+ courseEffectiven.setDelFlag(2);
+ int update = courseEffectivenMapper.updateById(courseEffectiven);
+ if (update>0){
+ return CommonResult.success();
+ }
+ return CommonResult.failed();
+ }
+}
diff --git a/multi-system/src/main/resources/mapper/system/CourseEffectivenMapper.xml b/multi-system/src/main/resources/mapper/system/CourseEffectivenMapper.xml
new file mode 100644
index 0000000..436cb15
--- /dev/null
+++ b/multi-system/src/main/resources/mapper/system/CourseEffectivenMapper.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gkhy.exam.system.mapper.CourseEffectivenMapper">
+
+ <select id="selectEffectivenList" resultType="com.gkhy.exam.system.domain.CourseEffectiven">
+ SELECT
+ ce.`id`,
+ ce.`company_id`,
+ sc.`name` as company_name,
+ ce.`plan_id`,
+ tp.`train_name` as plan_name,
+ ce.`teacher_id`,
+ su.`name` as teacher_name,
+ ce.`dept_id`,
+ sd.`dept_name`,
+ ce.`open_time`,
+ ce.`staffs`,
+ ce.`personal_quality`,
+ ce.`preparatory`,
+ ce.`course_content`,
+ ce.`suggest`,
+ ce.`about_teacher`,
+ ce.`about_content`,
+ ce.`teach_form`,
+ ce.`other`,
+ ce.`del_flag`,
+ ce.`create_by`,
+ ce.`create_time`,
+ ce.`update_by`,
+ ce.`update_time`
+ FROM
+ `course_effectiven` ce
+ LEFT JOIN sys_user su ON ce.teacher_id = su.id
+ LEFT JOIN sys_company sc ON ce.company_id = sc.id
+ LEFT JOIN sys_dept sd ON ce.dept_id = sd.dept_id
+ LEFT JOIN train_plan tp ON ce.plan_id = tp.id
+ WHERE
+ ce.del_flag = 0
+ <if test="companyId!=null">
+ and ce.company_id = #{companyId}
+ </if>
+ ORDER BY
+ ce.create_time DESC
+ </select>
+</mapper>
--
Gitblit v1.9.2