Search in sources :

Example 6 with DepartmentCriteria

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;
}
Also used : Department(com.qlangtech.tis.manage.biz.dal.pojo.Department) DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria)

Example 7 with DepartmentCriteria

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));
}
Also used : UsrDptRelationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria) CriteriaSetter(com.qlangtech.tis.manage.common.apps.AppsFetcher.CriteriaSetter) Criteria(com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria) UsrDptRelationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria) DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria) IAppsFetcher(com.qlangtech.tis.manage.common.apps.IAppsFetcher) DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria)

Example 8 with DepartmentCriteria

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);
}
Also used : Department(com.qlangtech.tis.manage.biz.dal.pojo.Department) Option(com.qlangtech.tis.manage.common.Option) DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria)

Aggregations

DepartmentCriteria (com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria)8 Department (com.qlangtech.tis.manage.biz.dal.pojo.Department)5 Criteria (com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria.Criteria)1 UsrDptRelationCriteria (com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria)1 Option (com.qlangtech.tis.manage.common.Option)1 CriteriaSetter (com.qlangtech.tis.manage.common.apps.AppsFetcher.CriteriaSetter)1 IAppsFetcher (com.qlangtech.tis.manage.common.apps.IAppsFetcher)1 Func (com.qlangtech.tis.manage.spring.aop.Func)1 Validator (com.qlangtech.tis.plugin.annotation.Validator)1 Date (java.util.Date)1