添加学员一人一档功能并完善数据权限控制

dev
zhangyue 2026-03-06 08:55:05 +08:00
parent 9ebd0efeed
commit 0057a05c9c
14 changed files with 219 additions and 46 deletions

View File

@ -76,6 +76,7 @@ public class ClassController {
return classService.countStuClass(qry);
}
@ApiOperation("详情")
@GetMapping("/{id}")
public SingleResponse<ClassCO> getInfoById(@PathVariable("id") Long id) {

View File

@ -9,10 +9,7 @@ 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.StudentCO;
import com.zcloud.edu.dto.study.StudentAddCmd;
import com.zcloud.edu.dto.study.StudentCountQry;
import com.zcloud.edu.dto.study.StudentPageQry;
import com.zcloud.edu.dto.study.StudentUpdateCmd;
import com.zcloud.edu.dto.study.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -48,6 +45,14 @@ public class StudentController {
public PageResponse<StudentCO> page(@RequestBody StudentPageQry qry) {
return studentService.listPage(qry);
}
@ApiOperation("一人一档分页")
@PostMapping("/personnelFileList")
public PageResponse<StudentCO> personnelFileList(@RequestBody StudentPageQry qry) {
return studentService.personnelFileListPage(qry);
}
@ApiOperation("培训记录管理分页")
@PostMapping("/listPageClassByStudent")
public PageResponse<StudentCO> listPageClassByStudent(@RequestBody StudentPageQry qry) {

View File

@ -57,6 +57,13 @@ public class StudentQueryExe {
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
}
public PageResponse<StudentCO> executePersonnelFileListPage(StudentPageQry studentPageQry) {
Map<String, Object> params = PageQueryHelper.toHashMap(studentPageQry);
PageResponse<StudentDO> pageResponse = studentRepository.personnelFileListPage(params);
List<StudentCO> examCenterCOS = studentCoConvertor.converDOsToCOs(pageResponse.getData());
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
}
public PageResponse<StudentCO> executelistPageClassByStudent(StudentPageQry studentPageQry) {
Map<String, Object> params = PageQueryHelper.toHashMap(studentPageQry);
PageResponse<StudentDO> pageResponse = studentRepository.listPageClassByStudent(params);
@ -94,10 +101,11 @@ public class StudentQueryExe {
StudentDO studentDO = studentRepository.getById(qry.getStuId());
StudentDO studentUrl = studentRepository.findFaceUrlByPhone(studentDO.getPhone());
StudentE studentE = new StudentE();
BeanUtils.copyProperties(studentDO, studentE);
if(studentUrl!=null){
studentE.setUserAvatarUrl(studentUrl.getUserAvatarUrl());
}
BeanUtils.copyProperties(studentDO, studentE);
// 班级信息
ClassDO classDO = classRepository.getByClassId(studentDO.getClassId());
ClassE classE = new ClassE();
@ -109,7 +117,7 @@ public class StudentQueryExe {
List<ClassCurriculumE> classCurList = BeanUtil.copyToList(curEList, ClassCurriculumE.class);
PersonArchivesE personArchivesE = new PersonArchivesE();
personArchivesE.init(studentE, classE, classCurList, studentUrl.getUserAvatarUrl());
personArchivesE.init(studentE, classE, classCurList, studentE.getUserAvatarUrl());
PersonArchivesDTO personArchivesDTO = new PersonArchivesDTO();
BeanUtils.copyProperties(personArchivesE, personArchivesDTO);
return SingleResponse.of(personArchivesDTO);

View File

@ -42,6 +42,12 @@ public class StudentServiceImpl implements StudentServiceI {
return studentQueryExe.execute(qry);
}
@Override
public PageResponse<StudentCO> personnelFileListPage(StudentPageQry qry) {
return studentQueryExe.executePersonnelFileListPage(qry);
}
@Override
public PageResponse<StudentCO> listPageClassByStudent(StudentPageQry qry) {
return studentQueryExe.executelistPageClassByStudent(qry);

View File

@ -23,6 +23,7 @@ import java.util.List;
*/
public interface StudentServiceI {
PageResponse<StudentCO> listPage(StudentPageQry qry);
PageResponse<StudentCO> personnelFileListPage(StudentPageQry qry);
PageResponse<StudentCO> listPageClassByStudent(StudentPageQry qry);

View File

@ -0,0 +1,36 @@
package com.zcloud.edu.dto.study;
import com.alibaba.cola.dto.Command;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* web-client
*
* @Author zhangyue
* @Date 2026-01-13 14:18:21
*/
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ClassExamPaperExportCmd extends Command {
@ApiModelProperty(value = "班级id", name = "classId", required = true)
@NotEmpty(message = "班级id不能为空")
private String classId;
@ApiModelProperty(value = "是否有答案 0-没有 1-有", name = "answerFlag", required = true)
@NotNull(message = "请选择是否有答案")
private Integer answerFlag;
}

View File

@ -2,6 +2,8 @@ package com.zcloud.edu.persistence.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jjb.saas.framework.datascope.annotation.DataScope;
import com.jjb.saas.framework.datascope.annotation.DataScopes;
import com.zcloud.edu.domain.model.training.TrainingApplyProcessNodeE;
import com.zcloud.edu.persistence.dataobject.TrainingApplyRecordDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -16,12 +18,15 @@ import java.util.List;
* @Date 2026-01-12 15:21:49
*/
@Mapper
@DataScopes({
@DataScope(method = "selectTrainingRecordPage", menuPerms = "")
})
public interface TrainingApplyRecordMapper extends BaseMapper<TrainingApplyRecordDO> {
/**
*
*/
IPage<TrainingApplyRecordDO> selectTrainingRecordPage(IPage<TrainingApplyRecordDO> page, @Param("ew") QueryWrapper<TrainingApplyRecordDO> queryWrapper);
IPage<TrainingApplyRecordDO> selectTrainingRecordPage(IPage<TrainingApplyRecordDO> page, @Param("ew") QueryWrapper<TrainingApplyRecordDO> queryWrapper, String menuPerms);
/**
*

View File

@ -3,6 +3,8 @@ 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.jjb.saas.framework.datascope.annotation.DataScope;
import com.jjb.saas.framework.datascope.annotation.DataScopes;
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;
@ -19,10 +21,15 @@ import java.util.Map;
* @Date 2026-01-13 14:18:15
*/
@Mapper
@DataScopes({
@DataScope(method = "personnelFileListPage", menuPerms = "")
})
public interface StudentMapper extends BaseMapper<StudentDO> {
IPage<StudentDO> listPageClassByStudent(IPage<StudentDO> page, @Param("params") Map<String, Object> params);
IPage<StudentDO> personnelFileListPage(IPage<StudentDO> page, @Param("params") Map<String, Object> params, String menuPerms);
long postponeUpdateStudent(String classId);
List<ClassDO> countStudentByClass(List<String> classIds);

View File

@ -51,7 +51,7 @@ public class TrainingApplyRecordRepositoryImpl extends BaseRepositoryImpl<Traini
if (!ObjectUtils.isEmpty(params.get("menuPath"))) {
menuPerms = MenuEnum.getMenuKeyByPath(params.get("menuPath").toString());
}
IPage<TrainingApplyRecordDO> result = trainingApplyRecordMapper.selectTrainingRecordPage(iPage, queryWrapper);
IPage<TrainingApplyRecordDO> result = trainingApplyRecordMapper.selectTrainingRecordPage(iPage, queryWrapper, menuPerms);
return PageHelper.pageToResponse(result, result.getRecords());
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jjb.saas.framework.repository.common.PageHelper;
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
import com.zcloud.edu.domain.enums.MenuEnum;
import com.zcloud.edu.persistence.dataobject.study.ClassDO;
import com.zcloud.edu.persistence.dataobject.study.StudentDO;
import com.zcloud.edu.persistence.mapper.study.ClassMapper;
@ -14,6 +15,7 @@ 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;
@ -36,7 +38,13 @@ public class ClassRepositoryImpl extends BaseRepositoryImpl<ClassMapper, ClassDO
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params,"c.");
queryWrapper.orderByAsc("c.state").orderByDesc("c.create_time");
queryWrapper.eq("c.delete_enum","FALSE");
IPage<ClassDO> result = classMapper.listPage(iPage, queryWrapper, null);
String menuPerms = "";
if (!ObjectUtils.isEmpty(params.get("menuPath"))) {
menuPerms = MenuEnum.getMenuKeyByPath(params.get("menuPath").toString());
}
IPage<ClassDO> result = classMapper.listPage(iPage, queryWrapper, menuPerms);
return PageHelper.pageToResponse(result, result.getRecords());
}

View File

@ -40,6 +40,16 @@ public class StudentRepositoryImpl extends BaseRepositoryImpl<StudentMapper, Stu
return PageHelper.pageToResponse(result, result.getRecords());
}
@Override
public PageResponse<StudentDO> personnelFileListPage(Map<String, Object> params) {
IPage<StudentDO> iPage = new Query<StudentDO>().getPage(params);
QueryWrapper<StudentDO> queryWrapper = new QueryWrapper<>();
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
queryWrapper.orderByDesc("create_time");
IPage<StudentDO> result = studentMapper.selectPage(iPage, queryWrapper);
return PageHelper.pageToResponse(result, result.getRecords());
}
@Override
public PageResponse<StudentDO> listPageClassByStudent(Map<String, Object> params) {
IPage<StudentDO> iPage = new Query<StudentDO>().getPage(params);

View File

@ -17,6 +17,9 @@ import java.util.Map;
*/
public interface StudentRepository extends BaseRepository<StudentDO> {
PageResponse<StudentDO> listPage(Map<String, Object> params);
PageResponse<StudentDO> personnelFileListPage(Map<String, Object> params);
PageResponse<StudentDO> listPageClassByStudent(Map<String, Object> params);
Boolean addBatch(List<StudentDO> studentDOs);

View File

@ -99,6 +99,7 @@
class c
left join training_type t on t.training_type_id = c.train_type
left join corp_info ci on ci.id = c.corpinfo_id
left join user u on u.id = c.teacher_id
${ew.customSqlSegment}
</select>

View File

@ -239,6 +239,88 @@
</where>
</select>
<select id="personnelFileListPage" resultType="com.zcloud.edu.persistence.dataobject.study.StudentDO">
select
s.id,
s.student_id,
s.user_id,
c.id clz_id,
s.class_id,
s.name,
s.class_corpinfo_id,
s.phone,
s.user_id_card,
s.nation,
s.nation_name,
s.user_avatar_url,
s.current_address,
s.location_address,
s.cultural_level,
s.cultural_level_name,
s.marital_status,
s.marital_status_name,
s.political_affiliation,
s.political_affiliation_name,
s.post_name,
s.sign_flag,
s.exam_sign_flag,
case when s.state = 1 then 1
when s.state = 0 and c.start_time > now() then 0
when s.state = 0 and c.start_time &lt;= now() and c.end_time &gt;= now() then 2
when s.state = 0 and c.end_time &lt;= now() then 3
end as state,
s.interested_ids,
s.interested_names,
s.project_ids,
s.project_names,
c.name as class_name,
c.start_time,
c.end_time,
count(*) class_count,
count(CASE WHEN s.state = 1 THEN 1 END) complete_class_count
from
student s
left join class c on c.class_id = s.class_id
and c.delete_enum = 'FALSE'
and c.state != 1
left join user u on u.phone = s.phone and u.delete_enum = 'FALSE'
left join user tea on c.teacher_id = tea.id and tea.delete_enum = 'FALSE'
<where>
s.delete_enum = 'FALSE'
<if test="params.phone != null and params.phone != ''">
and s.phone = #{params.phone}
</if>
<if test="params.likeName != null and params.likeName != ''">
and s.name like concat('%',#{params.likeName},'%')
</if>
<if test="params.likeProjectNames != null and params.likeProjectNames != ''">
and s.project_names like concat('%',#{params.likeProjectNames},'%')
</if>
<if test="params.likeClassName != null and params.likeClassName != ''">
and c.name like concat('%',#{params.likeClassName},'%')
</if>
<if test="params.state != null and params.state != ''">
<if test="params.state == 0">
and s.state = 0
and c.start_time > now()
</if>
<if test="params.state == 1">
and s.state = #{params.state}
</if>
<if test="params.state == 2">
and s.state = 0
and c.start_time &lt;= now()
and c.end_time &gt;= now()
</if>
</if>
</where>
group by s.phone
</select>
<!-- findInfoByStudentId -->
<select id="findInfoByStudentId" resultType="com.zcloud.edu.persistence.dataobject.study.StudentDO">
select