前端JS:
function(btn,event,eOpts){
/**
* 平台提示,不用刻意随时删除这段注释.
* var func = JE.getFunc('功能编码'),//得到功能对象
* kqtree = func.treeview,//得到快速查询树对象
* mainRecord = func.getParentData();//得到父亲功能对象
* var formRecord = func.getFormData();//如果是表单按钮就可以得到本功能表单里的数据
* var fieldValue = formRecord.fieldCode;
* var form = func.formview;//得到表单对象
*/
var func = JE.getFunc('ZY_XSB');
var formRecord = func.getFormData();
var obj = JE.ajax({
url:'/zystudent/zystudentAction!selStu.action',
params:formRecord
});
if(obj.success){
var form = func.formview;
var bt = form.down("button[ref=formBackBtn]");
if (bt)
bt.fireHandler();
func.gridLoad();
}else{
JE.alert('失败,请联系管理员');
}
}
控制层:
public void selStu() throws Exception{
String nianji = request.getParameter("XSB_GRADE_CODE");
String xueqi = request.getParameter("XSB_TERM_CODE");
String ZY_XSB_ID = request.getParameter("ZY_XSB_ID");
try {
this.serviceTemplate.deleteByWehreSql("ZY_XSB", "AND ZY_XSB_ID='"
+ ZY_XSB_ID + "'");//清除缓存
List<DynaBean> list = this.serviceTemplate
.selectListBySql(" SELECT TERM_TERM_NAME,TERM_TERM_CODE,TERM_GRADE_NAME,TERM_GRADE_CODE,TERM_CLASS_NAME,TERM_CLASS_CODE,TERM_STUDENT_NAME,TERM_STUDENT_CODE"
+ " FROM LD_SCHOOL_STUDENT_TERM "
+ " WHERE TERM_TERM_CODE = '"
+ xueqi
+ "' "
+ " AND TERM_GRADE_CODE = '" + nianji + "' ");
if (null == list || list.size() == 0)
return;
for (int i = 0; i < list.size(); i++) {
DynaBean bean = list.get(i);
long count = this.serviceTemplate.selectCount(
"ZY_XSB",
"AND XSB_TERM_CODE='" + bean.getStr("TERM_TERM_CODE")
+ "'" + "AND XSB_XH='"
+ bean.getStr("TERM_STUDENT_CODE") + "'");
if (count > 0) {
continue;
}
System.out.println(bean.getStr("SCORE_TERM_CODE"));
bean.setStr(BeanUtils.KEY_TABLE_CODE, "ZY_XSB");
bean.setStr("XSB_TERM_NAME", bean.getStr("TERM_TERM_NAME"));
bean.setStr("XSB_TERM_CODE", bean.getStr("TERM_TERM_CODE"));
bean.setStr("XSB_GRADE_NAME", bean.getStr("TERM_GRADE_NAME"));
bean.setStr("XSB_GRADE_CODE", bean.getStr("TERM_GRADE_CODE"));
bean.setStr("XSB_CLASS_NAME", bean.getStr("TERM_CLASS_NAME"));
bean.setStr("XSB_CLASS_CODE", bean.getStr("TERM_CLASS_CODE"));
bean.setStr("XSB_XH", bean.getStr("TERM_STUDENT_CODE"));
bean.setStr("XSB_XS", bean.getStr("TERM_STUDENT_NAME"));
this.serviceTemplate.buildModelCreateInfo(bean);
this.serviceTemplate.insert(bean);
}
toWrite(jsonBuilder.returnSuccessJson("{}"));
} catch (Exception e) {
logger.error(e.getMessage(), e);
toWrite(jsonBuilder.returnFailureJson(e.getMessage()));
}
}