Commit 45c08615 authored by Mindfaker's avatar Mindfaker

fix

parent b8abc2c6
package cn.exploring.engine.server.db.domain.vo;
import cn.exploring.engine.server.db.domain.StudentInfo;
/**
* @author Liu_c
*/
public class StudentVo extends StudentInfo {
public String ClassName;
public String getClassName() {
return ClassName;
}
public void setClassName(String className) {
ClassName = className;
}
}
...@@ -4,9 +4,10 @@ import cn.exploring.engine.server.db.dao.SpecialSqlMapper; ...@@ -4,9 +4,10 @@ import cn.exploring.engine.server.db.dao.SpecialSqlMapper;
import cn.exploring.engine.server.db.dao.StudentInfoMapper; import cn.exploring.engine.server.db.dao.StudentInfoMapper;
import cn.exploring.engine.server.db.domain.StudentInfo; import cn.exploring.engine.server.db.domain.StudentInfo;
import cn.exploring.engine.server.db.domain.StudentInfoExample; import cn.exploring.engine.server.db.domain.StudentInfoExample;
import com.alibaba.fastjson.JSON; import cn.exploring.engine.server.db.domain.vo.StudentVo;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -126,10 +127,11 @@ public class StudentInfoService { ...@@ -126,10 +127,11 @@ public class StudentInfoService {
example.setOrderByClause(sort + " " + order); example.setOrderByClause(sort + " " + order);
List<StudentInfo> studentInfoList = studentInfoMapper.selectByExample(example); List<StudentInfo> studentInfoList = studentInfoMapper.selectByExample(example);
Map<Integer, String> classMap = classService.getClassNameMap(); Map<Integer, String> classMap = classService.getClassNameMap();
List<Map> dataList = studentInfoList.stream().map(x -> { List<StudentVo> dataList = studentInfoList.stream().map(x -> {
Map oneData = JSON.parseObject(JSON.toJSONString(x), Map.class); StudentVo voData = new StudentVo();
oneData.put("className", classMap.get(classId)); BeanUtils.copyProperties(x, voData);
return oneData; voData.setClassName(classMap.get(x.getClassId()));
return voData;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
Long total = PageInfo.of(studentInfoList).getTotal(); Long total = PageInfo.of(studentInfoList).getTotal();
return new HashMap(){{ return new HashMap(){{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment