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
* @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;
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());
}
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 (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));
user.setRoleCodes(String.join(",", thisRoleCodeList));
user.setRoleNames(String.join(",", thisRoleNameList));
return flag;
}
}

View File

@ -47,7 +47,7 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
* @param page 分页参数
* @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 截止时间
* @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自来客户

View File

@ -24,4 +24,20 @@ public class DlDriveSchoolStaffVO {
private String subject;
/**课程类型*/
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 Double priceAmount;
/**课程类型*/
private String courseType;
/**科目*/
private Integer subject;
}

View File

@ -54,5 +54,7 @@ public interface DriveSchoolCarMapper extends BaseMapper<DriveSchoolCar>
* @param endTime 截止时间
* @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 = "coachId",required = false) Long coachId,
@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 = "endTime",required = false) String endTime,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@ -120,16 +123,12 @@ public class TrainController {
}
if("student".equals(type)){
Page<DlDriveSchoolStudent> page = new Page<>(pageNo,pageSize);
IPage<DlDriveSchoolStudentVO> studentPage = studentMapper.selectTrainStudent(coachId,startTimeStr,endTimeStr,searchValue,page);
studentPage.getRecords().forEach(item->{
//查每个学生的当前所处的科目
item.setProcess(processService.selectByUserId(item.getUserId(),item.getCoachId()));
});
IPage<DlDriveSchoolStudentVO> studentPage = studentMapper.selectTrainStudent(coachId,startTimeStr,endTimeStr,searchValue,courseType,subject,sort,page);
return success(studentPage);
}else{
//训练车辆
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 != ''">
AND main.type = #{entity.type}
</if>
<if test="entity.name != null and entity.name != ''">
AND main.name LIKE CONCAT('%',#{entity.name},'%')
</if>
</where>
GROUP BY
main.id

View File

@ -46,16 +46,55 @@
<select id="pageStaffStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO">
SELECT
main.id AS id,
main.name AS name,
main.NAME AS NAME,
main.type AS type,
main.avatar AS avatar,
main.phone AS phone
main.phone AS phone,
main.user_id AS userId,
dsco.course_type,
dsp.`subject`
FROM
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
</where>
order by main.create_time desc
<if test="entity.coachId != null and entity.coachId != ''">
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 id="selectByCoachId" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
@ -124,17 +163,23 @@
</select>
<select id="selectTrainStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
dss.*
dss.*,dsc.type AS courseType,dst.subject
FROM
drive_school_student dss
LEFT JOIN drive_school_train dst ON dss.user_id = dst.user_id
AND dst.deleted = 0
LEFT JOIN drive_school_train dst ON dss.user_id = dst.user_id AND dst.deleted = 0
LEFT JOIN drive_school_course dsc ON dst.course_id = dsc.id
WHERE
dst.id IS NOT NULL
AND dss.deleted = 0
<if test="coachId != null and coachId != ''">
AND dst.coach_id = #{coachId}
</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 != ''">
AND dss.name LIKE CONCAT('%',#{searchValue},'%')
</if>
@ -146,6 +191,16 @@
</if>
GROUP BY
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 id="indexGetTrainList" resultType="cn.iocoder.yudao.module.base.vo.StudentCountVO">
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.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.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.carRegisterDate != null "> and car_register_date = #{entity.carRegisterDate}</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 != ''">
AND dsc.car_no LIKE CONCAT('%',#{searchValue},'%')
</if>
<if test="courseType != null and courseType != ''">
AND dsc.course_type =#{courseType}
</if>
<if test="startTime!=null and startTime!=''">
AND dst.create_time &gt;= #{startTime}
</if>