Showing
6 changed files
with
17 additions
and
12 deletions
@@ -37,9 +37,9 @@ public class HostGroupCtrl { | @@ -37,9 +37,9 @@ public class HostGroupCtrl { | ||
37 | 37 | ||
38 | @RequestMapping("/getAllGroups") | 38 | @RequestMapping("/getAllGroups") |
39 | @ResponseBody | 39 | @ResponseBody |
40 | - public BaseResponse getAllGroups(String tagType) { | 40 | + public BaseResponse getAllGroups(@RequestBody TagReq request) { |
41 | try{ | 41 | try{ |
42 | - List<HostGroup> list=hostGroupService.getAllGroups(tagType); | 42 | + List<HostGroup> list=hostGroupService.getAllGroups(request.getTagTypeContent(),request.getSearchContent()); |
43 | 43 | ||
44 | if (list == null || CollectionUtils.isEmpty(list)) { | 44 | if (list == null || CollectionUtils.isEmpty(list)) { |
45 | return new BaseResponse<List<HostGroup>>(); | 45 | return new BaseResponse<List<HostGroup>>(); |
@@ -58,7 +58,7 @@ public class HostGroupCtrl { | @@ -58,7 +58,7 @@ public class HostGroupCtrl { | ||
58 | @ResponseBody | 58 | @ResponseBody |
59 | public BaseResponse getAllTagsGroupByType() { | 59 | public BaseResponse getAllTagsGroupByType() { |
60 | try{ | 60 | try{ |
61 | - List<HostGroup> list=hostGroupService.getAllGroups(""); | 61 | + List<HostGroup> list=hostGroupService.getAllGroups("",""); |
62 | 62 | ||
63 | Map<String,List<HostGroup>> map= new HashMap<String,List<HostGroup>>(); | 63 | Map<String,List<HostGroup>> map= new HashMap<String,List<HostGroup>>(); |
64 | if(list!=null&&list.size()>0){ | 64 | if(list!=null&&list.size()>0){ |
@@ -76,7 +76,7 @@ public class MObjectInfoCtrl { | @@ -76,7 +76,7 @@ public class MObjectInfoCtrl { | ||
76 | 76 | ||
77 | String selectTag = ""; | 77 | String selectTag = ""; |
78 | 78 | ||
79 | - List<HostGroup> sourceGroupList = groupService.getAllGroups(""); | 79 | + List<HostGroup> sourceGroupList = groupService.getAllGroups("",""); |
80 | 80 | ||
81 | //add blank tag | 81 | //add blank tag |
82 | 82 |
@@ -21,6 +21,6 @@ public interface IHostGroupService { | @@ -21,6 +21,6 @@ public interface IHostGroupService { | ||
21 | 21 | ||
22 | BaseResponse<HostGroup> getHostGroupById(int id); | 22 | BaseResponse<HostGroup> getHostGroupById(int id); |
23 | 23 | ||
24 | - List<HostGroup> getAllGroups(String tagType); | 24 | + List<HostGroup> getAllGroups(String tagType,String searchContent); |
25 | 25 | ||
26 | } | 26 | } |
@@ -93,7 +93,7 @@ public class HostGroupServiceImpl implements IHostGroupService { | @@ -93,7 +93,7 @@ public class HostGroupServiceImpl implements IHostGroupService { | ||
93 | } | 93 | } |
94 | 94 | ||
95 | @Override | 95 | @Override |
96 | - public List<HostGroup> getAllGroups(String tagType) { | ||
97 | - return hostGroupMapper.selectAllGroups(tagType); | 96 | + public List<HostGroup> getAllGroups(String tagType,String searchContent) { |
97 | + return hostGroupMapper.selectAllGroups(tagType,searchContent); | ||
98 | } | 98 | } |
99 | } | 99 | } |
@@ -23,6 +23,6 @@ public interface HostGroupMapper { | @@ -23,6 +23,6 @@ public interface HostGroupMapper { | ||
23 | 23 | ||
24 | List<HostGroup> selectHostGroups(PageBean page); | 24 | List<HostGroup> selectHostGroups(PageBean page); |
25 | 25 | ||
26 | - List<HostGroup> selectAllGroups(@Param("tagType") String tagType); | 26 | + List<HostGroup> selectAllGroups(@Param("tagTypeContent") String tagTypeContent,@Param("searchContent") String searchContent); |
27 | 27 | ||
28 | } | 28 | } |
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> | 11 | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
12 | </resultMap> | 12 | </resultMap> |
13 | <sql id="Base_Column_List" > | 13 | <sql id="Base_Column_List" > |
14 | - id, group_name,tag_type,descr, create_time, update_time | 14 | + id, group_name,tag_type,descr, create_time, update_time,pid |
15 | </sql> | 15 | </sql> |
16 | 16 | ||
17 | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > | 17 | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > |
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | update host_group | 37 | update host_group |
38 | set group_name = #{groupName,jdbcType=VARCHAR}, | 38 | set group_name = #{groupName,jdbcType=VARCHAR}, |
39 | descr = #{descr,jdbcType=VARCHAR}, | 39 | descr = #{descr,jdbcType=VARCHAR}, |
40 | - pid = #{descr,jdbcType=INTEGER}, | 40 | + pid = #{pid,jdbcType=INTEGER}, |
41 | tag_type = #{tagType,jdbcType=VARCHAR}, | 41 | tag_type = #{tagType,jdbcType=VARCHAR}, |
42 | update_time = now() | 42 | update_time = now() |
43 | where id = #{id,jdbcType=INTEGER} | 43 | where id = #{id,jdbcType=INTEGER} |
@@ -65,8 +65,13 @@ | @@ -65,8 +65,13 @@ | ||
65 | <include refid="Base_Column_List" /> | 65 | <include refid="Base_Column_List" /> |
66 | from host_group | 66 | from host_group |
67 | where 1=1 | 67 | where 1=1 |
68 | - <if test="tagType!=null && tagType != ''"> | ||
69 | - and tag_type = #{tagType,jdbcType=VARCHAR} | 68 | + <if test="searchContent!=null && searchContent != ''"> |
69 | + and (group_name like CONCAT('%',#{searchContent,jdbcType=VARCHAR},'%') | ||
70 | + or | ||
71 | + descr like CONCAT('%',#{searchContent,jdbcType=VARCHAR},'%')) | ||
72 | + </if> | ||
73 | + <if test="tagTypeContent!=null && tagTypeContent != ''"> | ||
74 | + and tag_type = #{tagTypeContent,jdbcType=VARCHAR} | ||
70 | </if> | 75 | </if> |
71 | </select> | 76 | </select> |
72 | 77 |
-
Please register or login to post a comment