| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- package cn.com.lzt.car.archives.controller;
- import cn.afterturn.easypoi.entity.vo.NormalExcelConstants;
- import cn.afterturn.easypoi.excel.entity.ExportParams;
- import cn.com.lzt.car.cardoc.entity.CarEntity;
- import cn.com.lzt.car.cardoc.service.CarService;
- import com.daju.common.util.DataPage;
- import com.daju.mix.dao.entity.TBArchivesArea;
- import com.daju.mix.dao.entity.TBArchivesClearingPoint;
- import com.daju.mix.dao.entity.TBArchivesDustbin;
- import com.daju.mix.dao.mapper.TBArchivesAreaMapper;
- import com.daju.mix.dao.service.ITBArchivesAreaService;
- import com.daju.mix.dao.service.impl.TBArchivesAreaServiceImpl;
- import com.daju.mix.dao.service.impl.TBArchivesClearingPointServiceImpl;
- import org.jeecgframework.core.common.exception.BusinessException;
- import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
- import org.jeecgframework.core.common.model.json.AjaxJson;
- import org.jeecgframework.core.common.model.json.DataGrid;
- import org.jeecgframework.core.constant.Globals;
- import org.jeecgframework.core.util.ResourceUtil;
- import org.jeecgframework.core.util.StringUtil;
- import org.jeecgframework.tag.core.easyui.TagUtil;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.ModelMap;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import org.springframework.web.servlet.ModelAndView;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.util.HashMap;
- import java.util.List;
- /**
- * 区域档案
- *
- * @author :sahib.kio.m
- * @date :Created in 2021/7/8 上午10:31
- */
- @Controller
- @RequestMapping("/archivesAreaController")
- public class ArchivesAreaController {
- private String bestXmlPath = "cn/com/lzt/car/archives/";
- @Resource
- private TBArchivesAreaServiceImpl archivesAreaService;
- @RequestMapping(params = "list")
- public ModelAndView list(HttpServletRequest request) {
- return new ModelAndView(bestXmlPath + "archivesAreaList");
- }
- /**
- * easyui AJAX请求数据
- *
- * @param request
- * @param response
- * @param dataGrid
- * @param tbArchivesArea
- */
- @RequestMapping(params = "datagrid")
- public void datagrid(TBArchivesArea tbArchivesArea, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
- DataPage<TBArchivesArea> page = archivesAreaService.queryPageList(tbArchivesArea, dataGrid, request);
- TagUtil.datagrid(response, dataGrid, page);
- }
- @RequestMapping(params = "datagridToBody")
- @ResponseBody
- public DataPage<TBArchivesArea> datagridToBody(TBArchivesArea tbArchivesArea, HttpServletRequest request, DataGrid dataGrid) {
- DataPage<TBArchivesArea> page = archivesAreaService.queryPageList(tbArchivesArea, dataGrid, request);
- return page;
- }
- /**
- * 更新页面跳转
- *
- * @return
- */
- @RequestMapping(params = "goUpdate")
- public ModelAndView goUpdate(TBArchivesArea tbArchivesArea, HttpServletRequest req) {
- if (StringUtil.isNotEmpty(tbArchivesArea.getId())) {
- tbArchivesArea = archivesAreaService.getById(tbArchivesArea.getId());
- req.setAttribute("tbArchivesArea", tbArchivesArea);
- }
- return new ModelAndView(bestXmlPath + "archivesArea-update");
- }
- @RequestMapping(params = "doUpdate")
- @ResponseBody
- public AjaxJson doUpdate(TBArchivesArea tbArchivesArea, HttpServletRequest request) {
- String message = null;
- AjaxJson j = new AjaxJson();
- message = "区域档案更新成功";
- try {
- HashMap<String, Object> map = archivesAreaService.updataById(tbArchivesArea);
- j.setAttributes(map);
- } catch (Exception e) {
- e.printStackTrace();
- message = "区域档案更新失败";
- throw new BusinessException(e.getMessage());
- }
- j.setMsg(message);
- return j;
- }
- /**
- * 导出excel
- *
- */
- @RequestMapping(params = "exportXls")
- public String exportXls(ModelMap modelMap) {
- List<TBArchivesArea> cars = archivesAreaService.list();
- modelMap.put(NormalExcelConstants.FILE_NAME, "作业元素档案");
- modelMap.put(NormalExcelConstants.CLASS, TBArchivesArea.class);
- modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("作业元素档案列表", "导出人:" + ResourceUtil.getSessionUser().getRealName(),
- "导出信息"));
- modelMap.put(NormalExcelConstants.DATA_LIST, cars);
- return NormalExcelConstants.EASYPOI_EXCEL_VIEW;
- }
- }
|