From 9194fde36f2434b4f74d50d12cc1f0b8b0972094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Sun, 23 Apr 2023 11:48:15 +0800 Subject: [PATCH] 'commit' --- YangPuBaoMing.iml | 162 +----------------- .../FengHuang/Yp/Controller/YpController.java | 72 ++------ .../dsideal/FengHuang/Yp/Model/YpModel.java | 32 ++-- 3 files changed, 31 insertions(+), 235 deletions(-) diff --git a/YangPuBaoMing.iml b/YangPuBaoMing.iml index 4214dc3..97714ab 100644 --- a/YangPuBaoMing.iml +++ b/YangPuBaoMing.iml @@ -1,164 +1,8 @@ - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/dsideal/FengHuang/Yp/Controller/YpController.java b/src/main/java/com/dsideal/FengHuang/Yp/Controller/YpController.java index 86e7501..82efaf5 100644 --- a/src/main/java/com/dsideal/FengHuang/Yp/Controller/YpController.java +++ b/src/main/java/com/dsideal/FengHuang/Yp/Controller/YpController.java @@ -77,8 +77,8 @@ public class YpController extends Controller { @Before(POST.class) @IsNumericInterface({"task_id"}) @EmptyInterface({"task_name"}) - public void updateTask(int task_id, String task_name) { - model.updateTask(task_id, task_name); + public void updateTask(int task_id, String task_name, String bx_ids, String limits) { + model.updateTask(task_id, task_name, bx_ids, limits); Kv kv = Kv.by("success", true); kv.set("message", "保存成功!"); renderJson(kv); @@ -259,52 +259,6 @@ public class YpController extends Controller { //path : /FengHuang/upload/sfzh+".jpg" } - /** - * 功能:当前任务增加班型 - * - * @param task_id - * @param bx_id - * @param limit - */ - @Before(POST.class) - @IsNumericInterface({"task_id", "bx_id", "limit"}) - public void addBx(int task_id, int bx_id, int limit) { - model.addBx(task_id, bx_id, limit); - Kv kv = Kv.by("success", true); - kv.set("message", "保存成功!"); - renderJson(kv); - } - - /** - * 功能:当前任务修改班型 - * - * @param task_id - * @param bx_id - * @param limit - */ - @Before(POST.class) - @IsNumericInterface({"task_id", "bx_id", "limit"}) - public void updateBx(int task_id, int bx_id, int limit) { - model.updateBx(task_id, bx_id, limit); - Kv kv = Kv.by("success", true); - kv.set("message", "保存成功!"); - renderJson(kv); - } - - /** - * 功能:当前任务删除班型 - * - * @param task_id - * @param bx_id - */ - @Before(POST.class) - @IsNumericInterface({"task_id", "bx_id"}) - public void delBx(int task_id, int bx_id) { - model.delBx(task_id, bx_id); - Kv kv = Kv.by("success", true); - kv.set("message", "保存成功!"); - renderJson(kv); - } /** * 功能:获取指定任务下的班型选择情况 @@ -318,17 +272,17 @@ public class YpController extends Controller { /** * 功能:获取验证码 - 调用方法: - - - - 后台验证验证码是否正确 - boolean result = validateCaptcha("inputRandomCode");//inputRandomCode是用户提交过来的验证码 + * 调用方法: + * + * + *

+ * 后台验证验证码是否正确 + * boolean result = validateCaptcha("inputRandomCode");//inputRandomCode是用户提交过来的验证码 */ @Before(GET.class) public void getYzm() { diff --git a/src/main/java/com/dsideal/FengHuang/Yp/Model/YpModel.java b/src/main/java/com/dsideal/FengHuang/Yp/Model/YpModel.java index 5df6126..5064f0a 100644 --- a/src/main/java/com/dsideal/FengHuang/Yp/Model/YpModel.java +++ b/src/main/java/com/dsideal/FengHuang/Yp/Model/YpModel.java @@ -51,14 +51,14 @@ public class YpModel { /** * 功能:增加任务 */ - public void addTask(String task_name, String bx_id, String limits) { + public void addTask(String task_name, String bx_ids, String limits) { Record record = new Record(); record.set("task_name", task_name); record.set("create_time", DateTime.now()); record.set("b_use", 0); record.set("is_run", 0); Db.save("t_yp_task", "task_id", record); - String[] a = bx_id.split(","); + String[] a = bx_ids.split(","); String[] b = limits.split(","); int task_id = record.getInt("task_id"); for (int i = 0; i < a.length; i++) { @@ -73,9 +73,21 @@ public class YpModel { /** * 功能:修改任务 */ - public void updateTask(int task_id, String task_name) { + public void updateTask(int task_id, String task_name, String bx_ids, String limits) { String sql = "update t_yp_task set task_name=? where task_id=?"; Db.update(sql, task_name, task_id); + + String[] a = bx_ids.split(","); + String[] b = limits.split(","); + sql = "delete from t_yp_task_bx_limit where task_id=?"; + Db.update(sql, task_id); + for (int i = 0; i < a.length; i++) { + Record r1 = new Record(); + r1.set("task_id", task_id); + r1.set("bx_id", a[i]); + r1.set("limit", b[i]); + Db.save("t_yp_task_bx_limit", "task_id,bx_id", r1); + } } /** @@ -245,20 +257,6 @@ public class YpModel { return pageRecord; } - public void addBx(int task_id, int bx_id, int limit) { - delBx(task_id, bx_id); - Record record = new Record(); - record.set("task_id", task_id); - record.set("bx_id", bx_id); - record.set("limit", limit); - Db.save("t_yp_task_bx_limit", "task_id,bx_id", record); - } - - public void updateBx(int task_id, int bx_id, int limit) { - delBx(task_id, bx_id); - addBx(task_id, bx_id, limit); - } - public void delBx(int task_id, int bx_id) { String sql = "delete from t_yp_task_bx_limit where task_id=? and bx_id=?"; Db.update(sql, task_id, bx_id);