package com.hxzk.controller; import com.github.pagehelper.PageInfo; import com.hxzk.pojo.TbMapShow; import com.hxzk.pojo.TbMessageHistory; import com.hxzk.service.MapShowService; import com.hxzk.util.MyFile; import com.hxzk.util.result; import com.hxzk.util.resultutil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; 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 org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; 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 MapShowController { @Autowired MapShowService mapShowService; @GetMapping("MapShow") result> findTag(Integer page, Integer limit){ PageInfo cz= mapShowService.findAll(page, limit); return resultutil.returnSuccess(cz.getTotal(), cz.getList()); } @GetMapping("findMapShow") List findMapShow(){ List cz= mapShowService.findAll(); return cz; } @PostMapping("upMapShow") public void upMapShow(TbMapShow mapShow, MultipartFile zhuti, MultipartFile map, HttpServletResponse response, HttpServletRequest request) throws IOException { mapShow.setZhuti("主题"); mapShow.setMap("地图"); if (mapShow.getIshow() == null || mapShow.getIshow().equals("null")){ mapShow.setIshow("不显示"); }else{ mapShow.setIshow("显示"); } mapShowService.upMapShow(mapShow); response.sendRedirect("/hxzkuwb/HouTai/XiTong/SystemMapShow.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; } }