package com.hxzk.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hxzk.pojo.TbHistoryinwarning; import com.hxzk.pojo.TbHomeicon; import com.hxzk.pojo.TbSystemOperationLog; import com.hxzk.service.HomeIconService; import com.hxzk.service.SystemLogService; import com.hxzk.util.result; import com.hxzk.util.resultutil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @RestController @RequestMapping("/") public class HomeIconController { @Autowired HomeIconService homeIconService; @Autowired SystemLogService systemLogService; @GetMapping("findHomeIcon") result> ffindHomeIcon(){ PageInfo cz=homeIconService.findAll(); return resultutil.returnSuccess(cz.getTotal(), cz.getList()); } //修改图标信息 @PostMapping("updateIconname") public void updatename(String name,String id){ homeIconService.updatename(name, id); } @PostMapping("updateHomeIcon") public void addHomeIcon(TbHomeicon homeicon, HttpServletResponse response) throws IOException { if(homeicon.getNone() == null){ homeicon.setNone("1"); }else{ homeicon.setNone("0"); } homeIconService.updateHomeIcon(homeicon); TbSystemOperationLog systemOperationLog = new TbSystemOperationLog(); systemOperationLog.setName(UserController.username); systemOperationLog.setTime(gettime()); systemOperationLog.setContent("修改了,"+homeicon.getName()+"图标信息"); systemLogService.insertSystem(systemOperationLog); response.sendRedirect("/hxzkuwb/HouTai/XiTong/ShouYeSheZhi.jsp"); } @PostMapping("updateIcon1") public void updateIcon1(TbHomeicon homeicon,HttpServletResponse response) throws IOException { homeIconService.upIcon(homeicon); response.sendRedirect("/hxzkuwb/HouTai/XiTong/SystemIcon.jsp"); } public String gettime(){ Date now = new Date(); // 创建日期格式化对象,设置格式为 "yyyy-MM-dd HH:mm" SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // 格式化日期对象,输出字符串结果 String formattedDate = sdf.format(now); return formattedDate; } }