增加公众号回复删除

This commit is contained in:
TinyAnts 2022-09-13 16:18:10 +08:00
parent 71998ed2f1
commit 502c44850f
3 changed files with 34 additions and 7 deletions

View File

@ -1,7 +1,10 @@
package com.mdd.admin.controller.channel;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.mdd.admin.service.channel.IChannelOaReplyService;
import com.mdd.common.core.AjaxResult;
import com.mdd.common.validator.IDMustValidator;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -59,7 +62,8 @@ public class OaReplyController {
* @return Object
*/
@PostMapping("/edit")
public Object edit() {
public Object edit(@RequestBody Map<String, String> params) {
iChannelOaReplyService.edit(params);
return AjaxResult.success();
}
@ -70,7 +74,9 @@ public class OaReplyController {
* @return Object
*/
@PostMapping("/del")
public Object del() {
public Object del(@RequestBody Map<String, String> params) {
Assert.notNull(params.get("id"), "id参数缺失");
iChannelOaReplyService.del(Integer.parseInt(params.get("id")));
return AjaxResult.success();
}

View File

@ -24,6 +24,12 @@ public interface IChannelOaReplyService {
*/
void edit(Map<String, String> params);
void del();
/**
* 回复删除
*
* @author fzr
* @param id 主键
*/
void del(Integer id);
}

View File

@ -124,7 +124,7 @@ public class ChannelOaReplyServiceImpl implements IChannelOaReplyService {
officialReply.setStatus(Integer.parseInt(params.get("status")));
officialReply.setCreateTime(System.currentTimeMillis() / 1000);
officialReply.setUpdateTime(System.currentTimeMillis() / 1000);
officialReplyMapper.insert(officialReply);
officialReplyMapper.updateById(officialReply);
break;
case 2:
Assert.notNull(params.get("name"), "规则名称不能为空");
@ -143,7 +143,7 @@ public class ChannelOaReplyServiceImpl implements IChannelOaReplyService {
officialReply.setStatus(Integer.parseInt(params.get("status")));
officialReply.setCreateTime(System.currentTimeMillis() / 1000);
officialReply.setUpdateTime(System.currentTimeMillis() / 1000);
officialReplyMapper.insert(officialReply);
officialReplyMapper.updateById(officialReply);
break;
case 3:
Assert.notNull(params.get("name"), "规则名称不能为空");
@ -158,16 +158,31 @@ public class ChannelOaReplyServiceImpl implements IChannelOaReplyService {
officialReply.setStatus(Integer.parseInt(params.get("status")));
officialReply.setCreateTime(System.currentTimeMillis() / 1000);
officialReply.setUpdateTime(System.currentTimeMillis() / 1000);
officialReplyMapper.insert(officialReply);
officialReplyMapper.updateById(officialReply);
break;
default:
throw new OperateException("不被支持的类型");
}
}
/**
* 回复删除
*
* @author fzr
* @param id 主键
*/
@Override
public void del() {
public void del(Integer id) {
OfficialReply officialReply =officialReplyMapper.selectOne(new QueryWrapper<OfficialReply>()
.eq("id", id)
.eq("is_delete", 0)
.last("limit 1"));
Assert.notNull(officialReply, "数据不存在!");
officialReply.setIsDelete(1);
officialReply.setDeleteTime(System.currentTimeMillis() / 1000);
officialReplyMapper.updateById(officialReply);
}
}