From 2fb30737af4b4f7139d8f90cde7b9a0a79b1b2b9 Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Sat, 19 Jun 2021 02:37:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=86=E7=A0=81=E7=AE=A1=E7=90=86=E5=99=A8?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?all.do=E6=B7=BB=E5=8A=A0=E6=9B=B4=E5=A4=9A=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yutou/tools/Tools/PasswordManager.java | 10 ++++++++-- src/main/java/com/yutou/tools/ToolsApplication.java | 2 +- .../tools/mybatis/model/ToolsPasswordExample.java | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) 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;