四六级学生数据导入导出接口
This commit is contained in:
parent
489efb0ae4
commit
a6aba82501
|
@ -0,0 +1,67 @@
|
||||||
|
package org.jeecg.modules.controller;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.modules.entity.Cet4_major;
|
||||||
|
import org.jeecg.modules.entity.Cet_4;
|
||||||
|
import org.jeecg.modules.service.impl.CetMajorServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @Author: Cool
|
||||||
|
* @Date: 2024/10/16/17:58
|
||||||
|
* @Description: 学生信息Controller
|
||||||
|
*/
|
||||||
|
@Api(tags = "cetStudent")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/cetStudent")
|
||||||
|
@Slf4j
|
||||||
|
public class CetStudentController extends JeecgController<Cet4_major, CetMajorServiceImpl> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CetMajorServiceImpl cetMajorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出excel
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("cet:cetStudent:exportXls")
|
||||||
|
@RequestMapping(value = "/exportXls")
|
||||||
|
public ModelAndView exportXls(HttpServletRequest request, Cet4_major major) {
|
||||||
|
return super.exportXls(request, major, Cet4_major.class, "cet_4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过excel导入数据
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("cet:cetStudent:importExcel")
|
||||||
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
return super.importExcel(request, response, Cet4_major.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("downloadTemplate")
|
||||||
|
@ApiOperation("四六级导入数据文件模版")
|
||||||
|
public Result<?> downloadTemplate(HttpServletResponse response) {
|
||||||
|
return cetMajorService.downloadTemplate(response);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,10 +2,15 @@ package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.modules.entity.Cet4_major;
|
import org.jeecg.modules.entity.Cet4_major;
|
||||||
import org.jeecg.modules.mapper.Cet4_majorMapper;
|
import org.jeecg.modules.mapper.Cet4_majorMapper;
|
||||||
|
import org.jeecg.modules.utils.ExportUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created with IntelliJ IDEA.
|
* Created with IntelliJ IDEA.
|
||||||
*
|
*
|
||||||
|
@ -16,4 +21,15 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class CetMajorServiceImpl extends ServiceImpl<Cet4_majorMapper, Cet4_major> {
|
public class CetMajorServiceImpl extends ServiceImpl<Cet4_majorMapper, Cet4_major> {
|
||||||
|
private final String CET_STUDENT_IMPORT_TEMPLATE = "template/cetStudentImportTemplate.xls";
|
||||||
|
private final String CET_STUDENT_FILE_TEMPLATE_NAME = "四六级学生信息导入模版.xlsx";
|
||||||
|
|
||||||
|
public Result<?> downloadTemplate(HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
ExportUtil.downloadExcelTemplate(response, CET_STUDENT_FILE_TEMPLATE_NAME, CET_STUDENT_IMPORT_TEMPLATE);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue