From 5ea1141cd8456ecdbb8510d66d4b1151d2d50b2f Mon Sep 17 00:00:00 2001 From: PQZ Date: Thu, 16 Jan 2025 21:06:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=95=99=E7=BB=83=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/DlDriveSchoolCoachController.java | 91 +++++++++++++++++ .../base/controller/admin/TestController.java | 4 - .../base/entity/DlDriveSchoolCoach.java | 98 +++++++++++++++++++ .../yudao/module/base/entity/TestEntity.java | 4 - .../base/mapper/DlDriveSchoolCoachMapper.java | 32 ++++++ .../yudao/module/base/mapper/TestMapper.java | 4 - .../service/DlDriveSchoolCoachService.java | 63 ++++++++++++ .../module/base/service/TestService.java | 4 - .../impl/DlDriveSchoolCoachServiceImpl.java | 73 ++++++++++++++ .../base/service/impl/TestServiceImpl.java | 4 - .../base/vo/DlDriveSchoolCoachPageReqVO.java | 15 +++ .../base/vo/DlDriveSchoolCoachRespVO.java | 13 +++ .../base/vo/DlDriveSchoolCoachSaveReqVO.java | 11 +++ .../iocoder/yudao/module/base/vo/TestVo.java | 4 - .../mapper/base/DlDriveSchoolCoachMapper.xml | 24 +++++ 15 files changed, 420 insertions(+), 24 deletions(-) create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/DlDriveSchoolCoachController.java delete mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/TestController.java create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCoach.java delete mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/TestEntity.java create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCoachMapper.java delete mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/TestMapper.java create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCoachService.java delete mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/TestService.java create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCoachServiceImpl.java delete mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/TestServiceImpl.java create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachPageReqVO.java create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachRespVO.java create mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachSaveReqVO.java delete mode 100644 dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/TestVo.java create mode 100644 dl-module-jx/src/main/resources/mapper/base/DlDriveSchoolCoachMapper.xml 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 new file mode 100644 index 00000000..8db4bae1 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/DlDriveSchoolCoachController.java @@ -0,0 +1,91 @@ +package cn.iocoder.yudao.module.base.controller.admin; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach; +import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachService; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachSaveReqVO; +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.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 驾校教练") +@RestController +@RequestMapping("/base/dl-drive-school-coach") +@Validated +public class DlDriveSchoolCoachController { + + @Resource + private DlDriveSchoolCoachService dlDriveSchoolCoachService; + + /** + * 驾校教练、普通员工列表 + * + * @param pageReqVO {@link DlDriveSchoolCoachPageReqVO} + * @param pageNo 分页参数第几页 + * @param pageSize 分页参数每页多少条数据 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult> + * @author PQZ + * @date 14:58 2025/1/16 + **/ + @GetMapping("/page") + @Operation(summary = "获得驾校教练分页") + public CommonResult> getDlDriveSchoolCoachPage(DlDriveSchoolCoachPageReqVO pageReqVO, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + Page page = new Page<>(pageNo, pageSize); + return success(dlDriveSchoolCoachService.queryListPage(pageReqVO, page)); + } + + /** + * 新增驾校教练 + * + * @param createReqVO {@link DlDriveSchoolCoachSaveReqVO} + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 16:19 2025/1/16 + **/ + @PostMapping("/create") + @Operation(summary = "创建驾校教练") + public CommonResult createDlDriveSchoolCoach(@Valid @RequestBody DlDriveSchoolCoachSaveReqVO createReqVO) { + dlDriveSchoolCoachService.createDlDriveSchoolCoach(createReqVO); + return success(true); + } + + @PutMapping("/update") + @Operation(summary = "更新驾校教练") + public CommonResult updateDlDriveSchoolCoach(@Valid @RequestBody DlDriveSchoolCoachSaveReqVO updateReqVO) { + dlDriveSchoolCoachService.updateDlDriveSchoolCoach(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除驾校教练") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deleteDlDriveSchoolCoach(@RequestParam("id") String id) { + dlDriveSchoolCoachService.deleteDlDriveSchoolCoach(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得驾校教练") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getDlDriveSchoolCoach(@RequestParam("id") String id) { + DlDriveSchoolCoach dlDriveSchoolCoach = dlDriveSchoolCoachService.getDlDriveSchoolCoach(id); + return success(BeanUtils.toBean(dlDriveSchoolCoach, DlDriveSchoolCoachRespVO.class)); + } + + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/TestController.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/TestController.java deleted file mode 100644 index c86fa884..00000000 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/controller/admin/TestController.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.iocoder.yudao.module.base.controller.admin; - -public class TestController { -} diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCoach.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCoach.java new file mode 100644 index 00000000..63cdfe3a --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCoach.java @@ -0,0 +1,98 @@ +package cn.iocoder.yudao.module.base.entity; + +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 驾校教练 DO + * + * @author pqz + */ +@TableName("drive_school_coach") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DlDriveSchoolCoach extends TenantBaseDO { + + /** + * 主键id + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; + /** + * 照片 + */ + private String image; + /** + * 姓名 + */ + private String name; + /** + * 年龄 + */ + private Integer age; + /** + * 性别 + * + */ + private String sex; + /** + * 联系电话 + */ + private String phone; + /** + * 身份证号 + */ + private String idNumber; + /** + * 车牌 + */ + private String carId; + /** + * 户籍地址 + */ + private String regAddress; + /** + * 家庭住址 + */ + private String address; + /** + * 教龄 + */ + private Integer seniority; + /** + * 个人简介 + */ + private String instructorDesc; + /** + * 工作人员类型(教练、工作人员) + */ + private String type; + /** + * 用户id + */ + private Integer userId; + /** + * 身份证 + */ + private String idPhoto; + /** + * 生活照 + */ + private String lifePhoto; + /** + * 驾驶证 + */ + private String drivePhoto; + /** + * 其他证件 + */ + private String otherPhoto; + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/TestEntity.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/TestEntity.java deleted file mode 100644 index 5ff0fe6b..00000000 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/TestEntity.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.iocoder.yudao.module.base.entity; - -public class TestEntity { -} diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCoachMapper.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCoachMapper.java new file mode 100644 index 00000000..124b8cbf --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCoachMapper.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.base.mapper; + +import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO; +import cn.iocoder.yudao.module.member.vo.MemberLevelRespVO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 驾校教练 Mapper + * + * @author pqz + */ +@Mapper +public interface DlDriveSchoolCoachMapper extends BaseMapper { + + /** + * 驾校教练、普通员工列表 + * + * @param entity {@link DlDriveSchoolCoachPageReqVO} + * @param page 分页参数 + * @return com.baomidou.mybatisplus.core.metadata.IPage + * @author PQZ + * @date 15:04 2025/1/16 + **/ + IPage queryListPage(@Param("entity") DlDriveSchoolCoachPageReqVO entity, Page page); + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/TestMapper.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/TestMapper.java deleted file mode 100644 index d8629f09..00000000 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/TestMapper.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.iocoder.yudao.module.base.mapper; - -public class TestMapper { -} diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCoachService.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCoachService.java new file mode 100644 index 00000000..ed2a318e --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCoachService.java @@ -0,0 +1,63 @@ +package cn.iocoder.yudao.module.base.service; + +import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachSaveReqVO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; + +import javax.validation.Valid; + +/** + * 驾校教练 Service 接口 + * + * @author pqz + */ +public interface DlDriveSchoolCoachService extends IService { + + /** + * 驾校教练、普通员工列表 + * + * @param pageReqVO {@link DlDriveSchoolCoachPageReqVO} + * @param page 分页参数 + * @return com.baomidou.mybatisplus.core.metadata.IPage + * @author PQZ + * @date 15:02 2025/1/16 + **/ + IPage queryListPage(DlDriveSchoolCoachPageReqVO pageReqVO, Page page); + + /** + * 创建驾校教练 + * + * @param createReqVO {@link DlDriveSchoolCoachSaveReqVO} + * @author PQZ + * @date 2025/1/16 + **/ + void createDlDriveSchoolCoach(@Valid DlDriveSchoolCoachSaveReqVO createReqVO); + + /** + * 更新驾校教练 + * + * @param updateReqVO 更新信息 + */ + void updateDlDriveSchoolCoach(@Valid DlDriveSchoolCoachSaveReqVO updateReqVO); + + /** + * 删除驾校教练 + * + * @param id 编号 + */ + void deleteDlDriveSchoolCoach(String id); + + /** + * 获得驾校教练 + * + * @param id 编号 + * @return 驾校教练 + */ + DlDriveSchoolCoach getDlDriveSchoolCoach(String id); + + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/TestService.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/TestService.java deleted file mode 100644 index d788e8ae..00000000 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/TestService.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.iocoder.yudao.module.base.service; - -public class TestService { -} diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCoachServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCoachServiceImpl.java new file mode 100644 index 00000000..e748884b --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCoachServiceImpl.java @@ -0,0 +1,73 @@ +package cn.iocoder.yudao.module.base.service.impl; + +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach; +import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCoachMapper; +import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachService; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO; +import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachSaveReqVO; +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 javax.annotation.Resource; + +/** + * 驾校教练 Service 实现类 + * + * @author pqz + */ +@Service +@Validated +public class DlDriveSchoolCoachServiceImpl extends ServiceImpl implements DlDriveSchoolCoachService { + + @Resource + private DlDriveSchoolCoachMapper dlDriveSchoolCoachMapper; + + /** + * 驾校教练、普通员工列表 + * + * @param pageReqVO {@link DlDriveSchoolCoachPageReqVO} + * @param page 分页参数 + * @return com.baomidou.mybatisplus.core.metadata.IPage + * @author PQZ + * @date 15:02 2025/1/16 + **/ + @Override + public IPage queryListPage(DlDriveSchoolCoachPageReqVO pageReqVO, Page page) { + return dlDriveSchoolCoachMapper.queryListPage(pageReqVO,page); + } + + @Override + public void createDlDriveSchoolCoach(DlDriveSchoolCoachSaveReqVO createReqVO) { + // 插入 + DlDriveSchoolCoach dlDriveSchoolCoach = BeanUtils.toBean(createReqVO, DlDriveSchoolCoach.class); + dlDriveSchoolCoachMapper.insert(dlDriveSchoolCoach); + + } + + @Override + public void updateDlDriveSchoolCoach(DlDriveSchoolCoachSaveReqVO updateReqVO) { + // 校验存在 + DlDriveSchoolCoach updateObj = BeanUtils.toBean(updateReqVO, DlDriveSchoolCoach.class); + dlDriveSchoolCoachMapper.updateById(updateObj); + } + + @Override + public void deleteDlDriveSchoolCoach(String id) { + // 删除 + dlDriveSchoolCoachMapper.deleteById(id); + } + + + + @Override + public DlDriveSchoolCoach getDlDriveSchoolCoach(String id) { + return dlDriveSchoolCoachMapper.selectById(id); + } + + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/TestServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/TestServiceImpl.java deleted file mode 100644 index 39c3b314..00000000 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/TestServiceImpl.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.iocoder.yudao.module.base.service.impl; - -public class TestServiceImpl { -} diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachPageReqVO.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachPageReqVO.java new file mode 100644 index 00000000..5dd63ee5 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachPageReqVO.java @@ -0,0 +1,15 @@ +package cn.iocoder.yudao.module.base.vo; + +import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - 驾校教练分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DlDriveSchoolCoachPageReqVO extends DlDriveSchoolCoach { + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachRespVO.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachRespVO.java new file mode 100644 index 00000000..ea17e396 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachRespVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.module.base.vo; + +import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 驾校教练 Response VO") +@Data +@ExcelIgnoreUnannotated +public class DlDriveSchoolCoachRespVO extends DlDriveSchoolCoach { + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachSaveReqVO.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachSaveReqVO.java new file mode 100644 index 00000000..6e664df2 --- /dev/null +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/DlDriveSchoolCoachSaveReqVO.java @@ -0,0 +1,11 @@ +package cn.iocoder.yudao.module.base.vo; + +import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 驾校教练新增/修改 Request VO") +@Data +public class DlDriveSchoolCoachSaveReqVO extends DlDriveSchoolCoach { + +} \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/TestVo.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/TestVo.java deleted file mode 100644 index fbecf357..00000000 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/vo/TestVo.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.iocoder.yudao.module.base.vo; - -public class TestVo { -} diff --git a/dl-module-jx/src/main/resources/mapper/base/DlDriveSchoolCoachMapper.xml b/dl-module-jx/src/main/resources/mapper/base/DlDriveSchoolCoachMapper.xml new file mode 100644 index 00000000..e9e8ed70 --- /dev/null +++ b/dl-module-jx/src/main/resources/mapper/base/DlDriveSchoolCoachMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + \ No newline at end of file From 3e8480c3907113969e403fda5bc692c07a83b291 Mon Sep 17 00:00:00 2001 From: PQZ Date: Thu, 16 Jan 2025 21:44:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=95=99=E7=BB=83=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/DlDriveSchoolCoachController.java | 29 +++--- .../base/entity/DlDriveSchoolCoach.java | 2 +- .../base/mapper/DlDriveSchoolCoachMapper.java | 1 - .../service/DlDriveSchoolCoachService.java | 22 ++--- .../impl/DlDriveSchoolCoachServiceImpl.java | 95 +++++++++++++++---- 5 files changed, 105 insertions(+), 44 deletions(-) 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 8db4bae1..b80c0fa8 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 @@ -12,7 +12,6 @@ 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.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -50,7 +49,7 @@ public class DlDriveSchoolCoachController { } /** - * 新增驾校教练 + * 保存驾校教练 * * @param createReqVO {@link DlDriveSchoolCoachSaveReqVO} * @return cn.iocoder.yudao.framework.common.pojo.CommonResult @@ -59,18 +58,19 @@ public class DlDriveSchoolCoachController { **/ @PostMapping("/create") @Operation(summary = "创建驾校教练") - public CommonResult createDlDriveSchoolCoach(@Valid @RequestBody DlDriveSchoolCoachSaveReqVO createReqVO) { - dlDriveSchoolCoachService.createDlDriveSchoolCoach(createReqVO); - return success(true); - } - - @PutMapping("/update") - @Operation(summary = "更新驾校教练") - public CommonResult updateDlDriveSchoolCoach(@Valid @RequestBody DlDriveSchoolCoachSaveReqVO updateReqVO) { - dlDriveSchoolCoachService.updateDlDriveSchoolCoach(updateReqVO); + public CommonResult saveSchoolCoach(@Valid @RequestBody DlDriveSchoolCoachSaveReqVO createReqVO) { + dlDriveSchoolCoachService.saveSchoolCoach(createReqVO); return success(true); } + /** + * 通过id删除驾校教练 + * + * @param id 教练id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 21:40 2025/1/16 + **/ @DeleteMapping("/delete") @Operation(summary = "删除驾校教练") @Parameter(name = "id", description = "编号", required = true) @@ -79,6 +79,13 @@ public class DlDriveSchoolCoachController { return success(true); } + /** + * 通过教练id获取驾校教练 + * @author PQZ + * @date 21:41 2025/1/16 + * @param id 教练id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ @GetMapping("/get") @Operation(summary = "获得驾校教练") @Parameter(name = "id", description = "编号", required = true, example = "1024") diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCoach.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCoach.java index 63cdfe3a..0175136d 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCoach.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/entity/DlDriveSchoolCoach.java @@ -77,7 +77,7 @@ public class DlDriveSchoolCoach extends TenantBaseDO { /** * 用户id */ - private Integer userId; + private Long userId; /** * 身份证 */ diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCoachMapper.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCoachMapper.java index 124b8cbf..06595b84 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCoachMapper.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/mapper/DlDriveSchoolCoachMapper.java @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.base.mapper; import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach; import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO; import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO; -import cn.iocoder.yudao.module.member.vo.MemberLevelRespVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCoachService.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCoachService.java index ed2a318e..983d61c7 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCoachService.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/DlDriveSchoolCoachService.java @@ -29,26 +29,20 @@ public interface DlDriveSchoolCoachService extends IService IPage queryListPage(DlDriveSchoolCoachPageReqVO pageReqVO, Page page); /** - * 创建驾校教练 + * 保存驾校教练 * * @param createReqVO {@link DlDriveSchoolCoachSaveReqVO} - * @author PQZ - * @date 2025/1/16 + * @author PQZ @date 2025/1/16 **/ - void createDlDriveSchoolCoach(@Valid DlDriveSchoolCoachSaveReqVO createReqVO); - - /** - * 更新驾校教练 - * - * @param updateReqVO 更新信息 - */ - void updateDlDriveSchoolCoach(@Valid DlDriveSchoolCoachSaveReqVO updateReqVO); + void saveSchoolCoach(@Valid DlDriveSchoolCoachSaveReqVO createReqVO); /** * 删除驾校教练 * - * @param id 编号 - */ + * @param id 教练id + * @author PQZ + * @date 21:39 2025/1/16 + **/ void deleteDlDriveSchoolCoach(String id); /** @@ -57,7 +51,7 @@ public interface DlDriveSchoolCoachService extends IService * @param id 编号 * @return 驾校教练 */ - DlDriveSchoolCoach getDlDriveSchoolCoach(String id); + DlDriveSchoolCoachRespVO getDlDriveSchoolCoach(String id); } \ No newline at end of file diff --git a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCoachServiceImpl.java b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCoachServiceImpl.java index e748884b..1e8a9462 100644 --- a/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCoachServiceImpl.java +++ b/dl-module-jx/src/main/java/cn/iocoder/yudao/module/base/service/impl/DlDriveSchoolCoachServiceImpl.java @@ -7,13 +7,24 @@ import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachService; import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO; import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO; import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachSaveReqVO; +import cn.iocoder.yudao.module.system.api.permission.PermissionApi; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; +import cn.iocoder.yudao.module.system.api.user.dto.UserDTO; 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.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; +import java.util.HashSet; +import java.util.Set; + +import static cn.iocoder.yudao.common.BaseConstants.PASSWORD_DEFAULT; +import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_STAFF; /** * 驾校教练 Service 实现类 @@ -26,6 +37,11 @@ public class DlDriveSchoolCoachServiceImpl extends ServiceImpl queryListPage(DlDriveSchoolCoachPageReqVO pageReqVO, Page page) { - return dlDriveSchoolCoachMapper.queryListPage(pageReqVO,page); + return dlDriveSchoolCoachMapper.queryListPage(pageReqVO, page); } + /** + * 保存驾校教练 + * + * @param createReqVO {@link DlDriveSchoolCoachSaveReqVO} + * @author PQZ + * @date 21:07 2025/1/16 + **/ @Override - public void createDlDriveSchoolCoach(DlDriveSchoolCoachSaveReqVO createReqVO) { - // 插入 + @Transactional(rollbackFor = Exception.class) + public void saveSchoolCoach(DlDriveSchoolCoachSaveReqVO createReqVO) { + /*1、数据类型转换*/ DlDriveSchoolCoach dlDriveSchoolCoach = BeanUtils.toBean(createReqVO, DlDriveSchoolCoach.class); - dlDriveSchoolCoachMapper.insert(dlDriveSchoolCoach); - - } - - @Override - public void updateDlDriveSchoolCoach(DlDriveSchoolCoachSaveReqVO updateReqVO) { - // 校验存在 - DlDriveSchoolCoach updateObj = BeanUtils.toBean(updateReqVO, DlDriveSchoolCoach.class); - dlDriveSchoolCoachMapper.updateById(updateObj); + if (null == createReqVO.getUserId()) { + /*2、新增教练或编辑教练无用户id时,同时插入一条用户数据*/ + //通过手机号查询用户 + AdminUserRespDTO userDTO = adminUserApi.getUserByUsername(createReqVO.getPhone()); + Long userId; + //存在两种情况,1、用户存在,2、用户不存在 + if (null == userDTO) { + UserDTO user = new UserDTO(); + //如果不存在创建用户; + user.setUsername(createReqVO.getPhone()); + user.setNickname(createReqVO.getName()); + //默认密码 + user.setPassword(PASSWORD_DEFAULT); + user.setMobile(createReqVO.getPhone()); + //用户类型员工 + user.setUserType(USER_TYPE_STAFF); + //创建客户 + userId = adminUserApi.createUser(user); + //创建客户后为客户绑定角色 + Set roleCodes = new HashSet<>(); + // TODO: 2025/1/16 枚举值问老马(保存角色方法不对) + permissionApi.assignUserRole(userId, roleCodes); + } else { + userId = userDTO.getId(); + } + dlDriveSchoolCoach.setUserId(userId); + } + /*3、保存教练信息*/ + saveOrUpdate(dlDriveSchoolCoach); } + /** + * 删除驾校教练 + * + * @param id 教练id + * @author PQZ + * @date 21:39 2025/1/16 + **/ @Override public void deleteDlDriveSchoolCoach(String id) { - // 删除 - dlDriveSchoolCoachMapper.deleteById(id); + removeById(id); } - + /** + * 通过id查询教练信息 + * + * @param id 教练id + * @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO + * @author PQZ + * @date 21:43 2025/1/16 + **/ @Override - public DlDriveSchoolCoach getDlDriveSchoolCoach(String id) { - return dlDriveSchoolCoachMapper.selectById(id); + public DlDriveSchoolCoachRespVO getDlDriveSchoolCoach(String id) { + //通过id查询教练信息 + DlDriveSchoolCoach schoolCoach = getById(id); + //数据类型转换 + DlDriveSchoolCoachRespVO result = BeanUtils.toBean(schoolCoach, DlDriveSchoolCoachRespVO.class); + return result; } From ba96bbd7900f6dec854a83fffd5a3e98ce560128 Mon Sep 17 00:00:00 2001 From: PQZ Date: Thu, 16 Jan 2025 22:39:49 +0800 Subject: [PATCH 3/3] 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 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> + * @author PQZ + * @date 22:20 2025/1/16 + **/ + @GetMapping("/page") + @Operation(summary = "分页获取课程信息") + public CommonResult> getDlDriveSchoolCoursePage(DlDriveSchoolCourseVO pageReqVO, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + Page page = new Page<>(pageNo, pageSize); + return success(courseService.queryListPage(pageReqVO, page)); + } + + /** + * 不分页获取课程信息 + * + * @param pageReqVO {@link DlDriveSchoolCourseVO} + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult> + * @author PQZ + * @date 22:22 2025/1/16 + **/ + @GetMapping("/list") + @Operation(summary = "不分页获取课程信息") + public CommonResult> getDlDriveSchoolCourseList(DlDriveSchoolCourseVO pageReqVO) { + return success(courseService.queryList(pageReqVO)); + } + + /** + * 保存课程信息 + * + * @param saveVO {@link DlDriveSchoolCourseVO} + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 22:24 2025/1/16 + **/ + @PostMapping("/save") + @Operation(summary = "创建驾校教练") + public CommonResult saveSchoolCoach(@Valid @RequestBody DlDriveSchoolCourseVO saveVO) { + courseService.saveDriveSchoolCourse(saveVO); + return success(true); + } + + + /** + * 删除课程信息 + * + * @param id 课程id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 22:25 2025/1/16 + **/ + @DeleteMapping("/delete") + @Operation(summary = "删除课程信息") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deleteCourse(@RequestParam("id") String id) { + courseService.deleteCourse(id); + return success(true); + } + + + /** + * 获取课程信息 + * + * @param id 课程id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 22:26 2025/1/16 + **/ + @GetMapping("/get") + @Operation(summary = "获取课程信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult 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 { + + +} \ 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 { + + /** + * 分页查询驾校课程 + * + * @param pageReqVO DlDriveSchoolCourseVO + * @param page 分页参数 + * @return com.baomidou.mybatisplus.core.metadata.IPage + * @author PQZ + * @date 22:04 2025/1/16 + **/ + IPage queryListPage(DlDriveSchoolCourseVO pageReqVO, Page page); + + /** + * 不分页查询驾校课程 + * + * @param courseVO {@link DlDriveSchoolCourseVO} + * @return java.util.List + * @author PQZ + * @date 22:07 2025/1/16 + **/ + List 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 implements DlDriveSchoolCourseService { + + + /** + * 分页查询驾校课程 + * + * @param pageReqVO {@link DlDriveSchoolCourseVO} + * @param page 分页参数 + * @return com.baomidou.mybatisplus.core.metadata.IPage + * @author PQZ + * @date 22:04 2025/1/16 + **/ + @Override + public IPage queryListPage(DlDriveSchoolCourseVO pageReqVO, Page page) { + return null; + } + + /** + * 不分页查询驾校课程 + * + * @param courseVO {@link DlDriveSchoolCourseVO} + * @return java.util.List + * @author PQZ + * @date 22:07 2025/1/16 + **/ + @Override + public List queryList(DlDriveSchoolCourseVO courseVO) { + LambdaQueryWrapper 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 { + +}