新增报课子系统
This commit is contained in:
@@ -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 >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{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 >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{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 >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{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_tenant",
|
||||||
"sys_dictionary",
|
"sys_dictionary",
|
||||||
"sys_dictionary_data",
|
"sys_dictionary_data",
|
||||||
"apps_test_data"
|
"apps_test_data",
|
||||||
|
"shop_merchant_account"
|
||||||
).contains(tableName);
|
).contains(tableName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ public class GoodsController extends BaseController {
|
|||||||
return success(goodsService.listRel(param));
|
return success(goodsService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
@ApiOperation("根据id查询商品记录表")
|
@ApiOperation("根据id查询商品记录表")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
@@ -77,6 +76,7 @@ public class GoodsController extends BaseController {
|
|||||||
return success(goods);
|
return success(goods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:goods:save')")
|
||||||
@ApiOperation("添加商品记录表")
|
@ApiOperation("添加商品记录表")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody Goods goods) {
|
public ApiResult<?> save(@RequestBody Goods goods) {
|
||||||
@@ -93,6 +93,7 @@ public class GoodsController extends BaseController {
|
|||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:goods:update')")
|
||||||
@ApiOperation("修改商品记录表")
|
@ApiOperation("修改商品记录表")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody Goods goods) {
|
public ApiResult<?> update(@RequestBody Goods goods) {
|
||||||
@@ -107,6 +108,7 @@ public class GoodsController extends BaseController {
|
|||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:goods:remove')")
|
||||||
@ApiOperation("删除商品记录表")
|
@ApiOperation("删除商品记录表")
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
@@ -116,6 +118,7 @@ public class GoodsController extends BaseController {
|
|||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:goods:save')")
|
||||||
@ApiOperation("批量添加商品记录表")
|
@ApiOperation("批量添加商品记录表")
|
||||||
@PostMapping("/batch")
|
@PostMapping("/batch")
|
||||||
public ApiResult<?> saveBatch(@RequestBody List<Goods> list) {
|
public ApiResult<?> saveBatch(@RequestBody List<Goods> list) {
|
||||||
@@ -125,6 +128,7 @@ public class GoodsController extends BaseController {
|
|||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:goods:update')")
|
||||||
@ApiOperation("批量修改商品记录表")
|
@ApiOperation("批量修改商品记录表")
|
||||||
@PutMapping("/batch")
|
@PutMapping("/batch")
|
||||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Goods> batchParam) {
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<Goods> batchParam) {
|
||||||
@@ -134,6 +138,7 @@ public class GoodsController extends BaseController {
|
|||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:goods:remove')")
|
||||||
@ApiOperation("批量删除商品记录表")
|
@ApiOperation("批量删除商品记录表")
|
||||||
@DeleteMapping("/batch")
|
@DeleteMapping("/batch")
|
||||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
AND a.id = #{param.id}
|
AND a.id = #{param.id}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.phone != null">
|
<if test="param.phone != null">
|
||||||
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
|
AND a.phone = #{param.phone}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.realName != null">
|
<if test="param.realName != null">
|
||||||
AND a.real_name LIKE CONCAT('%', #{param.realName}, '%')
|
AND a.real_name LIKE CONCAT('%', #{param.realName}, '%')
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class MerchantAccountParam extends BaseParam {
|
|||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商户手机号")
|
@ApiModelProperty(value = "商户手机号")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@ApiModelProperty(value = "真实姓名")
|
@ApiModelProperty(value = "真实姓名")
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,229 @@
|
|||||||
|
package com.gxwebsoft.generator;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
|
import com.baomidou.mybatisplus.generator.AutoGenerator;
|
||||||
|
import com.baomidou.mybatisplus.generator.InjectionConfig;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.*;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||||
|
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||||
|
import com.gxwebsoft.generator.engine.BeetlTemplateEnginePlus;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码生成工具
|
||||||
|
*
|
||||||
|
* @author WebSoft
|
||||||
|
* @since 2021-09-05 00:31:14
|
||||||
|
*/
|
||||||
|
public class BookingGenerator {
|
||||||
|
// 输出位置
|
||||||
|
private static final String OUTPUT_LOCATION = System.getProperty("user.dir");
|
||||||
|
//private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径
|
||||||
|
// 输出目录
|
||||||
|
private static final String OUTPUT_DIR = "/src/main/java";
|
||||||
|
// Vue文件输出位置
|
||||||
|
private static final String OUTPUT_LOCATION_VUE = "/Users/gxwebsoft/VUE/com.gxwebsoft.core-web";
|
||||||
|
// Vue文件输出目录
|
||||||
|
private static final String OUTPUT_DIR_VUE = "/src";
|
||||||
|
// 作者名称
|
||||||
|
private static final String AUTHOR = "科技小王子";
|
||||||
|
// 是否在xml中添加二级缓存配置
|
||||||
|
private static final boolean ENABLE_CACHE = false;
|
||||||
|
// 数据库连接配置
|
||||||
|
private static final String DB_URL = "jdbc:mysql://47.119.165.234:3308/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8";
|
||||||
|
private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver";
|
||||||
|
private static final String DB_USERNAME = "modules";
|
||||||
|
private static final String DB_PASSWORD = "FYJGx7s8yt7K8xDH";
|
||||||
|
// 包名
|
||||||
|
private static final String PACKAGE_NAME = "com.gxwebsoft";
|
||||||
|
// 模块名
|
||||||
|
private static final String MODULE_NAME = "booking";
|
||||||
|
// 需要生成的表
|
||||||
|
private static final String[] TABLE_NAMES = new String[]{
|
||||||
|
"booking_lesson",
|
||||||
|
"booking_teacher",
|
||||||
|
"booking_category"
|
||||||
|
};
|
||||||
|
// 需要去除的表前缀
|
||||||
|
private static final String[] TABLE_PREFIX = new String[]{
|
||||||
|
"booking_",
|
||||||
|
"tb_"
|
||||||
|
};
|
||||||
|
// 不需要作为查询参数的字段
|
||||||
|
private static final String[] PARAM_EXCLUDE_FIELDS = new String[]{
|
||||||
|
"tenant_id",
|
||||||
|
"create_time",
|
||||||
|
"update_time"
|
||||||
|
};
|
||||||
|
// 查询参数使用String的类型
|
||||||
|
private static final String[] PARAM_TO_STRING_TYPE = new String[]{
|
||||||
|
"Date",
|
||||||
|
"LocalDate",
|
||||||
|
"LocalTime",
|
||||||
|
"LocalDateTime"
|
||||||
|
};
|
||||||
|
// 查询参数使用EQ的类型
|
||||||
|
private static final String[] PARAM_EQ_TYPE = new String[]{
|
||||||
|
"Integer",
|
||||||
|
"Boolean",
|
||||||
|
"BigDecimal"
|
||||||
|
};
|
||||||
|
// 是否添加权限注解
|
||||||
|
private static final boolean AUTH_ANNOTATION = false;
|
||||||
|
// 是否添加日志注解
|
||||||
|
private static final boolean LOG_ANNOTATION = false;
|
||||||
|
// controller的mapping前缀
|
||||||
|
private static final String CONTROLLER_MAPPING_PREFIX = "/api";
|
||||||
|
// 模板所在位置
|
||||||
|
private static final String TEMPLATES_DIR = "/src/test/java/com/gxwebsoft/generator/templates";
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// 代码生成器
|
||||||
|
AutoGenerator mpg = new AutoGenerator();
|
||||||
|
|
||||||
|
// 全局配置
|
||||||
|
GlobalConfig gc = new GlobalConfig();
|
||||||
|
gc.setOutputDir(OUTPUT_LOCATION + OUTPUT_DIR);
|
||||||
|
gc.setAuthor(AUTHOR);
|
||||||
|
gc.setOpen(false);
|
||||||
|
gc.setFileOverride(true);
|
||||||
|
gc.setEnableCache(ENABLE_CACHE);
|
||||||
|
gc.setSwagger2(true);
|
||||||
|
gc.setIdType(IdType.AUTO);
|
||||||
|
gc.setServiceName("%sService");
|
||||||
|
mpg.setGlobalConfig(gc);
|
||||||
|
|
||||||
|
// 数据源配置
|
||||||
|
DataSourceConfig dsc = new DataSourceConfig();
|
||||||
|
dsc.setUrl(DB_URL);
|
||||||
|
// dsc.setSchemaName("public");
|
||||||
|
dsc.setDriverName(DB_DRIVER);
|
||||||
|
dsc.setUsername(DB_USERNAME);
|
||||||
|
dsc.setPassword(DB_PASSWORD);
|
||||||
|
mpg.setDataSource(dsc);
|
||||||
|
|
||||||
|
// 包配置
|
||||||
|
PackageConfig pc = new PackageConfig();
|
||||||
|
pc.setModuleName(MODULE_NAME);
|
||||||
|
pc.setParent(PACKAGE_NAME);
|
||||||
|
mpg.setPackageInfo(pc);
|
||||||
|
|
||||||
|
// 策略配置
|
||||||
|
StrategyConfig strategy = new StrategyConfig();
|
||||||
|
strategy.setNaming(NamingStrategy.underline_to_camel);
|
||||||
|
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
|
||||||
|
strategy.setInclude(TABLE_NAMES);
|
||||||
|
strategy.setTablePrefix(TABLE_PREFIX);
|
||||||
|
strategy.setSuperControllerClass(PACKAGE_NAME + ".common.core.web.BaseController");
|
||||||
|
strategy.setEntityLombokModel(true);
|
||||||
|
strategy.setRestControllerStyle(true);
|
||||||
|
strategy.setControllerMappingHyphenStyle(true);
|
||||||
|
strategy.setLogicDeleteFieldName("deleted");
|
||||||
|
mpg.setStrategy(strategy);
|
||||||
|
|
||||||
|
// 模板配置
|
||||||
|
TemplateConfig templateConfig = new TemplateConfig();
|
||||||
|
templateConfig.setController(TEMPLATES_DIR + "/controller.java");
|
||||||
|
templateConfig.setEntity(TEMPLATES_DIR + "/entity.java");
|
||||||
|
templateConfig.setMapper(TEMPLATES_DIR + "/mapper.java");
|
||||||
|
templateConfig.setXml(TEMPLATES_DIR + "/mapper.xml");
|
||||||
|
templateConfig.setService(TEMPLATES_DIR + "/service.java");
|
||||||
|
templateConfig.setServiceImpl(TEMPLATES_DIR + "/serviceImpl.java");
|
||||||
|
mpg.setTemplate(templateConfig);
|
||||||
|
mpg.setTemplateEngine(new BeetlTemplateEnginePlus());
|
||||||
|
|
||||||
|
// 自定义模板配置
|
||||||
|
InjectionConfig cfg = new InjectionConfig() {
|
||||||
|
@Override
|
||||||
|
public void initMap() {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("packageName", PACKAGE_NAME);
|
||||||
|
map.put("paramExcludeFields", PARAM_EXCLUDE_FIELDS);
|
||||||
|
map.put("paramToStringType", PARAM_TO_STRING_TYPE);
|
||||||
|
map.put("paramEqType", PARAM_EQ_TYPE);
|
||||||
|
map.put("authAnnotation", AUTH_ANNOTATION);
|
||||||
|
map.put("logAnnotation", LOG_ANNOTATION);
|
||||||
|
map.put("controllerMappingPrefix", CONTROLLER_MAPPING_PREFIX);
|
||||||
|
this.setMap(map);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
String templatePath = TEMPLATES_DIR + "/param.java.btl";
|
||||||
|
List<FileOutConfig> focList = new ArrayList<>();
|
||||||
|
focList.add(new FileOutConfig(templatePath) {
|
||||||
|
@Override
|
||||||
|
public String outputFile(TableInfo tableInfo) {
|
||||||
|
return OUTPUT_LOCATION + OUTPUT_DIR + "/"
|
||||||
|
+ PACKAGE_NAME.replace(".", "/")
|
||||||
|
+ "/" + pc.getModuleName() + "/param/"
|
||||||
|
+ tableInfo.getEntityName() + "Param" + StringPool.DOT_JAVA;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* 以下是生成VUE项目代码
|
||||||
|
* 生成文件的路径 /api/shop/goods/index.ts
|
||||||
|
*/
|
||||||
|
templatePath = TEMPLATES_DIR + "/index.ts.btl";
|
||||||
|
|
||||||
|
focList.add(new FileOutConfig(templatePath) {
|
||||||
|
@Override
|
||||||
|
public String outputFile(TableInfo tableInfo) {
|
||||||
|
return OUTPUT_LOCATION_VUE + OUTPUT_DIR_VUE
|
||||||
|
+ "/api/" + pc.getModuleName() + "/"
|
||||||
|
+ tableInfo.getEntityPath() + "/" + "index.ts";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 生成TS文件 (/api/shop/goods/model/index.ts)
|
||||||
|
templatePath = TEMPLATES_DIR + "/model.ts.btl";
|
||||||
|
focList.add(new FileOutConfig(templatePath) {
|
||||||
|
@Override
|
||||||
|
public String outputFile(TableInfo tableInfo) {
|
||||||
|
return OUTPUT_LOCATION_VUE + OUTPUT_DIR_VUE
|
||||||
|
+ "/api/" + pc.getModuleName() + "/"
|
||||||
|
+ tableInfo.getEntityPath() + "/model/" + "index.ts";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 生成Vue文件(/views/shop/goods/index.vue)
|
||||||
|
templatePath = TEMPLATES_DIR + "/index.vue.btl";
|
||||||
|
focList.add(new FileOutConfig(templatePath) {
|
||||||
|
@Override
|
||||||
|
public String outputFile(TableInfo tableInfo) {
|
||||||
|
return OUTPUT_LOCATION_VUE + OUTPUT_DIR_VUE
|
||||||
|
+ "/views/" + pc.getModuleName() + "/"
|
||||||
|
+ tableInfo.getEntityPath() + "/" + "index.vue";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 生成components文件(/views/shop/goods/components/edit.vue)
|
||||||
|
templatePath = TEMPLATES_DIR + "/components.edit.vue.btl";
|
||||||
|
focList.add(new FileOutConfig(templatePath) {
|
||||||
|
@Override
|
||||||
|
public String outputFile(TableInfo tableInfo) {
|
||||||
|
return OUTPUT_LOCATION_VUE + OUTPUT_DIR_VUE
|
||||||
|
+ "/views/" + pc.getModuleName() + "/"
|
||||||
|
+ tableInfo.getEntityPath() + "/components/" + tableInfo.getEntityPath() + "Edit.vue";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 生成components文件(/views/shop/goods/components/search.vue)
|
||||||
|
templatePath = TEMPLATES_DIR + "/components.search.vue.btl";
|
||||||
|
focList.add(new FileOutConfig(templatePath) {
|
||||||
|
@Override
|
||||||
|
public String outputFile(TableInfo tableInfo) {
|
||||||
|
return OUTPUT_LOCATION_VUE + OUTPUT_DIR_VUE
|
||||||
|
+ "/views/" + pc.getModuleName() + "/"
|
||||||
|
+ tableInfo.getEntityPath() + "/components/" + "search.vue";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cfg.setFileOutConfigList(focList);
|
||||||
|
mpg.setCfg(cfg);
|
||||||
|
|
||||||
|
mpg.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -64,6 +64,9 @@ public class ${table.controllerName} {
|
|||||||
* 分页查询${table.comment!}
|
* 分页查询${table.comment!}
|
||||||
*/
|
*/
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<% if(cfg.authAnnotation) { %>
|
||||||
|
@PreAuthorize("hasAuthority('${authPre}:list')")
|
||||||
|
<% } %>
|
||||||
<% if(swagger2) { %>
|
<% if(swagger2) { %>
|
||||||
@ApiOperation("分页查询${table.comment!}")
|
@ApiOperation("分页查询${table.comment!}")
|
||||||
<% } %>
|
<% } %>
|
||||||
@@ -81,6 +84,9 @@ public class ${table.controllerName} {
|
|||||||
* 查询全部${table.comment!}
|
* 查询全部${table.comment!}
|
||||||
*/
|
*/
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<% if(cfg.authAnnotation) { %>
|
||||||
|
@PreAuthorize("hasAuthority('${authPre}:list')")
|
||||||
|
<% } %>
|
||||||
<% if(swagger2) { %>
|
<% if(swagger2) { %>
|
||||||
@ApiOperation("查询全部${table.comment!}")
|
@ApiOperation("查询全部${table.comment!}")
|
||||||
<% } %>
|
<% } %>
|
||||||
@@ -98,6 +104,7 @@ public class ${table.controllerName} {
|
|||||||
* 根据id查询${table.comment!}
|
* 根据id查询${table.comment!}
|
||||||
*/
|
*/
|
||||||
<% } %>
|
<% } %>
|
||||||
|
@PreAuthorize("hasAuthority('${authPre}:list')")
|
||||||
@ApiOperation("根据id查询${table.comment!}")
|
@ApiOperation("根据id查询${table.comment!}")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<${entity}> get(@PathVariable("id") Integer id) {
|
public ApiResult<${entity}> get(@PathVariable("id") Integer id) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { MODULES_API_URL } from '@/config/setting';
|
|||||||
*/
|
*/
|
||||||
export async function page${entity}(params: ${entity}Param) {
|
export async function page${entity}(params: ${entity}Param) {
|
||||||
const res = await request.get<ApiResult<PageResult<${entity}>>>(
|
const res = await request.get<ApiResult<PageResult<${entity}>>>(
|
||||||
MODULES_API_URL + '/shop/${controllerMappingHyphen}/page',
|
MODULES_API_URL + '/${package.ModuleName}/${controllerMappingHyphen}/page',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ export async function page${entity}(params: ${entity}Param) {
|
|||||||
*/
|
*/
|
||||||
export async function list${entity}(params?: ${entity}Param) {
|
export async function list${entity}(params?: ${entity}Param) {
|
||||||
const res = await request.get<ApiResult<${entity}[]>>(
|
const res = await request.get<ApiResult<${entity}[]>>(
|
||||||
MODULES_API_URL + '/shop/${controllerMappingHyphen}',
|
MODULES_API_URL + '/${package.ModuleName}/${controllerMappingHyphen}',
|
||||||
{
|
{
|
||||||
params
|
params
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ export async function list${entity}(params?: ${entity}Param) {
|
|||||||
*/
|
*/
|
||||||
export async function add${entity}(data: ${entity}) {
|
export async function add${entity}(data: ${entity}) {
|
||||||
const res = await request.post<ApiResult<unknown>>(
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/${controllerMappingHyphen}',
|
MODULES_API_URL + '/${package.ModuleName}/${controllerMappingHyphen}',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -54,7 +54,7 @@ export async function add${entity}(data: ${entity}) {
|
|||||||
*/
|
*/
|
||||||
export async function update${entity}(data: ${entity}) {
|
export async function update${entity}(data: ${entity}) {
|
||||||
const res = await request.put<ApiResult<unknown>>(
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/${controllerMappingHyphen}',
|
MODULES_API_URL + '/${package.ModuleName}/${controllerMappingHyphen}',
|
||||||
data
|
data
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -68,7 +68,7 @@ export async function update${entity}(data: ${entity}) {
|
|||||||
*/
|
*/
|
||||||
export async function remove${entity}(id?: number) {
|
export async function remove${entity}(id?: number) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/${controllerMappingHyphen}/' + id
|
MODULES_API_URL + '/${package.ModuleName}/${controllerMappingHyphen}/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
return res.data.message;
|
return res.data.message;
|
||||||
@@ -81,7 +81,7 @@ export async function remove${entity}(id?: number) {
|
|||||||
*/
|
*/
|
||||||
export async function removeBatch${entity}(data: (number | undefined)[]) {
|
export async function removeBatch${entity}(data: (number | undefined)[]) {
|
||||||
const res = await request.delete<ApiResult<unknown>>(
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
MODULES_API_URL + '/shop/${controllerMappingHyphen}/batch',
|
MODULES_API_URL + '/${package.ModuleName}/${controllerMappingHyphen}/batch',
|
||||||
{
|
{
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ export async function removeBatch${entity}(data: (number | undefined)[]) {
|
|||||||
*/
|
*/
|
||||||
export async function get${entity}(id: number) {
|
export async function get${entity}(id: number) {
|
||||||
const res = await request.get<ApiResult<${entity}>>(
|
const res = await request.get<ApiResult<${entity}>>(
|
||||||
MODULES_API_URL + '/shop/${controllerMappingHyphen}/' + id
|
MODULES_API_URL + '/${package.ModuleName}/${controllerMappingHyphen}/' + id
|
||||||
);
|
);
|
||||||
if (res.data.code === 0 && res.data.data) {
|
if (res.data.code === 0 && res.data.data) {
|
||||||
return res.data.data;
|
return res.data.data;
|
||||||
|
|||||||
Reference in New Issue
Block a user