Search in sources :

Example 1 with UsrDptRelation

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);
}
Also used : UsrDptRelationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria) UsrDptRelation(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation) Date(java.util.Date)

Example 2 with UsrDptRelation

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() + "”");
}
Also used : Role(com.qlangtech.tis.manage.biz.dal.pojo.Role) UsrDptRelationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria) UsrDptRelation(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 3 with UsrDptRelation

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

Example 4 with UsrDptRelation

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 + "”添加成功");
}
Also used : UsrDptRelationCriteria(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria) UsrDptRelation(com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation)

Example 5 with UsrDptRelation

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

Aggregations

UsrDptRelation (com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelation)9 UsrDptRelationCriteria (com.qlangtech.tis.manage.biz.dal.pojo.UsrDptRelationCriteria)5 Func (com.qlangtech.tis.manage.spring.aop.Func)2 Department (com.qlangtech.tis.manage.biz.dal.pojo.Department)1 Role (com.qlangtech.tis.manage.biz.dal.pojo.Role)1 Date (java.util.Date)1 Cookie (javax.servlet.http.Cookie)1 HttpSession (javax.servlet.http.HttpSession)1 StrutsRequestWrapper (org.apache.struts2.dispatcher.StrutsRequestWrapper)1