use of com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation in project tis by qlangtech.
the class OrgAuthorityAction method bindUser2Dpt.
public static void bindUser2Dpt(RunContext runContext, Integer departmentId, IUser user) {
Assert.assertNotNull(user);
UsrDptRelationCriteria query;
UsrDptRelation relation = new UsrDptRelation();
relation.setCreateTime(new Date());
relation.setDptId(departmentId);
relation.setDptName(getDepartmentName(runContext.getDepartmentDAO(), departmentId));
relation.setUsrId(user.getId());
relation.setUserName(user.getName());
// relation.setIsDeleted("N");
query = new UsrDptRelationCriteria();
query.createCriteria().andUsrIdEqualTo(user.getId());
Assert.assertNotNull(user.getId());
runContext.getUsrDptRelationDAO().deleteByExample(query);
runContext.getUsrDptRelationDAO().insertSelective(relation);
}
use of com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation in project tis by qlangtech.
the class RoleAction method doSelectRole.
/**
* 用户选择角色
*
* @param context
*/
@Func(PermissionConstant.AUTHORITY_USER_ROLE_SET)
public void doSelectRole(Context context) {
String usrid = this.getString("usrid");
Integer roleid = this.getInt("roleid");
Role role = this.getRoleDAO().loadFromWriteDB(roleid);
Assert.assertNotNull(role);
UsrDptRelationCriteria ucriteria = new UsrDptRelationCriteria();
ucriteria.createCriteria().andUsrIdEqualTo(usrid);
UsrDptRelation record = new UsrDptRelation();
record.setRoleName(role.getRoleName());
record.setrId(role.getrId());
this.getUsrDptRelationDAO().updateByExampleSelective(record, ucriteria);
addActionMessage(context, "用户选择了新的角色:“" + role.getRoleName() + "”");
}
use of com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation in project tis by qlangtech.
the class UserAction method doChangeDepartment.
/**
* 用户部门更新
*
* @param context
*/
@Func(PermissionConstant.AUTHORITY_USER_MANAGE)
public void doChangeDepartment(Context context) {
String usrid = this.getString("usrid");
Integer selecteddptid = this.getInt("selecteddptid");
Assert.assertNotNull(usrid);
Assert.assertNotNull(selecteddptid);
UsrDptRelation usr = this.getUsrDptRelationDAO().loadFromWriteDB(usrid);
Assert.assertNotNull(usr);
Department department = this.getDepartmentDAO().loadFromWriteDB(selecteddptid);
Assert.assertNotNull(department);
UsrDptRelationCriteria criteria = new UsrDptRelationCriteria();
criteria.createCriteria().andUsrIdEqualTo(usrid);
UsrDptRelation record = new UsrDptRelation();
record.setDptName(department.getFullName());
record.setDptId(department.getDptId());
record.setUpdateTime(new Date());
this.getUsrDptRelationDAO().updateByExampleSelective(record, criteria);
this.addActionMessage(context, "已经将用户“" + usr.getUserName() + "”归属到新的部门:" + department.getFullName());
}
use of com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation in project tis by qlangtech.
the class UserAction method doUsrAdd.
/**
* 添加用户,默认是给系统用户添加的
*
* @param context
*/
public void doUsrAdd(Context context) {
String userAccount = this.getString("userAccount");
String realName = this.getString("realName");
String password = this.getString("password");
Integer dptid = this.getInt("dptid");
if (StringUtils.isEmpty(userAccount)) {
this.addErrorMessage(context, "请填写登陆账户名");
return;
}
if (StringUtils.isEmpty(realName)) {
this.addErrorMessage(context, "请填写真实名称");
return;
}
if (StringUtils.isEmpty(password)) {
this.addErrorMessage(context, "请填写密码");
return;
}
UsrDptRelationCriteria q = new UsrDptRelationCriteria();
q.createCriteria().andUserNameEqualTo(userAccount);
if (this.getUsrDptRelationDAO().countByExample(q) > 0) {
this.addErrorMessage(context, "用户“" + userAccount + "”已经存在");
return;
}
UsrDptRelation user = new UsrDptRelation();
user.setUsrId(StringUtils.remove(UUID.randomUUID().toString(), "-"));
user.setUserName(userAccount);
user.setRealName(realName);
user.setPassword(ManageUtils.md5(password));
user.setDptId(dptid);
user.setCreateTime(new Date());
user.setUpdateTime(new Date());
user.setDptId(-1);
user.setDptName("none");
user.setrId(-1);
this.getUsrDptRelationDAO().insertSelective(user);
this.addActionMessage(context, "用户“" + userAccount + "”添加成功");
}
use of com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation in project tis by qlangtech.
the class UsrDptRelationDAOImpl method selectByPrimaryKey.
public UsrDptRelation selectByPrimaryKey(String usrId) {
UsrDptRelation key = new UsrDptRelation();
key.setUsrId(usrId);
UsrDptRelation record = this.load("usr_dpt_relation.ibatorgenerated_selectByPrimaryKey", key);
return record;
}
Aggregations