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));
}
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));
}
});
}
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);
}
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);
}
}
}
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);
}
Aggregations