Authored by qinchao

主机管理

... ... @@ -37,9 +37,9 @@ public class HostGroupCtrl {
@RequestMapping("/getAllGroups")
@ResponseBody
public BaseResponse getAllGroups(String tagType) {
public BaseResponse getAllGroups(@RequestBody TagReq request) {
try{
List<HostGroup> list=hostGroupService.getAllGroups(tagType);
List<HostGroup> list=hostGroupService.getAllGroups(request.getTagTypeContent(),request.getSearchContent());
if (list == null || CollectionUtils.isEmpty(list)) {
return new BaseResponse<List<HostGroup>>();
... ... @@ -58,7 +58,7 @@ public class HostGroupCtrl {
@ResponseBody
public BaseResponse getAllTagsGroupByType() {
try{
List<HostGroup> list=hostGroupService.getAllGroups("");
List<HostGroup> list=hostGroupService.getAllGroups("","");
Map<String,List<HostGroup>> map= new HashMap<String,List<HostGroup>>();
if(list!=null&&list.size()>0){
... ...
... ... @@ -76,7 +76,7 @@ public class MObjectInfoCtrl {
String selectTag = "";
List<HostGroup> sourceGroupList = groupService.getAllGroups("");
List<HostGroup> sourceGroupList = groupService.getAllGroups("","");
//add blank tag
... ...
... ... @@ -21,6 +21,6 @@ public interface IHostGroupService {
BaseResponse<HostGroup> getHostGroupById(int id);
List<HostGroup> getAllGroups(String tagType);
List<HostGroup> getAllGroups(String tagType,String searchContent);
}
... ...
... ... @@ -93,7 +93,7 @@ public class HostGroupServiceImpl implements IHostGroupService {
}
@Override
public List<HostGroup> getAllGroups(String tagType) {
return hostGroupMapper.selectAllGroups(tagType);
public List<HostGroup> getAllGroups(String tagType,String searchContent) {
return hostGroupMapper.selectAllGroups(tagType,searchContent);
}
}
... ...
... ... @@ -23,6 +23,6 @@ public interface HostGroupMapper {
List<HostGroup> selectHostGroups(PageBean page);
List<HostGroup> selectAllGroups(@Param("tagType") String tagType);
List<HostGroup> selectAllGroups(@Param("tagTypeContent") String tagTypeContent,@Param("searchContent") String searchContent);
}
\ No newline at end of file
... ...
... ... @@ -11,7 +11,7 @@
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, group_name,tag_type,descr, create_time, update_time
id, group_name,tag_type,descr, create_time, update_time,pid
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
... ... @@ -37,7 +37,7 @@
update host_group
set group_name = #{groupName,jdbcType=VARCHAR},
descr = #{descr,jdbcType=VARCHAR},
pid = #{descr,jdbcType=INTEGER},
pid = #{pid,jdbcType=INTEGER},
tag_type = #{tagType,jdbcType=VARCHAR},
update_time = now()
where id = #{id,jdbcType=INTEGER}
... ... @@ -65,8 +65,13 @@
<include refid="Base_Column_List" />
from host_group
where 1=1
<if test="tagType!=null &amp;&amp; tagType != ''">
and tag_type = #{tagType,jdbcType=VARCHAR}
<if test="searchContent!=null &amp;&amp; searchContent != ''">
and (group_name like CONCAT('%',#{searchContent,jdbcType=VARCHAR},'%')
or
descr like CONCAT('%',#{searchContent,jdbcType=VARCHAR},'%'))
</if>
<if test="tagTypeContent!=null &amp;&amp; tagTypeContent != ''">
and tag_type = #{tagTypeContent,jdbcType=VARCHAR}
</if>
</select>
... ...