This commit is contained in:
Vinjor 2025-02-21 10:30:09 +08:00
parent 89a6bcd013
commit 27ca0c143c
9 changed files with 125 additions and 42 deletions

View File

@ -187,34 +187,28 @@ public class ApiAppLoginServiceImpl implements ApiAppLoginService {
* @param roleCodeList 已有的角色code * @param roleCodeList 已有的角色code
* @return boolean * @return boolean
**/ **/
private boolean checkSchoolCanLogin(AdminUserDO user,List<String> roleCodeList,String type){ private boolean checkSchoolCanLogin(AdminUserDO user, List<String> roleCodeList, String type) {
boolean flag = false; boolean flag = false;
List<String> thisRoleCodeList = new ArrayList<>(); List<String> thisRoleCodeList = new ArrayList<>();
List<String> thisRoleNameList = new ArrayList<>(); List<String> thisRoleNameList = new ArrayList<>();
if("2".equals(type)){ if (roleCodeList.contains(SchoolRoleEnum.ADMIN.getCode())) {
//管理端
if(roleCodeList.contains(SchoolRoleEnum.ADMIN.getCode())){
//驾校业务管理员 //驾校业务管理员
flag = true; flag = true;
thisRoleCodeList.add(SchoolRoleEnum.ADMIN.getCode()); thisRoleCodeList.add(SchoolRoleEnum.ADMIN.getCode());
thisRoleNameList.add(SchoolRoleEnum.ADMIN.getName()); thisRoleNameList.add(SchoolRoleEnum.ADMIN.getName());
}else if(roleCodeList.contains(SchoolRoleEnum.STAFF.getCode())){ } else if (roleCodeList.contains(SchoolRoleEnum.STAFF.getCode())) {
//驾校工作人员 //驾校工作人员
flag = true; flag = true;
thisRoleCodeList.add(SchoolRoleEnum.STAFF.getCode()); thisRoleCodeList.add(SchoolRoleEnum.STAFF.getCode());
thisRoleNameList.add(SchoolRoleEnum.STAFF.getName()); thisRoleNameList.add(SchoolRoleEnum.STAFF.getName());
} } else if (roleCodeList.contains(SchoolRoleEnum.COACH.getCode())) {
}else if("3".equals(type)){
//教练端
if(roleCodeList.contains(SchoolRoleEnum.COACH.getCode())){
//驾校教练 //驾校教练
flag = true; flag = true;
thisRoleCodeList.add(SchoolRoleEnum.COACH.getCode()); thisRoleCodeList.add(SchoolRoleEnum.COACH.getCode());
thisRoleNameList.add(SchoolRoleEnum.COACH.getName()); thisRoleNameList.add(SchoolRoleEnum.COACH.getName());
} }
} user.setRoleCodes(String.join(",", thisRoleCodeList));
user.setRoleCodes(String.join(",",thisRoleCodeList)); user.setRoleNames(String.join(",", thisRoleNameList));
user.setRoleNames(String.join(",",thisRoleNameList));
return flag; return flag;
} }
} }

View File

@ -47,7 +47,7 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
* @param page 分页参数 * @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO> * @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO>
**/ **/
IPage<DlDriveSchoolStaffVO> pageStaffStudent(DlDriveSchoolStaffVO staffVO, Page<DlDriveSchoolStaffVO> page); IPage<DlDriveSchoolStaffVO> pageStaffStudent(@Param("entity") DlDriveSchoolStaffVO staffVO, Page<DlDriveSchoolStaffVO> page);
/** /**
* 教练查询自己的学生 * 教练查询自己的学生
@ -86,7 +86,14 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
* @param endTime 截止时间 * @param endTime 截止时间
* @return java.util.List<cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO> * @return java.util.List<cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO>
**/ **/
IPage<DlDriveSchoolStudentVO> selectTrainStudent(@Param("coachId")Long coachId, @Param("startTime") String startTime, @Param("endTime")String endTime,@Param("searchValue")String searchValue, Page<DlDriveSchoolStudent> page); IPage<DlDriveSchoolStudentVO> selectTrainStudent(@Param("coachId")Long coachId,
@Param("startTime") String startTime,
@Param("endTime")String endTime,
@Param("searchValue")String searchValue,
@Param("courseType")String courseType,
@Param("subject")Integer subject,
@Param("sort")String sort,
Page<DlDriveSchoolStudent> page);
/** /**
* @param type 时间查询类型01驾校统招02教练自招03自来客户 * @param type 时间查询类型01驾校统招02教练自招03自来客户

View File

@ -24,4 +24,20 @@ public class DlDriveSchoolStaffVO {
private String subject; private String subject;
/**课程类型*/ /**课程类型*/
private String courseTypes; private String courseTypes;
/**用户ID*/
private Long userId;
/**时间查询类型all-全部|day-当日|month-当月|more-自定义)*/
private String timeType;
/**课程类型*/
private String courseType;
/**排序方式asc desc*/
private String sort;
/**教练ID*/
private Long coachId;
/**查询时间范围--开始*/
private String startTime;
/**查询时间范围--结束*/
private String endTime;
} }

