Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
15a297a465 | ||
|
0efab164cd | ||
|
31e18a0512 | ||
|
30a0c9fc93 | ||
|
77db6a0963 | ||
|
ba96bbd790 | ||
|
3e8480c390 | ||
|
29212c74ca | ||
|
5ea1141cd8 | ||
|
276868828e | ||
|
dc7a0a5ea8 | ||
|
b868a7cae5 |
@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 驾校系统可用角色枚举
|
||||
*
|
||||
* @author vinjor-m
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum SchoolRoleEnum {
|
||||
/**
|
||||
* 驾校业务管理员
|
||||
*/
|
||||
ADMIN("jiaxiao","驾校业务管理员"),
|
||||
/**
|
||||
* 驾校工作人员
|
||||
*/
|
||||
STAFF("school_staff","驾校工作人员"),
|
||||
/**
|
||||
* 驾校教练
|
||||
*/
|
||||
COACH("instructor","驾校教练");
|
||||
|
||||
/**
|
||||
* 角色code
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 根据角色code返回对应的枚举
|
||||
* @author vinjor-M
|
||||
* @date 14:23 2024/10/16
|
||||
* @param code 角色code
|
||||
* @return cn.iocoder.yudao.common.SystemEnum
|
||||
**/
|
||||
public static SchoolRoleEnum getRole(String code) {
|
||||
for (SchoolRoleEnum roleEnum : SchoolRoleEnum.values()) {
|
||||
if (roleEnum.getCode().equalsIgnoreCase(code)) {
|
||||
// 找到对应的枚举
|
||||
return roleEnum;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("无效的角色code:" + code);
|
||||
}
|
||||
|
||||
}
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.staff.service.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
|
||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
import cn.iocoder.yudao.common.SchoolRoleEnum;
|
||||
import cn.iocoder.yudao.common.SystemEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.staff.service.ApiAppLoginService;
|
||||
@ -117,7 +118,7 @@ public class ApiAppLoginServiceImpl implements ApiAppLoginService {
|
||||
|
||||
} else if (SystemEnum.SCHOOL.getCode().equals(loginBody.getSysCode())) {
|
||||
//驾校业务系统
|
||||
|
||||
flag = this.checkSchoolCanLogin(user, roleCodeList,loginBody.getTypes());
|
||||
} else if (SystemEnum.RESCUE.getCode().equals(loginBody.getSysCode())) {
|
||||
//救援业务系统
|
||||
flag = (loginBody.getType().equals("0") && roleNames.contains("调度中心")) || (loginBody.getType().equals("0") && roleNames.contains("交警大队"));
|
||||
@ -177,4 +178,43 @@ public class ApiAppLoginServiceImpl implements ApiAppLoginService {
|
||||
user.setRoleNames(String.join(",",thisRoleNameList));
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否可以登录驾校系统
|
||||
* @author vinjor-M
|
||||
* @date 15:34 2024/10/16
|
||||
* @param user 当前用户
|
||||
* @param roleCodeList 已有的角色code
|
||||
* @return boolean
|
||||
**/
|
||||
private boolean checkSchoolCanLogin(AdminUserDO user,List<String> roleCodeList,String type){
|
||||
boolean flag = false;
|
||||
List<String> thisRoleCodeList = new ArrayList<>();
|
||||
List<String> thisRoleNameList = new ArrayList<>();
|
||||
if("2".equals(type)){
|
||||
//管理端
|
||||
if(roleCodeList.contains(SchoolRoleEnum.ADMIN.getCode())){
|
||||
//驾校业务管理员
|
||||
flag = true;
|
||||
thisRoleCodeList.add(SchoolRoleEnum.ADMIN.getCode());
|
||||
thisRoleNameList.add(SchoolRoleEnum.ADMIN.getName());
|
||||
}else if(roleCodeList.contains(SchoolRoleEnum.STAFF.getCode())){
|
||||
//驾校工作人员
|
||||
flag = true;
|
||||
thisRoleCodeList.add(SchoolRoleEnum.STAFF.getCode());
|
||||
thisRoleNameList.add(SchoolRoleEnum.STAFF.getName());
|
||||
}
|
||||
}else if("3".equals(type)){
|
||||
//教练端
|
||||
if(roleCodeList.contains(SchoolRoleEnum.COACH.getCode())){
|
||||
//驾校教练
|
||||
flag = true;
|
||||
thisRoleCodeList.add(SchoolRoleEnum.COACH.getCode());
|
||||
thisRoleNameList.add(SchoolRoleEnum.COACH.getName());
|
||||
}
|
||||
}
|
||||
user.setRoleCodes(String.join(",",thisRoleCodeList));
|
||||
user.setRoleNames(String.join(",",thisRoleNameList));
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,13 @@ public class StaffLoginBody {
|
||||
* 唯一标识
|
||||
*/
|
||||
private String uuid;
|
||||
//0账号密码登录,1手机号登录 2:管理 3:教练
|
||||
/**
|
||||
* 登录类型 0账号密码登录,1手机号登录
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
*系统端类型 2:管理 3:教练
|
||||
*/
|
||||
private String types;
|
||||
private String phone;
|
||||
private String realName;
|
||||
|
@ -0,0 +1,98 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachService;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 驾校教练")
|
||||
@RestController
|
||||
@RequestMapping("/base/dl-drive-school-coach")
|
||||
@Validated
|
||||
public class DlDriveSchoolCoachController {
|
||||
|
||||
@Resource
|
||||
private DlDriveSchoolCoachService dlDriveSchoolCoachService;
|
||||
|
||||
/**
|
||||
* 驾校教练、普通员工列表
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolCoachPageReqVO}
|
||||
* @param pageNo 分页参数第几页
|
||||
* @param pageSize 分页参数每页多少条数据
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage < ?>>
|
||||
* @author PQZ
|
||||
* @date 14:58 2025/1/16
|
||||
**/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得驾校教练分页")
|
||||
public CommonResult<IPage<?>> getDlDriveSchoolCoachPage(DlDriveSchoolCoachPageReqVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<DlDriveSchoolCoachRespVO> page = new Page<>(pageNo, pageSize);
|
||||
return success(dlDriveSchoolCoachService.queryListPage(pageReqVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存驾校教练
|
||||
*
|
||||
* @param createReqVO {@link DlDriveSchoolCoachSaveReqVO}
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.String>
|
||||
* @author PQZ
|
||||
* @date 16:19 2025/1/16
|
||||
**/
|
||||
@PostMapping("/save")
|
||||
@Operation(summary = "创建驾校教练")
|
||||
public CommonResult<Boolean> saveSchoolCoach(@Valid @RequestBody DlDriveSchoolCoachSaveReqVO createReqVO) {
|
||||
dlDriveSchoolCoachService.saveSchoolCoach(createReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除驾校教练
|
||||
*
|
||||
* @param id 教练id
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||
* @author PQZ
|
||||
* @date 21:40 2025/1/16
|
||||
**/
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除驾校教练")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteDlDriveSchoolCoach(@RequestParam("id") String id) {
|
||||
dlDriveSchoolCoachService.deleteDlDriveSchoolCoach(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过教练id获取驾校教练
|
||||
* @author PQZ
|
||||
* @date 21:41 2025/1/16
|
||||
* @param id 教练id
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO>
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得驾校教练")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<DlDriveSchoolCoachRespVO> getDlDriveSchoolCoach(@RequestParam("id") String id) {
|
||||
DlDriveSchoolCoach dlDriveSchoolCoach = dlDriveSchoolCoachService.getDlDriveSchoolCoach(id);
|
||||
return success(BeanUtils.toBean(dlDriveSchoolCoach, DlDriveSchoolCoachRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseService;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 课程管理")
|
||||
@RestController
|
||||
@RequestMapping("/base/dl-drive-school-course")
|
||||
@Validated
|
||||
public class DlDriveSchoolCourseController {
|
||||
|
||||
@Resource
|
||||
private DlDriveSchoolCourseService courseService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页获取课程信息
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolCourseVO}
|
||||
* @param pageNo 分页参数-第几页
|
||||
* @param pageSize 分页参数-当前页有多少条数据
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage < ?>>
|
||||
* @author PQZ
|
||||
* @date 22:20 2025/1/16
|
||||
**/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页获取课程信息")
|
||||
public CommonResult<IPage<?>> getDlDriveSchoolCoursePage(DlDriveSchoolCourseVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<DlDriveSchoolCourseVO> page = new Page<>(pageNo, pageSize);
|
||||
return success(courseService.queryListPage(pageReqVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 不分页获取课程信息
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolCourseVO}
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.util.List < ?>>
|
||||
* @author PQZ
|
||||
* @date 22:22 2025/1/16
|
||||
**/
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "不分页获取课程信息")
|
||||
public CommonResult<List<?>> getDlDriveSchoolCourseList(DlDriveSchoolCourseVO pageReqVO) {
|
||||
return success(courseService.queryList(pageReqVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存课程信息
|
||||
*
|
||||
* @param saveVO {@link DlDriveSchoolCourseVO}
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||
* @author PQZ
|
||||
* @date 22:24 2025/1/16
|
||||
**/
|
||||
@PostMapping("/save")
|
||||
@Operation(summary = "创建驾校教练")
|
||||
public CommonResult<Boolean> saveSchoolCoach(@Valid @RequestBody DlDriveSchoolCourseVO saveVO) {
|
||||
courseService.saveDriveSchoolCourse(saveVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除课程信息
|
||||
*
|
||||
* @param id 课程id
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
|
||||
* @author PQZ
|
||||
* @date 22:25 2025/1/16
|
||||
**/
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除课程信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteCourse(@RequestParam("id") String id) {
|
||||
courseService.deleteCourse(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取课程信息
|
||||
*
|
||||
* @param id 课程id
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO>
|
||||
* @author PQZ
|
||||
* @date 22:26 2025/1/16
|
||||
**/
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获取课程信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<DlDriveSchoolCourseVO> getDlDriveSchoolCoach(@RequestParam("id") String id) {
|
||||
return success(courseService.queryDetailById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 驾校学员")
|
||||
@RestController
|
||||
@RequestMapping("/base/dl-drive-school-student")
|
||||
@Validated
|
||||
public class DlDriveSchoolStudentController {
|
||||
|
||||
@Resource
|
||||
private DlDriveSchoolStudentService schoolStudentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建驾校学员")
|
||||
public CommonResult<String> createDlDriveSchoolStudent(@Valid @RequestBody DlDriveSchoolStudentVO createReqVO) {
|
||||
return success(schoolStudentService.createDlDriveSchoolStudent(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新驾校学员")
|
||||
public CommonResult<Boolean> updateDlDriveSchoolStudent(@Valid @RequestBody DlDriveSchoolStudentVO updateReqVO) {
|
||||
schoolStudentService.updateDlDriveSchoolStudent(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除驾校学员")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteDlDriveSchoolStudent(@RequestParam("id") String id) {
|
||||
schoolStudentService.deleteDlDriveSchoolStudent(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得驾校学员")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<DlDriveSchoolStudent> getDlDriveSchoolStudent(@RequestParam("id") String id) {
|
||||
DlDriveSchoolStudent dlDriveSchoolStudent = schoolStudentService.getById(id);
|
||||
return success(dlDriveSchoolStudent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取学员列表
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolStudentVO}
|
||||
* @param pageNo 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage < ?>>
|
||||
* @author PQZ
|
||||
* @date 10:46 2025/1/18
|
||||
**/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得驾校学员分页")
|
||||
public CommonResult<IPage<?>> getDlDriveSchoolStudentPage(@Valid DlDriveSchoolStudentVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<DlDriveSchoolStudentVO> page = new Page<>(pageNo, pageSize);
|
||||
return success(schoolStudentService.queryListPage(pageReqVO, page));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package cn.iocoder.yudao.module.base.controller.app;
|
||||
|
||||
public class AppTestController {
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package cn.iocoder.yudao.module.base.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 驾校教练 DO
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@TableName("drive_school_coach")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DlDriveSchoolCoach extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 照片
|
||||
*/
|
||||
private String image;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private Integer age;
|
||||
/**
|
||||
* 性别
|
||||
*
|
||||
*/
|
||||
private String sex;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idNumber;
|
||||
/**
|
||||
* 车牌
|
||||
*/
|
||||
private String carId;
|
||||
/**
|
||||
* 户籍地址
|
||||
*/
|
||||
private String regAddress;
|
||||
/**
|
||||
* 家庭住址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 教龄
|
||||
*/
|
||||
private Integer seniority;
|
||||
/**
|
||||
* 个人简介
|
||||
*/
|
||||
private String instructorDesc;
|
||||
/**
|
||||
* 工作人员类型(教练、工作人员)
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String idPhoto;
|
||||
/**
|
||||
* 生活照
|
||||
*/
|
||||
private String lifePhoto;
|
||||
/**
|
||||
* 驾驶证
|
||||
*/
|
||||
private String drivePhoto;
|
||||
/**
|
||||
* 其他证件
|
||||
*/
|
||||
private String otherPhoto;
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.base.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 驾校教练 DO
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@TableName("drive_school_coach_course")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DlDriveSchoolCoachCourse extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 教练id
|
||||
*/
|
||||
private String coachId;
|
||||
/**
|
||||
* 课程id
|
||||
*/
|
||||
private String courseId;
|
||||
/**
|
||||
* 科目
|
||||
*/
|
||||
private String subject;
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.base.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 驾校课程实体
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@TableName("drive_school_course")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DlDriveSchoolCourse extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 车辆档位
|
||||
*/
|
||||
private String automatic;
|
||||
|
||||
/**
|
||||
* 驾照类型
|
||||
*/
|
||||
private String license;
|
||||
|
||||
/**
|
||||
* 驾驶证类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 课程名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 课程开始时间
|
||||
*/
|
||||
private String dayStart;
|
||||
|
||||
/**
|
||||
* 课程结束时间
|
||||
*/
|
||||
private String dayEnd;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 封面图
|
||||
*/
|
||||
private String photo;
|
||||
/**
|
||||
* 课程简介
|
||||
*/
|
||||
private String describ;
|
||||
/**
|
||||
* 定金
|
||||
*/
|
||||
private BigDecimal reserveMoney;
|
||||
/**
|
||||
* 交付定金的优惠
|
||||
*/
|
||||
private double favour;
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package cn.iocoder.yudao.module.base.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 驾校学员 DO
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@TableName("drive_school_student")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DlDriveSchoolStudent extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private Integer age;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
/**
|
||||
* 工作单位
|
||||
*/
|
||||
private String workName;
|
||||
/**
|
||||
* 户籍地址
|
||||
*/
|
||||
private String registAddress;
|
||||
/**
|
||||
* 家庭住址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 人员类型(暂留)
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 证件照
|
||||
*/
|
||||
private String idPhoto;
|
||||
/**
|
||||
* 生活照
|
||||
*/
|
||||
private String lifePhoto;
|
||||
/**
|
||||
* 其他照片
|
||||
*/
|
||||
private String otherPhoto;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.base.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 驾校教练 Mapper
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Mapper
|
||||
public interface DlDriveSchoolCoachMapper extends BaseMapper<DlDriveSchoolCoach> {
|
||||
|
||||
/**
|
||||
* 驾校教练、普通员工列表
|
||||
*
|
||||
* @param entity {@link DlDriveSchoolCoachPageReqVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO>
|
||||
* @author PQZ
|
||||
* @date 15:04 2025/1/16
|
||||
**/
|
||||
IPage<DlDriveSchoolCoachRespVO> queryListPage(@Param("entity") DlDriveSchoolCoachPageReqVO entity, Page<DlDriveSchoolCoachRespVO> page);
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.base.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCourse;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 驾校课程Mapper
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Mapper
|
||||
public interface DlDriveSchoolCourseMapper extends BaseMapper<DlDriveSchoolCourse> {
|
||||
/**
|
||||
* 分页查询驾校课程
|
||||
*
|
||||
* @param entity {@link DlDriveSchoolCourseVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO>
|
||||
* @author PQZ
|
||||
* @date 7:10 2025/1/17
|
||||
**/
|
||||
IPage<DlDriveSchoolCourseVO> queryListPage(@Param("entity") DlDriveSchoolCourseVO entity, Page<DlDriveSchoolCourseVO> page);
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.base.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 驾校学员 Mapper
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Mapper
|
||||
public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStudent> {
|
||||
|
||||
/**
|
||||
* 分页查询学生
|
||||
*
|
||||
* @param entity DlDriveSchoolStudentVO
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO>
|
||||
* @author PQZ
|
||||
* @date 10:44 2025/1/18
|
||||
**/
|
||||
IPage<DlDriveSchoolStudentVO> queryListPage(@Param("entity") DlDriveSchoolStudentVO entity, Page<DlDriveSchoolStudentVO> page);
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.base.service;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 驾校教练 Service 接口
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
public interface DlDriveSchoolCoachService extends IService<DlDriveSchoolCoach> {
|
||||
|
||||
/**
|
||||
* 驾校教练、普通员工列表
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolCoachPageReqVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO>
|
||||
* @author PQZ
|
||||
* @date 15:02 2025/1/16
|
||||
**/
|
||||
IPage<DlDriveSchoolCoachRespVO> queryListPage(DlDriveSchoolCoachPageReqVO pageReqVO, Page<DlDriveSchoolCoachRespVO> page);
|
||||
|
||||
/**
|
||||
* 保存驾校教练
|
||||
*
|
||||
* @param createReqVO {@link DlDriveSchoolCoachSaveReqVO}
|
||||
* @author PQZ @date 2025/1/16
|
||||
**/
|
||||
void saveSchoolCoach(@Valid DlDriveSchoolCoachSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 删除驾校教练
|
||||
*
|
||||
* @param id 教练id
|
||||
* @author PQZ
|
||||
* @date 21:39 2025/1/16
|
||||
**/
|
||||
void deleteDlDriveSchoolCoach(String id);
|
||||
|
||||
/**
|
||||
* 获得驾校教练
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 驾校教练
|
||||
*/
|
||||
DlDriveSchoolCoachRespVO getDlDriveSchoolCoach(String id);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.base.service;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCourse;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 驾校课程Service
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
public interface DlDriveSchoolCourseService extends IService<DlDriveSchoolCourse> {
|
||||
|
||||
/**
|
||||
* 分页查询驾校课程
|
||||
*
|
||||
* @param pageReqVO DlDriveSchoolCourseVO
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO>
|
||||
* @author PQZ
|
||||
* @date 22:04 2025/1/16
|
||||
**/
|
||||
IPage<DlDriveSchoolCourseVO> queryListPage(DlDriveSchoolCourseVO pageReqVO, Page<DlDriveSchoolCourseVO> page);
|
||||
|
||||
/**
|
||||
* 不分页查询驾校课程
|
||||
*
|
||||
* @param courseVO {@link DlDriveSchoolCourseVO}
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO>
|
||||
* @author PQZ
|
||||
* @date 22:07 2025/1/16
|
||||
**/
|
||||
List<DlDriveSchoolCourse> queryList(DlDriveSchoolCourseVO courseVO);
|
||||
|
||||
/**
|
||||
* 保存课程信息
|
||||
*
|
||||
* @param courseVO {@link DlDriveSchoolCourseVO}
|
||||
* @author PQZ
|
||||
* @date 22:12 2025/1/16
|
||||
**/
|
||||
void saveDriveSchoolCourse(DlDriveSchoolCourseVO courseVO);
|
||||
|
||||
/**
|
||||
* 删除课程信息
|
||||
*
|
||||
* @param id 课程id
|
||||
* @author PQZ
|
||||
* @date 22:14 2025/1/16
|
||||
**/
|
||||
void deleteCourse(String id);
|
||||
|
||||
/**
|
||||
* 通过id查询课程信息
|
||||
*
|
||||
* @param id 课程id
|
||||
* @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO
|
||||
* @author PQZ
|
||||
* @date 22:15 2025/1/16
|
||||
**/
|
||||
DlDriveSchoolCourseVO queryDetailById(String id);
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.base.service;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 驾校学员 Service 接口
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStudent> {
|
||||
|
||||
/**
|
||||
* 创建驾校学员
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createDlDriveSchoolStudent(@Valid DlDriveSchoolStudentVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新驾校学员
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDlDriveSchoolStudent(@Valid DlDriveSchoolStudentVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除驾校学员
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDlDriveSchoolStudent(String id);
|
||||
|
||||
/**
|
||||
* 获得驾校学员
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 驾校学员
|
||||
*/
|
||||
DlDriveSchoolStudent getDlDriveSchoolStudent(String id);
|
||||
|
||||
/**
|
||||
* 分页查询学生列表
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolStudentVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<?>
|
||||
* @author PQZ
|
||||
* @date 10:41 2025/1/18
|
||||
**/
|
||||
IPage<DlDriveSchoolStudentVO> queryListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page);
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
|
||||
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCoachMapper;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCoachService;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachPageReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.PASSWORD_DEFAULT;
|
||||
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_STAFF;
|
||||
|
||||
/**
|
||||
* 驾校教练 Service 实现类
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DlDriveSchoolCoachServiceImpl extends ServiceImpl<DlDriveSchoolCoachMapper, DlDriveSchoolCoach> implements DlDriveSchoolCoachService {
|
||||
|
||||
@Resource
|
||||
private DlDriveSchoolCoachMapper dlDriveSchoolCoachMapper;
|
||||
@Resource
|
||||
@Lazy
|
||||
private AdminUserApi adminUserApi;
|
||||
@Resource
|
||||
private PermissionApi permissionApi;
|
||||
|
||||
/**
|
||||
* 驾校教练、普通员工列表
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolCoachPageReqVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO>
|
||||
* @author PQZ
|
||||
* @date 15:02 2025/1/16
|
||||
**/
|
||||
@Override
|
||||
public IPage<DlDriveSchoolCoachRespVO> queryListPage(DlDriveSchoolCoachPageReqVO pageReqVO, Page<DlDriveSchoolCoachRespVO> page) {
|
||||
return dlDriveSchoolCoachMapper.queryListPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存驾校教练
|
||||
*
|
||||
* @param createReqVO {@link DlDriveSchoolCoachSaveReqVO}
|
||||
* @author PQZ
|
||||
* @date 21:07 2025/1/16
|
||||
**/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveSchoolCoach(DlDriveSchoolCoachSaveReqVO createReqVO) {
|
||||
/*1、数据类型转换*/
|
||||
DlDriveSchoolCoach dlDriveSchoolCoach = BeanUtils.toBean(createReqVO, DlDriveSchoolCoach.class);
|
||||
if (null == createReqVO.getUserId()) {
|
||||
/*2、新增教练或编辑教练无用户id时,同时插入一条用户数据*/
|
||||
//通过手机号查询用户
|
||||
AdminUserRespDTO userDTO = adminUserApi.getUserByUsername(createReqVO.getPhone());
|
||||
Long userId;
|
||||
//存在两种情况,1、用户存在,2、用户不存在
|
||||
if (null == userDTO) {
|
||||
UserDTO user = new UserDTO();
|
||||
//如果不存在创建用户;
|
||||
user.setUsername(createReqVO.getPhone());
|
||||
user.setNickname(createReqVO.getName());
|
||||
//默认密码
|
||||
user.setPassword(PASSWORD_DEFAULT);
|
||||
user.setMobile(createReqVO.getPhone());
|
||||
//用户类型员工
|
||||
user.setUserType(USER_TYPE_STAFF);
|
||||
//创建客户
|
||||
userId = adminUserApi.createUser(user);
|
||||
//创建客户后为客户绑定角色
|
||||
Set<String> roleCodes = new HashSet<>();
|
||||
// TODO: 2025/1/16 枚举值问老马(保存角色方法不对)
|
||||
permissionApi.assignUserRole(userId, roleCodes);
|
||||
} else {
|
||||
userId = userDTO.getId();
|
||||
}
|
||||
dlDriveSchoolCoach.setUserId(userId);
|
||||
}
|
||||
/*3、保存教练信息*/
|
||||
saveOrUpdate(dlDriveSchoolCoach);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除驾校教练
|
||||
*
|
||||
* @param id 教练id
|
||||
* @author PQZ
|
||||
* @date 21:39 2025/1/16
|
||||
**/
|
||||
@Override
|
||||
public void deleteDlDriveSchoolCoach(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询教练信息
|
||||
*
|
||||
* @param id 教练id
|
||||
* @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO
|
||||
* @author PQZ
|
||||
* @date 21:43 2025/1/16
|
||||
**/
|
||||
@Override
|
||||
public DlDriveSchoolCoachRespVO getDlDriveSchoolCoach(String id) {
|
||||
//通过id查询教练信息
|
||||
DlDriveSchoolCoach schoolCoach = getById(id);
|
||||
//数据类型转换
|
||||
DlDriveSchoolCoachRespVO result = BeanUtils.toBean(schoolCoach, DlDriveSchoolCoachRespVO.class);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCourse;
|
||||
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCoachMapper;
|
||||
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCourseMapper;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolCourseService;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO;
|
||||
import cn.iocoder.yudao.module.jx.core.page.TenantBaDO;
|
||||
import cn.iocoder.yudao.module.jx.utils.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 驾校教练 Service 实现类
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DlDriveSchoolCourseServiceImpl extends ServiceImpl<DlDriveSchoolCourseMapper, DlDriveSchoolCourse> implements DlDriveSchoolCourseService {
|
||||
|
||||
@Resource
|
||||
private DlDriveSchoolCourseMapper courseMapper;
|
||||
|
||||
/**
|
||||
* 分页查询驾校课程
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolCourseVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO>
|
||||
* @author PQZ
|
||||
* @date 22:04 2025/1/16
|
||||
**/
|
||||
@Override
|
||||
public IPage<DlDriveSchoolCourseVO> queryListPage(DlDriveSchoolCourseVO pageReqVO, Page<DlDriveSchoolCourseVO> page) {
|
||||
return courseMapper.queryListPage(pageReqVO,page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 不分页查询驾校课程
|
||||
*
|
||||
* @param courseVO {@link DlDriveSchoolCourseVO}
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO>
|
||||
* @author PQZ
|
||||
* @date 22:07 2025/1/16
|
||||
**/
|
||||
@Override
|
||||
public List<DlDriveSchoolCourse> queryList(DlDriveSchoolCourseVO courseVO) {
|
||||
LambdaQueryWrapper<DlDriveSchoolCourse> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0);
|
||||
if (StringUtils.isNotEmpty(courseVO.getName())) {
|
||||
lambdaQueryWrapper.like(DlDriveSchoolCourse::getName, courseVO.getName());
|
||||
}
|
||||
return list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存课程信息
|
||||
*
|
||||
* @param courseVO {@link DlDriveSchoolCourseVO}
|
||||
* @author PQZ
|
||||
* @date 22:12 2025/1/16
|
||||
**/
|
||||
@Override
|
||||
public void saveDriveSchoolCourse(DlDriveSchoolCourseVO courseVO) {
|
||||
saveOrUpdate(courseVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课程信息
|
||||
*
|
||||
* @param id 课程id
|
||||
* @author PQZ
|
||||
* @date 22:14 2025/1/16
|
||||
**/
|
||||
@Override
|
||||
public void deleteCourse(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询课程信息
|
||||
*
|
||||
* @param id 课程id
|
||||
* @return cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO
|
||||
* @author PQZ
|
||||
* @date 22:15 2025/1/16
|
||||
**/
|
||||
@Override
|
||||
public DlDriveSchoolCourseVO queryDetailById(String id) {
|
||||
DlDriveSchoolCourse course = getById(id);
|
||||
DlDriveSchoolCourseVO result = BeanUtils.toBean(course, DlDriveSchoolCourseVO.class);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
|
||||
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolStudentMapper;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 驾校学员 Service 实现类
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolStudentMapper, DlDriveSchoolStudent> implements DlDriveSchoolStudentService {
|
||||
|
||||
@Resource
|
||||
private DlDriveSchoolStudentMapper dlDriveSchoolStudentMapper;
|
||||
|
||||
@Override
|
||||
public String createDlDriveSchoolStudent(DlDriveSchoolStudentVO createReqVO) {
|
||||
// 插入
|
||||
DlDriveSchoolStudent dlDriveSchoolStudent = BeanUtils.toBean(createReqVO, DlDriveSchoolStudent.class);
|
||||
dlDriveSchoolStudentMapper.insert(dlDriveSchoolStudent);
|
||||
// 返回
|
||||
return dlDriveSchoolStudent.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDlDriveSchoolStudent(DlDriveSchoolStudentVO updateReqVO) {
|
||||
// 更新
|
||||
DlDriveSchoolStudent updateObj = BeanUtils.toBean(updateReqVO, DlDriveSchoolStudent.class);
|
||||
dlDriveSchoolStudentMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDlDriveSchoolStudent(String id) {
|
||||
// 删除
|
||||
dlDriveSchoolStudentMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public DlDriveSchoolStudent getDlDriveSchoolStudent(String id) {
|
||||
return dlDriveSchoolStudentMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询学生列表
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolStudentVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<?>
|
||||
* @author PQZ
|
||||
* @date 10:41 2025/1/18
|
||||
**/
|
||||
@Override
|
||||
public IPage<DlDriveSchoolStudentVO> queryListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page) {
|
||||
return dlDriveSchoolStudentMapper.queryListPage(pageReqVO,page);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 驾校教练分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DlDriveSchoolCoachPageReqVO extends DlDriveSchoolCoach {
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 驾校教练 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DlDriveSchoolCoachRespVO extends DlDriveSchoolCoach {
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCoach;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 驾校教练新增/修改 Request VO")
|
||||
@Data
|
||||
public class DlDriveSchoolCoachSaveReqVO extends DlDriveSchoolCoach {
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCourse;
|
||||
import cn.iocoder.yudao.module.jx.core.page.TenantBaDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "驾校课程管理VO")
|
||||
@Data
|
||||
public class DlDriveSchoolCourseVO extends DlDriveSchoolCourse {
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 驾校学员 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DlDriveSchoolStudentVO extends DlDriveSchoolStudent {
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.course.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 学员课程进度")
|
||||
@RestController
|
||||
@RequestMapping("/process")
|
||||
@Validated
|
||||
public class ProcessController {
|
||||
|
||||
@Resource
|
||||
private ProcessService processService;
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目
|
||||
* @author vinjor-M
|
||||
* @date 11:05 2025/1/15
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/getMyCourseAndSubject")
|
||||
@Operation(summary = "教练查自己带教的课程和科目")
|
||||
public CommonResult<?> getMyCourseAndSubject() {
|
||||
return success(processService.getMyCourseAndSubject());
|
||||
}
|
||||
/**
|
||||
* 教练查自己带教的课程和科目在训练中的学生
|
||||
* @author vinjor-M
|
||||
* @date 11:05 2025/1/15
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/getMyCourseStudentPage")
|
||||
@Operation(summary = "教练查自己带教的课程和科目在训练中的学生")
|
||||
public CommonResult<IPage<?>> getMyCourseStudentPage(Process process,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<Process> page = new Page<>(pageNo,pageSize);
|
||||
return success(processService.getMyCourseStudentPage(process,page));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package cn.iocoder.yudao.module.course.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 驾校-学员课程进度 DO
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@TableName("drive_school_process")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Process extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 课程ID
|
||||
*/
|
||||
private String courseId;
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String courseName;
|
||||
/**
|
||||
* 用户(学员)ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 用户(学员)姓名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 学员手机号
|
||||
*/
|
||||
private String userMobile;
|
||||
/**
|
||||
* 教练ID
|
||||
*/
|
||||
private Integer coachId;
|
||||
/**
|
||||
* 教练姓名
|
||||
*/
|
||||
private String coachName;
|
||||
/**
|
||||
* 科目(1-科目一;2-科目二;3科目三;4科目四)
|
||||
*/
|
||||
private Integer subject;
|
||||
/**
|
||||
* 考试次数(第一次考试为1,第二次为2...)
|
||||
*/
|
||||
private Integer examNum;
|
||||
/**
|
||||
* 当前状态(0-未开始;1-训练中;2-已完成)
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 考试是否合格(0未通过;1已通过;null 未考试)
|
||||
*/
|
||||
private Boolean ifPass;
|
||||
/**
|
||||
* 考试分数
|
||||
*/
|
||||
private Double examScore;
|
||||
/**
|
||||
* 图片证明材料
|
||||
*/
|
||||
private String images;
|
||||
/**
|
||||
* 考试时间
|
||||
*/
|
||||
private Date examTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 本科目累计训练时长
|
||||
*/
|
||||
private Double trainTime;
|
||||
/**
|
||||
* 财务审核是否通过(0未通过;1通过;null待审核)
|
||||
*/
|
||||
private Boolean financePass;
|
||||
/**
|
||||
* 财务审核备注
|
||||
*/
|
||||
private String financeRemark;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.course.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 驾校-学员课程进度 Mapper
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProcessMapper extends BaseMapper<Process> {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.course.service;
|
||||
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 学员课程进度 Service 接口
|
||||
*
|
||||
* @author lzt
|
||||
*/
|
||||
public interface ProcessService extends IService<Process> {
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目
|
||||
* @author vinjor-M
|
||||
* @date 11:05 2025/1/15
|
||||
* @return java.util.List<cn.iocoder.yudao.module.course.entity.Process>
|
||||
**/
|
||||
List<Process> getMyCourseAndSubject();
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目在训练中的学生
|
||||
* @author vinjor-M
|
||||
* @date 17:11 2025/1/15
|
||||
* @param process 查询对象
|
||||
**/
|
||||
IPage<Process> getMyCourseStudentPage(Process process, Page<Process> page);
|
||||
|
||||
/**
|
||||
* 查某个学员在某个教练的某个课程、某个科目的学习进度(当前在练习中的)
|
||||
* @author vinjor-M
|
||||
* @date 18:39 2025/1/16
|
||||
* @param userId 学生id
|
||||
* @param courseId 课程id
|
||||
* @param subject 科目
|
||||
* @param coachId 教练id
|
||||
* @return cn.iocoder.yudao.module.course.entity.Process
|
||||
**/
|
||||
Process getByStudentAndCourse(Integer userId,String courseId,Integer subject,Long coachId);
|
||||
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package cn.iocoder.yudao.module.course.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.mapper.ProcessMapper;
|
||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 学员课程进度 Service 实现类
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Service
|
||||
public class ProcessServiceImpl extends ServiceImpl<ProcessMapper, Process> implements ProcessService {
|
||||
@Autowired
|
||||
private ProcessMapper processMapper;
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.course.entity.Process>
|
||||
* @author vinjor-M
|
||||
* @date 11:05 2025/1/15
|
||||
**/
|
||||
@Override
|
||||
public List<Process> getMyCourseAndSubject() {
|
||||
//当前教练ID
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||
.eq(Process::getCoachId,userId)
|
||||
//状态不等于2-已完成的科目
|
||||
.ne(Process::getStatus,"2")
|
||||
.groupBy(Process::getCourseId).groupBy(Process::getSubject);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 教练查自己带教的课程和科目在训练中的学生
|
||||
*
|
||||
* @param process
|
||||
* @param page
|
||||
* @author vinjor-M
|
||||
* @date 17:11 2025/1/15
|
||||
**/
|
||||
@Override
|
||||
public IPage<Process> getMyCourseStudentPage(Process process, Page<Process> page) {
|
||||
//当前教练ID
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||
.eq(Process::getCoachId,userId)
|
||||
.eq(Process::getCourseId,process.getCourseId())
|
||||
.eq(Process::getSubject,process.getSubject());
|
||||
if(StringUtils.isNotEmpty(process.getUserName())){
|
||||
queryWrapper.like(Process::getUserName,process.getUserName());
|
||||
}
|
||||
//状态等于1-训练中的
|
||||
queryWrapper.eq(Process::getStatus,"1")
|
||||
.groupBy(Process::getUserId)
|
||||
.orderByDesc(BaseDO::getCreateTime);
|
||||
return this.page(page,queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查某个学员在某个教练的某个课程、某个科目的学习进度(当前在练习中的)
|
||||
*
|
||||
* @param userId 学生id
|
||||
* @param courseId 课程id
|
||||
* @param subject 科目
|
||||
* @param coachId 教练id
|
||||
* @return cn.iocoder.yudao.module.course.entity.Process
|
||||
* @author vinjor-M
|
||||
* @date 18:39 2025/1/16
|
||||
**/
|
||||
@Override
|
||||
public Process getByStudentAndCourse(Integer userId, String courseId, Integer subject, Long coachId) {
|
||||
LambdaQueryWrapper<Process> queryWrapper = new LambdaQueryWrapper<Process>()
|
||||
.eq(Process::getUserId,userId)
|
||||
.eq(Process::getCoachId,coachId)
|
||||
.eq(Process::getCourseId,courseId)
|
||||
.eq(Process::getSubject,subject)
|
||||
.eq(Process::getStatus,"1")
|
||||
.orderByDesc(BaseDO::getCreateTime);
|
||||
List<Process> processList = this.list(queryWrapper);
|
||||
return processList.isEmpty()?null:processList.get(0);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package cn.iocoder.yudao.module.train.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import cn.iocoder.yudao.module.train.service.ReservationCourseService;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 预约练车")
|
||||
@RestController
|
||||
@RequestMapping("/reservation-course")
|
||||
@Validated
|
||||
public class ReservationCourseController {
|
||||
|
||||
@Resource
|
||||
private ReservationCourseService reservationCourseService;
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得预约练车分页")
|
||||
@PreAuthorize("@ss.hasPermission('train:reservation-course:query')")
|
||||
public CommonResult<IPage<?>> getPage(ReservationCourseVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<ReservationCourseVO> page = new Page<>(pageNo,pageSize);
|
||||
if("my".equals(pageReqVO.getSelectType())){
|
||||
//查自己的
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
pageReqVO.setCoachId(userId);
|
||||
}
|
||||
//查未取消的
|
||||
pageReqVO.setIfCancel(false);
|
||||
return success(reservationCourseService.queryListPage(pageReqVO,page));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "审核预约练车")
|
||||
@PreAuthorize("@ss.hasPermission('train:reservation-course:update')")
|
||||
public CommonResult<Boolean> updateReservationCourse(@Valid @RequestBody ReservationCourseVO updateReqVO) {
|
||||
reservationCourseService.updateById(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除预约练车")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('train:reservation-course:delete')")
|
||||
public CommonResult<Boolean> deleteReservationCourse(@RequestParam("id") String id) {
|
||||
reservationCourseService.removeById(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得预约练车")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('train:reservation-course:query')")
|
||||
public CommonResult<ReservationCourse> getReservationCourse(@RequestParam("id") String id) {
|
||||
return success(reservationCourseService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据学生userId查询学生信息及当天的预约记录
|
||||
* @author vinjor-M
|
||||
* @date 17:25 2025/1/16
|
||||
* @param userId 学生userId
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.module.train.entity.ReservationCourse>
|
||||
**/
|
||||
@GetMapping("/getUserInfoAndReservation")
|
||||
@Operation(summary = "根据学生userId查询学生信息及当天的预约记录")
|
||||
@Parameter(name = "id", description = "学生userId", required = true, example = "1024")
|
||||
public CommonResult<?> getReservationCourse(@RequestParam("userId") Integer userId,
|
||||
@RequestParam("courseId") String courseId,
|
||||
@RequestParam("type") String type,
|
||||
@RequestParam("subject") Integer subject) {
|
||||
return success(reservationCourseService.getUserInfoAndReservation(userId,courseId,subject,type));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.train.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.train.service.TrainService;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 练车记录")
|
||||
@RestController
|
||||
@RequestMapping("/train")
|
||||
@Validated
|
||||
public class TrainController {
|
||||
|
||||
@Resource
|
||||
private TrainService trainService;
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得练车记录分页")
|
||||
public CommonResult<IPage<?>> getPage(TrainVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<TrainVO> page = new Page<>(pageNo,pageSize);
|
||||
if("my".equals(pageReqVO.getSelectType())){
|
||||
//查自己的
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
pageReqVO.setCoachId(userId);
|
||||
}
|
||||
return success(trainService.queryListPage(pageReqVO,page));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "到场打卡")
|
||||
public CommonResult<?> createObj( @RequestBody TrainVO trainVO) {
|
||||
trainService.createObj(trainVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "离场打卡")
|
||||
public CommonResult<?> updateObj( @RequestBody TrainVO trainVO) {
|
||||
trainService.updateObj(trainVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查看练车记录详情")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<?> getById(@RequestParam("id") String id) {
|
||||
return success(trainService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.train.controller.app;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import cn.iocoder.yudao.module.train.service.ReservationCourseService;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "小程序 - 预约练车")
|
||||
@RestController
|
||||
@RequestMapping("/reservation-course")
|
||||
@Validated
|
||||
public class AppReservationCourseController {
|
||||
|
||||
@Resource
|
||||
private ReservationCourseService reservationCourseService;
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得预约练车分页")
|
||||
public CommonResult<IPage<?>> getPage(ReservationCourseVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<ReservationCourseVO> page = new Page<>(pageNo,pageSize);
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
pageReqVO.setUserId(userId);
|
||||
return success(reservationCourseService.queryListPage(pageReqVO,page));
|
||||
}
|
||||
|
||||
@PutMapping("/create")
|
||||
@Operation(summary = "预约练车")
|
||||
public CommonResult<Boolean> createReservationCourse( @RequestBody ReservationCourse createObj) {
|
||||
reservationCourseService.save(createObj);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/cancel")
|
||||
@Operation(summary = "取消预约练车")
|
||||
public CommonResult<Boolean> updateReservationCourse(String id) {
|
||||
ReservationCourse updateObj = new ReservationCourse();
|
||||
updateObj.setId(id);
|
||||
updateObj.setIfCancel(true);
|
||||
reservationCourseService.updateById(updateObj);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除预约练车")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteReservationCourse(@RequestParam("id") String id) {
|
||||
reservationCourseService.removeById(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得预约练车")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<ReservationCourse> getReservationCourse(@RequestParam("id") String id) {
|
||||
return success(reservationCourseService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.train.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 预约练车 DO
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@TableName("drive_school_reservation_course")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReservationCourse extends TenantBaseDO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 课程ID
|
||||
*/
|
||||
private String courseId;
|
||||
/**
|
||||
* 教练id
|
||||
*/
|
||||
private Long coachId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户姓名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String courseName;
|
||||
/**
|
||||
* 教练名字
|
||||
*/
|
||||
private String coachName;
|
||||
/**
|
||||
* 预约日期 yyyy-MM-dd
|
||||
*/
|
||||
private String reservDay;
|
||||
/**
|
||||
* 时间段(字典:school_reserv_time)09:00-10:00
|
||||
*/
|
||||
private String reservTime;
|
||||
/**
|
||||
* 科目(1-科目一;2-科目二;3科目三;4科目四)
|
||||
*/
|
||||
private Integer subject;
|
||||
/**
|
||||
* 预约类型 1:正常预约 2:立即练车
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String refuseReason;
|
||||
/**
|
||||
* 教练审核状态 0:拒绝 ;1:通过 ;null :待审核
|
||||
*/
|
||||
private Boolean status;
|
||||
/**
|
||||
* 用户是否取消(0未取消|1已取消)
|
||||
*/
|
||||
private Boolean ifCancel;
|
||||
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
package cn.iocoder.yudao.module.train.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 驾校-训练记录 DO
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@TableName("drive_school_train")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Train extends TenantBaseDO {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 课程ID
|
||||
*/
|
||||
private String courseId;
|
||||
/**
|
||||
* 预约记录ID
|
||||
*/
|
||||
private String reservationId;
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String courseName;
|
||||
/**
|
||||
* 科目(1-科目一;2-科目二;3科目三;4科目四)
|
||||
*/
|
||||
private Integer subject;
|
||||
/**
|
||||
* 用户(学员)ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户(学员)姓名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 学员手机号
|
||||
*/
|
||||
private String userMobile;
|
||||
/**
|
||||
* 教练ID
|
||||
*/
|
||||
private Long coachId;
|
||||
/**
|
||||
* 教练姓名
|
||||
*/
|
||||
private String coachName;
|
||||
/**
|
||||
* 训练地址id
|
||||
*/
|
||||
private String addrId;
|
||||
/**
|
||||
* 训练地址
|
||||
*/
|
||||
private String addr;
|
||||
/**
|
||||
* 训练日期(yyyy-MM-dd)
|
||||
*/
|
||||
private String trainDay;
|
||||
/**
|
||||
* 交通方式(字典:school_transport_way)
|
||||
*/
|
||||
private String transWay;
|
||||
/**
|
||||
* 预约方式(字典:school_reservation_way)
|
||||
*/
|
||||
private String reservationWay;
|
||||
/**
|
||||
* 到场时间
|
||||
*/
|
||||
private Date startTime;
|
||||
/**
|
||||
* 到场备注
|
||||
*/
|
||||
private String startRemark;
|
||||
/**
|
||||
* 到场图片
|
||||
*/
|
||||
private String startImages;
|
||||
/**
|
||||
* 离场时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 离场备注
|
||||
*/
|
||||
private String endRemark;
|
||||
/**
|
||||
* 离场图片
|
||||
*/
|
||||
private String endImages;
|
||||
/**
|
||||
* 本次有效训练时长(分钟)
|
||||
*/
|
||||
private Double trainTime;
|
||||
/**
|
||||
* 累计有效训练时长(分钟)到场打卡存的是本次训练前的累计时长,离场打卡后,存的是本次训练完后累计时长
|
||||
*/
|
||||
private Double allTrainTime;
|
||||
/**
|
||||
* 是否已评价(0未评价|1已评价)
|
||||
*/
|
||||
private Boolean ifEvaluate;
|
||||
/**
|
||||
* 评价ID
|
||||
*/
|
||||
private Integer evaluateId;
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.train.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 预约练车 Mapper
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReservationCourseMapper extends BaseMapper<ReservationCourse> {
|
||||
|
||||
IPage<ReservationCourseVO> queryListPage(@Param("entity") ReservationCourseVO entity, Page<ReservationCourseVO> page);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.train.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 练车记录 Mapper
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Mapper
|
||||
public interface TrainMapper extends BaseMapper<Train> {
|
||||
|
||||
IPage<TrainVO> queryListPage(@Param("entity") TrainVO entity, Page<TrainVO> page);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.train.service;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 预约练车 Service 接口
|
||||
*
|
||||
* @author lzt
|
||||
*/
|
||||
public interface ReservationCourseService extends IService<ReservationCourse> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @author vinjor-M
|
||||
* @date 15:05 2025/1/14
|
||||
* @param pageReqVO TODO
|
||||
* @param page TODO
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.train.vo.ReservationCourseVO>
|
||||
**/
|
||||
IPage<ReservationCourseVO> queryListPage(ReservationCourseVO pageReqVO, Page<ReservationCourseVO> page);
|
||||
|
||||
/**
|
||||
* 根据学生userId查询学生信息及当天的预约记录
|
||||
* @author vinjor-M
|
||||
* @date 17:27 2025/1/16
|
||||
* @param userId
|
||||
* @return java.util.Map<java.lang.String,java.lang.Object>
|
||||
**/
|
||||
Map<String,Object> getUserInfoAndReservation(Integer userId,String courseId,Integer subject,String type);
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.train.service;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 预约练车 Service 接口
|
||||
*
|
||||
* @author lzt
|
||||
*/
|
||||
public interface TrainService extends IService<Train> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @author vinjor-M
|
||||
* @date 15:05 2025/1/14
|
||||
* @param pageReqVO TODO
|
||||
* @param page TODO
|
||||
**/
|
||||
IPage<TrainVO> queryListPage(TrainVO pageReqVO, Page<TrainVO> page);
|
||||
|
||||
/**
|
||||
* 到场打卡
|
||||
* @author vinjor-M
|
||||
* @date 15:47 2025/1/14
|
||||
* @param trainVO TODO
|
||||
**/
|
||||
void createObj(TrainVO trainVO);
|
||||
|
||||
/**
|
||||
* 离场打卡
|
||||
* @author vinjor-M
|
||||
* @date 15:49 2025/1/14
|
||||
* @param trainVO TODO
|
||||
**/
|
||||
void updateObj(TrainVO trainVO);
|
||||
|
||||
/**
|
||||
* 查某个学院某个课程某个科目某天的培训记录-未签退的
|
||||
* @author vinjor-M
|
||||
* @date 10:21 2025/1/17
|
||||
* @param userId 学员用户id
|
||||
* @param courseId 课程ID
|
||||
* @param subject 科目
|
||||
* @param dayStr 日期
|
||||
* @return cn.iocoder.yudao.module.train.entity.Train
|
||||
**/
|
||||
Train getUserTrainData(Integer userId,String courseId,Integer subject,String dayStr);
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package cn.iocoder.yudao.module.train.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import cn.iocoder.yudao.module.train.mapper.ReservationCourseMapper;
|
||||
import cn.iocoder.yudao.module.train.service.ReservationCourseService;
|
||||
import cn.iocoder.yudao.module.train.service.TrainService;
|
||||
import cn.iocoder.yudao.module.train.vo.ReservationCourseVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 预约练车 Service 实现类
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Service
|
||||
public class ReservationCourseServiceImpl extends ServiceImpl<ReservationCourseMapper, ReservationCourse> implements ReservationCourseService {
|
||||
@Autowired
|
||||
private ReservationCourseMapper reservationCourseMapper;
|
||||
@Autowired
|
||||
private ProcessService processService;
|
||||
@Autowired
|
||||
private TrainService trainService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageReqVO TODO
|
||||
* @param page TODO
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.train.vo.ReservationCourseVO>
|
||||
* @author vinjor-M
|
||||
* @date 15:03 2025/1/14
|
||||
**/
|
||||
@Override
|
||||
public IPage<ReservationCourseVO> queryListPage(ReservationCourseVO pageReqVO, Page<ReservationCourseVO> page) {
|
||||
IPage<ReservationCourseVO> rtnList = reservationCourseMapper.queryListPage(pageReqVO, page);
|
||||
return rtnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据学生userId查询学生信息及当天的预约记录
|
||||
*
|
||||
* @param userId
|
||||
* @return java.util.Map<java.lang.String, java.lang.Object>
|
||||
* @author vinjor-M
|
||||
* @date 17:27 2025/1/16
|
||||
**/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Map<String, Object> getUserInfoAndReservation(Integer userId,String courseId,Integer subject,String type) {
|
||||
Map<String, Object> rtnMap = new HashMap<>();
|
||||
//当前教练ID
|
||||
Long coachId = SecurityFrameworkUtils.getLoginUserId();
|
||||
String nowDayStr = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
//查预约记录
|
||||
LambdaQueryWrapper<ReservationCourse> queryWrapper=new LambdaQueryWrapper<ReservationCourse>()
|
||||
.eq(ReservationCourse::getUserId,userId)
|
||||
.eq(ReservationCourse::getCoachId,coachId)
|
||||
.eq(ReservationCourse::getCourseId,courseId)
|
||||
.eq(ReservationCourse::getSubject,subject)
|
||||
.eq(ReservationCourse::getIfCancel,false)
|
||||
.eq(ReservationCourse::getReservDay,nowDayStr)
|
||||
.eq(ReservationCourse::getStatus,1)
|
||||
.orderByDesc(BaseDO::getCreateTime);
|
||||
List<ReservationCourse> list = this.list(queryWrapper);
|
||||
if(!list.isEmpty()){
|
||||
rtnMap.put("reservation",list.get(0));
|
||||
}
|
||||
//查该学员,该科目进度
|
||||
Process process = processService.getByStudentAndCourse(userId,courseId,subject,coachId);
|
||||
if(null==process){
|
||||
throw new Exception("该学员未报名你的课程,请向管理员核实");
|
||||
}
|
||||
//查当天训练记录--未签退的
|
||||
rtnMap.put("train",trainService.getUserTrainData(userId,courseId,subject,nowDayStr));
|
||||
rtnMap.put("process",process);
|
||||
//TODO 学员表接口对接
|
||||
rtnMap.put("userInfo",null);
|
||||
return rtnMap;
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package cn.iocoder.yudao.module.train.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.iocoder.yudao.module.course.entity.Process;
|
||||
import cn.iocoder.yudao.module.course.service.ProcessService;
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.mapper.TrainMapper;
|
||||
import cn.iocoder.yudao.module.train.service.TrainService;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 预约练车 Service 实现类
|
||||
*
|
||||
* @author 若依
|
||||
*/
|
||||
@Service
|
||||
public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements TrainService {
|
||||
@Autowired
|
||||
private TrainMapper trainMapper;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private ProcessService processService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageReqVO TODO
|
||||
* @param page TODO
|
||||
* @author vinjor-M
|
||||
* @date 15:03 2025/1/14
|
||||
**/
|
||||
@Override
|
||||
public IPage<TrainVO> queryListPage(TrainVO pageReqVO, Page<TrainVO> page) {
|
||||
IPage<TrainVO> rtnList = trainMapper.queryListPage(pageReqVO, page);
|
||||
return rtnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 到场打卡
|
||||
*
|
||||
* @param trainVO
|
||||
* @author vinjor-M
|
||||
* @date 15:47 2025/1/14
|
||||
**/
|
||||
@Override
|
||||
public void createObj(TrainVO trainVO) {
|
||||
trainVO.setTrainDay(DateUtil.format(new Date(), "yyyy-MM-dd"));
|
||||
this.save(trainVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 离场打卡
|
||||
*
|
||||
* @param trainVO
|
||||
* @author vinjor-M
|
||||
* @date 15:49 2025/1/14
|
||||
**/
|
||||
@Override
|
||||
public void updateObj(TrainVO trainVO) {
|
||||
//计算累计训练时长
|
||||
Double allTrainTime = trainVO.getAllTrainTime()+trainVO.getTrainTime();
|
||||
trainVO.setAllTrainTime(allTrainTime);
|
||||
this.updateById(trainVO);
|
||||
//更新该课程学习进度的 训练时长
|
||||
Process process = new Process();
|
||||
process.setId(trainVO.getProcessId());
|
||||
process.setTrainTime(allTrainTime);
|
||||
processService.updateById(process);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查某个学院某个课程某个科目某天的培训记录-未签退的
|
||||
*
|
||||
* @param userId 学员用户id
|
||||
* @param courseId 课程ID
|
||||
* @param subject 科目
|
||||
* @param dayStr 日期
|
||||
* @return cn.iocoder.yudao.module.train.entity.Train
|
||||
* @author vinjor-M
|
||||
* @date 10:21 2025/1/17
|
||||
**/
|
||||
@Override
|
||||
public Train getUserTrainData(Integer userId, String courseId, Integer subject, String dayStr) {
|
||||
LambdaQueryWrapper<Train> queryWrapper = new LambdaQueryWrapper<Train>()
|
||||
.eq(Train::getUserId,userId)
|
||||
.eq(Train::getCourseId,courseId)
|
||||
.eq(Train::getSubject,subject)
|
||||
.eq(Train::getTrainDay,dayStr)
|
||||
.isNull(Train::getEndTime);
|
||||
List<Train> list = this.list(queryWrapper);
|
||||
return list.isEmpty()?null:list.get(0);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.train.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.ReservationCourse;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ReservationCourseVO extends ReservationCourse {
|
||||
/**
|
||||
* selectType(my-当前用户的|all所有的)
|
||||
*/
|
||||
private String selectType;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.train.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TrainVO extends Train {
|
||||
/**
|
||||
* 查询类型(my-当前用户的|all所有的)
|
||||
*/
|
||||
private String selectType;
|
||||
/**
|
||||
* 学习课程进度表ID
|
||||
*/
|
||||
private String processId;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?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="cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCoachMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolCoachRespVO">
|
||||
SELECT
|
||||
main.*
|
||||
FROM
|
||||
drive_school_coach main
|
||||
<where>
|
||||
main.deleted = 0
|
||||
<if test="entity.type != null and entity.type != '' ">and main.type = #{entity.type}</if>
|
||||
<if test="entity.name != null and entity.name != ''">and main.name like concat('%', #{entity.name}, '%')
|
||||
</if>
|
||||
<if test="entity.phone != null and entity.phone != ''">and main.phone like concat('%', #{entity.phone},'%')
|
||||
</if>
|
||||
</where>
|
||||
order by main.create_time desc
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,22 @@
|
||||
<?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="cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCourseMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolCourseVO">
|
||||
SELECT
|
||||
main.*
|
||||
FROM
|
||||
drive_school_course main
|
||||
<where>
|
||||
main.deleted = 0
|
||||
<if test="entity.name != null and entity.name != ''">and main.name like concat('%', #{entity.name}, '%')</if>
|
||||
</where>
|
||||
order by main.create_time desc
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,23 @@
|
||||
<?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="cn.iocoder.yudao.module.base.mapper.DlDriveSchoolStudentMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
|
||||
SELECT
|
||||
main.*
|
||||
FROM
|
||||
drive_school_student main
|
||||
<where>
|
||||
main.deleted = 0
|
||||
<if test="entity.name != null and entity.name != ''">and main.name like concat('%', #{entity.name}, '%')</if>
|
||||
</where>
|
||||
order by main.create_time desc
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,7 @@
|
||||
<?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="cn.iocoder.yudao.module.course.mapper.ProcessMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,34 @@
|
||||
<?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="cn.iocoder.yudao.module.train.mapper.ReservationCourseMapper">
|
||||
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.train.vo.ReservationCourseVO">
|
||||
SELECT
|
||||
dsrc.*
|
||||
FROM
|
||||
drive_school_reservation_course dsrc
|
||||
where
|
||||
dsrc.deleted = 0
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
and dsrc.user_id =#{entity.userId}
|
||||
</if>
|
||||
<if test="entity.coachId != null and entity.coachId != ''">
|
||||
and dsrc.coach_id =#{entity.coachId}
|
||||
</if>
|
||||
<if test="entity.courseId != null and entity.courseId != ''">
|
||||
and dsrc.course_id =#{entity.courseId}
|
||||
</if>
|
||||
<if test="entity.subject != null and entity.subject != ''">
|
||||
and dsrc.subject =#{entity.subject}
|
||||
</if>
|
||||
<if test="entity.ifCancel != null">
|
||||
and dsrc.if_cancel =#{entity.ifCancel}
|
||||
</if>
|
||||
<if test="entity.reservDay != null and entity.reservDay != ''">
|
||||
and dsrc.reserv_day LIKE CONCAT(#{entity.reservDay},'%')
|
||||
</if>
|
||||
order by dsrc.create_time desc
|
||||
</select>
|
||||
</mapper>
|
34
dl-module-jx/src/main/resources/mapper/train/TrainMapper.xml
Normal file
34
dl-module-jx/src/main/resources/mapper/train/TrainMapper.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?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="cn.iocoder.yudao.module.train.mapper.ReservationCourseMapper">
|
||||
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.train.vo.TrainVO">
|
||||
SELECT
|
||||
dsrc.*
|
||||
FROM
|
||||
drive_school_reservation_course dsrc
|
||||
where
|
||||
dsrc.deleted = 0
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
and dsrc.user_id =#{entity.userId}
|
||||
</if>
|
||||
<if test="entity.coachId != null and entity.coachId != ''">
|
||||
and dsrc.coach_id =#{entity.coachId}
|
||||
</if>
|
||||
<if test="entity.courseId != null and entity.courseId != ''">
|
||||
and dsrc.course_id =#{entity.courseId}
|
||||
</if>
|
||||
<if test="entity.subject != null and entity.subject != ''">
|
||||
and dsrc.subject =#{entity.subject}
|
||||
</if>
|
||||
<if test="entity.ifCancel != null">
|
||||
and dsrc.if_cancel =#{entity.ifCancel}
|
||||
</if>
|
||||
<if test="entity.reservDay != null and entity.reservDay != ''">
|
||||
and dsrc.reserv_day LIKE CONCAT(#{entity.reservDay},'%')
|
||||
</if>
|
||||
order by dsrc.create_time desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user