|
/**
* easyui AJAX请求数据
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(PersonEntity person,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(PersonEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, person, request.getParameterMap());
this.personService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
* 删除用户
*
* @return
*/
@RequestMapping(params = "del")
@ResponseBody
public AjaxJson del(PersonEntity person, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
person = systemService.getEntity(PersonEntity.class, person.getId());
message = "用户删除成功";
personService.delete(person);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
j.setMsg(message);
return j;
}
/**
* 添加用户
*
* @param ids
* @return
*/
@RequestMapping(params = "save")
@ResponseBody
public AjaxJson save(PersonEntity person, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
if (StringUtil.isNotEmpty(person.getId())) {
message = "用户更新成功";
PersonEntity t = personService.get(PersonEntity.class, person.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(person, t);
personService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "用户更新失败";
}
} else {
System.out.println("111");
message = "用户添加成功";
personService.save(person);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}
j.setMsg(message);
return j;
} |
|