View File

@ -18,4 +18,8 @@ public class DlDriveSchoolStudentVO extends DlDriveSchoolStudent {
private Process process; private Process process;
/**总金额*/ /**总金额*/
private Double priceAmount; private Double priceAmount;
/**课程类型*/
private String courseType;
/**科目*/
private Integer subject;
} }

View File

@ -54,5 +54,7 @@ public interface DriveSchoolCarMapper extends BaseMapper<DriveSchoolCar>
* @param endTime 截止时间 * @param endTime 截止时间
* @return java.util.List<cn.iocoder.yudao.module.base.vo.DriveSchoolCar> * @return java.util.List<cn.iocoder.yudao.module.base.vo.DriveSchoolCar>
**/ **/
IPage<DriveSchoolCar> selectTrainCar(@Param("coachId")Long coachId, @Param("startTime") String startTime, @Param("endTime")String endTime,@Param("searchValue")String searchValue, Page<DriveSchoolCar> page); IPage<DriveSchoolCar> selectTrainCar(@Param("coachId")Long coachId, @Param("startTime") String startTime,
@Param("endTime")String endTime,@Param("searchValue")String searchValue,
@Param("courseType")String courseType, Page<DriveSchoolCar> page);
} }

View File

@ -95,6 +95,9 @@ public class TrainController {
@RequestParam(value = "timeType") String timeType, @RequestParam(value = "timeType") String timeType,
@RequestParam(value = "coachId",required = false) Long coachId, @RequestParam(value = "coachId",required = false) Long coachId,
@RequestParam(value = "searchValue",required = false) String searchValue, @RequestParam(value = "searchValue",required = false) String searchValue,
@RequestParam(value = "courseType",required = false) String courseType,
@RequestParam(value = "subject",required = false) Integer subject,
@RequestParam(value = "sort",required = false) String sort,
@RequestParam(value = "startTime",required = false) String startTime, @RequestParam(value = "startTime",required = false) String startTime,
@RequestParam(value = "endTime",required = false) String endTime, @RequestParam(value = "endTime",required = false) String endTime,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@ -120,16 +123,12 @@ public class TrainController {
} }
if("student".equals(type)){ if("student".equals(type)){
Page<DlDriveSchoolStudent> page = new Page<>(pageNo,pageSize); Page<DlDriveSchoolStudent> page = new Page<>(pageNo,pageSize);
IPage<DlDriveSchoolStudentVO> studentPage = studentMapper.selectTrainStudent(coachId,startTimeStr,endTimeStr,searchValue,page); IPage<DlDriveSchoolStudentVO> studentPage = studentMapper.selectTrainStudent(coachId,startTimeStr,endTimeStr,searchValue,courseType,subject,sort,page);
studentPage.getRecords().forEach(item->{
//查每个学生的当前所处的科目
item.setProcess(processService.selectByUserId(item.getUserId(),item.getCoachId()));
});
return success(studentPage); return success(studentPage);
}else{ }else{
//训练车辆 //训练车辆
Page<DriveSchoolCar> page = new Page<>(pageNo,pageSize); Page<DriveSchoolCar> page = new Page<>(pageNo,pageSize);
return success(carMapper.selectTrainCar(coachId,startTimeStr,endTimeStr,searchValue,page)); return success(carMapper.selectTrainCar(coachId,startTimeStr,endTimeStr,searchValue,courseType,page));
} }
} }
} }

View File

