正在显示
7 个修改的文件
包含
269 行增加
和
189 行删除
@@ -2,16 +2,14 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | @@ -2,16 +2,14 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | ||
2 | 2 | ||
3 | import com.github.pagehelper.PageHelper; | 3 | import com.github.pagehelper.PageHelper; |
4 | import com.github.pagehelper.PageInfo; | 4 | import com.github.pagehelper.PageInfo; |
5 | -import org.springframework.stereotype.Service; | ||
6 | - | ||
7 | -import javax.annotation.Resource; | ||
8 | - | ||
9 | import com.sunyo.wlpt.message.bus.service.domain.BusExchange; | 5 | import com.sunyo.wlpt.message.bus.service.domain.BusExchange; |
10 | import com.sunyo.wlpt.message.bus.service.mapper.BusExchangeMapper; | 6 | import com.sunyo.wlpt.message.bus.service.mapper.BusExchangeMapper; |
11 | import com.sunyo.wlpt.message.bus.service.service.BusExchangeService; | 7 | import com.sunyo.wlpt.message.bus.service.service.BusExchangeService; |
8 | +import org.springframework.stereotype.Service; | ||
12 | import org.springframework.transaction.annotation.Propagation; | 9 | import org.springframework.transaction.annotation.Propagation; |
13 | import org.springframework.transaction.annotation.Transactional; | 10 | import org.springframework.transaction.annotation.Transactional; |
14 | 11 | ||
12 | +import javax.annotation.Resource; | ||
15 | import java.util.List; | 13 | import java.util.List; |
16 | 14 | ||
17 | /** | 15 | /** |
@@ -27,27 +25,23 @@ public class BusExchangeServiceImpl implements BusExchangeService { | @@ -27,27 +25,23 @@ public class BusExchangeServiceImpl implements BusExchangeService { | ||
27 | 25 | ||
28 | @Override | 26 | @Override |
29 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) | 27 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
30 | - public int deleteByPrimaryKey(String id) { | 28 | + public int deleteByPrimaryKey(String id) |
29 | + { | ||
31 | // 判断删除的个数,需被删除的个数是否一致 | 30 | // 判断删除的个数,需被删除的个数是否一致 |
32 | int index = 0; | 31 | int index = 0; |
33 | String splitItem = ","; | 32 | String splitItem = ","; |
34 | //如果id,传过来多个,以','分割,即批量删除 | 33 | //如果id,传过来多个,以','分割,即批量删除 |
35 | if (id.contains(splitItem)) { | 34 | if (id.contains(splitItem)) { |
36 | - try { | ||
37 | - String[] split = id.split(splitItem); | ||
38 | - for (int i = 0; i < split.length; i++) { | ||
39 | - int num = busExchangeMapper.deleteByPrimaryKey(split[i]); | ||
40 | - if (num > 0) { | ||
41 | - index = index + num; | ||
42 | - } | 35 | + String[] split = id.split(splitItem); |
36 | + for (int i = 0; i < split.length; i++) { | ||
37 | + int num = busExchangeMapper.deleteByPrimaryKey(split[i]); | ||
38 | + if (num > 0) { | ||
39 | + index = index + num; | ||
43 | } | 40 | } |
44 | - if (index == split.length) { | ||
45 | - return 1; | ||
46 | - } else { | ||
47 | - return 0; | ||
48 | - } | ||
49 | - } catch (Exception e) { | ||
50 | - e.printStackTrace(); | 41 | + } |
42 | + if (index == split.length) { | ||
43 | + return 1; | ||
44 | + } else { | ||
51 | return 0; | 45 | return 0; |
52 | } | 46 | } |
53 | } else { | 47 | } else { |
@@ -56,32 +50,38 @@ public class BusExchangeServiceImpl implements BusExchangeService { | @@ -56,32 +50,38 @@ public class BusExchangeServiceImpl implements BusExchangeService { | ||
56 | } | 50 | } |
57 | 51 | ||
58 | @Override | 52 | @Override |
59 | - public int insert(BusExchange record) { | 53 | + public int insert(BusExchange record) |
54 | + { | ||
60 | return busExchangeMapper.insert(record); | 55 | return busExchangeMapper.insert(record); |
61 | } | 56 | } |
62 | 57 | ||
63 | @Override | 58 | @Override |
64 | - public int insertSelective(BusExchange record) { | 59 | + public int insertSelective(BusExchange record) |
60 | + { | ||
65 | return busExchangeMapper.insertSelective(record); | 61 | return busExchangeMapper.insertSelective(record); |
66 | } | 62 | } |
67 | 63 | ||
68 | @Override | 64 | @Override |
69 | - public BusExchange selectByPrimaryKey(String id) { | 65 | + public BusExchange selectByPrimaryKey(String id) |
66 | + { | ||
70 | return busExchangeMapper.selectByPrimaryKey(id); | 67 | return busExchangeMapper.selectByPrimaryKey(id); |
71 | } | 68 | } |
72 | 69 | ||
73 | @Override | 70 | @Override |
74 | - public int updateByPrimaryKeySelective(BusExchange record) { | 71 | + public int updateByPrimaryKeySelective(BusExchange record) |
72 | + { | ||
75 | return busExchangeMapper.updateByPrimaryKeySelective(record); | 73 | return busExchangeMapper.updateByPrimaryKeySelective(record); |
76 | } | 74 | } |
77 | 75 | ||
78 | @Override | 76 | @Override |
79 | - public int updateByPrimaryKey(BusExchange record) { | 77 | + public int updateByPrimaryKey(BusExchange record) |
78 | + { | ||
80 | return busExchangeMapper.updateByPrimaryKey(record); | 79 | return busExchangeMapper.updateByPrimaryKey(record); |
81 | } | 80 | } |
82 | 81 | ||
83 | @Override | 82 | @Override |
84 | - public PageInfo selectBusExchangeList(BusExchange busExchange, Integer pageNum, Integer pageSize) { | 83 | + public PageInfo selectBusExchangeList(BusExchange busExchange, Integer pageNum, Integer pageSize) |
84 | + { | ||
85 | PageHelper.startPage(pageNum, pageSize); | 85 | PageHelper.startPage(pageNum, pageSize); |
86 | List<BusExchange> busExchangeList = busExchangeMapper.selectBusExchangeList(busExchange); | 86 | List<BusExchange> busExchangeList = busExchangeMapper.selectBusExchangeList(busExchange); |
87 | PageInfo<BusExchange> pageInfo = new PageInfo<>(busExchangeList); | 87 | PageInfo<BusExchange> pageInfo = new PageInfo<>(busExchangeList); |
@@ -89,12 +89,14 @@ public class BusExchangeServiceImpl implements BusExchangeService { | @@ -89,12 +89,14 @@ public class BusExchangeServiceImpl implements BusExchangeService { | ||
89 | } | 89 | } |
90 | 90 | ||
91 | @Override | 91 | @Override |
92 | - public List<BusExchange> validateBusExchange(BusExchange busExchange) { | 92 | + public List<BusExchange> validateBusExchange(BusExchange busExchange) |
93 | + { | ||
93 | return busExchangeMapper.validateBusExchange(busExchange); | 94 | return busExchangeMapper.validateBusExchange(busExchange); |
94 | } | 95 | } |
95 | 96 | ||
96 | @Override | 97 | @Override |
97 | - public List<BusExchange> getExchangeList(BusExchange busExchange) { | 98 | + public List<BusExchange> getExchangeList(BusExchange busExchange) |
99 | + { | ||
98 | return busExchangeMapper.getExchangeList(busExchange); | 100 | return busExchangeMapper.getExchangeList(busExchange); |
99 | } | 101 | } |
100 | 102 |
@@ -2,17 +2,14 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | @@ -2,17 +2,14 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | ||
2 | 2 | ||
3 | import com.github.pagehelper.PageHelper; | 3 | import com.github.pagehelper.PageHelper; |
4 | import com.github.pagehelper.PageInfo; | 4 | import com.github.pagehelper.PageInfo; |
5 | -import com.sunyo.wlpt.message.bus.service.domain.BusExchange; | ||
6 | -import org.springframework.stereotype.Service; | ||
7 | - | ||
8 | -import javax.annotation.Resource; | ||
9 | - | ||
10 | import com.sunyo.wlpt.message.bus.service.domain.BusQueue; | 5 | import com.sunyo.wlpt.message.bus.service.domain.BusQueue; |
11 | import com.sunyo.wlpt.message.bus.service.mapper.BusQueueMapper; | 6 | import com.sunyo.wlpt.message.bus.service.mapper.BusQueueMapper; |
12 | import com.sunyo.wlpt.message.bus.service.service.BusQueueService; | 7 | import com.sunyo.wlpt.message.bus.service.service.BusQueueService; |
8 | +import org.springframework.stereotype.Service; | ||
13 | import org.springframework.transaction.annotation.Propagation; | 9 | import org.springframework.transaction.annotation.Propagation; |
14 | import org.springframework.transaction.annotation.Transactional; | 10 | import org.springframework.transaction.annotation.Transactional; |
15 | 11 | ||
12 | +import javax.annotation.Resource; | ||
16 | import java.util.List; | 13 | import java.util.List; |
17 | 14 | ||
18 | /** | 15 | /** |
@@ -28,27 +25,23 @@ public class BusQueueServiceImpl implements BusQueueService { | @@ -28,27 +25,23 @@ public class BusQueueServiceImpl implements BusQueueService { | ||
28 | 25 | ||
29 | @Override | 26 | @Override |
30 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) | 27 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
31 | - public int deleteByPrimaryKey(String id) { | 28 | + public int deleteByPrimaryKey(String id) |
29 | + { | ||
32 | // 判断删除的个数,需被删除的个数是否一致 | 30 | // 判断删除的个数,需被删除的个数是否一致 |
33 | int index = 0; | 31 | int index = 0; |
34 | String splitItem = ","; | 32 | String splitItem = ","; |
35 | //如果id,传过来多个,以','分割,即批量删除 | 33 | //如果id,传过来多个,以','分割,即批量删除 |
36 | if (id.contains(splitItem)) { | 34 | if (id.contains(splitItem)) { |
37 | - try { | ||
38 | - String[] split = id.split(splitItem); | ||
39 | - for (int i = 0; i < split.length; i++) { | ||
40 | - int num = busQueueMapper.deleteByPrimaryKey(split[i]); | ||
41 | - if (num > 0) { | ||
42 | - index = index + num; | ||
43 | - } | 35 | + String[] split = id.split(splitItem); |
36 | + for (int i = 0; i < split.length; i++) { | ||
37 | + int num = busQueueMapper.deleteByPrimaryKey(split[i]); | ||
38 | + if (num > 0) { | ||
39 | + index = index + num; | ||
44 | } | 40 | } |
45 | - if (index == split.length) { | ||
46 | - return 1; | ||
47 | - } else { | ||
48 | - return 0; | ||
49 | - } | ||
50 | - } catch (Exception e) { | ||
51 | - e.printStackTrace(); | 41 | + } |
42 | + if (index == split.length) { | ||
43 | + return 1; | ||
44 | + } else { | ||
52 | return 0; | 45 | return 0; |
53 | } | 46 | } |
54 | } else { | 47 | } else { |
@@ -57,32 +50,38 @@ public class BusQueueServiceImpl implements BusQueueService { | @@ -57,32 +50,38 @@ public class BusQueueServiceImpl implements BusQueueService { | ||
57 | } | 50 | } |
58 | 51 | ||
59 | @Override | 52 | @Override |
60 | - public int insert(BusQueue record) { | 53 | + public int insert(BusQueue record) |
54 | + { | ||
61 | return busQueueMapper.insert(record); | 55 | return busQueueMapper.insert(record); |
62 | } | 56 | } |
63 | 57 | ||
64 | @Override | 58 | @Override |
65 | - public int insertSelective(BusQueue record) { | 59 | + public int insertSelective(BusQueue record) |
60 | + { | ||
66 | return busQueueMapper.insertSelective(record); | 61 | return busQueueMapper.insertSelective(record); |
67 | } | 62 | } |
68 | 63 | ||
69 | @Override | 64 | @Override |
70 | - public BusQueue selectByPrimaryKey(String id) { | 65 | + public BusQueue selectByPrimaryKey(String id) |
66 | + { | ||
71 | return busQueueMapper.selectByPrimaryKey(id); | 67 | return busQueueMapper.selectByPrimaryKey(id); |
72 | } | 68 | } |
73 | 69 | ||
74 | @Override | 70 | @Override |
75 | - public int updateByPrimaryKeySelective(BusQueue record) { | 71 | + public int updateByPrimaryKeySelective(BusQueue record) |
72 | + { | ||
76 | return busQueueMapper.updateByPrimaryKeySelective(record); | 73 | return busQueueMapper.updateByPrimaryKeySelective(record); |
77 | } | 74 | } |
78 | 75 | ||
79 | @Override | 76 | @Override |
80 | - public int updateByPrimaryKey(BusQueue record) { | 77 | + public int updateByPrimaryKey(BusQueue record) |
78 | + { | ||
81 | return busQueueMapper.updateByPrimaryKey(record); | 79 | return busQueueMapper.updateByPrimaryKey(record); |
82 | } | 80 | } |
83 | 81 | ||
84 | @Override | 82 | @Override |
85 | - public PageInfo selectBusQueueList(BusQueue busQueue, Integer pageNum, Integer pageSize) { | 83 | + public PageInfo selectBusQueueList(BusQueue busQueue, Integer pageNum, Integer pageSize) |
84 | + { | ||
86 | PageHelper.startPage(pageNum, pageSize); | 85 | PageHelper.startPage(pageNum, pageSize); |
87 | List<BusQueue> busQueueList = busQueueMapper.selectBusQueueList(busQueue); | 86 | List<BusQueue> busQueueList = busQueueMapper.selectBusQueueList(busQueue); |
88 | PageInfo<BusQueue> pageInfo = new PageInfo<>(busQueueList); | 87 | PageInfo<BusQueue> pageInfo = new PageInfo<>(busQueueList); |
@@ -90,12 +89,14 @@ public class BusQueueServiceImpl implements BusQueueService { | @@ -90,12 +89,14 @@ public class BusQueueServiceImpl implements BusQueueService { | ||
90 | } | 89 | } |
91 | 90 | ||
92 | @Override | 91 | @Override |
93 | - public List<BusQueue> validateBusQueue(BusQueue busQueue) { | 92 | + public List<BusQueue> validateBusQueue(BusQueue busQueue) |
93 | + { | ||
94 | return busQueueMapper.validateBusQueue(busQueue); | 94 | return busQueueMapper.validateBusQueue(busQueue); |
95 | } | 95 | } |
96 | 96 | ||
97 | @Override | 97 | @Override |
98 | - public List<BusQueue> getQueueList(BusQueue busQueue) { | 98 | + public List<BusQueue> getQueueList(BusQueue busQueue) |
99 | + { | ||
99 | return busQueueMapper.getQueueList(busQueue); | 100 | return busQueueMapper.getQueueList(busQueue); |
100 | } | 101 | } |
101 | 102 |
@@ -2,16 +2,14 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | @@ -2,16 +2,14 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | ||
2 | 2 | ||
3 | import com.github.pagehelper.PageHelper; | 3 | import com.github.pagehelper.PageHelper; |
4 | import com.github.pagehelper.PageInfo; | 4 | import com.github.pagehelper.PageInfo; |
5 | -import org.springframework.stereotype.Service; | ||
6 | - | ||
7 | -import javax.annotation.Resource; | ||
8 | - | ||
9 | -import com.sunyo.wlpt.message.bus.service.mapper.BusServerMapper; | ||
10 | import com.sunyo.wlpt.message.bus.service.domain.BusServer; | 5 | import com.sunyo.wlpt.message.bus.service.domain.BusServer; |
6 | +import com.sunyo.wlpt.message.bus.service.mapper.BusServerMapper; | ||
11 | import com.sunyo.wlpt.message.bus.service.service.BusServerService; | 7 | import com.sunyo.wlpt.message.bus.service.service.BusServerService; |
8 | +import org.springframework.stereotype.Service; | ||
12 | import org.springframework.transaction.annotation.Propagation; | 9 | import org.springframework.transaction.annotation.Propagation; |
13 | import org.springframework.transaction.annotation.Transactional; | 10 | import org.springframework.transaction.annotation.Transactional; |
14 | 11 | ||
12 | +import javax.annotation.Resource; | ||
15 | import java.util.List; | 13 | import java.util.List; |
16 | 14 | ||
17 | /** | 15 | /** |
@@ -26,7 +24,8 @@ public class BusServerServiceImpl implements BusServerService { | @@ -26,7 +24,8 @@ public class BusServerServiceImpl implements BusServerService { | ||
26 | private BusServerMapper busServerMapper; | 24 | private BusServerMapper busServerMapper; |
27 | 25 | ||
28 | @Override | 26 | @Override |
29 | - public PageInfo selectBusServerList(BusServer busServer, Integer pageNum, Integer pageSize) { | 27 | + public PageInfo selectBusServerList(BusServer busServer, Integer pageNum, Integer pageSize) |
28 | + { | ||
30 | PageHelper.startPage(pageNum, pageSize); | 29 | PageHelper.startPage(pageNum, pageSize); |
31 | List<BusServer> busServerList = busServerMapper.selectBusServerList(busServer); | 30 | List<BusServer> busServerList = busServerMapper.selectBusServerList(busServer); |
32 | PageInfo<BusServer> pageInfo = new PageInfo<>(busServerList); | 31 | PageInfo<BusServer> pageInfo = new PageInfo<>(busServerList); |
@@ -34,34 +33,31 @@ public class BusServerServiceImpl implements BusServerService { | @@ -34,34 +33,31 @@ public class BusServerServiceImpl implements BusServerService { | ||
34 | } | 33 | } |
35 | 34 | ||
36 | @Override | 35 | @Override |
37 | - public List<BusServer> validateServerName(BusServer busServer) { | 36 | + public List<BusServer> validateServerName(BusServer busServer) |
37 | + { | ||
38 | return busServerMapper.validateServerName(busServer); | 38 | return busServerMapper.validateServerName(busServer); |
39 | } | 39 | } |
40 | 40 | ||
41 | 41 | ||
42 | @Override | 42 | @Override |
43 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) | 43 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
44 | - public int deleteByPrimaryKey(String id) { | 44 | + public int deleteByPrimaryKey(String id) |
45 | + { | ||
45 | // 判断删除的个数,需被删除的个数是否一致 | 46 | // 判断删除的个数,需被删除的个数是否一致 |
46 | int index = 0; | 47 | int index = 0; |
47 | String splitItem = ","; | 48 | String splitItem = ","; |
48 | //如果id,传过来多个,以','分割,即批量删除 | 49 | //如果id,传过来多个,以','分割,即批量删除 |
49 | if (id.contains(splitItem)) { | 50 | if (id.contains(splitItem)) { |
50 | - try { | ||
51 | - String[] split = id.split(splitItem); | ||
52 | - for (int i = 0; i < split.length; i++) { | ||
53 | - int num = busServerMapper.deleteByPrimaryKey(split[i]); | ||
54 | - if (num > 0) { | ||
55 | - index = index + num; | ||
56 | - } | 51 | + String[] split = id.split(splitItem); |
52 | + for (int i = 0; i < split.length; i++) { | ||
53 | + int num = busServerMapper.deleteByPrimaryKey(split[i]); | ||
54 | + if (num > 0) { | ||
55 | + index = index + num; | ||
57 | } | 56 | } |
58 | - if (index == split.length) { | ||
59 | - return 1; | ||
60 | - } else { | ||
61 | - return 0; | ||
62 | - } | ||
63 | - } catch (Exception e) { | ||
64 | - e.printStackTrace(); | 57 | + } |
58 | + if (index == split.length) { | ||
59 | + return 1; | ||
60 | + } else { | ||
65 | return 0; | 61 | return 0; |
66 | } | 62 | } |
67 | } else { | 63 | } else { |
@@ -70,47 +66,56 @@ public class BusServerServiceImpl implements BusServerService { | @@ -70,47 +66,56 @@ public class BusServerServiceImpl implements BusServerService { | ||
70 | } | 66 | } |
71 | 67 | ||
72 | @Override | 68 | @Override |
73 | - public int insert(BusServer record) { | 69 | + public int insert(BusServer record) |
70 | + { | ||
74 | return busServerMapper.insert(record); | 71 | return busServerMapper.insert(record); |
75 | } | 72 | } |
76 | 73 | ||
77 | @Override | 74 | @Override |
78 | - public int insertSelective(BusServer record) { | 75 | + public int insertSelective(BusServer record) |
76 | + { | ||
79 | return busServerMapper.insertSelective(record); | 77 | return busServerMapper.insertSelective(record); |
80 | } | 78 | } |
81 | 79 | ||
82 | @Override | 80 | @Override |
83 | - public BusServer selectByPrimaryKey(String id) { | 81 | + public BusServer selectByPrimaryKey(String id) |
82 | + { | ||
84 | return busServerMapper.selectByPrimaryKey(id); | 83 | return busServerMapper.selectByPrimaryKey(id); |
85 | } | 84 | } |
86 | 85 | ||
87 | @Override | 86 | @Override |
88 | - public int updateByPrimaryKeySelective(BusServer record) { | 87 | + public int updateByPrimaryKeySelective(BusServer record) |
88 | + { | ||
89 | return busServerMapper.updateByPrimaryKeySelective(record); | 89 | return busServerMapper.updateByPrimaryKeySelective(record); |
90 | } | 90 | } |
91 | 91 | ||
92 | @Override | 92 | @Override |
93 | - public int updateByPrimaryKey(BusServer record) { | 93 | + public int updateByPrimaryKey(BusServer record) |
94 | + { | ||
94 | return busServerMapper.updateByPrimaryKey(record); | 95 | return busServerMapper.updateByPrimaryKey(record); |
95 | } | 96 | } |
96 | 97 | ||
97 | @Override | 98 | @Override |
98 | - public List<BusServer> validateBusServer(BusServer busServer) { | 99 | + public List<BusServer> validateBusServer(BusServer busServer) |
100 | + { | ||
99 | return busServerMapper.validateBusServer(busServer); | 101 | return busServerMapper.validateBusServer(busServer); |
100 | } | 102 | } |
101 | 103 | ||
102 | @Override | 104 | @Override |
103 | - public List<BusServer> getServerList() { | 105 | + public List<BusServer> getServerList() |
106 | + { | ||
104 | return busServerMapper.getServerList(); | 107 | return busServerMapper.getServerList(); |
105 | } | 108 | } |
106 | 109 | ||
107 | @Override | 110 | @Override |
108 | - public List<BusServer> getServerAndHostList() { | 111 | + public List<BusServer> getServerAndHostList() |
112 | + { | ||
109 | return busServerMapper.getServerAndHostList(); | 113 | return busServerMapper.getServerAndHostList(); |
110 | } | 114 | } |
111 | 115 | ||
112 | @Override | 116 | @Override |
113 | - public List<BusServer> getServerAndHostAndExchangeList() { | 117 | + public List<BusServer> getServerAndHostAndExchangeList() |
118 | + { | ||
114 | return busServerMapper.getServerAndHostAndExchangeList(); | 119 | return busServerMapper.getServerAndHostAndExchangeList(); |
115 | } | 120 | } |
116 | } | 121 | } |
@@ -2,21 +2,16 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | @@ -2,21 +2,16 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | ||
2 | 2 | ||
3 | import com.github.pagehelper.PageHelper; | 3 | import com.github.pagehelper.PageHelper; |
4 | import com.github.pagehelper.PageInfo; | 4 | import com.github.pagehelper.PageInfo; |
5 | -import com.sunyo.wlpt.message.bus.service.domain.BusQueue; | ||
6 | -import org.springframework.stereotype.Service; | ||
7 | - | ||
8 | -import javax.annotation.Resource; | ||
9 | - | ||
10 | -import com.sunyo.wlpt.message.bus.service.mapper.MessageNoteMapper; | ||
11 | import com.sunyo.wlpt.message.bus.service.domain.MessageNote; | 5 | import com.sunyo.wlpt.message.bus.service.domain.MessageNote; |
6 | +import com.sunyo.wlpt.message.bus.service.mapper.MessageNoteMapper; | ||
12 | import com.sunyo.wlpt.message.bus.service.service.MessageNoteService; | 7 | import com.sunyo.wlpt.message.bus.service.service.MessageNoteService; |
8 | +import org.springframework.stereotype.Service; | ||
13 | import org.springframework.transaction.annotation.Propagation; | 9 | import org.springframework.transaction.annotation.Propagation; |
14 | import org.springframework.transaction.annotation.Transactional; | 10 | import org.springframework.transaction.annotation.Transactional; |
15 | 11 | ||
12 | +import javax.annotation.Resource; | ||
16 | import java.util.List; | 13 | import java.util.List; |
17 | 14 | ||
18 | -import static java.util.stream.Collectors.toList; | ||
19 | - | ||
20 | /** | 15 | /** |
21 | * @author 子诚 | 16 | * @author 子诚 |
22 | * Description: | 17 | * Description: |
@@ -30,27 +25,23 @@ public class MessageNoteServiceImpl implements MessageNoteService { | @@ -30,27 +25,23 @@ public class MessageNoteServiceImpl implements MessageNoteService { | ||
30 | 25 | ||
31 | @Override | 26 | @Override |
32 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) | 27 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
33 | - public int deleteByPrimaryKey(String id) { | 28 | + public int deleteByPrimaryKey(String id) |
29 | + { | ||
34 | // 判断删除的个数,需被删除的个数是否一致 | 30 | // 判断删除的个数,需被删除的个数是否一致 |
35 | int index = 0; | 31 | int index = 0; |
36 | String splitItem = ","; | 32 | String splitItem = ","; |
37 | //如果id,传过来多个,以','分割,即批量删除 | 33 | //如果id,传过来多个,以','分割,即批量删除 |
38 | if (id.contains(splitItem)) { | 34 | if (id.contains(splitItem)) { |
39 | - try { | ||
40 | - String[] split = id.split(splitItem); | ||
41 | - for (int i = 0; i < split.length; i++) { | ||
42 | - int num = messageNoteMapper.deleteByPrimaryKey(split[i]); | ||
43 | - if (num > 0) { | ||
44 | - index = index + num; | ||
45 | - } | 35 | + String[] split = id.split(splitItem); |
36 | + for (int i = 0; i < split.length; i++) { | ||
37 | + int num = messageNoteMapper.deleteByPrimaryKey(split[i]); | ||
38 | + if (num > 0) { | ||
39 | + index = index + num; | ||
46 | } | 40 | } |
47 | - if (index == split.length) { | ||
48 | - return 1; | ||
49 | - } else { | ||
50 | - return 0; | ||
51 | - } | ||
52 | - } catch (Exception e) { | ||
53 | - e.printStackTrace(); | 41 | + } |
42 | + if (index == split.length) { | ||
43 | + return 1; | ||
44 | + } else { | ||
54 | return 0; | 45 | return 0; |
55 | } | 46 | } |
56 | } else { | 47 | } else { |
@@ -59,32 +50,38 @@ public class MessageNoteServiceImpl implements MessageNoteService { | @@ -59,32 +50,38 @@ public class MessageNoteServiceImpl implements MessageNoteService { | ||
59 | } | 50 | } |
60 | 51 | ||
61 | @Override | 52 | @Override |
62 | - public int insert(MessageNote record) { | 53 | + public int insert(MessageNote record) |
54 | + { | ||
63 | return messageNoteMapper.insert(record); | 55 | return messageNoteMapper.insert(record); |
64 | } | 56 | } |
65 | 57 | ||
66 | @Override | 58 | @Override |
67 | - public int insertSelective(MessageNote record) { | 59 | + public int insertSelective(MessageNote record) |
60 | + { | ||
68 | return messageNoteMapper.insertSelective(record); | 61 | return messageNoteMapper.insertSelective(record); |
69 | } | 62 | } |
70 | 63 | ||
71 | @Override | 64 | @Override |
72 | - public MessageNote selectByPrimaryKey(String id) { | 65 | + public MessageNote selectByPrimaryKey(String id) |
66 | + { | ||
73 | return messageNoteMapper.selectByPrimaryKey(id); | 67 | return messageNoteMapper.selectByPrimaryKey(id); |
74 | } | 68 | } |
75 | 69 | ||
76 | @Override | 70 | @Override |
77 | - public int updateByPrimaryKeySelective(MessageNote record) { | 71 | + public int updateByPrimaryKeySelective(MessageNote record) |
72 | + { | ||
78 | return messageNoteMapper.updateByPrimaryKeySelective(record); | 73 | return messageNoteMapper.updateByPrimaryKeySelective(record); |
79 | } | 74 | } |
80 | 75 | ||
81 | @Override | 76 | @Override |
82 | - public int updateByPrimaryKey(MessageNote record) { | 77 | + public int updateByPrimaryKey(MessageNote record) |
78 | + { | ||
83 | return messageNoteMapper.updateByPrimaryKey(record); | 79 | return messageNoteMapper.updateByPrimaryKey(record); |
84 | } | 80 | } |
85 | 81 | ||
86 | @Override | 82 | @Override |
87 | - public PageInfo selectMessageNoteList(MessageNote messageNote, Integer pageNum, Integer pageSize) { | 83 | + public PageInfo selectMessageNoteList(MessageNote messageNote, Integer pageNum, Integer pageSize) |
84 | + { | ||
88 | PageHelper.startPage(pageNum, pageSize); | 85 | PageHelper.startPage(pageNum, pageSize); |
89 | List<MessageNote> messageNoteList = messageNoteMapper.selectMessageNoteList(messageNote); | 86 | List<MessageNote> messageNoteList = messageNoteMapper.selectMessageNoteList(messageNote); |
90 | // 使用stream 并行将 byte[] 转换成 String | 87 | // 使用stream 并行将 byte[] 转换成 String |
@@ -97,7 +94,8 @@ public class MessageNoteServiceImpl implements MessageNoteService { | @@ -97,7 +94,8 @@ public class MessageNoteServiceImpl implements MessageNoteService { | ||
97 | } | 94 | } |
98 | 95 | ||
99 | @Override | 96 | @Override |
100 | - public void autoDelete(Integer deleteTime) { | 97 | + public void autoDelete(Integer deleteTime) |
98 | + { | ||
101 | messageNoteMapper.autoDelete(deleteTime); | 99 | messageNoteMapper.autoDelete(deleteTime); |
102 | } | 100 | } |
103 | 101 |
@@ -2,17 +2,14 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | @@ -2,17 +2,14 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | ||
2 | 2 | ||
3 | import com.github.pagehelper.PageHelper; | 3 | import com.github.pagehelper.PageHelper; |
4 | import com.github.pagehelper.PageInfo; | 4 | import com.github.pagehelper.PageInfo; |
5 | -import com.sunyo.wlpt.message.bus.service.domain.BusServer; | ||
6 | -import org.springframework.stereotype.Service; | ||
7 | - | ||
8 | -import javax.annotation.Resource; | ||
9 | - | ||
10 | -import com.sunyo.wlpt.message.bus.service.mapper.RoutingKeyMapper; | ||
11 | import com.sunyo.wlpt.message.bus.service.domain.RoutingKey; | 5 | import com.sunyo.wlpt.message.bus.service.domain.RoutingKey; |
6 | +import com.sunyo.wlpt.message.bus.service.mapper.RoutingKeyMapper; | ||
12 | import com.sunyo.wlpt.message.bus.service.service.RoutingKeyService; | 7 | import com.sunyo.wlpt.message.bus.service.service.RoutingKeyService; |
8 | +import org.springframework.stereotype.Service; | ||
13 | import org.springframework.transaction.annotation.Propagation; | 9 | import org.springframework.transaction.annotation.Propagation; |
14 | import org.springframework.transaction.annotation.Transactional; | 10 | import org.springframework.transaction.annotation.Transactional; |
15 | 11 | ||
12 | +import javax.annotation.Resource; | ||
16 | import java.util.List; | 13 | import java.util.List; |
17 | 14 | ||
18 | /** | 15 | /** |
@@ -28,27 +25,23 @@ public class RoutingKeyServiceImpl implements RoutingKeyService { | @@ -28,27 +25,23 @@ public class RoutingKeyServiceImpl implements RoutingKeyService { | ||
28 | 25 | ||
29 | @Override | 26 | @Override |
30 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) | 27 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
31 | - public int deleteByPrimaryKey(String id) { | 28 | + public int deleteByPrimaryKey(String id) |
29 | + { | ||
32 | // 判断删除的个数,需被删除的个数是否一致 | 30 | // 判断删除的个数,需被删除的个数是否一致 |
33 | int index = 0; | 31 | int index = 0; |
34 | String splitItem = ","; | 32 | String splitItem = ","; |
35 | //如果id,传过来多个,以','分割,即批量删除 | 33 | //如果id,传过来多个,以','分割,即批量删除 |
36 | if (id.contains(splitItem)) { | 34 | if (id.contains(splitItem)) { |
37 | - try { | ||
38 | - String[] split = id.split(splitItem); | ||
39 | - for (int i = 0; i < split.length; i++) { | ||
40 | - int num = routingKeyMapper.deleteByPrimaryKey(split[i]); | ||
41 | - if (num > 0) { | ||
42 | - index = index + num; | ||
43 | - } | 35 | + String[] split = id.split(splitItem); |
36 | + for (int i = 0; i < split.length; i++) { | ||
37 | + int num = routingKeyMapper.deleteByPrimaryKey(split[i]); | ||
38 | + if (num > 0) { | ||
39 | + index = index + num; | ||
44 | } | 40 | } |
45 | - if (index == split.length) { | ||
46 | - return 1; | ||
47 | - } else { | ||
48 | - return 0; | ||
49 | - } | ||
50 | - } catch (Exception e) { | ||
51 | - e.printStackTrace(); | 41 | + } |
42 | + if (index == split.length) { | ||
43 | + return 1; | ||
44 | + } else { | ||
52 | return 0; | 45 | return 0; |
53 | } | 46 | } |
54 | } else { | 47 | } else { |
@@ -57,32 +50,38 @@ public class RoutingKeyServiceImpl implements RoutingKeyService { | @@ -57,32 +50,38 @@ public class RoutingKeyServiceImpl implements RoutingKeyService { | ||
57 | } | 50 | } |
58 | 51 | ||
59 | @Override | 52 | @Override |
60 | - public int insert(RoutingKey record) { | 53 | + public int insert(RoutingKey record) |
54 | + { | ||
61 | return routingKeyMapper.insert(record); | 55 | return routingKeyMapper.insert(record); |
62 | } | 56 | } |
63 | 57 | ||
64 | @Override | 58 | @Override |
65 | - public int insertSelective(RoutingKey record) { | 59 | + public int insertSelective(RoutingKey record) |
60 | + { | ||
66 | return routingKeyMapper.insertSelective(record); | 61 | return routingKeyMapper.insertSelective(record); |
67 | } | 62 | } |
68 | 63 | ||
69 | @Override | 64 | @Override |
70 | - public RoutingKey selectByPrimaryKey(String id) { | 65 | + public RoutingKey selectByPrimaryKey(String id) |
66 | + { | ||
71 | return routingKeyMapper.selectByPrimaryKey(id); | 67 | return routingKeyMapper.selectByPrimaryKey(id); |
72 | } | 68 | } |
73 | 69 | ||
74 | @Override | 70 | @Override |
75 | - public int updateByPrimaryKeySelective(RoutingKey record) { | 71 | + public int updateByPrimaryKeySelective(RoutingKey record) |
72 | + { | ||
76 | return routingKeyMapper.updateByPrimaryKeySelective(record); | 73 | return routingKeyMapper.updateByPrimaryKeySelective(record); |
77 | } | 74 | } |
78 | 75 | ||
79 | @Override | 76 | @Override |
80 | - public int updateByPrimaryKey(RoutingKey record) { | 77 | + public int updateByPrimaryKey(RoutingKey record) |
78 | + { | ||
81 | return routingKeyMapper.updateByPrimaryKey(record); | 79 | return routingKeyMapper.updateByPrimaryKey(record); |
82 | } | 80 | } |
83 | 81 | ||
84 | @Override | 82 | @Override |
85 | - public PageInfo selectRoutingKeyList(RoutingKey routingKey, Integer pageNum, Integer pageSize) { | 83 | + public PageInfo selectRoutingKeyList(RoutingKey routingKey, Integer pageNum, Integer pageSize) |
84 | + { | ||
86 | PageHelper.startPage(pageNum, pageSize); | 85 | PageHelper.startPage(pageNum, pageSize); |
87 | List<RoutingKey> routingKeyList = routingKeyMapper.selectRoutingKeyList(routingKey); | 86 | List<RoutingKey> routingKeyList = routingKeyMapper.selectRoutingKeyList(routingKey); |
88 | PageInfo<RoutingKey> pageInfo = new PageInfo<>(routingKeyList); | 87 | PageInfo<RoutingKey> pageInfo = new PageInfo<>(routingKeyList); |
@@ -90,12 +89,14 @@ public class RoutingKeyServiceImpl implements RoutingKeyService { | @@ -90,12 +89,14 @@ public class RoutingKeyServiceImpl implements RoutingKeyService { | ||
90 | } | 89 | } |
91 | 90 | ||
92 | @Override | 91 | @Override |
93 | - public List<RoutingKey> validateRoutingKey(RoutingKey routingKey) { | 92 | + public List<RoutingKey> validateRoutingKey(RoutingKey routingKey) |
93 | + { | ||
94 | return routingKeyMapper.validateRoutingKey(routingKey); | 94 | return routingKeyMapper.validateRoutingKey(routingKey); |
95 | } | 95 | } |
96 | 96 | ||
97 | @Override | 97 | @Override |
98 | - public List<RoutingKey> getRoutingKeyList(RoutingKey routingKey) { | 98 | + public List<RoutingKey> getRoutingKeyList(RoutingKey routingKey) |
99 | + { | ||
99 | return routingKeyMapper.getRoutingKeyList(routingKey); | 100 | return routingKeyMapper.getRoutingKeyList(routingKey); |
100 | } | 101 | } |
101 | 102 |
@@ -2,16 +2,15 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | @@ -2,16 +2,15 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | ||
2 | 2 | ||
3 | import com.github.pagehelper.PageHelper; | 3 | import com.github.pagehelper.PageHelper; |
4 | import com.github.pagehelper.PageInfo; | 4 | import com.github.pagehelper.PageInfo; |
5 | -import org.springframework.stereotype.Service; | ||
6 | - | ||
7 | -import javax.annotation.Resource; | ||
8 | - | ||
9 | -import com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding; | 5 | +import com.sunyo.wlpt.message.bus.service.domain.*; |
10 | import com.sunyo.wlpt.message.bus.service.mapper.UserMessageBindingMapper; | 6 | import com.sunyo.wlpt.message.bus.service.mapper.UserMessageBindingMapper; |
11 | -import com.sunyo.wlpt.message.bus.service.service.UserMessageBindingService; | 7 | +import com.sunyo.wlpt.message.bus.service.service.*; |
8 | +import com.sunyo.wlpt.message.bus.service.utils.IdUtils; | ||
9 | +import org.springframework.stereotype.Service; | ||
12 | import org.springframework.transaction.annotation.Propagation; | 10 | import org.springframework.transaction.annotation.Propagation; |
13 | import org.springframework.transaction.annotation.Transactional; | 11 | import org.springframework.transaction.annotation.Transactional; |
14 | 12 | ||
13 | +import javax.annotation.Resource; | ||
15 | import java.util.List; | 14 | import java.util.List; |
16 | 15 | ||
17 | /** | 16 | /** |
@@ -23,11 +22,27 @@ import java.util.List; | @@ -23,11 +22,27 @@ import java.util.List; | ||
23 | public class UserMessageBindingServiceImpl implements UserMessageBindingService { | 22 | public class UserMessageBindingServiceImpl implements UserMessageBindingService { |
24 | 23 | ||
25 | @Resource | 24 | @Resource |
25 | + private BusServerService busServerService; | ||
26 | + | ||
27 | + @Resource | ||
28 | + private VirtualHostService virtualHostService; | ||
29 | + | ||
30 | + @Resource | ||
31 | + private BusExchangeService busExchangeService; | ||
32 | + | ||
33 | + @Resource | ||
34 | + private BusQueueService busQueueService; | ||
35 | + | ||
36 | + @Resource | ||
37 | + private RoutingKeyService routingKeyService; | ||
38 | + | ||
39 | + @Resource | ||
26 | private UserMessageBindingMapper userMessageBindingMapper; | 40 | private UserMessageBindingMapper userMessageBindingMapper; |
27 | 41 | ||
28 | @Override | 42 | @Override |
29 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) | 43 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
30 | - public int deleteByPrimaryKey(String id) { | 44 | + public int deleteByPrimaryKey(String id) |
45 | + { | ||
31 | // 判断删除的个数,需被删除的个数是否一致 | 46 | // 判断删除的个数,需被删除的个数是否一致 |
32 | int index = 0; | 47 | int index = 0; |
33 | String splitItem = ","; | 48 | String splitItem = ","; |
@@ -56,38 +71,94 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -56,38 +71,94 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
56 | } | 71 | } |
57 | 72 | ||
58 | @Override | 73 | @Override |
59 | - public int insert(UserMessageBinding record) { | 74 | + public int insert(UserMessageBinding record) |
75 | + { | ||
60 | return userMessageBindingMapper.insert(record); | 76 | return userMessageBindingMapper.insert(record); |
61 | } | 77 | } |
62 | 78 | ||
63 | @Override | 79 | @Override |
64 | - public int insertSelective(UserMessageBinding record) { | ||
65 | - return userMessageBindingMapper.insertSelective(record); | 80 | + @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
81 | + public int insertSelective(UserMessageBinding userMessageBinding) | ||
82 | + { | ||
83 | + int index = 0; | ||
84 | + String queueId = userMessageBinding.getQueueId(); | ||
85 | + String splitItem = ","; | ||
86 | + if (queueId.contains(splitItem)) { | ||
87 | + String[] split = queueId.split(splitItem); | ||
88 | + for (int i = 0; i < split.length; i++) { | ||
89 | + // 设置id | ||
90 | + userMessageBinding.setId(IdUtils.generateId()); | ||
91 | + userMessageBinding.setQueueId(split[i]); | ||
92 | + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | ||
93 | + if (num > 0) { | ||
94 | + index = index + num; | ||
95 | + } | ||
96 | + } | ||
97 | + if (index == split.length) { | ||
98 | + return 1; | ||
99 | + } else { | ||
100 | + return 0; | ||
101 | + } | ||
102 | + } | ||
103 | + return userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | ||
66 | } | 104 | } |
67 | 105 | ||
68 | @Override | 106 | @Override |
69 | - public UserMessageBinding selectByPrimaryKey(String id) { | 107 | + public UserMessageBinding selectByPrimaryKey(String id) |
108 | + { | ||
70 | return userMessageBindingMapper.selectByPrimaryKey(id); | 109 | return userMessageBindingMapper.selectByPrimaryKey(id); |
71 | } | 110 | } |
72 | 111 | ||
73 | @Override | 112 | @Override |
74 | - public int updateByPrimaryKeySelective(UserMessageBinding record) { | ||
75 | - return userMessageBindingMapper.updateByPrimaryKeySelective(record); | 113 | + public int updateByPrimaryKeySelective(UserMessageBinding userMessageBinding) |
114 | + { | ||
115 | + return userMessageBindingMapper.updateByPrimaryKeySelective(umb_fillName(userMessageBinding)); | ||
76 | } | 116 | } |
77 | 117 | ||
78 | @Override | 118 | @Override |
79 | - public int updateByPrimaryKey(UserMessageBinding record) { | 119 | + public int updateByPrimaryKey(UserMessageBinding record) |
120 | + { | ||
80 | return userMessageBindingMapper.updateByPrimaryKey(record); | 121 | return userMessageBindingMapper.updateByPrimaryKey(record); |
81 | } | 122 | } |
82 | 123 | ||
83 | @Override | 124 | @Override |
84 | - public PageInfo selectUserMessageBindingList(UserMessageBinding userMessageBinding, Integer pageNum, Integer pageSize) { | 125 | + public PageInfo selectUserMessageBindingList(UserMessageBinding userMessageBinding, Integer pageNum, Integer pageSize) |
126 | + { | ||
85 | PageHelper.startPage(pageNum, pageSize); | 127 | PageHelper.startPage(pageNum, pageSize); |
86 | List<UserMessageBinding> userMessageBindingList = userMessageBindingMapper.selectUserMessageBindingList(userMessageBinding); | 128 | List<UserMessageBinding> userMessageBindingList = userMessageBindingMapper.selectUserMessageBindingList(userMessageBinding); |
87 | PageInfo<UserMessageBinding> pageInfo = new PageInfo<>(userMessageBindingList); | 129 | PageInfo<UserMessageBinding> pageInfo = new PageInfo<>(userMessageBindingList); |
88 | return pageInfo; | 130 | return pageInfo; |
89 | } | 131 | } |
90 | 132 | ||
133 | + /** | ||
134 | + * 编辑 or 新增方法,根绝前端传递来的id值,来填充对应的name | ||
135 | + * 服务器id,虚拟主机id,交换机id,队列id,路由键id | ||
136 | + */ | ||
137 | + public UserMessageBinding umb_fillName(UserMessageBinding userMessageBinding) | ||
138 | + { | ||
139 | + // 填充,服务器名称 | ||
140 | + BusServer busServer = busServerService.selectByPrimaryKey(userMessageBinding.getServerId()); | ||
141 | + userMessageBinding.setServerName(busServer.getServerName()); | ||
142 | + | ||
143 | + // 填充,虚拟主机名称 | ||
144 | + VirtualHost virtualHost = virtualHostService.selectByPrimaryKey(userMessageBinding.getVirtualHostId()); | ||
145 | + userMessageBinding.setVirtualHostName(virtualHost.getVirtualHostName()); | ||
146 | + | ||
147 | + // 填充,交换机名称 | ||
148 | + BusExchange busExchange = busExchangeService.selectByPrimaryKey(userMessageBinding.getExchangeId()); | ||
149 | + userMessageBinding.setExchangeName(busExchange.getExchangeName()); | ||
150 | + | ||
151 | + // 填充,队列名称 | ||
152 | + BusQueue busQueue = busQueueService.selectByPrimaryKey(userMessageBinding.getQueueId()); | ||
153 | + userMessageBinding.setQueueName(busQueue.getQueueName()); | ||
154 | + | ||
155 | + // 填充,路由键名称 | ||
156 | + RoutingKey routingKey = routingKeyService.selectByPrimaryKey(userMessageBinding.getRoutingKeyId()); | ||
157 | + userMessageBinding.setRoutingKeyName(routingKey.getRoutingKeyName()); | ||
158 | + | ||
159 | + return userMessageBinding; | ||
160 | + } | ||
161 | + | ||
91 | } | 162 | } |
92 | 163 | ||
93 | 164 |
@@ -2,17 +2,14 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | @@ -2,17 +2,14 @@ package com.sunyo.wlpt.message.bus.service.service.impl; | ||
2 | 2 | ||
3 | import com.github.pagehelper.PageHelper; | 3 | import com.github.pagehelper.PageHelper; |
4 | import com.github.pagehelper.PageInfo; | 4 | import com.github.pagehelper.PageInfo; |
5 | -import com.sunyo.wlpt.message.bus.service.domain.BusServer; | ||
6 | -import org.springframework.stereotype.Service; | ||
7 | - | ||
8 | -import javax.annotation.Resource; | ||
9 | - | ||
10 | -import com.sunyo.wlpt.message.bus.service.mapper.VirtualHostMapper; | ||
11 | import com.sunyo.wlpt.message.bus.service.domain.VirtualHost; | 5 | import com.sunyo.wlpt.message.bus.service.domain.VirtualHost; |
6 | +import com.sunyo.wlpt.message.bus.service.mapper.VirtualHostMapper; | ||
12 | import com.sunyo.wlpt.message.bus.service.service.VirtualHostService; | 7 | import com.sunyo.wlpt.message.bus.service.service.VirtualHostService; |
8 | +import org.springframework.stereotype.Service; | ||
13 | import org.springframework.transaction.annotation.Propagation; | 9 | import org.springframework.transaction.annotation.Propagation; |
14 | import org.springframework.transaction.annotation.Transactional; | 10 | import org.springframework.transaction.annotation.Transactional; |
15 | 11 | ||
12 | +import javax.annotation.Resource; | ||
16 | import java.util.List; | 13 | import java.util.List; |
17 | 14 | ||
18 | /** | 15 | /** |
@@ -28,29 +25,26 @@ public class VirtualHostServiceImpl implements VirtualHostService { | @@ -28,29 +25,26 @@ public class VirtualHostServiceImpl implements VirtualHostService { | ||
28 | 25 | ||
29 | @Override | 26 | @Override |
30 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) | 27 | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) |
31 | - public int deleteByPrimaryKey(String id) { | 28 | + public int deleteByPrimaryKey(String id) |
29 | + { | ||
32 | // 判断删除的个数,需被删除的个数是否一致 | 30 | // 判断删除的个数,需被删除的个数是否一致 |
33 | int index = 0; | 31 | int index = 0; |
34 | String splitItem = ","; | 32 | String splitItem = ","; |
35 | //如果id,传过来多个,以','分割,即批量删除 | 33 | //如果id,传过来多个,以','分割,即批量删除 |
36 | if (id.contains(splitItem)) { | 34 | if (id.contains(splitItem)) { |
37 | - try { | ||
38 | - String[] split = id.split(splitItem); | ||
39 | - for (int i = 0; i < split.length; i++) { | ||
40 | - int num = virtualHostMapper.deleteByPrimaryKey(split[i]); | ||
41 | - if (num > 0) { | ||
42 | - index = index + num; | ||
43 | - } | ||
44 | - } | ||
45 | - if (index == split.length) { | ||
46 | - return 1; | ||
47 | - } else { | ||
48 | - return 0; | 35 | + String[] split = id.split(splitItem); |
36 | + for (int i = 0; i < split.length; i++) { | ||
37 | + int num = virtualHostMapper.deleteByPrimaryKey(split[i]); | ||
38 | + if (num > 0) { | ||
39 | + index = index + num; | ||
49 | } | 40 | } |
50 | - } catch (Exception e) { | ||
51 | - e.printStackTrace(); | 41 | + } |
42 | + if (index == split.length) { | ||
43 | + return 1; | ||
44 | + } else { | ||
52 | return 0; | 45 | return 0; |
53 | } | 46 | } |
47 | + | ||
54 | } else { | 48 | } else { |
55 | return virtualHostMapper.deleteByPrimaryKey(id); | 49 | return virtualHostMapper.deleteByPrimaryKey(id); |
56 | } | 50 | } |
@@ -58,32 +52,38 @@ public class VirtualHostServiceImpl implements VirtualHostService { | @@ -58,32 +52,38 @@ public class VirtualHostServiceImpl implements VirtualHostService { | ||
58 | } | 52 | } |
59 | 53 | ||
60 | @Override | 54 | @Override |
61 | - public int insert(VirtualHost record) { | 55 | + public int insert(VirtualHost record) |
56 | + { | ||
62 | return virtualHostMapper.insert(record); | 57 | return virtualHostMapper.insert(record); |
63 | } | 58 | } |
64 | 59 | ||
65 | @Override | 60 | @Override |
66 | - public int insertSelective(VirtualHost record) { | 61 | + public int insertSelective(VirtualHost record) |
62 | + { | ||
67 | return virtualHostMapper.insertSelective(record); | 63 | return virtualHostMapper.insertSelective(record); |
68 | } | 64 | } |
69 | 65 | ||
70 | @Override | 66 | @Override |
71 | - public VirtualHost selectByPrimaryKey(String id) { | 67 | + public VirtualHost selectByPrimaryKey(String id) |
68 | + { | ||
72 | return virtualHostMapper.selectByPrimaryKey(id); | 69 | return virtualHostMapper.selectByPrimaryKey(id); |
73 | } | 70 | } |
74 | 71 | ||
75 | @Override | 72 | @Override |
76 | - public int updateByPrimaryKeySelective(VirtualHost record) { | 73 | + public int updateByPrimaryKeySelective(VirtualHost record) |
74 | + { | ||
77 | return virtualHostMapper.updateByPrimaryKeySelective(record); | 75 | return virtualHostMapper.updateByPrimaryKeySelective(record); |
78 | } | 76 | } |
79 | 77 | ||
80 | @Override | 78 | @Override |
81 | - public int updateByPrimaryKey(VirtualHost record) { | 79 | + public int updateByPrimaryKey(VirtualHost record) |
80 | + { | ||
82 | return virtualHostMapper.updateByPrimaryKey(record); | 81 | return virtualHostMapper.updateByPrimaryKey(record); |
83 | } | 82 | } |
84 | 83 | ||
85 | @Override | 84 | @Override |
86 | - public PageInfo selectVirtualHostList(VirtualHost virtualHost, Integer pageNum, Integer pageSize) { | 85 | + public PageInfo selectVirtualHostList(VirtualHost virtualHost, Integer pageNum, Integer pageSize) |
86 | + { | ||
87 | PageHelper.startPage(pageNum, pageSize); | 87 | PageHelper.startPage(pageNum, pageSize); |
88 | List<VirtualHost> virtualHostList = virtualHostMapper.selectVirtualHostList(virtualHost); | 88 | List<VirtualHost> virtualHostList = virtualHostMapper.selectVirtualHostList(virtualHost); |
89 | PageInfo<VirtualHost> pageInfo = new PageInfo<>(virtualHostList); | 89 | PageInfo<VirtualHost> pageInfo = new PageInfo<>(virtualHostList); |
@@ -91,12 +91,14 @@ public class VirtualHostServiceImpl implements VirtualHostService { | @@ -91,12 +91,14 @@ public class VirtualHostServiceImpl implements VirtualHostService { | ||
91 | } | 91 | } |
92 | 92 | ||
93 | @Override | 93 | @Override |
94 | - public List<VirtualHost> validateVirtualHost(VirtualHost virtualHost) { | 94 | + public List<VirtualHost> validateVirtualHost(VirtualHost virtualHost) |
95 | + { | ||
95 | return virtualHostMapper.validateVirtualHost(virtualHost); | 96 | return virtualHostMapper.validateVirtualHost(virtualHost); |
96 | } | 97 | } |
97 | 98 | ||
98 | @Override | 99 | @Override |
99 | - public List<VirtualHost> getVirtualHostList(VirtualHost virtualHost) { | 100 | + public List<VirtualHost> getVirtualHostList(VirtualHost virtualHost) |
101 | + { | ||
100 | return virtualHostMapper.getVirtualHostList(virtualHost); | 102 | return virtualHostMapper.getVirtualHostList(virtualHost); |
101 | } | 103 | } |
102 | 104 |
-
请 注册 或 登录 后发表评论