diff --git a/pom.xml b/pom.xml index 3aafe144a..f82e582f9 100644 --- a/pom.xml +++ b/pom.xml @@ -49,6 +49,7 @@ 2.2.0 1.2.83 + 3.0.4.2 3.2.2 @@ -226,7 +227,6 @@ p6spy p6spy - ${p6spy.version} @@ -339,6 +339,12 @@ ${revision} + + cn.herodotus.engine + data-sdk-p6spy + ${p6spy.version} + + diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 26cd02333..46c320fcf 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -23,10 +23,17 @@ mysql-connector-j + + + + + - com.oracle.database.jdbc - ojdbc8 + cn.easyproject + ojdbc6 + 11.2.0.4 + org.postgresql @@ -56,11 +63,47 @@ org.dromara ruoyi-system + + + springdoc-openapi-starter-common + org.springdoc + + + httpclient + org.apache.httpcomponents + + + joda-time + joda-time + + + commons-io + commons-io + + + checker-qual + org.checkerframework + + + commons-logging + commons-logging + + + jsr305 + com.google.code.findbugs + + org.dromara ruoyi-job + + + guava + com.google.guava + + @@ -103,6 +146,12 @@ + + + org.dromara + ruoyi-imok-test + ${revision} + diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 4aaea57e7..7065d893c 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -43,23 +43,23 @@ spring: driverClassName: com.mysql.cj.jdbc.Driver # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) - url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true + url: jdbc:mysql://192.168.56.100:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true username: root - password: root + password: HEllo@123 # 从库数据源 slave: lazy: true type: ${spring.datasource.type} driverClassName: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true - username: - password: -# oracle: -# type: ${spring.datasource.type} -# driverClassName: oracle.jdbc.OracleDriver -# url: jdbc:oracle:thin:@//localhost:1521/XE -# username: ROOT -# password: root + url: jdbc:mysql://192.168.56.100:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true + username: root + password: HEllo@123 + oracle: + type: ${spring.datasource.type} + driver-class-name: oracle.jdbc.OracleDriver + url: jdbc:oracle:thin:@192.168.56.122:1521/oracledb + username: cpad + password: cpad # postgres: # type: ${spring.datasource.type} # driverClassName: org.postgresql.Driver @@ -98,7 +98,7 @@ spring.data: # 数据库索引 database: 0 # 密码(如没有密码请注释掉) - # password: + password: hello123 # 连接超时时间 timeout: 10s # 是否开启ssl diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 3f54f649b..599886c13 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -122,7 +122,7 @@ security: # 多租户配置 tenant: # 是否开启 - enable: true + enable: false # 排除表 excludes: - sys_menu diff --git a/ruoyi-common/ruoyi-common-mybatis/pom.xml b/ruoyi-common/ruoyi-common-mybatis/pom.xml index 2088b5439..07b486c92 100644 --- a/ruoyi-common/ruoyi-common-mybatis/pom.xml +++ b/ruoyi-common/ruoyi-common-mybatis/pom.xml @@ -45,14 +45,24 @@ org.mybatis mybatis-spring + + mybatis + org.mybatis + + + + + + - p6spy - p6spy + cn.herodotus.engine + data-sdk-p6spy + diff --git a/ruoyi-extend/ruoyi-powerjob-server/src/main/resources/application-dev.properties b/ruoyi-extend/ruoyi-powerjob-server/src/main/resources/application-dev.properties index ba024d3c2..5420bd66d 100644 --- a/ruoyi-extend/ruoyi-powerjob-server/src/main/resources/application-dev.properties +++ b/ruoyi-extend/ruoyi-powerjob-server/src/main/resources/application-dev.properties @@ -2,9 +2,9 @@ oms.env=dev ####### Database properties(Configure according to the the environment) ####### spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true +spring.datasource.core.jdbc-url=jdbc:mysql://192.168.56.100:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true spring.datasource.core.username=root -spring.datasource.core.password=root +spring.datasource.core.password=HEllo@123 spring.datasource.core.maximum-pool-size=20 spring.datasource.core.minimum-idle=5 diff --git a/ruoyi-modules/pom.xml b/ruoyi-modules/pom.xml index 4044916fb..1fc39eb09 100644 --- a/ruoyi-modules/pom.xml +++ b/ruoyi-modules/pom.xml @@ -14,6 +14,7 @@ ruoyi-generator ruoyi-job ruoyi-system + ruoyi-imok-test ruoyi-modules diff --git a/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/service/GenTableServiceImpl.java b/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/service/GenTableServiceImpl.java index d41881585..c10266e1f 100644 --- a/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/service/GenTableServiceImpl.java +++ b/ruoyi-modules/ruoyi-generator/src/main/java/org/dromara/generator/service/GenTableServiceImpl.java @@ -379,6 +379,7 @@ public class GenTableServiceImpl implements IGenTableService { StringWriter sw = new StringWriter(); Template tpl = Velocity.getTemplate(template, Constants.UTF8); tpl.merge(context, sw); + log.info("生成的文件======{}",sw.toString()); try { // 添加到zip zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); diff --git a/ruoyi-modules/ruoyi-generator/src/main/resources/generator.yml b/ruoyi-modules/ruoyi-generator/src/main/resources/generator.yml index d779d9794..e8a61e546 100644 --- a/ruoyi-modules/ruoyi-generator/src/main/resources/generator.yml +++ b/ruoyi-modules/ruoyi-generator/src/main/resources/generator.yml @@ -1,10 +1,11 @@ # 代码生成 gen: # 作者 - author: Lion Li + author: sungk # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool - packageName: org.dromara.system + packageName: org.dromara.imok # 自动去除表前缀,默认是false autoRemovePre: false # 表前缀(生成类名不会包含表前缀,多个用逗号分隔) - tablePrefix: sys_ +# tablePrefix: sys_ + tablePrefix: diff --git a/ruoyi-modules/ruoyi-imok-test/pom.xml b/ruoyi-modules/ruoyi-imok-test/pom.xml new file mode 100644 index 000000000..3e38d0f92 --- /dev/null +++ b/ruoyi-modules/ruoyi-imok-test/pom.xml @@ -0,0 +1,100 @@ + + + 4.0.0 + + org.dromara + ruoyi-modules + 5.1.2 + + + ruoyi-imok-test + + + 17 + 17 + UTF-8 + + + + + org.dromara + ruoyi-common-core + + + + org.dromara + ruoyi-common-doc + + + + org.dromara + ruoyi-common-mybatis + + + + org.dromara + ruoyi-common-translation + + + + + + + org.dromara + ruoyi-common-log + + + + + org.dromara + ruoyi-common-excel + + + + + + + org.dromara + ruoyi-common-tenant + + + + org.dromara + ruoyi-common-security + + + + org.dromara + ruoyi-common-web + + + + org.dromara + ruoyi-common-idempotent + + + + org.dromara + ruoyi-common-sensitive + + + + org.dromara + ruoyi-common-encrypt + + + + org.dromara + ruoyi-common-websocket + + + + diff --git a/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/Main.java b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/Main.java new file mode 100644 index 000000000..229dacb03 --- /dev/null +++ b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/Main.java @@ -0,0 +1,7 @@ +package org.dromara; + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/controller/TrainingCoursesController.java b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/controller/TrainingCoursesController.java new file mode 100644 index 000000000..e96c8653b --- /dev/null +++ b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/controller/TrainingCoursesController.java @@ -0,0 +1,105 @@ +package org.dromara.imok.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.imok.domain.vo.TrainingCoursesVo; +import org.dromara.imok.domain.bo.TrainingCoursesBo; +import org.dromara.imok.service.ITrainingCoursesService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 培训课程管理 + * + * @author sungk + * @date 2024-04-19 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/imok/courses") +public class TrainingCoursesController extends BaseController { + + private final ITrainingCoursesService trainingCoursesService; + + /** + * 查询培训课程管理列表 + */ + @SaCheckPermission("imok:courses:list") + @GetMapping("/list") + public TableDataInfo list(TrainingCoursesBo bo, PageQuery pageQuery) { + return trainingCoursesService.queryPageList(bo, pageQuery); + } + + /** + * 导出培训课程管理列表 + */ + @SaCheckPermission("imok:courses:export") + @Log(title = "培训课程管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(TrainingCoursesBo bo, HttpServletResponse response) { + List list = trainingCoursesService.queryList(bo); + ExcelUtil.exportExcel(list, "培训课程管理", TrainingCoursesVo.class, response); + } + + /** + * 获取培训课程管理详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("imok:courses:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable String id) { + return R.ok(trainingCoursesService.queryById(id)); + } + + /** + * 新增培训课程管理 + */ + @SaCheckPermission("imok:courses:add") + @Log(title = "培训课程管理", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody TrainingCoursesBo bo) { + return toAjax(trainingCoursesService.insertByBo(bo)); + } + + /** + * 修改培训课程管理 + */ + @SaCheckPermission("imok:courses:edit") + @Log(title = "培训课程管理", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody TrainingCoursesBo bo) { + return toAjax(trainingCoursesService.updateByBo(bo)); + } + + /** + * 删除培训课程管理 + * + * @param ids 主键串 + */ + @SaCheckPermission("imok:courses:remove") + @Log(title = "培训课程管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable String[] ids) { + return toAjax(trainingCoursesService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/domain/TrainingCourses.java b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/domain/TrainingCourses.java new file mode 100644 index 000000000..10a3a1bd9 --- /dev/null +++ b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/domain/TrainingCourses.java @@ -0,0 +1,98 @@ +package org.dromara.imok.domain; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 培训课程管理对象 training_courses + * + * @author sungk + * @date 2024-04-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("training_courses") +public class TrainingCourses extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主健 + */ + @TableId(value = "id") + private String id; + + /** + * 课程名称 + */ + private String name; + + /** + * 课程类别 + */ + private String category; + + /** + * 课程介绍 + */ + private String description; + + /** + * 课程大纲 + */ + private String syllabus; + + /** + * 授课讲师 + */ + private String instructor; + + /** + * 讲师简介 + */ + private String instructorProfile; + + /** + * 开课日期 + */ + private Date startDate; + + /** + * 结课日期 + */ + private Date endDate; + + /** + * 上课地点 + */ + private String location; + + /** + * 课程状态 + */ + private String status; + + /** + * 创建时间 + */ + private Date createdAt; + + /** + * 更新时间 + */ + private Date updatedAt; + + /** + * 课程编号 + */ + private String courseId; + + +} diff --git a/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/domain/bo/TrainingCoursesBo.java b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/domain/bo/TrainingCoursesBo.java new file mode 100644 index 000000000..b00ebfc5b --- /dev/null +++ b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/domain/bo/TrainingCoursesBo.java @@ -0,0 +1,110 @@ +package org.dromara.imok.domain.bo; + +import org.dromara.imok.domain.TrainingCourses; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 培训课程管理业务对象 training_courses + * + * @author sungk + * @date 2024-04-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = TrainingCourses.class, reverseConvertGenerate = false) +public class TrainingCoursesBo extends BaseEntity { + + /** + * 主健 + */ + @NotBlank(message = "主健不能为空", groups = { EditGroup.class }) + private String id; + + /** + * 课程名称 + */ + @NotBlank(message = "课程名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String name; + + /** + * 课程类别 + */ + @NotBlank(message = "课程类别不能为空", groups = { AddGroup.class, EditGroup.class }) + private String category; + + /** + * 课程介绍 + */ + @NotBlank(message = "课程介绍不能为空", groups = { AddGroup.class, EditGroup.class }) + private String description; + + /** + * 课程大纲 + */ + @NotBlank(message = "课程大纲不能为空", groups = { AddGroup.class, EditGroup.class }) + private String syllabus; + + /** + * 授课讲师 + */ + @NotBlank(message = "授课讲师不能为空", groups = { AddGroup.class, EditGroup.class }) + private String instructor; + + /** + * 讲师简介 + */ + @NotBlank(message = "讲师简介不能为空", groups = { AddGroup.class, EditGroup.class }) + private String instructorProfile; + + /** + * 开课日期 + */ + @NotNull(message = "开课日期不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date startDate; + + /** + * 结课日期 + */ + @NotNull(message = "结课日期不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date endDate; + + /** + * 上课地点 + */ + @NotBlank(message = "上课地点不能为空", groups = { AddGroup.class, EditGroup.class }) + private String location; + + /** + * 课程状态 + */ + @NotBlank(message = "课程状态不能为空", groups = { AddGroup.class, EditGroup.class }) + private String status; + + /** + * 创建时间 + */ + @NotNull(message = "创建时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date createdAt; + + /** + * 更新时间 + */ + @NotNull(message = "更新时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date updatedAt; + + /** + * 课程编号 + */ + @NotBlank(message = "课程编号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String courseId; + + +} diff --git a/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/domain/vo/TrainingCoursesVo.java b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/domain/vo/TrainingCoursesVo.java new file mode 100644 index 000000000..009c72fd6 --- /dev/null +++ b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/domain/vo/TrainingCoursesVo.java @@ -0,0 +1,118 @@ +package org.dromara.imok.domain.vo; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.imok.domain.TrainingCourses; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 培训课程管理视图对象 training_courses + * + * @author sungk + * @date 2024-04-19 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = TrainingCourses.class) +public class TrainingCoursesVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主健 + */ + @ExcelProperty(value = "主健") + private String id; + + /** + * 课程名称 + */ + @ExcelProperty(value = "课程名称") + private String name; + + /** + * 课程类别 + */ + @ExcelProperty(value = "课程类别") + private String category; + + /** + * 课程介绍 + */ + @ExcelProperty(value = "课程介绍") + private String description; + + /** + * 课程大纲 + */ + @ExcelProperty(value = "课程大纲") + private String syllabus; + + /** + * 授课讲师 + */ + @ExcelProperty(value = "授课讲师") + private String instructor; + + /** + * 讲师简介 + */ + @ExcelProperty(value = "讲师简介") + private String instructorProfile; + + /** + * 开课日期 + */ + @ExcelProperty(value = "开课日期") + private Date startDate; + + /** + * 结课日期 + */ + @ExcelProperty(value = "结课日期") + private Date endDate; + + /** + * 上课地点 + */ + @ExcelProperty(value = "上课地点") + private String location; + + /** + * 课程状态 + */ + @ExcelProperty(value = "课程状态") + private String status; + + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private Date createdAt; + + /** + * 更新时间 + */ + @ExcelProperty(value = "更新时间") + private Date updatedAt; + + /** + * 课程编号 + */ + @ExcelProperty(value = "课程编号") + private String courseId; + + +} diff --git a/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/mapper/TrainingCoursesMapper.java b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/mapper/TrainingCoursesMapper.java new file mode 100644 index 000000000..0f946c393 --- /dev/null +++ b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/mapper/TrainingCoursesMapper.java @@ -0,0 +1,15 @@ +package org.dromara.imok.mapper; + +import org.dromara.imok.domain.TrainingCourses; +import org.dromara.imok.domain.vo.TrainingCoursesVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 培训课程管理Mapper接口 + * + * @author sungk + * @date 2024-04-19 + */ +public interface TrainingCoursesMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/service/ITrainingCoursesService.java b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/service/ITrainingCoursesService.java new file mode 100644 index 000000000..e1d6d1ccf --- /dev/null +++ b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/service/ITrainingCoursesService.java @@ -0,0 +1,49 @@ +package org.dromara.imok.service; + +import org.dromara.imok.domain.TrainingCourses; +import org.dromara.imok.domain.vo.TrainingCoursesVo; +import org.dromara.imok.domain.bo.TrainingCoursesBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 培训课程管理Service接口 + * + * @author sungk + * @date 2024-04-19 + */ +public interface ITrainingCoursesService { + + /** + * 查询培训课程管理 + */ + TrainingCoursesVo queryById(String id); + + /** + * 查询培训课程管理列表 + */ + TableDataInfo queryPageList(TrainingCoursesBo bo, PageQuery pageQuery); + + /** + * 查询培训课程管理列表 + */ + List queryList(TrainingCoursesBo bo); + + /** + * 新增培训课程管理 + */ + Boolean insertByBo(TrainingCoursesBo bo); + + /** + * 修改培训课程管理 + */ + Boolean updateByBo(TrainingCoursesBo bo); + + /** + * 校验并批量删除培训课程管理信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/service/impl/TrainingCoursesServiceImpl.java b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/service/impl/TrainingCoursesServiceImpl.java new file mode 100644 index 000000000..f0ffad476 --- /dev/null +++ b/ruoyi-modules/ruoyi-imok-test/src/main/java/org/dromara/imok/service/impl/TrainingCoursesServiceImpl.java @@ -0,0 +1,125 @@ +package org.dromara.imok.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import jakarta.annotation.Resource; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.dromara.imok.domain.bo.TrainingCoursesBo; +import org.dromara.imok.domain.vo.TrainingCoursesVo; +import org.dromara.imok.domain.TrainingCourses; +import org.dromara.imok.mapper.TrainingCoursesMapper; +import org.dromara.imok.service.ITrainingCoursesService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 培训课程管理Service业务层处理 + * + * @author sungk + * @date 2024-04-19 + */ +@RequiredArgsConstructor +@Service +@DS("oracle") +public class TrainingCoursesServiceImpl implements ITrainingCoursesService { + + @Resource + private final TrainingCoursesMapper baseMapper; + + /** + * 查询培训课程管理 + */ + @Override + public TrainingCoursesVo queryById(String id){ + return baseMapper.selectVoById(id); + } + + /** + * 查询培训课程管理列表 + */ + @Override + public TableDataInfo queryPageList(TrainingCoursesBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询培训课程管理列表 + */ + @Override + public List queryList(TrainingCoursesBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(TrainingCoursesBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.like(StringUtils.isNotBlank(bo.getName()), TrainingCourses::getName, bo.getName()); + lqw.eq(StringUtils.isNotBlank(bo.getCategory()), TrainingCourses::getCategory, bo.getCategory()); + lqw.eq(StringUtils.isNotBlank(bo.getDescription()), TrainingCourses::getDescription, bo.getDescription()); + lqw.eq(StringUtils.isNotBlank(bo.getSyllabus()), TrainingCourses::getSyllabus, bo.getSyllabus()); + lqw.eq(StringUtils.isNotBlank(bo.getInstructor()), TrainingCourses::getInstructor, bo.getInstructor()); + lqw.eq(StringUtils.isNotBlank(bo.getInstructorProfile()), TrainingCourses::getInstructorProfile, bo.getInstructorProfile()); + lqw.eq(bo.getStartDate() != null, TrainingCourses::getStartDate, bo.getStartDate()); + lqw.eq(bo.getEndDate() != null, TrainingCourses::getEndDate, bo.getEndDate()); + lqw.eq(StringUtils.isNotBlank(bo.getLocation()), TrainingCourses::getLocation, bo.getLocation()); + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), TrainingCourses::getStatus, bo.getStatus()); + lqw.eq(bo.getCreatedAt() != null, TrainingCourses::getCreatedAt, bo.getCreatedAt()); + lqw.eq(bo.getUpdatedAt() != null, TrainingCourses::getUpdatedAt, bo.getUpdatedAt()); + lqw.eq(StringUtils.isNotBlank(bo.getCourseId()), TrainingCourses::getCourseId, bo.getCourseId()); + return lqw; + } + + /** + * 新增培训课程管理 + */ + @Override + public Boolean insertByBo(TrainingCoursesBo bo) { + TrainingCourses add = MapstructUtils.convert(bo, TrainingCourses.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改培训课程管理 + */ + @Override + public Boolean updateByBo(TrainingCoursesBo bo) { + TrainingCourses update = MapstructUtils.convert(bo, TrainingCourses.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(TrainingCourses entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除培训课程管理 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } +}