From ba96bbd7900f6dec854a83fffd5a3e98ce560128 Mon Sep 17 00:00:00 2001
From: PQZ <pangqingzhou@gmail.com>
Date: Thu, 16 Jan 2025 22:39:49 +0800
Subject: [PATCH] 111

---
 .../admin/DlDriveSchoolCoachController.java   |   2 +-
 .../admin/DlDriveSchoolCouseController.java   | 112 ++++++++++++++++++
 .../base/entity/DlDriveSchoolCourse.java      |  80 +++++++++++++
 .../mapper/DlDriveSchoolCourseMapper.java     |  16 +++
 .../service/DlDriveSchoolCourseService.java   |  67 +++++++++++
 .../impl/DlDriveSchoolCourseServiceImpl.java  | 101 ++++++++++++++++
 .../module/base/vo/DlDriveSchoolCourseVO.java |  17 +++
 7 files changed, 394 insertions(+), 1 deletion(-)
 create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/DlDriveSchoolCouseController.java
 create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCourse.java
 create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCourseMapper.java
 create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCourseService.java
 create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCourseServiceImpl.java
 create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCourseVO.java

diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/DlDriveSchoolCoachController.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/DlDriveSchoolCoachController.java
index b80c0fa8..f2358325 100644
--- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/DlDriveSchoolCoachController.java
+++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/DlDriveSchoolCoachController.java
@@ -56,7 +56,7 @@ public class DlDriveSchoolCoachController {
      * @author PQZ
      * @date 16:19 2025/1/16
      **/
-    @PostMapping("/create")
+    @PostMapping("/save")
     @Operation(summary = "创建驾校教练")
     public CommonResult<Boolean> saveSchoolCoach(@Valid @RequestBody DlDriveSchoolCoachSaveReqVO createReqVO) {
         dlDriveSchoolCoachService.saveSchoolCoach(createReqVO);
diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/DlDriveSchoolCouseController.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/DlDriveSchoolCouseController.java
new file mode 100644
index 00000000..c5f21c01
--- /dev/null
+++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/DlDriveSchoolCouseController.java
@@ -0,0 +1,112 @@
+package cn.iocoder.yudao.module.base.controller.admin;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseService;
+import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Tag(name = "管理后台 - 课程管理")
+@RestController
+@RequestMapping("/base/dl-drive-school-course")
+@Validated
+public class DlDriveSchoolCouseController {
+
+    @Resource
+    private DlDriveSchoolCourseService courseService;
+
+
+    /**
+     * 分页获取课程信息
+     *
+     * @param pageReqVO {@link DlDriveSchoolCourseVO}
+     * @param pageNo    分页参数-第几页
+     * @param pageSize  分页参数-当前页有多少条数据
+     * @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage < ?>>
+     * @author PQZ
+     * @date 22:20 2025/1/16
+     **/
+    @GetMapping("/page")
+    @Operation(summary = "分页获取课程信息")
+    public CommonResult<IPage<?>> getDlDriveSchoolCoursePage(DlDriveSchoolCourseVO pageReqVO,
+                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        Page<DlDriveSchoolCourseVO> page = new Page<>(pageNo, pageSize);
+        return success(courseService.queryListPage(pageReqVO, page));
+    }
+
+    /**
+     * 不分页获取课程信息
+     *
+     * @param pageReqVO {@link DlDriveSchoolCourseVO}
+     * @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.util.List < ?>>
+     * @author PQZ
+     * @date 22:22 2025/1/16
+     **/
+    @GetMapping("/list")
+    @Operation(summary = "不分页获取课程信息")
+    public CommonResult<List<?>> getDlDriveSchoolCourseList(DlDriveSchoolCourseVO pageReqVO) {
+        return success(courseService.queryList(pageReqVO));
+    }
+
+    /**
+     * 保存课程信息
+     *
+     * @param saveVO {@link DlDriveSchoolCourseVO}
+     * @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
+     * @author PQZ
+     * @date 22:24 2025/1/16
+     **/
+    @PostMapping("/save")
+    @Operation(summary = "创建驾校教练")
+    public CommonResult<Boolean> saveSchoolCoach(@Valid @RequestBody DlDriveSchoolCourseVO saveVO) {
+        courseService.saveDriveSchoolCourse(saveVO);
+        return success(true);
+    }
+
+
+    /**
+     * 删除课程信息
+     *
+     * @param id 课程id
+     * @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
+     * @author PQZ
+     * @date 22:25 2025/1/16
+     **/
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除课程信息")
+    @Parameter(name = "id", description = "编号", required = true)
+    public CommonResult<Boolean> deleteCourse(@RequestParam("id") String id) {
+        courseService.deleteCourse(id);
+        return success(true);
+    }
+
+
+    /**
+     * 获取课程信息
+     *
+     * @param id 课程id
+     * @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO>
+     * @author PQZ
+     * @date 22:26 2025/1/16
+     **/
+    @GetMapping("/get")
+    @Operation(summary = "获取课程信息")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    public CommonResult<DlDriveSchoolCourseVO> getDlDriveSchoolCoach(@RequestParam("id") String id) {
+        return success(courseService.queryDetailById(id));
+    }
+
+
+}
\ No newline at end of file
diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCourse.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCourse.java
new file mode 100644
index 00000000..2f3c92d1
--- /dev/null
+++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCourse.java
@@ -0,0 +1,80 @@
+package cn.iocoder.yudao.module.base.entity;
+
+import cn.iocoder.yudao.module.jx.core.page.TenantBaDO;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.*;
+
+import java.math.BigDecimal;
+
+/**
+ * 驾校课程实体
+ *
+ * @author pqz
+ */
+@TableName("drive_school_course")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class DlDriveSchoolCourse extends TenantBaDO {
+
+    /**
+     * 主键id
+     */
+    @TableId(type = IdType.ASSIGN_UUID)
+    private String id;
+
+    /**
+     * 车辆档位
+     */
+    private String automatic;
+
+    /**
+     * 驾照类型
+     */
+    private String license;
+
+    /**
+     * 驾驶证类型
+     */
+    private String type;
+
+    /**
+     * 课程名字
+     */
+    private String name;
+
+    /**
+     * 课程开始时间
+     */
+    private String dayStart;
+
+    /**
+     * 课程结束时间
+     */
+    private String dayEnd;
+    /**
+     * 价格
+     */
+    private BigDecimal price;
+    /**
+     * 封面图
+     */
+    private String photo;
+    /**
+     * 课程简介
+     */
+    private String describ;
+    /**
+     * 定金
+     */
+    private BigDecimal reserveMoney;
+    /**
+     * 交付定金的优惠
+     */
+    private double favour;
+}
diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCourseMapper.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCourseMapper.java
new file mode 100644
index 00000000..f802d85a
--- /dev/null
+++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCourseMapper.java
@@ -0,0 +1,16 @@
+package cn.iocoder.yudao.module.base.mapper;
+
+import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCourse;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 驾校课程Mapper
+ *
+ * @author pqz
+ */
+@Mapper
+public interface DlDriveSchoolCourseMapper extends BaseMapper<DlDriveSchoolCourse> {
+
+
+}
\ No newline at end of file
diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCourseService.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCourseService.java
new file mode 100644
index 00000000..7fa0549e
--- /dev/null
+++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCourseService.java
@@ -0,0 +1,67 @@
+package cn.iocoder.yudao.module.base.service;
+
+import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCourse;
+import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 驾校课程Service
+ *
+ * @author pqz
+ */
+public interface DlDriveSchoolCourseService extends IService<DlDriveSchoolCourse> {
+
+    /**
+     * 分页查询驾校课程
+     *
+     * @param pageReqVO DlDriveSchoolCourseVO
+     * @param page      分页参数
+     * @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO>
+     * @author PQZ
+     * @date 22:04 2025/1/16
+     **/
+    IPage<DlDriveSchoolCourseVO> queryListPage(DlDriveSchoolCourseVO pageReqVO, Page<DlDriveSchoolCourseVO> page);
+
+    /**
+     * 不分页查询驾校课程
+     *
+     * @param courseVO {@link DlDriveSchoolCourseVO}
+     * @return java.util.List<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO>
+     * @author PQZ
+     * @date 22:07 2025/1/16
+     **/
+    List<DlDriveSchoolCourse> queryList(DlDriveSchoolCourseVO courseVO);
+
+    /**
+     * 保存课程信息
+     *
+     * @param courseVO {@link DlDriveSchoolCourseVO}
+     * @author PQZ
+     * @date 22:12 2025/1/16
+     **/
+    void saveDriveSchoolCourse(DlDriveSchoolCourseVO courseVO);
+
+    /**
+     * 删除课程信息
+     *
+     * @param id 课程id
+     * @author PQZ
+     * @date 22:14 2025/1/16
+     **/
+    void deleteCourse(String id);
+
+    /**
+     * 通过id查询课程信息
+     *
+     * @param id 课程id
+     * @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO
+     * @author PQZ
+     * @date 22:15 2025/1/16
+     **/
+    DlDriveSchoolCourseVO queryDetailById(String id);
+
+}
\ No newline at end of file
diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCourseServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCourseServiceImpl.java
new file mode 100644
index 00000000..424aa875
--- /dev/null
+++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCourseServiceImpl.java
@@ -0,0 +1,101 @@
+package cn.iocoder.yudao.module.base.service.impl;
+
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCourse;
+import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCourseMapper;
+import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseService;
+import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO;
+import cn.iocoder.yudao.module.jx.core.page.TenantBaDO;
+import cn.iocoder.yudao.module.jx.utils.StringUtils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import java.util.List;
+
+/**
+ * 驾校教练 Service 实现类
+ *
+ * @author pqz
+ */
+@Service
+@Validated
+public class DlDriveSchoolCourseServiceImpl extends ServiceImpl<DlDriveSchoolCourseMapper, DlDriveSchoolCourse> implements DlDriveSchoolCourseService {
+
+
+    /**
+     * 分页查询驾校课程
+     *
+     * @param pageReqVO {@link DlDriveSchoolCourseVO}
+     * @param page      分页参数
+     * @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO>
+     * @author PQZ
+     * @date 22:04 2025/1/16
+     **/
+    @Override
+    public IPage<DlDriveSchoolCourseVO> queryListPage(DlDriveSchoolCourseVO pageReqVO, Page<DlDriveSchoolCourseVO> page) {
+        return null;
+    }
+
+    /**
+     * 不分页查询驾校课程
+     *
+     * @param courseVO {@link DlDriveSchoolCourseVO}
+     * @return java.util.List<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO>
+     * @author PQZ
+     * @date 22:07 2025/1/16
+     **/
+    @Override
+    public List<DlDriveSchoolCourse> queryList(DlDriveSchoolCourseVO courseVO) {
+        LambdaQueryWrapper<DlDriveSchoolCourse> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(TenantBaDO::getDeleted, 0);
+        if (StringUtils.isNotEmpty(courseVO.getName())) {
+            lambdaQueryWrapper.like(DlDriveSchoolCourse::getName, courseVO.getName());
+        }
+        return list(lambdaQueryWrapper);
+    }
+
+    /**
+     * 保存课程信息
+     *
+     * @param courseVO {@link DlDriveSchoolCourseVO}
+     * @author PQZ
+     * @date 22:12 2025/1/16
+     **/
+    @Override
+    public void saveDriveSchoolCourse(DlDriveSchoolCourseVO courseVO) {
+        saveOrUpdate(courseVO);
+    }
+
+    /**
+     * 删除课程信息
+     *
+     * @param id 课程id
+     * @author PQZ
+     * @date 22:14 2025/1/16
+     **/
+    @Override
+    public void deleteCourse(String id) {
+        removeById(id);
+    }
+
+    /**
+     * 通过id查询课程信息
+     *
+     * @param id 课程id
+     * @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO
+     * @author PQZ
+     * @date 22:15 2025/1/16
+     **/
+    @Override
+    public DlDriveSchoolCourseVO queryDetailById(String id) {
+        DlDriveSchoolCourse course = getById(id);
+        DlDriveSchoolCourseVO result = BeanUtils.toBean(course, DlDriveSchoolCourseVO.class);
+        return result;
+    }
+
+
+}
\ No newline at end of file
diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCourseVO.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCourseVO.java
new file mode 100644
index 00000000..40464e4e
--- /dev/null
+++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCourseVO.java
@@ -0,0 +1,17 @@
+package cn.iocoder.yudao.module.base.vo;
+
+import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCourse;
+import cn.iocoder.yudao.module.jx.core.page.TenantBaDO;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+
+import java.math.BigDecimal;
+
+@Schema(description = "驾校课程管理VO")
+@Data
+public class DlDriveSchoolCourseVO extends DlDriveSchoolCourse {
+
+}