package com.hxzk.controller; import com.github.pagehelper.PageInfo; import com.hxzk.pojo.TbFence; import com.hxzk.pojo.TbFzanchor; import com.hxzk.pojo.TbTag; import com.hxzk.service.FzAnchorService; import com.hxzk.udp.Udp_Out; 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.util.List; @RestController @RequestMapping("/") public class FzAnchorController { @Autowired FzAnchorService fzAnchorService; @GetMapping("findFzAnchor") result> findFzAnchor(Integer page, Integer limit){ PageInfo cz= fzAnchorService.findAll(page, limit); return resultutil.returnSuccess(cz.getTotal(), cz.getList()); } @PostMapping("addFzAnchor") public void addFzAnchor(TbFzanchor fzanchor, HttpServletResponse response) throws IOException { String msg = "BSTOCS1,ADDFZANC,"+fzanchor.getName()+","+fzanchor.getAchorId()+","+fzanchor.getFzDis()+",END"; Udp_Out.udp_to_cs(msg); response.sendRedirect("/hxzkuwb/HouTai/FangZhuangLeiDa/FangZhuangLeiDa.jsp"); } @PostMapping("upFzAnchor") public void upFzAnchor(TbFzanchor fzanchor, HttpServletResponse response) throws IOException { String msg = "BSTOCS1,ALTERFZANC,"+fzanchor.getName()+","+fzanchor.getAchorId()+","+fzanchor.getFzDis()+",END"; Udp_Out.udp_to_cs(msg); response.sendRedirect("/hxzkuwb/HouTai/FangZhuangLeiDa/FangZhuangLeiDa.jsp"); } @PostMapping("deFzAnchor") public void deFzAnchor(TbFzanchor fzanchor, HttpServletResponse response) throws IOException { String msg = "BSTOCS1,DELETEFZANC,"+fzanchor.getAchorId()+",END"; Udp_Out.udp_to_cs(msg); response.sendRedirect("/hxzkuwb/HouTai/FangZhuangLeiDa/FangZhuangLeiDa.jsp"); } @PostMapping("findFzAnctableSearch") result> findtableSearch(Integer page, Integer limit, TbFzanchor fzanchor){ PageInfo cz= fzAnchorService.findSearch(page, limit,fzanchor); return resultutil.returnSuccess(cz.getTotal(), cz.getList()); } }