From 4c45cb4ec11dde2cd08d33d67d44c7259028a2c6 Mon Sep 17 00:00:00 2001 From: gxwebsoft Date: Sat, 8 Jun 2024 22:06:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CourseCategoryController.java | 110 ++++++++++++++++++ ...nController.java => CourseController.java} | 59 +++++----- .../entity/{Lesson.java => Course.java} | 56 ++++++--- .../booking/entity/CourseCategory.java | 70 +++++++++++ .../booking/mapper/CourseCategoryMapper.java | 37 ++++++ .../{LessonMapper.java => CourseMapper.java} | 16 +-- .../mapper/xml/CourseCategoryMapper.xml | 66 +++++++++++ .../{LessonMapper.xml => CourseMapper.xml} | 39 +++++-- .../booking/param/CourseCategoryParam.java | 62 ++++++++++ .../{LessonParam.java => CourseParam.java} | 38 ++++-- .../service/CourseCategoryService.java | 42 +++++++ ...{LessonService.java => CourseService.java} | 22 ++-- .../impl/CourseCategoryServiceImpl.java | 47 ++++++++ .../service/impl/CourseServiceImpl.java | 47 ++++++++ .../service/impl/LessonServiceImpl.java | 47 -------- .../gxwebsoft/shop/mapper/xml/GoodsMapper.xml | 3 + .../com/gxwebsoft/shop/param/GoodsParam.java | 7 ++ .../gxwebsoft/generator/BookingGenerator.java | 4 +- 18 files changed, 643 insertions(+), 129 deletions(-) create mode 100644 src/main/java/com/gxwebsoft/booking/controller/CourseCategoryController.java rename src/main/java/com/gxwebsoft/booking/controller/{LessonController.java => CourseController.java} (58%) rename src/main/java/com/gxwebsoft/booking/entity/{Lesson.java => Course.java} (55%) create mode 100644 src/main/java/com/gxwebsoft/booking/entity/CourseCategory.java create mode 100644 src/main/java/com/gxwebsoft/booking/mapper/CourseCategoryMapper.java rename src/main/java/com/gxwebsoft/booking/mapper/{LessonMapper.java => CourseMapper.java} (55%) create mode 100644 src/main/java/com/gxwebsoft/booking/mapper/xml/CourseCategoryMapper.xml rename src/main/java/com/gxwebsoft/booking/mapper/xml/{LessonMapper.xml => CourseMapper.xml} (68%) create mode 100644 src/main/java/com/gxwebsoft/booking/param/CourseCategoryParam.java rename src/main/java/com/gxwebsoft/booking/param/{LessonParam.java => CourseParam.java} (70%) create mode 100644 src/main/java/com/gxwebsoft/booking/service/CourseCategoryService.java rename src/main/java/com/gxwebsoft/booking/service/{LessonService.java => CourseService.java} (51%) create mode 100644 src/main/java/com/gxwebsoft/booking/service/impl/CourseCategoryServiceImpl.java create mode 100644 src/main/java/com/gxwebsoft/booking/service/impl/CourseServiceImpl.java delete mode 100644 src/main/java/com/gxwebsoft/booking/service/impl/LessonServiceImpl.java diff --git a/src/main/java/com/gxwebsoft/booking/controller/CourseCategoryController.java b/src/main/java/com/gxwebsoft/booking/controller/CourseCategoryController.java new file mode 100644 index 0000000..dc7ab06 --- /dev/null +++ b/src/main/java/com/gxwebsoft/booking/controller/CourseCategoryController.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.booking.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.booking.service.CourseCategoryService; +import com.gxwebsoft.booking.entity.CourseCategory; +import com.gxwebsoft.booking.param.CourseCategoryParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 课程分类控制器 + * + * @author 科技小王子 + * @since 2024-06-08 15:00:52 + */ +@Api(tags = "课程分类管理") +@RestController +@RequestMapping("/api/booking/course-category") +public class CourseCategoryController extends BaseController { + @Resource + private CourseCategoryService courseCategoryService; + + @ApiOperation("分页查询课程分类") + @GetMapping("/page") + public ApiResult> page(CourseCategoryParam param) { + // 使用关联查询 + return success(courseCategoryService.pageRel(param)); + } + + @ApiOperation("查询全部课程分类") + @GetMapping() + public ApiResult> list(CourseCategoryParam param) { + // 使用关联查询 + return success(courseCategoryService.listRel(param)); + } + + @PreAuthorize("hasAuthority('booking:courseCategory:list')") + @ApiOperation("根据id查询课程分类") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(courseCategoryService.getByIdRel(id)); + } + + @ApiOperation("添加课程分类") + @PostMapping() + public ApiResult save(@RequestBody CourseCategory courseCategory) { + if (courseCategoryService.save(courseCategory)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @ApiOperation("修改课程分类") + @PutMapping() + public ApiResult update(@RequestBody CourseCategory courseCategory) { + if (courseCategoryService.updateById(courseCategory)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @ApiOperation("删除课程分类") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (courseCategoryService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @ApiOperation("批量添加课程分类") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (courseCategoryService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @ApiOperation("批量修改课程分类") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(courseCategoryService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @ApiOperation("批量删除课程分类") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (courseCategoryService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/booking/controller/LessonController.java b/src/main/java/com/gxwebsoft/booking/controller/CourseController.java similarity index 58% rename from src/main/java/com/gxwebsoft/booking/controller/LessonController.java rename to src/main/java/com/gxwebsoft/booking/controller/CourseController.java index 04b6220..94a0dd5 100644 --- a/src/main/java/com/gxwebsoft/booking/controller/LessonController.java +++ b/src/main/java/com/gxwebsoft/booking/controller/CourseController.java @@ -1,9 +1,9 @@ package com.gxwebsoft.booking.controller; import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.booking.service.LessonService; -import com.gxwebsoft.booking.entity.Lesson; -import com.gxwebsoft.booking.param.LessonParam; +import com.gxwebsoft.booking.service.CourseService; +import com.gxwebsoft.booking.entity.Course; +import com.gxwebsoft.booking.param.CourseParam; import com.gxwebsoft.common.core.web.ApiResult; import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.common.core.web.PageParam; @@ -22,91 +22,90 @@ import java.util.List; * 课程管理控制器 * * @author 科技小王子 - * @since 2024-04-21 14:31:15 + * @since 2024-06-08 15:00:52 */ @Api(tags = "课程管理管理") @RestController -@RequestMapping("/api/booking/lesson") -public class LessonController extends BaseController { +@RequestMapping("/api/booking/course") +public class CourseController extends BaseController { @Resource - private LessonService lessonService; + private CourseService courseService; @ApiOperation("分页查询课程管理") @GetMapping("/page") - public ApiResult> page(LessonParam param) { + public ApiResult> page(CourseParam param) { // 使用关联查询 - return success(lessonService.pageRel(param)); + return success(courseService.pageRel(param)); } @ApiOperation("查询全部课程管理") @GetMapping() - public ApiResult> list(LessonParam param) { + public ApiResult> list(CourseParam param) { // 使用关联查询 - return success(lessonService.listRel(param)); + return success(courseService.listRel(param)); } - @PreAuthorize("hasAuthority('booking:lesson:list')") @ApiOperation("根据id查询课程管理") @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { + public ApiResult get(@PathVariable("id") Integer id) { // 使用关联查询 - return success(lessonService.getByIdRel(id)); + return success(courseService.getByIdRel(id)); } - + @PreAuthorize("hasAuthority('booking:course:save')") @ApiOperation("添加课程管理") @PostMapping() - public ApiResult save(@RequestBody Lesson lesson) { - // 记录当前登录用户id - // User loginUser = getLoginUser(); - // if (loginUser != null) { - // lesson.setUserId(loginUser.getUserId()); - // } - if (lessonService.save(lesson)) { + public ApiResult save(@RequestBody Course course) { + if (courseService.save(course)) { return success("添加成功"); } return fail("添加失败"); } + @PreAuthorize("hasAuthority('booking:course:update')") @ApiOperation("修改课程管理") @PutMapping() - public ApiResult update(@RequestBody Lesson lesson) { - if (lessonService.updateById(lesson)) { + public ApiResult update(@RequestBody Course course) { + if (courseService.updateById(course)) { return success("修改成功"); } return fail("修改失败"); } + @PreAuthorize("hasAuthority('booking:course:remove')") @ApiOperation("删除课程管理") @DeleteMapping("/{id}") public ApiResult remove(@PathVariable("id") Integer id) { - if (lessonService.removeById(id)) { + if (courseService.removeById(id)) { return success("删除成功"); } return fail("删除失败"); } + @PreAuthorize("hasAuthority('booking:course:save')") @ApiOperation("批量添加课程管理") @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (lessonService.saveBatch(list)) { + public ApiResult saveBatch(@RequestBody List list) { + if (courseService.saveBatch(list)) { return success("添加成功"); } return fail("添加失败"); } + @PreAuthorize("hasAuthority('booking:course:update')") @ApiOperation("批量修改课程管理") @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(lessonService, "lesson_id")) { + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(courseService, "course_id")) { return success("修改成功"); } return fail("修改失败"); } + @PreAuthorize("hasAuthority('booking:course:remove')") @ApiOperation("批量删除课程管理") @DeleteMapping("/batch") public ApiResult removeBatch(@RequestBody List ids) { - if (lessonService.removeByIds(ids)) { + if (courseService.removeByIds(ids)) { return success("删除成功"); } return fail("删除失败"); diff --git a/src/main/java/com/gxwebsoft/booking/entity/Lesson.java b/src/main/java/com/gxwebsoft/booking/entity/Course.java similarity index 55% rename from src/main/java/com/gxwebsoft/booking/entity/Lesson.java rename to src/main/java/com/gxwebsoft/booking/entity/Course.java index 77d7085..fef27b0 100644 --- a/src/main/java/com/gxwebsoft/booking/entity/Lesson.java +++ b/src/main/java/com/gxwebsoft/booking/entity/Course.java @@ -1,10 +1,15 @@ package com.gxwebsoft.booking.entity; +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import java.time.LocalDateTime; import java.io.Serializable; +import java.util.Date; + import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -14,36 +19,42 @@ import lombok.EqualsAndHashCode; * 课程管理 * * @author 科技小王子 - * @since 2024-04-21 14:31:15 + * @since 2024-06-08 15:00:52 */ @Data @EqualsAndHashCode(callSuper = false) -@ApiModel(value = "Lesson对象", description = "课程管理") -@TableName("booking_lesson") -public class Lesson implements Serializable { +@ApiModel(value = "Course对象", description = "课程管理") +@TableName("booking_course") +public class Course implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "ID") - @TableId(value = "lesson_id", type = IdType.AUTO) - private Integer lessonId; + @TableId(value = "course_id", type = IdType.AUTO) + private Integer courseId; @ApiModelProperty(value = "课程名称") - private String lessonName; + private String courseName; - @ApiModelProperty(value = "图标") + @ApiModelProperty(value = "封面图") private String image; @ApiModelProperty(value = "分类ID") private Integer categoryId; + @ApiModelProperty(value = "课程价格") + private BigDecimal price; + + @ApiModelProperty(value = "咨询电话") + private String phone; + @ApiModelProperty(value = "老师ID") private Integer teacherId; - @ApiModelProperty(value = "商户ID") - private Integer merchantId; - @ApiModelProperty(value = "上课时间") - private LocalDateTime startTime; + private Date startTime; + + @ApiModelProperty(value = "课时") + private Integer classPeriod; @ApiModelProperty(value = "报名人数上限") private Integer maxNumber; @@ -51,9 +62,24 @@ public class Lesson implements Serializable { @ApiModelProperty(value = "上课地点") private String address; + @ApiModelProperty(value = "详细介绍") + private String content; + + @ApiModelProperty(value = "课程相册") + private String files; + + @ApiModelProperty(value = "年龄限制") + private String ageLimit; + + @ApiModelProperty(value = "报名时间") + private String bmTime; + @ApiModelProperty(value = "备注") private String comments; + @ApiModelProperty(value = "商户ID") + private Integer merchantId; + @ApiModelProperty(value = "状态") private Integer status; @@ -64,6 +90,10 @@ public class Lesson implements Serializable { private Integer tenantId; @ApiModelProperty(value = "创建时间") - private LocalDateTime createTime; + private Date createTime; + + @ApiModelProperty(value = "商户名称") + @TableField(exist = false) + private String merchantName; } diff --git a/src/main/java/com/gxwebsoft/booking/entity/CourseCategory.java b/src/main/java/com/gxwebsoft/booking/entity/CourseCategory.java new file mode 100644 index 0000000..9104017 --- /dev/null +++ b/src/main/java/com/gxwebsoft/booking/entity/CourseCategory.java @@ -0,0 +1,70 @@ +package com.gxwebsoft.booking.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 课程分类 + * + * @author 科技小王子 + * @since 2024-06-08 15:00:52 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "CourseCategory对象", description = "课程分类") +@TableName("booking_course_category") +public class CourseCategory implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品分类ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @ApiModelProperty(value = "分类名称") + private String name; + + @ApiModelProperty(value = "分类标识") + private String code; + + @ApiModelProperty(value = "分类图片") + private String image; + + @ApiModelProperty(value = "上级分类ID") + private Integer parentId; + + @ApiModelProperty(value = "排序(数字越小越靠前)") + private Integer sortNumber; + + @ApiModelProperty(value = "备注") + private String comments; + + @ApiModelProperty(value = "是否推荐") + private Integer recommend; + + @ApiModelProperty(value = "状态, 0正常, 1禁用") + private Integer status; + + @ApiModelProperty(value = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @ApiModelProperty(value = "租户id") + private Integer tenantId; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/booking/mapper/CourseCategoryMapper.java b/src/main/java/com/gxwebsoft/booking/mapper/CourseCategoryMapper.java new file mode 100644 index 0000000..91fd2b2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/booking/mapper/CourseCategoryMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.booking.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.booking.entity.CourseCategory; +import com.gxwebsoft.booking.param.CourseCategoryParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 课程分类Mapper + * + * @author 科技小王子 + * @since 2024-06-08 15:00:52 + */ +public interface CourseCategoryMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CourseCategoryParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CourseCategoryParam param); + +} diff --git a/src/main/java/com/gxwebsoft/booking/mapper/LessonMapper.java b/src/main/java/com/gxwebsoft/booking/mapper/CourseMapper.java similarity index 55% rename from src/main/java/com/gxwebsoft/booking/mapper/LessonMapper.java rename to src/main/java/com/gxwebsoft/booking/mapper/CourseMapper.java index cff4a03..77845f9 100644 --- a/src/main/java/com/gxwebsoft/booking/mapper/LessonMapper.java +++ b/src/main/java/com/gxwebsoft/booking/mapper/CourseMapper.java @@ -2,8 +2,8 @@ package com.gxwebsoft.booking.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.booking.entity.Lesson; -import com.gxwebsoft.booking.param.LessonParam; +import com.gxwebsoft.booking.entity.Course; +import com.gxwebsoft.booking.param.CourseParam; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -12,19 +12,19 @@ import java.util.List; * 课程管理Mapper * * @author 科技小王子 - * @since 2024-04-21 14:31:15 + * @since 2024-06-08 15:00:52 */ -public interface LessonMapper extends BaseMapper { +public interface CourseMapper extends BaseMapper { /** * 分页查询 * * @param page 分页对象 * @param param 查询参数 - * @return List + * @return List */ - List selectPageRel(@Param("page") IPage page, - @Param("param") LessonParam param); + List selectPageRel(@Param("page") IPage page, + @Param("param") CourseParam param); /** * 查询全部 @@ -32,6 +32,6 @@ public interface LessonMapper extends BaseMapper { * @param param 查询参数 * @return List */ - List selectListRel(@Param("param") LessonParam param); + List selectListRel(@Param("param") CourseParam param); } diff --git a/src/main/java/com/gxwebsoft/booking/mapper/xml/CourseCategoryMapper.xml b/src/main/java/com/gxwebsoft/booking/mapper/xml/CourseCategoryMapper.xml new file mode 100644 index 0000000..0f9d20a --- /dev/null +++ b/src/main/java/com/gxwebsoft/booking/mapper/xml/CourseCategoryMapper.xml @@ -0,0 +1,66 @@ + + + + + + + SELECT a.* + FROM booking_course_category a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.parent_id = #{param.parentId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/booking/mapper/xml/LessonMapper.xml b/src/main/java/com/gxwebsoft/booking/mapper/xml/CourseMapper.xml similarity index 68% rename from src/main/java/com/gxwebsoft/booking/mapper/xml/LessonMapper.xml rename to src/main/java/com/gxwebsoft/booking/mapper/xml/CourseMapper.xml index ca5bb0d..4d90438 100644 --- a/src/main/java/com/gxwebsoft/booking/mapper/xml/LessonMapper.xml +++ b/src/main/java/com/gxwebsoft/booking/mapper/xml/CourseMapper.xml @@ -1,14 +1,15 @@ - + - SELECT a.* - FROM booking_lesson a + SELECT a.*,b.merchant_name + FROM booking_course a + LEFT JOIN shop_merchant b ON a.merchant_id = b.merchant_id - - AND a.lesson_id = #{param.lessonId} + + AND a.course_id = #{param.courseId} AND a.lesson_name LIKE CONCAT('%', #{param.lessonName}, '%') @@ -19,24 +20,42 @@ AND a.category_id = #{param.categoryId} + + AND a.price = #{param.price} + AND a.teacher_id = #{param.teacherId} - - AND a.merchant_id = #{param.merchantId} - AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + AND a.class_period = #{param.classPeriod} + AND a.max_number = #{param.maxNumber} AND a.address LIKE CONCAT('%', #{param.address}, '%') + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.age_limit LIKE CONCAT('%', #{param.ageLimit}, '%') + + + AND a.bm_time LIKE CONCAT('%', #{param.bmTime}, '%') + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + AND a.merchant_id = #{param.merchantId} + AND a.status = #{param.status} @@ -57,12 +76,12 @@ - - diff --git a/src/main/java/com/gxwebsoft/booking/param/CourseCategoryParam.java b/src/main/java/com/gxwebsoft/booking/param/CourseCategoryParam.java new file mode 100644 index 0000000..34ca07e --- /dev/null +++ b/src/main/java/com/gxwebsoft/booking/param/CourseCategoryParam.java @@ -0,0 +1,62 @@ +package com.gxwebsoft.booking.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 课程分类查询参数 + * + * @author 科技小王子 + * @since 2024-06-08 15:00:52 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@ApiModel(value = "CourseCategoryParam对象", description = "课程分类查询参数") +public class CourseCategoryParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "商品分类ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @ApiModelProperty(value = "分类名称") + private String name; + + @ApiModelProperty(value = "分类标识") + private String code; + + @ApiModelProperty(value = "分类图片") + private String image; + + @ApiModelProperty(value = "上级分类ID") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @ApiModelProperty(value = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @ApiModelProperty(value = "备注") + private String comments; + + @ApiModelProperty(value = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @ApiModelProperty(value = "状态, 0正常, 1禁用") + @QueryField(type = QueryType.EQ) + private Integer status; + + @ApiModelProperty(value = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/booking/param/LessonParam.java b/src/main/java/com/gxwebsoft/booking/param/CourseParam.java similarity index 70% rename from src/main/java/com/gxwebsoft/booking/param/LessonParam.java rename to src/main/java/com/gxwebsoft/booking/param/CourseParam.java index c8f25f4..d82770c 100644 --- a/src/main/java/com/gxwebsoft/booking/param/LessonParam.java +++ b/src/main/java/com/gxwebsoft/booking/param/CourseParam.java @@ -14,40 +14,44 @@ import lombok.EqualsAndHashCode; * 课程管理查询参数 * * @author 科技小王子 - * @since 2024-04-21 14:31:15 + * @since 2024-06-08 15:00:52 */ @Data @EqualsAndHashCode(callSuper = false) @JsonInclude(JsonInclude.Include.NON_NULL) -@ApiModel(value = "LessonParam对象", description = "课程管理查询参数") -public class LessonParam extends BaseParam { +@ApiModel(value = "CourseParam对象", description = "课程管理查询参数") +public class CourseParam extends BaseParam { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "ID") @QueryField(type = QueryType.EQ) - private Integer lessonId; + private Integer courseId; @ApiModelProperty(value = "课程名称") private String lessonName; - @ApiModelProperty(value = "图标") + @ApiModelProperty(value = "封面图") private String image; @ApiModelProperty(value = "分类ID") @QueryField(type = QueryType.EQ) private Integer categoryId; + @ApiModelProperty(value = "课程价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + @ApiModelProperty(value = "老师ID") @QueryField(type = QueryType.EQ) private Integer teacherId; - @ApiModelProperty(value = "商户ID") - @QueryField(type = QueryType.EQ) - private Integer merchantId; - @ApiModelProperty(value = "上课时间") private String startTime; + @ApiModelProperty(value = "课时") + @QueryField(type = QueryType.EQ) + private Integer classPeriod; + @ApiModelProperty(value = "报名人数上限") @QueryField(type = QueryType.EQ) private Integer maxNumber; @@ -55,9 +59,25 @@ public class LessonParam extends BaseParam { @ApiModelProperty(value = "上课地点") private String address; + @ApiModelProperty(value = "详细介绍") + private String content; + + @ApiModelProperty(value = "课程相册") + private String files; + + @ApiModelProperty(value = "年龄限制") + private String ageLimit; + + @ApiModelProperty(value = "报名时间") + private String bmTime; + @ApiModelProperty(value = "备注") private String comments; + @ApiModelProperty(value = "商户ID") + @QueryField(type = QueryType.EQ) + private Integer merchantId; + @ApiModelProperty(value = "状态") @QueryField(type = QueryType.EQ) private Integer status; diff --git a/src/main/java/com/gxwebsoft/booking/service/CourseCategoryService.java b/src/main/java/com/gxwebsoft/booking/service/CourseCategoryService.java new file mode 100644 index 0000000..7e7b492 --- /dev/null +++ b/src/main/java/com/gxwebsoft/booking/service/CourseCategoryService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.booking.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.booking.entity.CourseCategory; +import com.gxwebsoft.booking.param.CourseCategoryParam; + +import java.util.List; + +/** + * 课程分类Service + * + * @author 科技小王子 + * @since 2024-06-08 15:00:52 + */ +public interface CourseCategoryService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CourseCategoryParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CourseCategoryParam param); + + /** + * 根据id查询 + * + * @param id 商品分类ID + * @return CourseCategory + */ + CourseCategory getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/booking/service/LessonService.java b/src/main/java/com/gxwebsoft/booking/service/CourseService.java similarity index 51% rename from src/main/java/com/gxwebsoft/booking/service/LessonService.java rename to src/main/java/com/gxwebsoft/booking/service/CourseService.java index c3dd27a..c2c46af 100644 --- a/src/main/java/com/gxwebsoft/booking/service/LessonService.java +++ b/src/main/java/com/gxwebsoft/booking/service/CourseService.java @@ -2,8 +2,8 @@ package com.gxwebsoft.booking.service; import com.baomidou.mybatisplus.extension.service.IService; import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.booking.entity.Lesson; -import com.gxwebsoft.booking.param.LessonParam; +import com.gxwebsoft.booking.entity.Course; +import com.gxwebsoft.booking.param.CourseParam; import java.util.List; @@ -11,32 +11,32 @@ import java.util.List; * 课程管理Service * * @author 科技小王子 - * @since 2024-04-21 14:31:15 + * @since 2024-06-08 15:00:52 */ -public interface LessonService extends IService { +public interface CourseService extends IService { /** * 分页关联查询 * * @param param 查询参数 - * @return PageResult + * @return PageResult */ - PageResult pageRel(LessonParam param); + PageResult pageRel(CourseParam param); /** * 关联查询全部 * * @param param 查询参数 - * @return List + * @return List */ - List listRel(LessonParam param); + List listRel(CourseParam param); /** * 根据id查询 * - * @param lessonId ID - * @return Lesson + * @param courseId ID + * @return Course */ - Lesson getByIdRel(Integer lessonId); + Course getByIdRel(Integer courseId); } diff --git a/src/main/java/com/gxwebsoft/booking/service/impl/CourseCategoryServiceImpl.java b/src/main/java/com/gxwebsoft/booking/service/impl/CourseCategoryServiceImpl.java new file mode 100644 index 0000000..467556c --- /dev/null +++ b/src/main/java/com/gxwebsoft/booking/service/impl/CourseCategoryServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.booking.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.booking.mapper.CourseCategoryMapper; +import com.gxwebsoft.booking.service.CourseCategoryService; +import com.gxwebsoft.booking.entity.CourseCategory; +import com.gxwebsoft.booking.param.CourseCategoryParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 课程分类Service实现 + * + * @author 科技小王子 + * @since 2024-06-08 15:00:52 + */ +@Service +public class CourseCategoryServiceImpl extends ServiceImpl implements CourseCategoryService { + + @Override + public PageResult pageRel(CourseCategoryParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CourseCategoryParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CourseCategory getByIdRel(Integer id) { + CourseCategoryParam param = new CourseCategoryParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/booking/service/impl/CourseServiceImpl.java b/src/main/java/com/gxwebsoft/booking/service/impl/CourseServiceImpl.java new file mode 100644 index 0000000..5074bf7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/booking/service/impl/CourseServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.booking.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.booking.mapper.CourseMapper; +import com.gxwebsoft.booking.service.CourseService; +import com.gxwebsoft.booking.entity.Course; +import com.gxwebsoft.booking.param.CourseParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 课程管理Service实现 + * + * @author 科技小王子 + * @since 2024-06-08 15:00:52 + */ +@Service +public class CourseServiceImpl extends ServiceImpl implements CourseService { + + @Override + public PageResult pageRel(CourseParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CourseParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public Course getByIdRel(Integer courseId) { + CourseParam param = new CourseParam(); + param.setCourseId(courseId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/booking/service/impl/LessonServiceImpl.java b/src/main/java/com/gxwebsoft/booking/service/impl/LessonServiceImpl.java deleted file mode 100644 index cb29815..0000000 --- a/src/main/java/com/gxwebsoft/booking/service/impl/LessonServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.booking.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.booking.mapper.LessonMapper; -import com.gxwebsoft.booking.service.LessonService; -import com.gxwebsoft.booking.entity.Lesson; -import com.gxwebsoft.booking.param.LessonParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 课程管理Service实现 - * - * @author 科技小王子 - * @since 2024-04-21 14:31:15 - */ -@Service -public class LessonServiceImpl extends ServiceImpl implements LessonService { - - @Override - public PageResult pageRel(LessonParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(LessonParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public Lesson getByIdRel(Integer lessonId) { - LessonParam param = new LessonParam(); - param.setLessonId(lessonId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/GoodsMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/GoodsMapper.xml index 8676bd0..7698bc6 100644 --- a/src/main/java/com/gxwebsoft/shop/mapper/xml/GoodsMapper.xml +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/GoodsMapper.xml @@ -25,6 +25,9 @@ AND a.category_id = #{param.categoryId} + + AND a.category_id IN (SELECT category_id FROM shop_goods_category WHERE parent_id=#{param.parentId}) + AND a.category_parent LIKE CONCAT('%', #{param.categoryParent}, '%') diff --git a/src/main/java/com/gxwebsoft/shop/param/GoodsParam.java b/src/main/java/com/gxwebsoft/shop/param/GoodsParam.java index 70ff9ec..6abb1ec 100644 --- a/src/main/java/com/gxwebsoft/shop/param/GoodsParam.java +++ b/src/main/java/com/gxwebsoft/shop/param/GoodsParam.java @@ -1,6 +1,8 @@ package com.gxwebsoft.shop.param; import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.TableField; import com.gxwebsoft.common.core.annotation.QueryField; import com.gxwebsoft.common.core.annotation.QueryType; import com.gxwebsoft.common.core.web.BaseParam; @@ -87,4 +89,9 @@ public class GoodsParam extends BaseParam { @QueryField(type = QueryType.EQ) private Integer deleted; + + @ApiModelProperty(value = "父级分类ID") + @TableField(exist = false) + private Integer parentId; + } diff --git a/src/test/java/com/gxwebsoft/generator/BookingGenerator.java b/src/test/java/com/gxwebsoft/generator/BookingGenerator.java index af28b79..230f090 100644 --- a/src/test/java/com/gxwebsoft/generator/BookingGenerator.java +++ b/src/test/java/com/gxwebsoft/generator/BookingGenerator.java @@ -61,7 +61,9 @@ public class BookingGenerator { // "booking_user_invoice", // "booking_user_card", // "booking_user_card_log", - "booking_item" +// "booking_item", + "booking_course", + "booking_course_category" }; // 需要去除的表前缀 private static final String[] TABLE_PREFIX = new String[]{