@ -41,6 +41,9 @@
<if test="entity.type != null and entity.type != ''"> <if test="entity.type != null and entity.type != ''">
AND main.type = #{entity.type} AND main.type = #{entity.type}
</if> </if>
<if test="entity.name != null and entity.name != ''">
AND main.name LIKE CONCAT('%',#{entity.name},'%')
</if>
</where> </where>
GROUP BY GROUP BY
main.id main.id

View File

@ -46,16 +46,55 @@
<select id="pageStaffStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO"> <select id="pageStaffStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO">
SELECT SELECT
main.id AS id, main.id AS id,
main.name AS name, main.NAME AS NAME,
main.type AS type, main.type AS type,
main.avatar AS avatar, main.avatar AS avatar,
main.phone AS phone main.phone AS phone,
main.user_id AS userId,
dsco.course_type,
dsp.`subject`
FROM FROM
drive_school_student main drive_school_student main
<where> LEFT JOIN drive_school_course_order dsco ON main.user_id = dsco.user_id
AND dsco.deleted = 0
AND dsco.payment_status IN ( '2', '3', '4', '5' )
AND dsco.if_end = 0
LEFT JOIN drive_school_process dsp ON main.user_id = dsp.user_id
AND dsco.course_id = dsp.course_id
AND dsp.`status` = '1'
WHERE
main.deleted = 0 main.deleted = 0
</where> <if test="entity.coachId != null and entity.coachId != ''">
order by main.create_time desc AND dsp.coach_id = #{entity.coachId}
</if>
<if test="entity.name!=null and entity.name!=''">
AND main.name LIKE CONCAT('%',#{entity.name},'%')
</if>
<if test="entity.courseType != null and entity.courseType != ''">
AND dsco.course_type = #{entity.courseType}
</if>
<if test="entity.subject != null and entity.subject != ''">
AND dsp.subject = #{entity.subject}
</if>
<if test="entity.startTime!=null and entity.startTime!=''">
AND dsco.create_time &gt;= #{entity.startTime}
</if>
<if test="entity.endTime!=null and entity.endTime!=''">
AND dsco.create_time &lt;= #{entity.endTime}
</if>
GROUP BY
main.id
<choose>
<when test="entity.sort=='asc'">
ORDER BY
dsco.create_time ASC
</when>
<otherwise>
ORDER BY
dsco.create_time DESC
</otherwise>
</choose>
</select> </select>
<select id="selectByCoachId" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO"> <select id="selectByCoachId" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT SELECT
@ -124,17 +163,23 @@
</select> </select>
<select id="selectTrainStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO"> <select id="selectTrainStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT SELECT
dss.* dss.*,dsc.type AS courseType,dst.subject
FROM FROM
drive_school_student dss drive_school_student dss
LEFT JOIN drive_school_train dst ON dss.user_id = dst.user_id LEFT JOIN drive_school_train dst ON dss.user_id = dst.user_id AND dst.deleted = 0
AND dst.deleted = 0 LEFT JOIN drive_school_course dsc ON dst.course_id = dsc.id
WHERE WHERE
dst.id IS NOT NULL dst.id IS NOT NULL
AND dss.deleted = 0 AND dss.deleted = 0
<if test="coachId != null and coachId != ''"> <if test="coachId != null and coachId != ''">
AND dst.coach_id = #{coachId} AND dst.coach_id = #{coachId}
</if> </if>
<if test="courseType != null and courseType != ''">
AND dsc.type = #{courseType}
</if>
<if test="subject != null and subject != ''">
AND dst.subject = #{subject}
</if>
<if test="searchValue != null and searchValue != ''"> <if test="searchValue != null and searchValue != ''">
AND dss.name LIKE CONCAT('%',#{searchValue},'%') AND dss.name LIKE CONCAT('%',#{searchValue},'%')
</if> </if>
@ -146,6 +191,16 @@
</if> </if>
GROUP BY GROUP BY
dss.id dss.id
<choose>
<when test="sort=='asc'">
ORDER BY
dst.create_time ASC
</when>
<otherwise>
ORDER BY
dst.create_time DESC
</otherwise>
</choose>
</select> </select>
<select id="indexGetTrainList" resultType="cn.iocoder.yudao.module.base.vo.StudentCountVO"> <select id="indexGetTrainList" resultType="cn.iocoder.yudao.module.base.vo.StudentCountVO">
SELECT SELECT

View File

@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="entity.brand != null and entity.brand != ''"> and brand = #{entity.brand}</if> <if test="entity.brand != null and entity.brand != ''"> and brand = #{entity.brand}</if>
<if test="entity.carModel != null and entity.carModel != ''"> and car_model = #{entity.carModel}</if> <if test="entity.carModel != null and entity.carModel != ''"> and car_model = #{entity.carModel}</if>
<if test="entity.carNo != null and entity.carNo != ''"> and car_no = #{entity.carNo}</if> <if test="entity.carNo != null and entity.carNo != ''"> and car_no = #{entity.carNo}</if>
<if test="entity.carNo != null and entity.carNo != ''"> and car_no = #{entity.carNo}</if> <if test="entity.courseType != null and entity.courseType != ''"> and course_type = #{entity.courseType}</if>
<if test="entity.carPhoto != null and vcarPhoto != ''"> and car_photo = #{entity.carPhoto}</if> <if test="entity.carPhoto != null and vcarPhoto != ''"> and car_photo = #{entity.carPhoto}</if>
<if test="entity.carRegisterDate != null "> and car_register_date = #{entity.carRegisterDate}</if> <if test="entity.carRegisterDate != null "> and car_register_date = #{entity.carRegisterDate}</if>
<if test="entity.inspectionDate != null "> and inspection_date = #{entity.inspectionDate}</if> <if test="entity.inspectionDate != null "> and inspection_date = #{entity.inspectionDate}</if>
@ -114,6 +114,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="searchValue != null and searchValue != ''"> <if test="searchValue != null and searchValue != ''">
AND dsc.car_no LIKE CONCAT('%',#{searchValue},'%') AND dsc.car_no LIKE CONCAT('%',#{searchValue},'%')
</if> </if>
<if test="courseType != null and courseType != ''">
AND dsc.course_type =#{courseType}
</if>
<if test="startTime!=null and startTime!=''"> <if test="startTime!=null and startTime!=''">
AND dst.create_time &gt;= #{startTime} AND dst.create_time &gt;= #{startTime}
</if> </if>