forked from liweijie/education
教学大纲,导出选中数据,有勾选导出勾选条目,无勾选导出所有
This commit is contained in:
+3
-2
@@ -119,7 +119,8 @@ public class ZYJXJHBController {
|
|||||||
public void exportData(
|
public void exportData(
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
@RequestParam(required = false) String zydh,
|
@RequestParam(required = false) String zydh,
|
||||||
@RequestParam(required = false) Integer ty) throws Exception {
|
@RequestParam(required = false) Integer ty,
|
||||||
zyjxjhbService.exportZYJXJHBExcel(response, zydh, ty);
|
@RequestParam(required = false) List<String> bhList) throws Exception {
|
||||||
|
zyjxjhbService.exportZYJXJHBExcel(response, zydh, ty, bhList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,5 +82,6 @@ public interface ZYJXJHBService {
|
|||||||
* @param zydh 专业代号(可选)
|
* @param zydh 专业代号(可选)
|
||||||
* @param ty 停用标识(可选,0-正常,1-停用)
|
* @param ty 停用标识(可选,0-正常,1-停用)
|
||||||
*/
|
*/
|
||||||
void exportZYJXJHBExcel(jakarta.servlet.http.HttpServletResponse response, String zydh, Integer ty) throws Exception;
|
void exportZYJXJHBExcel(jakarta.servlet.http.HttpServletResponse response, String zydh, Integer ty,
|
||||||
|
java.util.List<String> bhList) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-9
@@ -307,16 +307,25 @@ public class ZYJXJHBServiceImpl implements ZYJXJHBService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportZYJXJHBExcel(jakarta.servlet.http.HttpServletResponse response, String zydh, Integer ty) throws Exception {
|
public void exportZYJXJHBExcel(jakarta.servlet.http.HttpServletResponse response, String zydh, Integer ty,
|
||||||
LambdaQueryWrapper<ZYJXJHB> wrapper = new LambdaQueryWrapper<>();
|
java.util.List<String> bhList) throws Exception {
|
||||||
if (zydh != null && !zydh.isEmpty()) {
|
List<ZYJXJHB> list;
|
||||||
wrapper.eq(ZYJXJHB::getZydh, zydh);
|
if (bhList != null && !bhList.isEmpty()) {
|
||||||
|
// 勾选导出:按编号集合取数,忽略筛选条件
|
||||||
|
list = zyjxjhbMapper.selectBatchIds(bhList);
|
||||||
|
list.sort(java.util.Comparator.comparing(ZYJXJHB::getZydh,
|
||||||
|
java.util.Comparator.nullsLast(String::compareTo)));
|
||||||
|
} else {
|
||||||
|
LambdaQueryWrapper<ZYJXJHB> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (zydh != null && !zydh.isEmpty()) {
|
||||||
|
wrapper.eq(ZYJXJHB::getZydh, zydh);
|
||||||
|
}
|
||||||
|
if (ty != null) {
|
||||||
|
wrapper.eq(ZYJXJHB::getTy, ty);
|
||||||
|
}
|
||||||
|
wrapper.orderByAsc(ZYJXJHB::getZydh);
|
||||||
|
list = zyjxjhbMapper.selectList(wrapper);
|
||||||
}
|
}
|
||||||
if (ty != null) {
|
|
||||||
wrapper.eq(ZYJXJHB::getTy, ty);
|
|
||||||
}
|
|
||||||
wrapper.orderByAsc(ZYJXJHB::getZydh);
|
|
||||||
List<ZYJXJHB> list = zyjxjhbMapper.selectList(wrapper);
|
|
||||||
String[] headers = {"专业代号", "课编号", "学期第次", "课类型", "学时", "学分", "周课时",
|
String[] headers = {"专业代号", "课编号", "学期第次", "课类型", "学时", "学分", "周课时",
|
||||||
"课程定位", "模块", "成绩分制", "理论学时", "实践学时", "考试课时", "教研室代号", "简称"};
|
"课程定位", "模块", "成绩分制", "理论学时", "实践学时", "考试课时", "教研室代号", "简称"};
|
||||||
byte[] bytes = com.roomroot.jwgl.utils.ExcelExportUtil.export("专业教学计划", headers, list,
|
byte[] bytes = com.roomroot.jwgl.utils.ExcelExportUtil.export("专业教学计划", headers, list,
|
||||||
|
|||||||
@@ -574,8 +574,13 @@ export default {
|
|||||||
/* ---------- 下载 ---------- */
|
/* ---------- 下载 ---------- */
|
||||||
handleDownload() {
|
handleDownload() {
|
||||||
const query = {}
|
const query = {}
|
||||||
if (this.searchForm.zydh) query.zydh = this.searchForm.zydh
|
// 勾选行优先:有勾选则只导出所选,否则按筛选条件导出
|
||||||
if (this.searchForm.ty === 0 || this.searchForm.ty === 1) query.ty = this.searchForm.ty
|
if (this.selection.length) {
|
||||||
|
query.bhList = this.selection.map(row => row.bh).join(',')
|
||||||
|
} else {
|
||||||
|
if (this.searchForm.zydh) query.zydh = this.searchForm.zydh
|
||||||
|
if (this.searchForm.ty === 0 || this.searchForm.ty === 1) query.ty = this.searchForm.ty
|
||||||
|
}
|
||||||
exportSyllabus(query).then(blob => {
|
exportSyllabus(query).then(blob => {
|
||||||
saveAs(blob, '教学大纲.xlsx')
|
saveAs(blob, '教学大纲.xlsx')
|
||||||
this.$message.success('导出成功')
|
this.$message.success('导出成功')
|
||||||
|
|||||||
Reference in New Issue
Block a user