学生导入接口

This commit is contained in:
Cool 2024-10-23 19:17:05 +08:00
parent a329b820e4
commit 97e8f30549
2 changed files with 23 additions and 0 deletions

View File

@ -64,4 +64,10 @@ public class CetStudentController extends JeecgController<Cet4_major, CetMajorSe
public Result<?> downloadTemplate(HttpServletResponse response) {
return cetMajorService.downloadTemplate(response);
}
@RequestMapping("loadTable")
@ApiOperation("加载表格")
public Result<?> loadTable() {
return cetMajorService.loadTable();
}
}

View File

@ -1,5 +1,7 @@
package org.jeecg.modules.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
@ -10,6 +12,9 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
/**
* Created with IntelliJ IDEA.
@ -32,4 +37,16 @@ public class CetMajorServiceImpl extends ServiceImpl<Cet4_majorMapper, Cet4_majo
}
return null;
}
public Result<?> loadTable() {
QueryWrapper<Cet4_major> wrapper = new QueryWrapper<>();
wrapper.select("entrydate", "count(*) as count");
List<Map<String, Object>> list = this.listMaps(wrapper);
// 倒序排序
list.sort(Comparator.comparing((Map<String, Object> o) -> ((String) o.get("entrydate"))).reversed());
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", list);
return Result.OK(jsonObject);
}
}