diff --git a/EastLineServer/src/main/java/me/bello/eastline/controller/StockController.java b/EastLineServer/src/main/java/me/bello/eastline/controller/StockController.java index 3d3fb49..b9d5b04 100644 --- a/EastLineServer/src/main/java/me/bello/eastline/controller/StockController.java +++ b/EastLineServer/src/main/java/me/bello/eastline/controller/StockController.java @@ -17,6 +17,103 @@ public class StockController extends BaseController { /** + * 查询关注列表 + * + * @param req + * @return + * @throws Exception + */ + @RequestMapping(value = {"/queryTempCodes"}, method = RequestMethod.POST) + public RspData queryTempCodes(HttpServletRequest req) throws Exception { + RspData rspData = new RspData(); + + List> list = stockService.queryTempCodes(); + if (list.isEmpty()) { + rspData.setCode(RSP_OK); + rspData.setMsg("OK"); + } else { + rspData.setCode(RSP_OK); + rspData.setMsg("OK"); + rspData.setData(list); + + } + + return rspData; + + } + + /** + * 删除关注 + * + * @param req + * @return + * @throws Exception + */ + @RequestMapping(value = {"/delTempCode"}, method = RequestMethod.POST) + public RspData delTempCode(HttpServletRequest req) throws Exception { + RspData rspData = new RspData(); + + String code = req.getParameter("code"); + if (code == null || code.isEmpty()) { + rspData.setCode(RSP_FAIL); + rspData.setMsg("Code is not null."); + logger.error("Code is not null."); + return rspData; + } + + int result = stockService.delTempCode(code); +// if (list.isEmpty()) { + rspData.setCode(RSP_OK); + rspData.setMsg("OK"); +// } else { +// rspData.setCode(RSP_OK); +// rspData.setMsg("OK"); + rspData.setData(result); +// +// } + + return rspData; + + } + + /** + * 添加关注 + * + * @param req + * @return + * @throws Exception + */ + @RequestMapping(value = {"/addTempCode"}, method = RequestMethod.POST) + public RspData addTempCode(HttpServletRequest req) throws Exception { + RspData rspData = new RspData(); + + String code = req.getParameter("code"); + String name = req.getParameter("name"); + if (code == null || code.isEmpty()) { + rspData.setCode(RSP_FAIL); + rspData.setMsg("Code is not null."); + logger.error("Code is not null."); + return rspData; + } + + int result = stockService.addTempCode(code, name); +// if (list.isEmpty()) { + rspData.setCode(RSP_OK); + rspData.setMsg("OK"); +// } else { +// rspData.setCode(RSP_OK); +// rspData.setMsg("OK"); + rspData.setData(result); +// +// } + + return rspData; + + } + + + + /** * 根据code查询名称 * * @param req