Commit e66811f5 authored by jiaorz's avatar jiaorz

Merge branch 'master-bacground-im' into dev

parents ad41c11f ec956f6f
...@@ -470,4 +470,20 @@ public class MsgBiz { ...@@ -470,4 +470,20 @@ public class MsgBiz {
return ObjectRestResponse.succ(newValue); return ObjectRestResponse.succ(newValue);
} }
public ObjectRestResponse deleteById(String id) {
if (StringUtils.isBlank(id)) {
return ObjectRestResponse.paramIsEmpty();
}
Query query = new Query(Criteria.where("_id").is(id));
Msg oldValue = mongoTemplate.findOne(query, Msg.class, "s_msg");
if (oldValue == null) {
return ObjectRestResponse.createFailedResult(ResultCode.IM_MSG_NOT_EXIST_CODE, ResultCode.getMsg(ResultCode.IM_MSG_NOT_EXIST_CODE));
}
DeleteResult deleteResult = mongoTemplate.remove(query, Msg.class, "s_msg");
if (deleteResult != null && deleteResult.getDeletedCount() == 1) {
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createFailedResult(ResultCode.IM_DELETE_FAIL_CODE, ResultCode.getMsg(ResultCode.IM_DELETE_FAIL_CODE));
}
} }
...@@ -41,6 +41,10 @@ public class MsgController { ...@@ -41,6 +41,10 @@ public class MsgController {
return msgBiz.deleteByList(ids); return msgBiz.deleteByList(ids);
} }
@GetMapping(value = "/bg/app/unauth/delete")
public ObjectRestResponse deleteById(String id) {
return msgBiz.deleteById(id);
}
@PostMapping(value = "/bg/app/unauth/addMsg") @PostMapping(value = "/bg/app/unauth/addMsg")
public ObjectRestResponse addMsg(@RequestBody AddMsgParam param) { public ObjectRestResponse addMsg(@RequestBody AddMsgParam param) {
...@@ -56,4 +60,6 @@ public class MsgController { ...@@ -56,4 +60,6 @@ public class MsgController {
public ObjectRestResponse getMsgList(@RequestBody MsgQueryDto msgQueryDto) { public ObjectRestResponse getMsgList(@RequestBody MsgQueryDto msgQueryDto) {
return msgBiz.getMsgList(msgQueryDto); return msgBiz.getMsgList(msgQueryDto);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment