From 9b60d66e816a2f8115425ba8280e14c181288fc6 Mon Sep 17 00:00:00 2001 From: zhangjialei Date: Mon, 24 Feb 2025 17:16:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=20=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E6=B3=A8=E9=94=80(deluser)=20=E7=9A=84=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF;=E4=BF=AE?= =?UTF-8?q?=E6=94=B9user=5Froster.user=5Fno=20->=20userNo;name->userName;c?= =?UTF-8?q?ard=5Ftype->cardType;card=5Fno->cardNo;create=5Ftime->createTim?= =?UTF-8?q?e;=20change=5Ftime->changeTime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/userController.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/code/springboot/newBank/src/main/java/demo/zhangjialei/controller/userController.java b/code/springboot/newBank/src/main/java/demo/zhangjialei/controller/userController.java index 6ceaadb63..eee7a90fd 100644 --- a/code/springboot/newBank/src/main/java/demo/zhangjialei/controller/userController.java +++ b/code/springboot/newBank/src/main/java/demo/zhangjialei/controller/userController.java @@ -144,32 +144,30 @@ public class userController { public String delUser(HttpServletRequest request) { // 接收要注销得客户编号 - String user_no = request.getParameter("user_no"); + String userNo = request.getParameter("userNo"); // 向数据库中查询编号是否存在 - String sql_sel = String.format("select * from user_roster where user_no = %s", user_no); + String sql_sel = String.format("select * from user_roster where userNo = %s", userNo); List> sel_res = jdbcTemplate.queryForList(sql_sel); if (sel_res.size() != 0){ - // 修改用户花名册账号状态字段为失效 user_roster.status = '2' - - /*sql报错*/ - String sql_del = String.format("update user_roster ur set ur.status = '2', ur.change_time = sysdate(), ur.changer = 'system' where user_no = %s", user_no); - jdbcTemplate.update(sql_del); - // 销户成功 返回 100 - return "100"; - } else { - // 查询账号当前状态 - String spl_sel_status = String.format("select * from user_roster where user_no = %s", user_no); - String status = (String) jdbcTemplate.queryForList(spl_sel_status).get(0).get("status"); - if (!status.equals("2")) { + // 获取账号当前状态 + String status = (String) sel_res.get(0).get("status"); + if (status.equals("2")) { // 账号已被销户 返回 200 return "200"; + } else { + // 修改用户花名册账号状态字段为失效 user_roster.status = '2' + String sql_del = String.format("update user_roster ur set ur.status = '2', ur.change_time = sysdate(), ur.changer = 'system' where userNo = %s", userNo); + jdbcTemplate.update(sql_del); + // 销户成功 返回 100 + return "100"; } + } else { // 编号不存在 返回 300 return "300"; } - // http://localhost:12709/delUser?user_no=9900 + // http://localhost:12709/delUser?userNo=9900 } // 客户登录