diff --git a/src/main/java/com/yutou/tools/Tools/PasswordManager.java b/src/main/java/com/yutou/tools/Tools/PasswordManager.java index f00978f..1e5a32a 100644 --- a/src/main/java/com/yutou/tools/Tools/PasswordManager.java +++ b/src/main/java/com/yutou/tools/Tools/PasswordManager.java @@ -61,7 +61,7 @@ public class PasswordManager { } @ResponseBody @RequestMapping(value = "get/all.do",method = RequestMethod.GET) - public String getAllPassword(HttpServletRequest request){ + public String getAllPassword(HttpServletRequest request,String search){ JSONObject json=new JSONObject(); JSONArray array=new JSONArray(); int uid=tls.getUid(request); @@ -69,13 +69,19 @@ public class PasswordManager { return ""; } ToolsPasswordExample example=new ToolsPasswordExample(); - example.createCriteria().andUidEqualTo(uid); + ToolsPasswordExample.Criteria criteria=example.createCriteria(); + criteria.andUidEqualTo(uid); + if(!StringUtils.isEmpty(search)){ + criteria.search(search); + } List list=passwordDao.selectByExample(example); for (ToolsPassword password : list) { JSONObject item=new JSONObject(); item.put("id",password.getId()); item.put("account",password.getUsername()); item.put("title",password.getTitle()); + item.put("desc",password.getInfo()); + item.put("url",password.getUrl()); item.put("password",AESTools.decrypt(password.getPassword())); array.add(item); } diff --git a/src/main/java/com/yutou/tools/ToolsApplication.java b/src/main/java/com/yutou/tools/ToolsApplication.java index cf7131c..5034f70 100644 --- a/src/main/java/com/yutou/tools/ToolsApplication.java +++ b/src/main/java/com/yutou/tools/ToolsApplication.java @@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ToolsApplication { - public static final String version="1.1.3"; + public static final String version="1.1.4"; public static void main(String[] args) { System.out.println("当前版本号:" + version); diff --git a/src/main/java/com/yutou/tools/mybatis/model/ToolsPasswordExample.java b/src/main/java/com/yutou/tools/mybatis/model/ToolsPasswordExample.java index 4bc244a..c4cd053 100644 --- a/src/main/java/com/yutou/tools/mybatis/model/ToolsPasswordExample.java +++ b/src/main/java/com/yutou/tools/mybatis/model/ToolsPasswordExample.java @@ -104,6 +104,11 @@ public class ToolsPasswordExample { criteria.add(new Criterion(condition, value1, value2)); } + public Criteria search(String value){ + addCriterion("title like '%"+value+"%' or `info` like '%"+value+"%' or `url` like '%"+value+"%'"); + return (Criteria) this; + } + public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this;