use of com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria in project tis by qlangtech.
the class BizlineAction method getAllBizDomain.
/**
* 取得所有的业务线实体
*
* @return
*/
protected final List<Department> getAllBizDomain(boolean leaf) {
DepartmentCriteria q = new DepartmentCriteria();
q.createCriteria().andIsLeaf(leaf);
q.setOrderByClause("dpt_id desc");
List<Department> dpts = this.getDepartmentDAO().selectByExample(q, 1, 200);
return dpts;
}
use of com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria in project tis by qlangtech.
the class DepartmentAction method doDeleteDepartment.
/**
* 删除部门
*
* @param context
*/
public void doDeleteDepartment(Context context) {
final Integer dptid = this.getInt("dptid");
Assert.assertNotNull(dptid);
UsrDptRelationCriteria rcriteria = null;
DepartmentCriteria query = null;
// 校验是否有子部门
query = new DepartmentCriteria();
query.createCriteria().andParentIdEqualTo(dptid);
if (this.getDepartmentDAO().countByExample(query) > 0) {
this.addErrorMessage(context, "该部门有子部门,不能删除");
return;
}
// 校验是否有成员关联在该部门上
rcriteria = new UsrDptRelationCriteria();
rcriteria.createCriteria().andDptIdEqualTo(dptid);
if (this.getUsrDptRelationDAO().countByExample(rcriteria) > 0) {
this.addErrorMessage(context, "有成员关联在该部门,不能删除");
return;
}
// 检验是否有应用绑定在部门上
IAppsFetcher fetcher = getAppsFetcher();
int appsCount = fetcher.count(new CriteriaSetter() {
@Override
public void set(Criteria criteria) {
criteria.andDptIdEqualTo(dptid);
}
});
if (appsCount > 0) {
this.addErrorMessage(context, "该部门下有" + appsCount + "个应用,不能删除");
return;
}
this.getDepartmentDAO().deleteByPrimaryKey(dptid);
DataxAction.cleanDepsCache();
this.addActionMessage(context, "已经成功删除部门:" + OrgAuthorityAction.getDepartmentName(this.getDepartmentDAO(), dptid));
}
use of com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria in project tis by qlangtech.
the class UserAction method doGetChildDpt.
/**
* get child department
*
* @param context
*/
public void doGetChildDpt(Context context) {
Integer dptid = this.getInt("pid");
DepartmentCriteria query = new DepartmentCriteria();
query.createCriteria().andParentIdEqualTo(dptid);
List<Option> result = new ArrayList<Option>();
for (Department dpt : this.getDepartmentDAO().selectByExample(query)) {
result.add(new Option(dpt.getName(), String.valueOf(dpt.getDptId())));
}
context.put(AjaxValve.BIZ_RESULT, result);
}
Aggregations