新增:课程培训模块

This commit is contained in:
gxwebsoft
2024-06-08 22:06:32 +08:00
parent 146fb0560e
commit 4c45cb4ec1
18 changed files with 643 additions and 129 deletions
@@ -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<PageResult<CourseCategory>> page(CourseCategoryParam param) {
// 使用关联查询
return success(courseCategoryService.pageRel(param));
}
@ApiOperation("查询全部课程分类")
@GetMapping()
public ApiResult<List<CourseCategory>> list(CourseCategoryParam param) {
// 使用关联查询
return success(courseCategoryService.listRel(param));
}
@PreAuthorize("hasAuthority('booking:courseCategory:list')")
@ApiOperation("根据id查询课程分类")
@GetMapping("/{id}")
public ApiResult<CourseCategory> 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<CourseCategory> list) {
if (courseCategoryService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("批量修改课程分类")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<CourseCategory> batchParam) {
if (batchParam.update(courseCategoryService, "id")) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("批量删除课程分类")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (courseCategoryService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -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<PageResult<Lesson>> page(LessonParam param) {
public ApiResult<PageResult<Course>> page(CourseParam param) {
// 使用关联查询
return success(lessonService.pageRel(param));
return success(courseService.pageRel(param));
}
@ApiOperation("查询全部课程管理")
@GetMapping()
public ApiResult<List<Lesson>> list(LessonParam param) {
public ApiResult<List<Course>> list(CourseParam param) {
// 使用关联查询
return success(lessonService.listRel(param));
return success(courseService.listRel(param));
}
@PreAuthorize("hasAuthority('booking:lesson:list')")
@ApiOperation("根据id查询课程管理")
@GetMapping("/{id}")
public ApiResult<Lesson> get(@PathVariable("id") Integer id) {
public ApiResult<Course> 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<Lesson> list) {
if (lessonService.saveBatch(list)) {
public ApiResult<?> saveBatch(@RequestBody List<Course> list) {
if (courseService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('booking:course:update')")
@ApiOperation("批量修改课程管理")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Lesson> batchParam) {
if (batchParam.update(lessonService, "lesson_id")) {
public ApiResult<?> removeBatch(@RequestBody BatchParam<Course> batchParam) {
if (batchParam.update(courseService, "course_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('booking:course:remove')")
@ApiOperation("批量删除课程管理")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (lessonService.removeByIds(ids)) {
if (courseService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
@@ -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;
}
@@ -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;
}
@@ -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<CourseCategory> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<CourseCategory>
*/
List<CourseCategory> selectPageRel(@Param("page") IPage<CourseCategory> page,
@Param("param") CourseCategoryParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<CourseCategory> selectListRel(@Param("param") CourseCategoryParam param);
}
@@ -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<Lesson> {
public interface CourseMapper extends BaseMapper<Course> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Lesson>
* @return List<Course>
*/
List<Lesson> selectPageRel(@Param("page") IPage<Lesson> page,
@Param("param") LessonParam param);
List<Course> selectPageRel(@Param("page") IPage<Course> page,
@Param("param") CourseParam param);
/**
* 查询全部
@@ -32,6 +32,6 @@ public interface LessonMapper extends BaseMapper<Lesson> {
* @param param 查询参数
* @return List<User>
*/
List<Lesson> selectListRel(@Param("param") LessonParam param);
List<Course> selectListRel(@Param("param") CourseParam param);
}
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gxwebsoft.booking.mapper.CourseCategoryMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM booking_course_category a
<where>
<if test="param.id != null">
AND a.id = #{param.id}
</if>
<if test="param.name != null">
AND a.name LIKE CONCAT('%', #{param.name}, '%')
</if>
<if test="param.code != null">
AND a.code LIKE CONCAT('%', #{param.code}, '%')
</if>
<if test="param.image != null">
AND a.image LIKE CONCAT('%', #{param.image}, '%')
</if>
<if test="param.parentId != null">
AND a.parent_id = #{param.parentId}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.recommend != null">
AND a.recommend = #{param.recommend}
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.booking.entity.CourseCategory">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.CourseCategory">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gxwebsoft.booking.mapper.LessonMapper">
<mapper namespace="com.gxwebsoft.booking.mapper.CourseMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
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
<where>
<if test="param.lessonId != null">
AND a.lesson_id = #{param.lessonId}
<if test="param.courseId != null">
AND a.course_id = #{param.courseId}
</if>
<if test="param.lessonName != null">
AND a.lesson_name LIKE CONCAT('%', #{param.lessonName}, '%')
@@ -19,24 +20,42 @@
<if test="param.categoryId != null">
AND a.category_id = #{param.categoryId}
</if>
<if test="param.price != null">
AND a.price = #{param.price}
</if>
<if test="param.teacherId != null">
AND a.teacher_id = #{param.teacherId}
</if>
<if test="param.merchantId != null">
AND a.merchant_id = #{param.merchantId}
</if>
<if test="param.startTime != null">
AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%')
</if>
<if test="param.classPeriod != null">
AND a.class_period = #{param.classPeriod}
</if>
<if test="param.maxNumber != null">
AND a.max_number = #{param.maxNumber}
</if>
<if test="param.address != null">
AND a.address LIKE CONCAT('%', #{param.address}, '%')
</if>
<if test="param.content != null">
AND a.content LIKE CONCAT('%', #{param.content}, '%')
</if>
<if test="param.files != null">
AND a.files LIKE CONCAT('%', #{param.files}, '%')
</if>
<if test="param.ageLimit != null">
AND a.age_limit LIKE CONCAT('%', #{param.ageLimit}, '%')
</if>
<if test="param.bmTime != null">
AND a.bm_time LIKE CONCAT('%', #{param.bmTime}, '%')
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.merchantId != null">
AND a.merchant_id = #{param.merchantId}
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
@@ -57,12 +76,12 @@
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.booking.entity.Lesson">
<select id="selectPageRel" resultType="com.gxwebsoft.booking.entity.Course">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.Lesson">
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.Course">
<include refid="selectSql"></include>
</select>
@@ -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;
}
@@ -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;
@@ -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<CourseCategory> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<CourseCategory>
*/
PageResult<CourseCategory> pageRel(CourseCategoryParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<CourseCategory>
*/
List<CourseCategory> listRel(CourseCategoryParam param);
/**
* 根据id查询
*
* @param id 商品分类ID
* @return CourseCategory
*/
CourseCategory getByIdRel(Integer id);
}
@@ -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<Lesson> {
public interface CourseService extends IService<Course> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Lesson>
* @return PageResult<Course>
*/
PageResult<Lesson> pageRel(LessonParam param);
PageResult<Course> pageRel(CourseParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Lesson>
* @return List<Course>
*/
List<Lesson> listRel(LessonParam param);
List<Course> listRel(CourseParam param);
/**
* 根据id查询
*
* @param lessonId ID
* @return Lesson
* @param courseId ID
* @return Course
*/
Lesson getByIdRel(Integer lessonId);
Course getByIdRel(Integer courseId);
}
@@ -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<CourseCategoryMapper, CourseCategory> implements CourseCategoryService {
@Override
public PageResult<CourseCategory> pageRel(CourseCategoryParam param) {
PageParam<CourseCategory, CourseCategoryParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<CourseCategory> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<CourseCategory> listRel(CourseCategoryParam param) {
List<CourseCategory> list = baseMapper.selectListRel(param);
// 排序
PageParam<CourseCategory, CourseCategoryParam> 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));
}
}
@@ -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<CourseMapper, Course> implements CourseService {
@Override
public PageResult<Course> pageRel(CourseParam param) {
PageParam<Course, CourseParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<Course> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Course> listRel(CourseParam param) {
List<Course> list = baseMapper.selectListRel(param);
// 排序
PageParam<Course, CourseParam> 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));
}
}
@@ -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<LessonMapper, Lesson> implements LessonService {
@Override
public PageResult<Lesson> pageRel(LessonParam param) {
PageParam<Lesson, LessonParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<Lesson> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Lesson> listRel(LessonParam param) {
List<Lesson> list = baseMapper.selectListRel(param);
// 排序
PageParam<Lesson, LessonParam> 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));
}
}
@@ -25,6 +25,9 @@
<if test="param.categoryId != null">
AND a.category_id = #{param.categoryId}
</if>
<if test="param.parentId != null">
AND a.category_id IN (SELECT category_id FROM shop_goods_category WHERE parent_id=#{param.parentId})
</if>
<if test="param.categoryParent != null">
AND a.category_parent LIKE CONCAT('%', #{param.categoryParent}, '%')
</if>
@@ -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;
}