From 52e5072f9ed8fc69d53ac52786be47f665799321 Mon Sep 17 00:00:00 2001 From: yutou Date: Mon, 22 Feb 2021 18:35:18 +0800 Subject: [PATCH] update --- .../yutou/tools/Tools/PasswordManager.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/java/com/yutou/tools/Tools/PasswordManager.java b/src/main/java/com/yutou/tools/Tools/PasswordManager.java index e2e0ec0..f00978f 100644 --- a/src/main/java/com/yutou/tools/Tools/PasswordManager.java +++ b/src/main/java/com/yutou/tools/Tools/PasswordManager.java @@ -73,6 +73,7 @@ public class PasswordManager { 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("password",AESTools.decrypt(password.getPassword())); @@ -120,11 +121,34 @@ public class PasswordManager { JSONObject json=new JSONObject(); try{ if(StringUtils.isEmpty(title)||StringUtils.isEmpty(username)||StringUtils.isEmpty(password)||StringUtils.isEmpty(type)){ + System.out.println("tt "+request.getParameter("title")); + System.out.println("title = " + title + ", username = " + username + ", password = " + password + ", url = " + url + ", info = " + info + ", type = " + type); json.put("code",-1); json.put("msg","有参数为空"); return json.toJSONString(); } int uid=tls.getUid(request); + if(uid==-1){ + json.put("code",-1); + json.put("msg","有参数为空"); + return json.toJSONString(); + } + if("-1".equals(type)){ + int _type=-1; + ToolsPasswordTypeExample typeExample=new ToolsPasswordTypeExample(); + typeExample.createCriteria().andTitleEqualTo("默认"); + if(passwordTypeDao.selectByExample(typeExample).isEmpty()){ + ToolsPasswordType passwordType=new ToolsPasswordType(); + passwordType.setTitle("默认"); + passwordType.setUid(uid); + passwordTypeDao.insert(passwordType); + _type=passwordTypeDao.selectByExample(typeExample).get(0).getId(); + }else{ + List _type_list= passwordTypeDao.selectByExample(typeExample); + _type=_type_list.get(_type_list.size()-1).getId(); + } + type=_type+""; + } ToolsPassword toolsPassword=new ToolsPassword(); toolsPassword.setTitle(title); toolsPassword.setUsername(username);