This commit is contained in:
Vinjor 2025-02-19 16:26:12 +08:00
parent 2d7ffce71a
commit 2747405034
6 changed files with 116 additions and 0 deletions

View File

@ -76,5 +76,16 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
**/
List<DlDriveSchoolStudentVO> selectStudentListCoach(@Param("coachId")Long coachId, @Param("startTime") String startTime, @Param("endTime")String endTime);
/**
* app首页查询训练学员---指定条件下
* @author vinjor-M
* @date 15:53 2025/2/19
* @param coachId 教练ID
* @param startTime 开始时间
* @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, Page<DlDriveSchoolStudent> page);
}

View File

@ -99,5 +99,9 @@ public class Process extends TenantBaseDO {
* 财务审核备注
*/
private String financeRemark;
/**
* 课程类型字典course_type
*/
private String courseType;
}

View File

@ -44,4 +44,15 @@ public interface DriveSchoolCarMapper extends BaseMapper<DriveSchoolCar>
public int deleteDriveSchoolCarByIds(Long[] ids);
DriveSchoolCar selectByCarNo(String carNo);
/**
* app首页查询训练车辆---指定条件下
* @author vinjor-M
* @date 15:53 2025/2/19
* @param coachId 教练ID
* @param startTime 开始时间
* @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, Page<DriveSchoolCar> page);
}

View File

@ -1,7 +1,13 @@
package cn.iocoder.yudao.module.train.controller.admin;
import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolStudentMapper;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
import cn.iocoder.yudao.module.course.service.ProcessService;
import cn.iocoder.yudao.module.jx.mapper.DriveSchoolCarMapper;
import cn.iocoder.yudao.module.train.service.TrainService;
import cn.iocoder.yudao.module.train.vo.TrainVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -9,6 +15,7 @@ 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.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -24,6 +31,12 @@ public class TrainController {
@Resource
private TrainService trainService;
@Resource
private ProcessService processService;
@Resource
private DlDriveSchoolStudentMapper studentMapper;
@Resource
private DriveSchoolCarMapper carMapper;
@GetMapping("/page")
@ -64,4 +77,56 @@ public class TrainController {
}
/**
* 首页数据统计查询接口 --
* @author vinjor-M
* @date 14:12 2025/2/14
* @param type 查询类型car-训练车辆|student-训练学生
* @param timeType 时间查询类型all-全部|day-当日|month-当月|more-自定义
* @param coachId 教练id
* @param startTime 查询时间范围--开始
* @param endTime 查询时间范围--结束
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@GetMapping("/indexGetTrainList")
@Operation(summary = "首页数据统计查询接口")
public CommonResult<IPage<?>> indexGetTrainList(@RequestParam(value = "type") String type,
@RequestParam(value = "timeType") String timeType,
@RequestParam(value = "coachId",required = false) Long coachId,
@RequestParam(value = "startTime",required = false) String startTime,
@RequestParam(value = "endTime",required = false) String endTime,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
//默认查全部数据
String startTimeStr = "";
String endTimeStr = "";
if("more".equals(timeType)){
if(StringUtils.isNotEmpty(startTime)){
startTimeStr = startTime+" 00:00:01";
}
if(StringUtils.isNotEmpty(endTime)) {
endTimeStr = endTime + " 23:59:59";
}
}else if("month".equals(timeType)){
//当月
startTimeStr = DateUtil.format(DateUtil.beginOfMonth(DateUtil.date()),"yyyy-MM-dd")+" 00:00:01";
endTimeStr = DateUtil.format(DateUtil.endOfMonth(DateUtil.date()),"yyyy-MM-dd")+" 23:59:59";
}else if("day".equals(timeType)){
//当天
startTimeStr = DateUtil.formatDate(DateUtil.date())+" 00:00:01";
endTimeStr = DateUtil.formatDate(DateUtil.date())+" 23:59:59";
}
if("car".equals(type)){
Page<DlDriveSchoolStudent> page = new Page<>(pageNo,pageSize);
IPage<DlDriveSchoolStudentVO> studentPage = studentMapper.selectTrainStudent(coachId,startTimeStr,endTimeStr,page);
studentPage.getRecords().forEach(item->{
//查每个学生的当前所处的科目
item.setProcess(processService.selectByUserId(item.getUserId(),item.getCoachId()));
});
return success(studentPage);
}else if("student".equals(type)){
// return success(trainService.indexGetTrainList(type,timeType,coachId,startTimeStr,endTimeStr));
}
return success(null);
}
}

View File

@ -122,4 +122,26 @@
GROUP BY
dss.id
</select>
<select id="selectTrainStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
dss.*
FROM
drive_school_student dss
LEFT JOIN drive_school_train dst ON dss.user_id = dst.user_id
AND dst.deleted = 0
WHERE
dst.id IS NOT NULL
AND dss.deleted = 0
<if test="coachId != null and coachId != ''">
AND dst.coach_id = #{coachId}
</if>
<if test="startTime!=null and startTime!=''">
AND dst.create_time &gt;= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
AND dst.create_time &lt;= #{endTime}
</if>
GROUP BY
dss.id
</select>
</mapper>

View File

@ -97,6 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDriveSchoolCarVo"/>
where deleted = 0 and car_no = #{carNo}
</select>
<select id="selectTrainCar" resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCar">
</select>
</mapper>