Search in sources :

Example 1 with DepartmentCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria in project tis by qlangtech.

the class BizlineAction method doAddBizline.

@Func(value = PermissionConstant.APP_DEPARTMENT_MANAGE)
public void doAddBizline(Context context) {
    this.errorsPageShow(context);
    final String name = this.getString("name");
    if (StringUtils.isBlank(name)) {
        this.addErrorMessage(context, "请填写业务线名称");
        return;
    }
    DepartmentCriteria criteria = new DepartmentCriteria();
    criteria.createCriteria().andIsLeaf(false).andNameEqualTo(name).andParentIdEqualTo(-1);
    if (this.getDepartmentDAO().countByExample(criteria) > 0) {
        this.addErrorMessage(context, "业务线:''" + name + "' 已经存在,不能重复添加");
        return;
    }
    Department dpt = new Department();
    dpt.setLeaf(false);
    dpt.setName(name);
    dpt.setFullName(name);
    dpt.setGmtModified(new Date());
    dpt.setGmtCreate(new Date());
    dpt.setParentId(-1);
    dpt.setDptId(this.getDepartmentDAO().insertSelective(dpt));
    this.setBizResult(context, dpt);
    this.addActionMessage(context, "业务线:'" + name + "' 添加成功");
// this.setBizResult(context, getAllBizDomain(false));
}
Also used : Department(com.qlangtech.tis.manage.biz.dal.pojo.Department) Date(java.util.Date) DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 2 with DepartmentCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria in project tis by qlangtech.

the class DepartmentAction method doUpdateDepartment.

/**
 * 更新部门
 *
 * @param context
 */
public void doUpdateDepartment(Context context) {
    Department department = new Department();
    this.processDepartment(context, department, (dpt) -> {
        if (dpt.getDptId() == null) {
            throw new IllegalStateException("dpt.getDptId() can not be null");
        }
        final Integer dptId = dpt.getDptId();
        try {
            DepartmentCriteria criteria = new DepartmentCriteria();
            criteria.createCriteria().andDptIdEqualTo(dptId).andIsLeaf(true);
            dpt.setDptId(null);
            if (this.getDepartmentDAO().updateByExampleSelective(dpt, criteria) > 0) {
                DataxAction.cleanDepsCache();
                this.addActionMessage(context, "更新部门:'" + dpt.getName() + "'");
            } else {
                this.addErrorMessage(context, "更新部门 '" + dpt.getName() + "' 失败");
            }
        } finally {
            dpt.setDptId(dptId);
        }
    }, // 
    "dptId", new Validator.FieldValidators(Validator.require, Validator.integer) {

        @Override
        public void setFieldVal(String val) {
            department.setDptId(Integer.parseInt(val));
        }
    });
}
Also used : Department(com.qlangtech.tis.manage.biz.dal.pojo.Department) Validator(com.qlangtech.tis.plugin.annotation.Validator) DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria)

Example 3 with DepartmentCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria in project tis by qlangtech.

the class IDepartmentGetter method getDepartmentBelongs.

default List<Department> getDepartmentBelongs(RunContext runcontext) {
    DepartmentCriteria criteria = new DepartmentCriteria();
    criteria.createCriteria().andIsLeaf(true);
    return runcontext.getDepartmentDAO().selectByExample(criteria, 1, 500);
}
Also used : DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria)

Example 4 with DepartmentCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria in project tis by qlangtech.

the class NormalUserApplicationFetcher method processBelongDepartment.

private void processBelongDepartment(Department department, RunContext context) {
    if (true) {
        return;
    }
    Assert.assertNotNull("department can not be null", department);
    Assert.assertNotNull("context can not be null", context);
    // 部门是叶子节点吗?
    if (department.getLeaf()) {
        belongDpt.add(department);
    } else {
        DepartmentCriteria query = new DepartmentCriteria();
        query.createCriteria().andParentIdEqualTo(department.getDptId());
        for (Department dpt : context.getDepartmentDAO().selectByExample(query)) {
            processBelongDepartment(dpt, context);
        }
    }
}
Also used : Department(com.qlangtech.tis.manage.biz.dal.pojo.Department) DepartmentCriteria(com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria)

Example 5 with DepartmentCriteria

use of com.qlangtech.tis.manage.biz.dal.pojo.DepartmentCriteria in project tis by qlangtech.

the class TerminatorAdminAppsFetcher method getDepartmentBelongs.

// @Override
// public List<ApplicationApply> getAppApplyList(
// IApplicationApplyDAO applicationApplyDAO) {
// 
// return super.getAppApplyList(applicationApplyDAO);
// }
@Override
public List<Department> getDepartmentBelongs(RunContext runContext) {
    DepartmentCriteria criteria = new DepartmentCriteria();
    criteria.createCriteria().andIsLeaf(true);
    return runContext.getDepartmentDAO().selectByExample(criteria, 1, 500);
}
Also used : 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