删除信息
This commit is contained in:
@ -6,6 +6,7 @@ import com.chinaunicom.mall.ebtp.extend.bizmessage.vo.DescribeSiteMsgDetailVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -13,6 +14,8 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Api(value = "创建消息", description = "创建消息")
|
||||
@RestController
|
||||
@ -37,4 +40,11 @@ public class BizMessageProducerController {
|
||||
}).orElseGet(DescribeSiteMsgDetailVO::new);
|
||||
}
|
||||
|
||||
@ApiOperation("删除信息.")
|
||||
@DeleteMapping
|
||||
@ResponseStatus(code = HttpStatus.OK)
|
||||
public Map<String,Integer> deleteMessageByCode(@ApiParam(value = "消息内容", required = true)String code) {
|
||||
|
||||
return service.deleteMessageByCode(code);
|
||||
}
|
||||
}
|
||||
|
@ -21,4 +21,9 @@ public interface BizMessageMapper extends BaseMapper<BizMessage> {
|
||||
|
||||
List<BizMessageAuthorize> findAuthorizeList(BizMessageAuthorize vo);
|
||||
|
||||
List<BizMessage> findMessageByLikeCode(String code);
|
||||
|
||||
Integer deleteMessageByServicecdoe(List<String> magIds);
|
||||
|
||||
Integer deleteAuthorizeByServicecdoe(List<String> magIds);
|
||||
}
|
||||
|
@ -80,4 +80,23 @@
|
||||
and state = #{state}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="findMessageByLikeCode" resultType="com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessage" parameterType="java.lang.String">
|
||||
select * from biz_message where servicecode like CONCAT('%"questId":"',#{code},'"%')
|
||||
</select>
|
||||
|
||||
<delete id="deleteMessageByServicecdoe" parameterType="List">
|
||||
delete from biz_message where id in
|
||||
<foreach item="id" collection="magIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAuthorizeByServicecdoe" parameterType="java.lang.String">
|
||||
delete from biz_message_authorize
|
||||
where message_id in
|
||||
<foreach item="id" collection="magIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -3,10 +3,12 @@ package com.chinaunicom.mall.ebtp.extend.bizmessage.service;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizmessage.dto.BizMessageRawDTO;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizmessage.entity.BizMessage;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface BizMessageProducerService {
|
||||
|
||||
Optional<BizMessage> produce(BizMessageRawDTO messageRaw);
|
||||
|
||||
Map<String,Integer> deleteMessageByCode(String questId);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.bizmessage.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizmessage.dao.BizMessageAuthorizeMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.bizmessage.dao.BizMessageCategoryMapper;
|
||||
@ -25,8 +26,11 @@ import org.springframework.util.Assert;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 消息生产服务
|
||||
@ -159,4 +163,25 @@ public class BizMessageProducerServiceImpl implements BizMessageProducerService
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param questId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String,Integer> deleteMessageByCode(String questId) {
|
||||
List<BizMessage> messageList = messageMapper.findMessageByLikeCode(questId);
|
||||
log.info(" 删除查询结果 messageList: "+messageList);
|
||||
List<String> magIds = messageList.stream().map(BizMessage::getId).distinct().collect(Collectors.toList());
|
||||
Map<String,Integer> map = new HashMap<>();
|
||||
Integer m = new Integer(0);
|
||||
Integer a = new Integer(0);
|
||||
if(magIds!=null&&magIds.size()>0) {
|
||||
m = messageMapper.deleteMessageByServicecdoe(magIds);
|
||||
a = messageMapper.deleteAuthorizeByServicecdoe(magIds);
|
||||
}
|
||||
map.put("deleteMessage", m);
|
||||
map.put("deleteAuthorize", a);
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user