新增报课子系统

This commit is contained in:
gxwebsoft
2024-04-21 16:18:35 +08:00
parent 5e7cb9521f
commit 09131d9d48
29 changed files with 1621 additions and 10 deletions
@@ -0,0 +1,115 @@
package com.gxwebsoft.booking.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.booking.service.CategoryService;
import com.gxwebsoft.booking.entity.Category;
import com.gxwebsoft.booking.param.CategoryParam;
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-04-21 14:31:15
*/
@Api(tags = "课程分类管理")
@RestController
@RequestMapping("/api/booking/category")
public class CategoryController extends BaseController {
@Resource
private CategoryService categoryService;
@ApiOperation("分页查询课程分类")
@GetMapping("/page")
public ApiResult<PageResult<Category>> page(CategoryParam param) {
// 使用关联查询
return success(categoryService.pageRel(param));
}
@ApiOperation("查询全部课程分类")
@GetMapping()
public ApiResult<List<Category>> list(CategoryParam param) {
// 使用关联查询
return success(categoryService.listRel(param));
}
@PreAuthorize("hasAuthority('booking:category:list')")
@ApiOperation("根据id查询课程分类")
@GetMapping("/{id}")
public ApiResult<Category> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(categoryService.getByIdRel(id));
}
@ApiOperation("添加课程分类")
@PostMapping()
public ApiResult<?> save(@RequestBody Category category) {
// 记录当前登录用户id
// User loginUser = getLoginUser();
// if (loginUser != null) {
// category.setUserId(loginUser.getUserId());
// }
if (categoryService.save(category)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("修改课程分类")
@PutMapping()
public ApiResult<?> update(@RequestBody Category category) {
if (categoryService.updateById(category)) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("删除课程分类")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (categoryService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@ApiOperation("批量添加课程分类")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Category> list) {
if (categoryService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("批量修改课程分类")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Category> batchParam) {
if (batchParam.update(categoryService, "category_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("批量删除课程分类")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (categoryService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -0,0 +1,115 @@
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.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-04-21 14:31:15
*/
@Api(tags = "课程管理管理")
@RestController
@RequestMapping("/api/booking/lesson")
public class LessonController extends BaseController {
@Resource
private LessonService lessonService;
@ApiOperation("分页查询课程管理")
@GetMapping("/page")
public ApiResult<PageResult<Lesson>> page(LessonParam param) {
// 使用关联查询
return success(lessonService.pageRel(param));
}
@ApiOperation("查询全部课程管理")
@GetMapping()
public ApiResult<List<Lesson>> list(LessonParam param) {
// 使用关联查询
return success(lessonService.listRel(param));
}
@PreAuthorize("hasAuthority('booking:lesson:list')")
@ApiOperation("根据id查询课程管理")
@GetMapping("/{id}")
public ApiResult<Lesson> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(lessonService.getByIdRel(id));
}
@ApiOperation("添加课程管理")
@PostMapping()
public ApiResult<?> save(@RequestBody Lesson lesson) {
// 记录当前登录用户id
// User loginUser = getLoginUser();
// if (loginUser != null) {
// lesson.setUserId(loginUser.getUserId());
// }
if (lessonService.save(lesson)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("修改课程管理")
@PutMapping()
public ApiResult<?> update(@RequestBody Lesson lesson) {
if (lessonService.updateById(lesson)) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("删除课程管理")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (lessonService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@ApiOperation("批量添加课程管理")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Lesson> list) {
if (lessonService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("批量修改课程管理")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Lesson> batchParam) {
if (batchParam.update(lessonService, "lesson_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("批量删除课程管理")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (lessonService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -0,0 +1,115 @@
package com.gxwebsoft.booking.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.booking.service.TeacherService;
import com.gxwebsoft.booking.entity.Teacher;
import com.gxwebsoft.booking.param.TeacherParam;
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-04-21 14:31:15
*/
@Api(tags = "老师管理管理")
@RestController
@RequestMapping("/api/booking/teacher")
public class TeacherController extends BaseController {
@Resource
private TeacherService teacherService;
@ApiOperation("分页查询老师管理")
@GetMapping("/page")
public ApiResult<PageResult<Teacher>> page(TeacherParam param) {
// 使用关联查询
return success(teacherService.pageRel(param));
}
@ApiOperation("查询全部老师管理")
@GetMapping()
public ApiResult<List<Teacher>> list(TeacherParam param) {
// 使用关联查询
return success(teacherService.listRel(param));
}
@PreAuthorize("hasAuthority('booking:teacher:list')")
@ApiOperation("根据id查询老师管理")
@GetMapping("/{id}")
public ApiResult<Teacher> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(teacherService.getByIdRel(id));
}
@ApiOperation("添加老师管理")
@PostMapping()
public ApiResult<?> save(@RequestBody Teacher teacher) {
// 记录当前登录用户id
// User loginUser = getLoginUser();
// if (loginUser != null) {
// teacher.setUserId(loginUser.getUserId());
// }
if (teacherService.save(teacher)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("修改老师管理")
@PutMapping()
public ApiResult<?> update(@RequestBody Teacher teacher) {
if (teacherService.updateById(teacher)) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("删除老师管理")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (teacherService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@ApiOperation("批量添加老师管理")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Teacher> list) {
if (teacherService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("批量修改老师管理")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Teacher> batchParam) {
if (batchParam.update(teacherService, "teacher_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("批量删除老师管理")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (teacherService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -0,0 +1,92 @@
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 课程分类
*
* @author 科技小王子
* @since 2024-04-21 14:31:15
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Category对象", description = "课程分类")
@TableName("booking_category")
public class Category implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "商品分类ID")
@TableId(value = "category_id", type = IdType.AUTO)
private Integer categoryId;
@ApiModelProperty(value = "分类标识")
private String categoryCode;
@ApiModelProperty(value = "分类名称")
private String title;
@ApiModelProperty(value = "类型 0列表 1单页 2外链")
private Integer type;
@ApiModelProperty(value = "分类图片")
private String image;
@ApiModelProperty(value = "上级分类ID")
private Integer parentId;
@ApiModelProperty(value = "路由/链接地址")
private String path;
@ApiModelProperty(value = "组件路径")
private String component;
@ApiModelProperty(value = "绑定的页面")
private Integer pageId;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "商品数量")
private Integer count;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)")
private Integer hide;
@ApiModelProperty(value = "是否推荐")
private Integer recommend;
@ApiModelProperty(value = "是否显示在首页")
private Integer showIndex;
@ApiModelProperty(value = "状态, 0正常, 1禁用")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private LocalDateTime createTime;
@ApiModelProperty(value = "修改时间")
private LocalDateTime updateTime;
}
@@ -0,0 +1,69 @@
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 java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 课程管理
*
* @author 科技小王子
* @since 2024-04-21 14:31:15
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Lesson对象", description = "课程管理")
@TableName("booking_lesson")
public class Lesson implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@TableId(value = "lesson_id", type = IdType.AUTO)
private Integer lessonId;
@ApiModelProperty(value = "课程名称")
private String lessonName;
@ApiModelProperty(value = "图标")
private String image;
@ApiModelProperty(value = "分类ID")
private Integer categoryId;
@ApiModelProperty(value = "老师ID")
private Integer teacherId;
@ApiModelProperty(value = "商户ID")
private Integer merchantId;
@ApiModelProperty(value = "上课时间")
private LocalDateTime startTime;
@ApiModelProperty(value = "报名人数上限")
private Integer maxNumber;
@ApiModelProperty(value = "上课地点")
private String address;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "排序号")
private Integer sortNumber;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
}
@@ -0,0 +1,57 @@
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 java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 老师管理
*
* @author 科技小王子
* @since 2024-04-21 14:31:15
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Teacher对象", description = "老师管理")
@TableName("booking_teacher")
public class Teacher implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@TableId(value = "teacher_id", type = IdType.AUTO)
private Integer teacherId;
@ApiModelProperty(value = "老师姓名")
private String teacherName;
@ApiModelProperty(value = "老师照片")
private String image;
@ApiModelProperty(value = "老师介绍")
private String content;
@ApiModelProperty(value = "商户ID")
private Integer merchantId;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "排序号")
private Integer sortNumber;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
}
@@ -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.Category;
import com.gxwebsoft.booking.param.CategoryParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 课程分类Mapper
*
* @author 科技小王子
* @since 2024-04-21 14:31:15
*/
public interface CategoryMapper extends BaseMapper<Category> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Category>
*/
List<Category> selectPageRel(@Param("page") IPage<Category> page,
@Param("param") CategoryParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<Category> selectListRel(@Param("param") CategoryParam param);
}
@@ -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.Lesson;
import com.gxwebsoft.booking.param.LessonParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 课程管理Mapper
*
* @author 科技小王子
* @since 2024-04-21 14:31:15
*/
public interface LessonMapper extends BaseMapper<Lesson> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Lesson>
*/
List<Lesson> selectPageRel(@Param("page") IPage<Lesson> page,
@Param("param") LessonParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<Lesson> selectListRel(@Param("param") LessonParam param);
}
@@ -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.Teacher;
import com.gxwebsoft.booking.param.TeacherParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 老师管理Mapper
*
* @author 科技小王子
* @since 2024-04-21 14:31:15
*/
public interface TeacherMapper extends BaseMapper<Teacher> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Teacher>
*/
List<Teacher> selectPageRel(@Param("page") IPage<Teacher> page,
@Param("param") TeacherParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<Teacher> selectListRel(@Param("param") TeacherParam param);
}
@@ -0,0 +1,90 @@
<?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.CategoryMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM booking_category a
<where>
<if test="param.categoryId != null">
AND a.category_id = #{param.categoryId}
</if>
<if test="param.categoryCode != null">
AND a.category_code LIKE CONCAT('%', #{param.categoryCode}, '%')
</if>
<if test="param.title != null">
AND a.title LIKE CONCAT('%', #{param.title}, '%')
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</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.path != null">
AND a.path LIKE CONCAT('%', #{param.path}, '%')
</if>
<if test="param.component != null">
AND a.component LIKE CONCAT('%', #{param.component}, '%')
</if>
<if test="param.pageId != null">
AND a.page_id = #{param.pageId}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if>
<if test="param.count != null">
AND a.count = #{param.count}
</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.hide != null">
AND a.hide = #{param.hide}
</if>
<if test="param.recommend != null">
AND a.recommend = #{param.recommend}
</if>
<if test="param.showIndex != null">
AND a.show_index = #{param.showIndex}
</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.Category">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.Category">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -0,0 +1,69 @@
<?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">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM booking_lesson a
<where>
<if test="param.lessonId != null">
AND a.lesson_id = #{param.lessonId}
</if>
<if test="param.lessonName != null">
AND a.lesson_name LIKE CONCAT('%', #{param.lessonName}, '%')
</if>
<if test="param.image != null">
AND a.image LIKE CONCAT('%', #{param.image}, '%')
</if>
<if test="param.categoryId != null">
AND a.category_id = #{param.categoryId}
</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.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.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</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.Lesson">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.Lesson">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -0,0 +1,57 @@
<?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.TeacherMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM booking_teacher a
<where>
<if test="param.teacherId != null">
AND a.teacher_id = #{param.teacherId}
</if>
<if test="param.teacherName != null">
AND a.teacher_name LIKE CONCAT('%', #{param.teacherName}, '%')
</if>
<if test="param.merchantId != null">
AND a.merchant_id = #{param.merchantId}
</if>
<if test="param.image != null">
AND a.image LIKE CONCAT('%', #{param.image}, '%')
</if>
<if test="param.content != null">
AND a.content LIKE CONCAT('%', #{param.content}, '%')
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</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.Teacher">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.booking.entity.Teacher">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -0,0 +1,92 @@
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-04-21 14:31:15
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "CategoryParam对象", description = "课程分类查询参数")
public class CategoryParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "商品分类ID")
@QueryField(type = QueryType.EQ)
private Integer categoryId;
@ApiModelProperty(value = "分类标识")
private String categoryCode;
@ApiModelProperty(value = "分类名称")
private String title;
@ApiModelProperty(value = "类型 0列表 1单页 2外链")
@QueryField(type = QueryType.EQ)
private Integer type;
@ApiModelProperty(value = "分类图片")
private String image;
@ApiModelProperty(value = "上级分类ID")
@QueryField(type = QueryType.EQ)
private Integer parentId;
@ApiModelProperty(value = "路由/链接地址")
private String path;
@ApiModelProperty(value = "组件路径")
private String component;
@ApiModelProperty(value = "绑定的页面")
@QueryField(type = QueryType.EQ)
private Integer pageId;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "商品数量")
@QueryField(type = QueryType.EQ)
private Integer count;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)")
@QueryField(type = QueryType.EQ)
private Integer hide;
@ApiModelProperty(value = "是否推荐")
@QueryField(type = QueryType.EQ)
private Integer recommend;
@ApiModelProperty(value = "是否显示在首页")
@QueryField(type = QueryType.EQ)
private Integer showIndex;
@ApiModelProperty(value = "状态, 0正常, 1禁用")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
}
@@ -0,0 +1,69 @@
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-04-21 14:31:15
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "LessonParam对象", description = "课程管理查询参数")
public class LessonParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@QueryField(type = QueryType.EQ)
private Integer lessonId;
@ApiModelProperty(value = "课程名称")
private String lessonName;
@ApiModelProperty(value = "图标")
private String image;
@ApiModelProperty(value = "分类ID")
@QueryField(type = QueryType.EQ)
private Integer categoryId;
@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 maxNumber;
@ApiModelProperty(value = "上课地点")
private String address;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "排序号")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
}
@@ -0,0 +1,50 @@
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-04-21 14:31:15
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "TeacherParam对象", description = "老师管理查询参数")
public class TeacherParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@QueryField(type = QueryType.EQ)
private Integer teacherId;
@ApiModelProperty(value = "老师姓名")
private String teacherName;
@ApiModelProperty(value = "老师照片")
private String image;
@ApiModelProperty(value = "老师介绍")
private String content;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "排序号")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
}
@@ -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.Category;
import com.gxwebsoft.booking.param.CategoryParam;
import java.util.List;
/**
* 课程分类Service
*
* @author 科技小王子
* @since 2024-04-21 14:31:15
*/
public interface CategoryService extends IService<Category> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Category>
*/
PageResult<Category> pageRel(CategoryParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Category>
*/
List<Category> listRel(CategoryParam param);
/**
* 根据id查询
*
* @param categoryId 商品分类ID
* @return Category
*/
Category getByIdRel(Integer categoryId);
}
@@ -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.Lesson;
import com.gxwebsoft.booking.param.LessonParam;
import java.util.List;
/**
* 课程管理Service
*
* @author 科技小王子
* @since 2024-04-21 14:31:15
*/
public interface LessonService extends IService<Lesson> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Lesson>
*/
PageResult<Lesson> pageRel(LessonParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Lesson>
*/
List<Lesson> listRel(LessonParam param);
/**
* 根据id查询
*
* @param lessonId ID
* @return Lesson
*/
Lesson getByIdRel(Integer lessonId);
}
@@ -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.Teacher;
import com.gxwebsoft.booking.param.TeacherParam;
import java.util.List;
/**
* 老师管理Service
*
* @author 科技小王子
* @since 2024-04-21 14:31:15
*/
public interface TeacherService extends IService<Teacher> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Teacher>
*/
PageResult<Teacher> pageRel(TeacherParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Teacher>
*/
List<Teacher> listRel(TeacherParam param);
/**
* 根据id查询
*
* @param teacherId ID
* @return Teacher
*/
Teacher getByIdRel(Integer teacherId);
}
@@ -0,0 +1,47 @@
package com.gxwebsoft.booking.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.booking.mapper.CategoryMapper;
import com.gxwebsoft.booking.service.CategoryService;
import com.gxwebsoft.booking.entity.Category;
import com.gxwebsoft.booking.param.CategoryParam;
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 CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {
@Override
public PageResult<Category> pageRel(CategoryParam param) {
PageParam<Category, CategoryParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<Category> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Category> listRel(CategoryParam param) {
List<Category> list = baseMapper.selectListRel(param);
// 排序
PageParam<Category, CategoryParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public Category getByIdRel(Integer categoryId) {
CategoryParam param = new CategoryParam();
param.setCategoryId(categoryId);
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.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));
}
}
@@ -0,0 +1,47 @@
package com.gxwebsoft.booking.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.booking.mapper.TeacherMapper;
import com.gxwebsoft.booking.service.TeacherService;
import com.gxwebsoft.booking.entity.Teacher;
import com.gxwebsoft.booking.param.TeacherParam;
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 TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements TeacherService {
@Override
public PageResult<Teacher> pageRel(TeacherParam param) {
PageParam<Teacher, TeacherParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<Teacher> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Teacher> listRel(TeacherParam param) {
List<Teacher> list = baseMapper.selectListRel(param);
// 排序
PageParam<Teacher, TeacherParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public Teacher getByIdRel(Integer teacherId) {
TeacherParam param = new TeacherParam();
param.setTeacherId(teacherId);
return param.getOne(baseMapper.selectListRel(param));
}
}
@@ -63,7 +63,8 @@ public class MybatisPlusConfig {
"sys_tenant",
"sys_dictionary",
"sys_dictionary_data",
"apps_test_data"
"apps_test_data",
"shop_merchant_account"
).contains(tableName);
}
};
@@ -59,7 +59,6 @@ public class GoodsController extends BaseController {
return success(goodsService.listRel(param));
}
@Transactional(rollbackFor = {Exception.class})
@ApiOperation("根据id查询商品记录表")
@GetMapping("/{id}")
@@ -77,6 +76,7 @@ public class GoodsController extends BaseController {
return success(goods);
}
@PreAuthorize("hasAuthority('shop:goods:save')")
@ApiOperation("添加商品记录表")
@PostMapping()
public ApiResult<?> save(@RequestBody Goods goods) {
@@ -93,6 +93,7 @@ public class GoodsController extends BaseController {
return fail("添加失败");
}
@PreAuthorize("hasAuthority('shop:goods:update')")
@ApiOperation("修改商品记录表")
@PutMapping()
public ApiResult<?> update(@RequestBody Goods goods) {
@@ -107,6 +108,7 @@ public class GoodsController extends BaseController {
return fail("修改失败");
}
@PreAuthorize("hasAuthority('shop:goods:remove')")
@ApiOperation("删除商品记录表")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
@@ -116,6 +118,7 @@ public class GoodsController extends BaseController {
return fail("删除失败");
}
@PreAuthorize("hasAuthority('shop:goods:save')")
@ApiOperation("批量添加商品记录表")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Goods> list) {
@@ -125,6 +128,7 @@ public class GoodsController extends BaseController {
return fail("添加失败");
}
@PreAuthorize("hasAuthority('shop:goods:update')")
@ApiOperation("批量修改商品记录表")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Goods> batchParam) {
@@ -134,6 +138,7 @@ public class GoodsController extends BaseController {
return fail("修改失败");
}
@PreAuthorize("hasAuthority('shop:goods:remove')")
@ApiOperation("批量删除商品记录表")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
@@ -12,7 +12,7 @@
AND a.id = #{param.id}
</if>
<if test="param.phone != null">
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
AND a.phone = #{param.phone}
</if>
<if test="param.realName != null">
AND a.real_name LIKE CONCAT('%', #{param.realName}, '%')
@@ -28,6 +28,7 @@ public class MerchantAccountParam extends BaseParam {
private Integer id;
@ApiModelProperty(value = "商户手机号")
@QueryField(type = QueryType.EQ)
private String phone;
@ApiModelProperty(value = "真实姓名")