完善消息接口
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.jsh.erp.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.datasource.entities.Msg;
|
||||
import com.jsh.erp.datasource.entities.MsgEx;
|
||||
import com.jsh.erp.service.msg.MsgService;
|
||||
import com.jsh.erp.utils.BaseResponseInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -40,7 +42,7 @@ public class MsgController {
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
List<Msg> list = msgService.getMsgByStatus(status);
|
||||
List<MsgEx> list = msgService.getMsgByStatus(status);
|
||||
res.code = 200;
|
||||
res.data = list;
|
||||
} catch(Exception e){
|
||||
@@ -53,19 +55,19 @@ public class MsgController {
|
||||
|
||||
/**
|
||||
* 批量更新状态
|
||||
* @param ids
|
||||
* @param status
|
||||
* @param jsonObject
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/batchUpdateStatus")
|
||||
@ApiOperation(value = "批量更新状态")
|
||||
public BaseResponseInfo batchUpdateStatus(@RequestParam("ids") String ids,
|
||||
@RequestParam("status") String status,
|
||||
public BaseResponseInfo batchUpdateStatus(@RequestBody JSONObject jsonObject,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
String ids = jsonObject.getString("ids");
|
||||
String status = jsonObject.getString("status");
|
||||
msgService.batchUpdateStatus(ids, status);
|
||||
res.code = 200;
|
||||
res.data = "更新成功";
|
||||
@@ -102,4 +104,30 @@ public class MsgController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型查询数量
|
||||
* @param type
|
||||
* @param request
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@GetMapping("/getMsgCountByType")
|
||||
@ApiOperation(value = "根据类型查询数量")
|
||||
public BaseResponseInfo getMsgCountByType(@RequestParam("type") String type,
|
||||
HttpServletRequest request)throws Exception {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
try {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
Integer count = msgService.getMsgCountByType(type);
|
||||
map.put("count", count);
|
||||
res.code = 200;
|
||||
res.data = map;
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user