Commit dd910344 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/dev' into dev

parents 4582f258 df2f918e
......@@ -117,6 +117,18 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
return ObjectRestResponse.succ();
}
public ObjectRestResponse deleteById(Long id) {
if (id == null) {
return ObjectRestResponse.paramIsEmpty();
}
ImQuestion imQuestion = mapper.selectByPrimaryKey(id);
if (imQuestion == null) {
return ObjectRestResponse.createDefaultFail();
}
imQuestion.setIsDel(true);
updateSelectiveByIdRe(imQuestion);
return ObjectRestResponse.succ();
}
public ObjectRestResponse update(Long id, MsgTypeEnum type, UpdateTypeEnum updateType) {
if (id == null || type == null) {
......
......@@ -366,12 +366,12 @@ public class MsgBiz {
if (msgQueryDto.getSource() == 1) {
query.addCriteria(Criteria.where("source").is(msgQueryDto.getSource()));
} else {
query.addCriteria(Criteria.where("source").is(msgQueryDto.getSource()).orOperator(Criteria.where("source").is(null)));
query.addCriteria(Criteria.where("source").is(2));
}
}
//下单时间
if (msgQueryDto.getStartTime() != null) {
query.addCriteria(Criteria.where("body.time").gte(msgQueryDto.getStartTime()).orOperator(Criteria.where("body.time").lte(msgQueryDto.getEndTime())));
query.addCriteria(Criteria.where("body.time").gte(msgQueryDto.getStartTime())).addCriteria((Criteria.where("body.time").lte(msgQueryDto.getEndTime())));
}
//用户名
if (StringUtils.isNotBlank(msgQueryDto.getUsername())) {
......@@ -470,4 +470,20 @@ public class MsgBiz {
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,4 +41,10 @@ public class ImQuestionController {
public ObjectRestResponse delete(Long id) {
return imQuestionBiz.delete(id);
}
@GetMapping(value = "/bg/app/unauth/delete")
@ApiOperation(value = "删除问答信息")
public ObjectRestResponse deleteById(Long id) {
return imQuestionBiz.deleteById(id);
}
}
......@@ -41,6 +41,10 @@ public class MsgController {
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")
public ObjectRestResponse addMsg(@RequestBody AddMsgParam param) {
......@@ -56,4 +60,6 @@ public class MsgController {
public ObjectRestResponse getMsgList(@RequestBody MsgQueryDto 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