Compare commits

...

2 Commits

@ -30,7 +30,7 @@ public class YpController extends Controller {
*/ */
@Before(GET.class) @Before(GET.class)
public void getCurrentTaskInfo() { public void getCurrentTaskInfo() {
List<Record> list = model.getCurrentTaskInfo(); List<Record> list = model.getCurrentTask();
if (list.size() > 0) { if (list.size() > 0) {
renderJson(list.get(0)); renderJson(list.get(0));
} else { } else {
@ -190,7 +190,7 @@ public class YpController extends Controller {
} }
if (result == 2) { if (result == 2) {
kv.set("success", false); kv.set("success", false);
kv.set("message", "此身份证号已申请过,不能重复申请!"); kv.set("message", "此身份证号已在本次招生中申请过,不能重复申请!");
} }
if (result == 3) { if (result == 3) {
kv.set("success", false); kv.set("success", false);
@ -321,4 +321,18 @@ public class YpController extends Controller {
public void getYzm() { public void getYzm() {
renderCaptcha(); renderCaptcha();
} }
/**
*
*
* @param id
*/
@Before(GET.class)
public void delRecord(int id) {
model.delRecord(id);
Kv kv = Kv.by("success", true);
kv.set("message", "保存成功!");
renderJson(kv);
}
} }

@ -17,7 +17,7 @@ public class YpModel {
* *
* @return * @return
*/ */
public List<Record> getCurrentTaskInfo() { public List<Record> getCurrentTask() {
String sql = "select task_id,task_name,is_run from t_yp_task where b_use=1 and is_run=1"; String sql = "select task_id,task_name,is_run from t_yp_task where b_use=1 and is_run=1";
List<Record> list = Db.find(sql); List<Record> list = Db.find(sql);
return list; return list;
@ -224,8 +224,9 @@ public class YpModel {
*/ */
public int save(int task_id, String name, String xb, int bx_id, String address, String father_name, String mother_name, String sfzh, String tel, String uuid) { public int save(int task_id, String name, String xb, int bx_id, String address, String father_name, String mother_name, String sfzh, String tel, String uuid) {
//1、检查身份证号是不是已存在 //1、检查身份证号是不是已存在
String sql = "select count(1) as count from t_yp_record where sfzh=?"; Record currentR = getCurrentTask().get(0);
int count = Db.findFirst(sql, sfzh).getInt("count"); String sql = "select count(1) as count from t_yp_record where sfzh=? and task_id=? and b_use=1";
int count = Db.findFirst(sql, sfzh, currentR.getInt("task_id")).getInt("count");
if (count > 0) return 2; if (count > 0) return 2;
//2、是不是指定班型已招满 //2、是不是指定班型已招满
count = applyCount(task_id, bx_id); count = applyCount(task_id, bx_id);
@ -250,6 +251,15 @@ public class YpModel {
return 1; return 1;
} }
/**
*
* @param id
*/
public void delRecord(int id) {
String sql = "update t_yp_record set b_use=0 where id=?";
Db.update(sql, id);
}
/** /**
* *
* *

@ -10,6 +10,7 @@
#end #end
#sql("listTask") #sql("listTask")
select task_id,task_name,date_format(create_time,'%Y-%m-%d') as create_time,b_use,is_run from t_yp_task where b_use=1 order by task_id desc select task_id,task_name,date_format(create_time,'%Y-%m-%d') as create_time,b_use,is_run
from t_yp_task where b_use=1 order by task_id desc
#end #end
#end #end

@ -10,6 +10,7 @@
#end #end
#sql("listTask") #sql("listTask")
select task_id,task_name,date_format(create_time,'%Y-%m-%d') as create_time,b_use,is_run from t_yp_task where b_use=1 order by task_id desc select task_id,task_name,date_format(create_time,'%Y-%m-%d') as create_time,b_use,is_run
from t_yp_task where b_use=1 order by task_id desc
#end #end
#end #end
Loading…
Cancel
Save