feat(study): 添加学员统计功能并优化控制器接口

dev_student
zhaokai 2026-06-13 17:31:17 +08:00
parent 6d4a82ab67
commit 45898bf03a
20 changed files with 573 additions and 17 deletions

View File

@ -1,21 +1,36 @@
package com.zcloud.edu.web.study;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.jjb.saas.framework.auth.model.SSOUser;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.edu.api.study.StudentServiceI;
import com.zcloud.edu.dto.clientobject.study.EducationUserCO;
import com.zcloud.edu.dto.clientobject.study.StudentCO;
import com.zcloud.edu.dto.study.*;
import com.zcloud.edu.dto.clientobject.study.StudentCountByCorpCO;
import com.zcloud.edu.dto.clientobject.study.StudentExamCountCO;
import com.zcloud.edu.dto.clientobject.study.StudentExamCountByCorpCO;
import com.zcloud.edu.dto.study.EducationUserQry;
import com.zcloud.edu.dto.study.StudentAddCmd;
import com.zcloud.edu.dto.study.StudentCountByCorpQry;
import com.zcloud.edu.dto.study.StudentCountQry;
import com.zcloud.edu.dto.study.StudentExamCountQry;
import com.zcloud.edu.dto.study.StudentExamCountByCorpQry;
import com.zcloud.edu.dto.study.StudentPageQry;
import com.zcloud.edu.dto.study.StudentUpdateCmd;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@ -26,7 +41,7 @@ import java.util.List;
* @Author zhangyue
* @Date 2026-01-13 14:18:14
*/
@Api(tags = "班级信息")
@Api(tags = "学员信息")
@RequestMapping("/${application.gateway}/student")
@RestController
@AllArgsConstructor
@ -36,8 +51,6 @@ public class StudentController {
@ApiOperation("新增")
@PostMapping("/save")
public SingleResponse<StudentCO> add(@Validated @RequestBody List<StudentAddCmd> cmdList) {
System.out.println(cmdList);
SSOUser ssoUser = AuthContext.getCurrentUser();
return studentService.add(cmdList);
}
@ -53,7 +66,7 @@ public class StudentController {
return studentService.educationUserList(qry);
}
@ApiOperation("获取可推送三方人员")
@ApiOperation("获取可推送三方人员")
@PostMapping("/pushCandidateUserList")
public PageResponse<EducationUserCO> pushCandidateUserList(@RequestBody EducationUserQry qry) {
return studentService.pushCandidateUserList(qry);
@ -74,7 +87,7 @@ public class StudentController {
@ApiOperation("所有数据")
@GetMapping("/listAll")
public MultiResponse<StudentCO> listAll() {
return MultiResponse.of(new ArrayList<StudentCO>());
return MultiResponse.of(new ArrayList<>());
}
@ApiOperation("查询用户统计")
@ -127,4 +140,24 @@ public class StudentController {
studentService.edit(studentUpdateCmd);
return SingleResponse.buildSuccess();
}
@ApiOperation("考试人数统计-企业端首页")
@PostMapping("/listExamCount")
public MultiResponse<StudentExamCountCO> listExamCount(@RequestBody StudentExamCountQry qry) {
return studentService.listExamCount(qry);
}
@ApiOperation("考试人数统计-监管端首页企业列表")
@PostMapping("/listExamCountByCorp")
public MultiResponse<StudentExamCountByCorpCO> listExamCountByCorp(@RequestBody StudentExamCountByCorpQry qry) {
return studentService.listExamCountByCorp(qry);
}
@ApiOperation("考试人数统计-查询用户统计-相关方首页")
@PostMapping("/listStudentCountByCorp")
public MultiResponse<StudentCountByCorpCO> listStudentCountByCorp(@RequestBody StudentCountByCorpQry qry) {
return studentService.listStudentCountByCorp(qry);
}
}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.jjb.saas.framework.auth.utils.AuthContext;
import com.zcloud.edu.command.convertor.study.StudentCoConvertor;
import com.zcloud.edu.domain.model.archives.ClassArchivesE;
import com.zcloud.edu.domain.model.archives.PersonArchivesE;
@ -11,13 +12,22 @@ import com.zcloud.edu.domain.model.study.*;
import com.zcloud.edu.dto.archives.ClassArchivesQry;
import com.zcloud.edu.dto.clientobject.study.EducationUserCO;
import com.zcloud.edu.dto.clientobject.study.StudentCO;
import com.zcloud.edu.dto.clientobject.study.StudentCountByCorpCO;
import com.zcloud.edu.dto.clientobject.study.StudentExamCountCO;
import com.zcloud.edu.dto.clientobject.study.StudentExamCountByCorpCO;
import com.zcloud.edu.dto.clientobject.study.StudentSignCO;
import com.zcloud.edu.dto.data.archives.ClassArchivesDTO;
import com.zcloud.edu.dto.data.archives.PersonArchivesDTO;
import com.zcloud.edu.dto.study.EducationUserQry;
import com.zcloud.edu.dto.study.StudentCountByCorpQry;
import com.zcloud.edu.dto.study.StudentCountQry;
import com.zcloud.edu.dto.study.StudentExamCountQry;
import com.zcloud.edu.dto.study.StudentExamCountByCorpQry;
import com.zcloud.edu.dto.study.StudentPageQry;
import com.zcloud.edu.persistence.mapper.po.study.StudentCountByCorpPO;
import com.zcloud.edu.persistence.dataobject.study.*;
import com.zcloud.edu.persistence.mapper.po.study.StudentExamCountPO;
import com.zcloud.edu.persistence.mapper.po.study.StudentExamCountByCorpPO;
import com.zcloud.edu.persistence.repository.study.*;
import com.zcloud.gbscommon.utils.PageQueryHelper;
import com.zcloud.gbscommon.utils.Tools;
@ -242,6 +252,34 @@ public class StudentQueryExe {
return MultiResponse.of(studentCOList);
}
public MultiResponse<StudentExamCountCO> executeListExamCount(StudentExamCountQry qry){
if(qry.getClassCorpinfoId()==null){
qry.setClassCorpinfoId(AuthContext.getTenantId());
}
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
List<StudentExamCountPO> countList = studentRepository.listExamCount(params);
List<StudentExamCountCO> countCOList = BeanUtil.copyToList(countList, StudentExamCountCO.class);
return MultiResponse.of(countCOList);
}
public MultiResponse<StudentExamCountByCorpCO> executeListExamCountByCorp(StudentExamCountByCorpQry qry){
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
List<StudentExamCountByCorpPO> countList = studentRepository.listExamCountByCorp(params);
List<StudentExamCountByCorpCO> countCOList = BeanUtil.copyToList(countList, StudentExamCountByCorpCO.class);
return MultiResponse.of(countCOList);
}
public MultiResponse<StudentCountByCorpCO> executeListStudentCountByCorp(StudentCountByCorpQry qry){
if(qry.getInterestedId()==null){
qry.setInterestedId(AuthContext.getTenantId().toString());
}
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
List<StudentCountByCorpPO> countList = studentRepository.listStudentCountByCorp(params);
List<StudentCountByCorpCO> countCOList = BeanUtil.copyToList(countList, StudentCountByCorpCO.class);
return MultiResponse.of(countCOList);
}
public SingleResponse<StudentCO> executeGetInfoByStudentId(String studentId){
StudentDO studentDO = studentRepository.findInfoByStudentId(studentId);
StudentCO studentCO = BeanUtil.copyProperties(studentDO, StudentCO.class);

View File

@ -11,12 +11,14 @@ import com.zcloud.edu.command.study.StudentUpdateExe;
import com.zcloud.edu.dto.archives.ClassArchivesQry;
import com.zcloud.edu.dto.clientobject.study.EducationUserCO;
import com.zcloud.edu.dto.clientobject.study.StudentCO;
import com.zcloud.edu.dto.clientobject.study.StudentCountByCorpCO;
import com.zcloud.edu.dto.clientobject.study.StudentExamCountCO;
import com.zcloud.edu.dto.clientobject.study.StudentExamCountByCorpCO;
import com.zcloud.edu.dto.data.archives.ClassArchivesDTO;
import com.zcloud.edu.dto.data.archives.PersonArchivesDTO;
import com.zcloud.edu.dto.study.*;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -112,6 +114,21 @@ public class StudentServiceImpl implements StudentServiceI {
return studentQueryExe.executeListStudentCount(qry);
}
@Override
public MultiResponse<StudentExamCountCO> listExamCount(StudentExamCountQry qry) {
return studentQueryExe.executeListExamCount(qry);
}
@Override
public MultiResponse<StudentExamCountByCorpCO> listExamCountByCorp(StudentExamCountByCorpQry qry) {
return studentQueryExe.executeListExamCountByCorp(qry);
}
@Override
public MultiResponse<StudentCountByCorpCO> listStudentCountByCorp(StudentCountByCorpQry qry) {
return studentQueryExe.executeListStudentCountByCorp(qry);
}
@Override
public SingleResponse<StudentCO> getInfoByStudentId(String studentId) {
return studentQueryExe.executeGetInfoByStudentId(studentId);

View File

@ -6,6 +6,9 @@ import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.edu.dto.archives.ClassArchivesQry;
import com.zcloud.edu.dto.clientobject.study.EducationUserCO;
import com.zcloud.edu.dto.clientobject.study.StudentCO;
import com.zcloud.edu.dto.clientobject.study.StudentCountByCorpCO;
import com.zcloud.edu.dto.clientobject.study.StudentExamCountCO;
import com.zcloud.edu.dto.clientobject.study.StudentExamCountByCorpCO;
import com.zcloud.edu.dto.data.archives.ClassArchivesDTO;
import com.zcloud.edu.dto.data.archives.PersonArchivesDTO;
import com.zcloud.edu.dto.study.*;
@ -49,6 +52,12 @@ public interface StudentServiceI {
MultiResponse<StudentCO> listStudentCount(StudentCountQry qry);
MultiResponse<StudentExamCountCO> listExamCount(StudentExamCountQry qry);
MultiResponse<StudentExamCountByCorpCO> listExamCountByCorp(StudentExamCountByCorpQry qry);
MultiResponse<StudentCountByCorpCO> listStudentCountByCorp(StudentCountByCorpQry qry);
SingleResponse<StudentCO> getInfoByStudentId(String studentId);
PageResponse<EducationUserCO> educationUserList(EducationUserQry qry);

View File

@ -199,6 +199,10 @@ public class StudentCO extends ClientObject {
@TableField(exist = false)
private Integer studentCount;
@ApiModelProperty(value = "培训合格数量")
@TableField(exist = false)
private Integer qualifiedStudentCount;

View File

@ -0,0 +1,44 @@
package com.zcloud.edu.dto.clientobject.study;
import com.alibaba.cola.dto.ClientObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* web-client
*
* @Author zhangyue
* @Date 2026-06-13 15:05:00
*/
@Data
public class StudentCountByCorpCO extends ClientObject {
@ApiModelProperty(value = "部门名称")
private String departmentName;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "手机号")
private String phone;
@ApiModelProperty(value = "身份证号")
private String userIdCard;
@ApiModelProperty(value = "已通过培训数")
private Integer completeClassCount;
@ApiModelProperty(value = "培训总数")
private Integer classCount;
@ApiModelProperty(value = "培训有效期开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime startTime;
@ApiModelProperty(value = "培训有效期结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime endTime;
}

View File

@ -0,0 +1,27 @@
package com.zcloud.edu.dto.clientobject.study;
import com.alibaba.cola.dto.ClientObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* web-client
*
* @Author zhangyue
* @Date 2026-06-13 14:32:00
*/
@Data
public class StudentExamCountByCorpCO extends ClientObject {
@ApiModelProperty(value = "企业id")
private Long corpinfoId;
@ApiModelProperty(value = "企业名称")
private String corpName;
@ApiModelProperty(value = "涉及相关方单位数")
private Long relatedCorpCount;
@ApiModelProperty(value = "涉及人数")
private Long studentCount;
}

View File

@ -0,0 +1,30 @@
package com.zcloud.edu.dto.clientobject.study;
import com.alibaba.cola.dto.ClientObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* web-client
*
* @Author zhangyue
* @Date 2026-06-13 15:45:00
*/
@Data
public class StudentExamCountCO extends ClientObject {
@ApiModelProperty(value = "企业id")
private Long classCorpinfoId;
@ApiModelProperty(value = "所属相关方id")
private String interestedId;
@ApiModelProperty(value = "所属相关方名称")
private String interestedName;
@ApiModelProperty(value = "涉及人数")
private Integer studentCount;
@ApiModelProperty(value = "培训有效人数")
private Integer qualifiedStudentCount;
}

View File

@ -0,0 +1,28 @@
package com.zcloud.edu.dto.study;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* web-client
*
* @Author zhangyue
* @Date 2026-06-13 15:05:00
*/
@Data
public class StudentCountByCorpQry {
@ApiModelProperty(value = "企业id")
private Long classCorpinfoId;
@ApiModelProperty(value = "相关方id")
private String interestedId;
@ApiModelProperty(value = "姓名模糊查询")
private String likeName;
@ApiModelProperty(value = "培训有效期筛选1-正常 -1-过期 -2-横杠 -3-待定")
private Integer isValid;
private String menuPath;
}

View File

@ -1,6 +1,7 @@
package com.zcloud.edu.dto.study;
import com.alibaba.cola.dto.PageQuery;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ -27,13 +28,18 @@ public class StudentCountQry {
*/
private String eqStudentId;
private String eqClassId;
private String likeProjectNames;
private String likeName;
private String likeInterestedIds;
private List<Long> corpinfoIds;
private List<String> phones;
private String year;
@ApiModelProperty(value = "相关方id", name = "eqInterestedIds")
private String eqInterestedIds;
@ApiModelProperty(value = "企业id", name = "classCorpinfoId")
private Long classCorpinfoId;
}

View File

@ -0,0 +1,18 @@
package com.zcloud.edu.dto.study;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* web-client
*
* @Author zhangyue
* @Date 2026-06-13 14:32:00
*/
@Data
public class StudentExamCountByCorpQry {
@ApiModelProperty(value = "企业名称模糊查询")
private String likeCorpName;
private Long corpinfoId;
}

View File

@ -0,0 +1,23 @@
package com.zcloud.edu.dto.study;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* web-client
*
* @Author zhangyue
* @Date 2026-06-13 15:45:00
*/
@Data
public class StudentExamCountQry {
@ApiModelProperty(value = "所属相关方id")
private String interestedId;
@ApiModelProperty(value = "企业id")
private Long classCorpinfoId;
@ApiModelProperty(value = "年份")
private String year;
}

View File

@ -119,6 +119,10 @@ public class StudentDO extends BaseDO {
@TableField(exist = false)
private Integer studentCount;
@ApiModelProperty(value = "鍚堟牸浜烘暟")
@TableField(exist = false)
private Integer qualifiedStudentCount;
@ApiModelProperty(value = "完成班级数")
@TableField(exist = false)

View File

@ -0,0 +1,43 @@
package com.zcloud.edu.persistence.mapper.po.study;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* web-infrastructure
*
* @Author zhangyue
* @Date 2026-06-13 15:05:00
*/
@Data
public class StudentCountByCorpPO {
@ApiModelProperty(value = "部门名称")
private String departmentName;
@ApiModelProperty(value = "姓名")
private String name;
@ApiModelProperty(value = "手机号")
private String phone;
@ApiModelProperty(value = "身份证号")
private String userIdCard;
@ApiModelProperty(value = "已通过培训数")
private Integer completeClassCount;
@ApiModelProperty(value = "培训总数")
private Integer classCount;
@ApiModelProperty(value = "培训有效期开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime startTime;
@ApiModelProperty(value = "培训有效期结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime endTime;
}

View File

@ -0,0 +1,26 @@
package com.zcloud.edu.persistence.mapper.po.study;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* web-infrastructure
*
* @Author zhangyue
* @Date 2026-06-13 14:32:00
*/
@Data
public class StudentExamCountByCorpPO {
@ApiModelProperty(value = "企业id")
private Long corpinfoId;
@ApiModelProperty(value = "企业名称")
private String corpName;
@ApiModelProperty(value = "涉及相关方单位数")
private Long relatedCorpCount;
@ApiModelProperty(value = "涉及人数")
private Long studentCount;
}

View File

@ -0,0 +1,29 @@
package com.zcloud.edu.persistence.mapper.po.study;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* web-infrastructure
*
* @Author zhangyue
* @Date 2026-06-13 15:45:00
*/
@Data
public class StudentExamCountPO {
@ApiModelProperty(value = "企业id")
private Long classCorpinfoId;
@ApiModelProperty(value = "所属相关方id")
private String interestedId;
@ApiModelProperty(value = "所属相关方名称")
private String interestedName;
@ApiModelProperty(value = "涉及人数")
private Integer studentCount;
@ApiModelProperty(value = "培训有效人数")
private Integer qualifiedStudentCount;
}

View File

@ -1,6 +1,5 @@
package com.zcloud.edu.persistence.mapper.study;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -9,7 +8,9 @@ import com.jjb.saas.framework.datascope.annotation.DataScopes;
import com.zcloud.edu.dto.clientobject.study.EducationUserCO;
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
import com.zcloud.edu.persistence.mapper.po.study.StudentCountPO;
import com.zcloud.edu.persistence.mapper.po.study.StudentCountByCorpPO;
import com.zcloud.edu.persistence.mapper.po.study.StudentExamCountPO;
import com.zcloud.edu.persistence.mapper.po.study.StudentExamCountByCorpPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -24,7 +25,8 @@ import java.util.Map;
*/
@Mapper
@DataScopes({
@DataScope(method = "personnelFileListPage", menuPerms = "")
@DataScope(method = "personnelFileListPage", menuPerms = ""),
@DataScope(method = "listStudentCountByCorp", menuPerms = "")
})
public interface StudentMapper extends BaseMapper<StudentDO> {
@ -49,6 +51,12 @@ public interface StudentMapper extends BaseMapper<StudentDO> {
List<StudentDO> listStudentCount(@Param("params") Map<String, Object> params);
List<StudentCountByCorpPO> listStudentCountByCorp(@Param("params") Map<String, Object> params, String menuPerms);
List<StudentExamCountPO> listExamCount(@Param("params") Map<String, Object> params);
List<StudentExamCountByCorpPO> listExamCountByCorp(@Param("params") Map<String, Object> params);
StudentDO findInfoByStudentId(@Param("studentId") String studentId);

View File

@ -11,13 +11,16 @@ import com.zcloud.edu.domain.enums.MenuEnum;
import com.zcloud.edu.dto.clientobject.study.EducationUserCO;
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
import com.zcloud.edu.persistence.mapper.po.study.StudentCountPO;
import com.zcloud.edu.persistence.mapper.po.study.StudentCountByCorpPO;
import com.zcloud.edu.persistence.mapper.po.study.StudentExamCountPO;
import com.zcloud.edu.persistence.mapper.po.study.StudentExamCountByCorpPO;
import com.zcloud.edu.persistence.mapper.study.StudentMapper;
import com.zcloud.edu.persistence.repository.study.StudentRepository;
import com.zcloud.gbscommon.utils.PageQueryHelper;
import com.zcloud.gbscommon.utils.Query;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.List;
import java.util.Map;
@ -138,6 +141,25 @@ public class StudentRepositoryImpl extends BaseRepositoryImpl<StudentMapper, Stu
return studentMapper.listStudentCount(params);
}
@Override
public List<StudentCountByCorpPO> listStudentCountByCorp(Map<String, Object> params) {
String menuPerms = "";
if (!ObjectUtils.isEmpty(params.get("menuPath"))) {
menuPerms = MenuEnum.getMenuKeyByPath(params.get("menuPath").toString());
}
return studentMapper.listStudentCountByCorp(params,menuPerms);
}
@Override
public List<StudentExamCountPO> listExamCount(Map<String, Object> params) {
return studentMapper.listExamCount(params);
}
@Override
public List<StudentExamCountByCorpPO> listExamCountByCorp(Map<String, Object> params) {
return studentMapper.listExamCountByCorp(params);
}
@Override
public PageResponse<EducationUserCO> educationUserList(Map<String, Object> params) {
Page<Map<String, Object>> page = new Page<>(Integer.parseInt(params.get("pageIndex").toString()), Integer.parseInt(params.get("pageSize").toString()));

View File

@ -5,7 +5,9 @@ import com.jjb.saas.framework.repository.repo.BaseRepository;
import com.zcloud.edu.dto.clientobject.study.EducationUserCO;
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
import com.zcloud.edu.persistence.mapper.po.study.StudentCountPO;
import com.zcloud.edu.persistence.mapper.po.study.StudentCountByCorpPO;
import com.zcloud.edu.persistence.mapper.po.study.StudentExamCountPO;
import com.zcloud.edu.persistence.mapper.po.study.StudentExamCountByCorpPO;
import java.util.List;
import java.util.Map;
@ -48,6 +50,12 @@ public interface StudentRepository extends BaseRepository<StudentDO> {
List<StudentDO> listStudentCount(Map<String, Object> params);
List<StudentCountByCorpPO> listStudentCountByCorp(Map<String, Object> params);
List<StudentExamCountPO> listExamCount(Map<String, Object> params);
List<StudentExamCountByCorpPO> listExamCountByCorp(Map<String, Object> params);
PageResponse<EducationUserCO> educationUserList(Map<String, Object> params);
PageResponse<EducationUserCO> pushCandidateUserList(Map<String, Object> params);

View File

@ -182,6 +182,145 @@
group by s.phone
</select>
<select id="listStudentCountByCorp" resultType="com.zcloud.edu.persistence.mapper.po.study.StudentCountByCorpPO">
SELECT
max(coalesce(u.name, s.name)) AS name,
s.phone,
count(DISTINCT s.student_id) AS classCount,
count(DISTINCT CASE WHEN s.state = 1 THEN s.student_id END) AS completeClassCount,
max(d.name) AS departmentName,
max(coalesce(u.user_id_card, s.user_id_card)) AS userIdCard,
max(tu.start_time) AS startTime,
max(tu.end_time) AS endTime
FROM
student s
inner join class c on c.class_id = s.class_id
and c.delete_enum = 'FALSE'
left join user u on u.phone = s.phone
and u.delete_enum = 'FALSE'
left join department d on d.id = u.department_id
and d.delete_enum = 'FALSE'
left join (
SELECT
phone,
start_time,
end_time
FROM
(
SELECT
phone,
start_time,
end_time,
ROW_NUMBER() OVER (
PARTITION BY phone
ORDER BY
CASE WHEN end_time IS NULL THEN 1 ELSE 0 END ASC,
end_time DESC,
CASE WHEN start_time IS NULL THEN 1 ELSE 0 END ASC,
start_time DESC,
update_time DESC,
create_time DESC
) rn
FROM
training_user
WHERE
delete_enum = 'FALSE'
) t
WHERE
t.rn = 1
) tu on tu.phone = s.phone
<where>
s.interested_ids = #{params.interestedId}
and s.delete_enum = 'FALSE'
<if test="params.classCorpinfoId != null ">
and s.class_corpinfo_id = #{params.classCorpinfoId}
</if>
<if test="params.likeName != null and params.likeName != ''">
and coalesce(u.name, s.name) like concat('%',#{params.likeName},'%')
</if>
<if test="params.isValid != null and params.isValid == 1">
and (tu.start_time &lt;= now() and tu.end_time &gt;= now())
</if>
<if test="params.isValid != null and params.isValid == -1">
and now() not between tu.start_time and tu.end_time
</if>
<if test="params.isValid != null and params.isValid == -2">
and tu.end_time is null
</if>
<if test="params.isValid != null and params.isValid == -3">
and (tu.end_time is null or now() not between tu.start_time and tu.end_time)
</if>
</where>
GROUP BY
s.phone
ORDER BY
max(d.name) asc,
max(coalesce(u.name, s.name)) asc
</select>
<select id="listExamCount" resultType="com.zcloud.edu.persistence.mapper.po.study.StudentExamCountPO">
SELECT
s.interested_ids AS interestedId,
s.class_corpinfo_id as classCorpinfoId,
max(s.interested_names) AS interestedName,
count(DISTINCT s.phone) AS studentCount,
count(DISTINCT CASE WHEN s.state = 1 THEN s.phone END) AS qualifiedStudentCount
FROM
student s
left join class c on c.class_id = s.class_id
and c.delete_enum = 'FALSE'
left join corp_info ci on ci.id = s.interested_ids
and ci.delete_enum = 'FALSE'
<where>
s.delete_enum = 'FALSE'
and s.interested_ids is not null
and s.interested_ids != ''
<if test="params.interestedId != null and params.interestedId != ''">
and s.interested_ids = #{params.interestedId}
</if>
<if test="params.classCorpinfoId != null">
and s.class_corpinfo_id = #{params.classCorpinfoId}
</if>
<if test="params.year != null and params.year != ''">
and DATE_FORMAT(c.start_time, '%Y') = #{params.year}
</if>
</where>
group by
s.interested_ids
order by
ci.corp_order asc,
ci.create_time asc
</select>
<select id="listExamCountByCorp" resultType="com.zcloud.edu.persistence.mapper.po.study.StudentExamCountByCorpPO">
SELECT
ci.id AS corpinfoId,
ci.corp_name AS corpName,
count(DISTINCT CASE
WHEN s.interested_ids is not null and s.interested_ids != '' THEN s.interested_ids
END) AS relatedCorpCount,
count(DISTINCT s.phone) AS studentCount
FROM
corp_info ci
left join student s on ci.id = s.class_corpinfo_id
and s.delete_enum = 'FALSE'
<where>
ci.delete_enum = 'FALSE'
and ci.type in (0, 1, 6)
<if test="params.likeCorpName != null and params.likeCorpName != ''">
and ci.corp_name like concat('%',#{params.likeCorpName},'%')
</if>
<if test="params.corpinfoId != null">
and ci.id =#{params.corpinfoId}
</if>
</where>
group by
ci.id
order by
ci.corp_order asc,
ci.create_time asc
</select>
<select id="listPageClassByStudent" resultType="com.zcloud.edu.persistence.dataobject.study.StudentDO">
select
s.id,