public int save(PO record) { if (record != null && StringUtil.isNotNull(ReflectUtil.getFieldValue(record, record.PK))) { return updateByPrimaryKey(record); } else { return insert(record); } }
@RequestMapping("/getTypeList/{type}") @ResponseBody public String getTypeList(@PathVariable String type, HttpServletRequest request) { String select = request.getParameter("select"); Map<String, String> rootMap = SysConstants.ROOT_MAP.get(type); Set<String> set = rootMap.keySet(); Map<String, String> map = null; List<Map<String, String>> list = new ArrayList<Map<String, String>>(); for (String string : set) { if (StringUtil.isNotBlank(select) && "true".equals(select.trim())) { map = new HashMap<String, String>(); map.put("selected", "selected"); map.put("id", ""); map.put("text", "请选择"); list.add(map); select = null; } map = new HashMap<String, String>(); map.put("id", string); map.put("text", rootMap.get(string).toString()); list.add(map); } return Jacksons.json().fromObjectToJson(list); }
public JsonPager selectByPageMap(JsonPager jPager, Map param) { SysStaffPOExample example = new SysStaffPOExample(); com.system.model.po.SysStaffPOExample.Criteria c = example.createCriteria(); if (StringUtil.isNotNull(param.get("departId"))) { c.andDepartIdLike(param.get("departId") + "%"); } if (StringUtil.isNotNull(param.get("sort")) && StringUtil.isNotNull(param.get("order"))) { example.setOrderByClause( ReflectUtil.toSqlName(param.get("sort").toString()) + " " + param.get("order").toString()); } return selectByPage(jPager, example); }