/** * 更新 * * @param ids * @param pIds * @param names * @param principalIds */ public void update(String ids, String pIds, String names, String principalIds) { Department dept = Department.dao.findById(ids); if (null != names && !names.isEmpty()) { // 更新模块名称 dept.set("names", names).update(); } else if (null != pIds && !pIds.isEmpty()) { // 更新上级模块 dept.set("parentdepartmentids", pIds).update(); } else if (null != principalIds && !principalIds.isEmpty()) { // 更新部门负责人 dept.set("principaluserids", principalIds).update(); } }
/** * 保存 * * @param pIds * @param names * @param orderIds * @return */ @Before(Tx.class) public String save(String pIds, String names, int orderIds) { Department pDept = Department.dao.findById(pIds); pDept.set("isparent", "true").update(); String images = ""; if (orderIds < 2 || orderIds > 9) { orderIds = 2; images = "2.png"; } else { images = orderIds + ".png"; } Department dept = new Department(); dept.set("isparent", "false"); dept.set("parentdepartmentids", pIds); dept.set("orderids", orderIds); dept.set("names", names); dept.set("images", images); dept.save(); return dept.getStr("ids"); }