This commit is contained in:
PQZ 2025-02-14 14:15:40 +08:00
commit 8ac35cc7c8
7 changed files with 88 additions and 3 deletions

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.base.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
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;
@ -93,4 +92,18 @@ public class DlDriveSchoolStudentController {
public CommonResult<?> getCanExamStudentList(String courseId,Integer subject,String userName) {
return success(schoolStudentService.getCanExamStudentList(courseId, subject,userName));
}
/**
* 教练查自己所有学生列表
* @author vinjor-M
* @date 17:20 2025/2/12
**/
@GetMapping("/myStudentCoachPage")
@Operation(summary = "教练查自己所有学生列表")
public CommonResult<IPage<?>> myStudentCoachPage(@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.queryCoachListPage(pageReqVO, page));
}
}

View File

@ -80,7 +80,7 @@ public class DlDriveSchoolStudent extends TenantBaseDO {
/**
* 用户id
*/
private Integer userId;
private Long userId;
/**
* 证件照
*/

View File

@ -47,4 +47,14 @@ public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStud
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO>
**/
IPage<DlDriveSchoolStaffVO> pageStaffStudent(DlDriveSchoolStaffVO staffVO, Page<DlDriveSchoolStaffVO> page);
/**
* 教练查询自己的学生
* @author vinjor-M
* @date 17:23 2025/2/12
* @param pageReqVO TODO
* @param page TODO
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO>
**/
IPage<DlDriveSchoolStudentVO> selectByCoachId(@Param("entity") DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page);
}

View File

@ -99,4 +99,15 @@ public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStude
* @date 14:47 2025/2/6
**/
IPage<DlDriveSchoolStaffVO> pageStaffStudent(DlDriveSchoolStaffVO staffVO, Page<DlDriveSchoolStaffVO> page);
/**
* 教练查自己所有学生列表
*
* @param pageReqVO {@link DlDriveSchoolStudentVO}
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<?>
* @author PQZ
* @date 10:41 2025/1/18
**/
IPage<DlDriveSchoolStudentVO> queryCoachListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page);
}

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolStudentMapper;
import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO;
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
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;
@ -29,6 +30,8 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
@Resource
private DlDriveSchoolStudentMapper dlDriveSchoolStudentMapper;
@Resource
private ProcessService processService;
@Override
public String createDlDriveSchoolStudent(DlDriveSchoolStudentVO createReqVO) {
@ -137,5 +140,24 @@ public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolSt
return dlDriveSchoolStudentMapper.pageStaffStudent(staffVO,page);
}
/**
* 教练查自己所有学生列表
*
* @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> queryCoachListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page) {
IPage<DlDriveSchoolStudentVO> pageResult = dlDriveSchoolStudentMapper.selectByCoachId(pageReqVO,page);
pageResult.getRecords().forEach(item->{
//查每个学生的当前所处的科目
item.setProcess(processService.selectByUserId(item.getUserId(),item.getCoachId()));
});
return pageResult;
}
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
import cn.iocoder.yudao.module.course.entity.Process;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -9,5 +10,10 @@ import lombok.Data;
@Data
@ExcelIgnoreUnannotated
public class DlDriveSchoolStudentVO extends DlDriveSchoolStudent {
/**教练ID*/
private Long coachId;
/**教练ID*/
private String courseId;
/**学习进度*/
private Process process;
}

View File

@ -57,4 +57,27 @@
</where>
order by main.create_time desc
</select>
<select id="selectByCoachId" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
temp.*
FROM
(
SELECT
dss.*
FROM
drive_school_process dsp
LEFT JOIN drive_school_student dss ON dsp.user_id = dss.user_id
WHERE
dsp.deleted = 0
AND dsp.coach_id = #{entity.coachId}
<if test="entity.name != null and entity.name!=''">
AND dss.`name` LIKE CONCAT('%',#{entity.name},'%')
</if>
AND dss.id IS NOT NULL
ORDER BY
dss.create_time DESC
) temp
GROUP BY
temp.user_id
</select>
</mapper>