package com.zcloud.controller.keyProjects; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.keyProjects.KeyprojectPunishService; import com.zcloud.util.ObjectExcelView; import com.zcloud.util.Tools; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 说明:重点工程处罚 * 作者:luoxiaobao * 时间:2022-09-21 * 官网:www.zcloudchina.com */ @Controller @RequestMapping("/keyprojectpunish") public class KeyprojectPunishController extends BaseController { @Autowired private KeyprojectPunishService keyprojectpunishService; /**新增 * @param * @throws Exception */ @RequestMapping(value="/add") @RequiresPermissions("keyprojectpunish:add") @ResponseBody public Object add() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd.put("KEYPROJECTPUNISH_ID", this.get32UUID()); //主键 keyprojectpunishService.save(pd); map.put("result", errInfo); return map; } /**删除 * @param out * @throws Exception */ @RequestMapping(value="/delete") @RequiresPermissions("keyprojectpunish:del") @ResponseBody public Object delete() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); keyprojectpunishService.delete(pd); map.put("result", errInfo); //返回结果 return map; } /**修改 * @param * @throws Exception */ @RequestMapping(value="/edit") @RequiresPermissions("keyprojectpunish:edit") @ResponseBody public Object edit() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); keyprojectpunishService.edit(pd); map.put("result", errInfo); return map; } /**列表 * @param page * @throws Exception */ @RequestMapping(value="/list") @ResponseBody public Object list(Page page) throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); page.setPd(pd); List varList = keyprojectpunishService.list(page); //列出KeyprojectPunish列表 map.put("varList", varList); map.put("page", page); map.put("result", errInfo); return map; } /**去修改页面获取数据 * @param * @throws Exception */ @RequestMapping(value="/goEdit") @ResponseBody public Object goEdit() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); pd = keyprojectpunishService.findById(pd); //根据ID读取 map.put("pd", pd); map.put("result", errInfo); return map; } /**批量删除 * @param * @throws Exception */ @RequestMapping(value="/deleteAll") @RequiresPermissions("keyprojectpunish:del") @ResponseBody public Object deleteAll() throws Exception{ Map map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); String DATA_IDS = pd.getString("DATA_IDS"); if(Tools.notEmpty(DATA_IDS)){ String ArrayDATA_IDS[] = DATA_IDS.split(","); keyprojectpunishService.deleteAll(ArrayDATA_IDS); errInfo = "success"; }else{ errInfo = "fail"; } map.put("result", errInfo); //返回结果 return map; } /**导出到excel * @param * @throws Exception */ @RequestMapping(value="/excel") @RequiresPermissions("toExcel") public ModelAndView exportExcel() throws Exception{ ModelAndView mv = new ModelAndView(); PageData pd = new PageData(); pd = this.getPageData(); Map dataMap = new HashMap(); List titles = new ArrayList(); titles.add("添加人"); //1 titles.add("添加时间"); //2 titles.add("修改人"); //3 titles.add("修改时间"); //4 titles.add("是否删除(0:有效 1:删除)"); //5 titles.add("检查ID"); //6 titles.add("隐患ID"); //7 titles.add("处罚单位"); //8 titles.add("处罚人"); //9 titles.add("处罚原因"); //10 titles.add("处罚金额"); //11 titles.add("处罚时间"); //12 titles.add("是否处理 0否1是"); //13 titles.add("处理图片"); //14 titles.add("处理时间"); //15 dataMap.put("titles", titles); List varOList = keyprojectpunishService.listAll(pd); List varList = new ArrayList(); for(int i=0;i map = new HashMap(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); List byOperator = keyprojectpunishService.findByOperator(pd); map.put("data", byOperator); map.put("result", errInfo); //返回结果 return map; } }