作者 朱兆平

消息类型增加接口

@@ -57,4 +57,11 @@ public class MessageTypesController { @@ -57,4 +57,11 @@ public class MessageTypesController {
57 boolean result = messageTypeService.del(messageType.getId()); 57 boolean result = messageTypeService.del(messageType.getId());
58 return result ? new ResultJson("200","success") : new ResultJson("400","error"); 58 return result ? new ResultJson("200","success") : new ResultJson("400","error");
59 } 59 }
  60 +
  61 + @ApiOperation(value = "批量删除消息类", notes = "参数为id数组[1,2,3]")
  62 + @DeleteMapping("batchDelete")
  63 + public ResultJson delete(@RequestBody String[] ids){
  64 + boolean result = messageTypeService.batchDel(ids);
  65 + return result ? new ResultJson("200","success") : new ResultJson("400","error");
  66 + }
60 } 67 }
@@ -7,6 +7,8 @@ import java.util.List; @@ -7,6 +7,8 @@ import java.util.List;
7 public interface MessageTypeMapper { 7 public interface MessageTypeMapper {
8 int deleteByPrimaryKey(String id); 8 int deleteByPrimaryKey(String id);
9 9
  10 + int batchDeleteByPrimaryKey(String[] array);
  11 +
10 int insert(MessageType record); 12 int insert(MessageType record);
11 13
12 int insertSelective(MessageType record); 14 int insertSelective(MessageType record);
@@ -18,4 +18,6 @@ public interface MessageTypeService { @@ -18,4 +18,6 @@ public interface MessageTypeService {
18 18
19 boolean del(String id); 19 boolean del(String id);
20 20
  21 + boolean batchDel(String[] ids);
  22 +
21 } 23 }
@@ -52,4 +52,10 @@ public class MessageTypeServiceImp implements MessageTypeService { @@ -52,4 +52,10 @@ public class MessageTypeServiceImp implements MessageTypeService {
52 return i > 0; 52 return i > 0;
53 } 53 }
54 54
  55 + @Override
  56 + public boolean batchDel(String[] ids) {
  57 + int i = messageTypeMapper.batchDeleteByPrimaryKey(ids);
  58 + return i > 0;
  59 + }
  60 +
55 } 61 }
@@ -54,6 +54,15 @@ @@ -54,6 +54,15 @@
54 delete from message_type 54 delete from message_type
55 where ID = #{id,jdbcType=VARCHAR} 55 where ID = #{id,jdbcType=VARCHAR}
56 </delete> 56 </delete>
  57 +
  58 + <delete id="batchDeleteByPrimaryKey" parameterType="java.lang.String" >
  59 + delete from message_type
  60 + where ID in
  61 + <foreach collection="array" item="outputId" open="(" separator="," close=")">
  62 + #{outputId}
  63 + </foreach>
  64 + </delete>
  65 +
57 <insert id="insert" parameterType="com.sunyo.wlpt.message.bus.service.model.MessageType" > 66 <insert id="insert" parameterType="com.sunyo.wlpt.message.bus.service.model.MessageType" >
58 insert into message_type (ID, name, parent_id, 67 insert into message_type (ID, name, parent_id,
59 des, type) 68 des, type)