新增公司

This commit is contained in:
sxu 2025-01-05 20:00:45 +08:00
parent 4dfc5570cb
commit 5021c02115
3 changed files with 19 additions and 6 deletions

View File

@ -110,6 +110,9 @@ public class SysDept extends BaseEntity {
*/
private String logo;
//公司管理员用户ID
private Long adminUserId;
/**
* 公司用户初始密码
*/
@ -198,6 +201,14 @@ public class SysDept extends BaseEntity {
this.logo = logo;
}
public Long getAdminUserId() {
return adminUserId;
}
public void setAdminUserId(Long adminUserId) {
this.adminUserId = adminUserId;
}
public String getInitPassword() {
return initPassword;
}

View File

@ -451,6 +451,8 @@ public class SysDeptServiceImpl implements ISysDeptService
user.setPassword(SecurityUtils.encryptPassword(dept.getInitPassword()));
user.setDeptId(dept.getDeptId());
userMapper.insertUser(user);
dept.setAdminUserId(user.getUserId());
deptMapper.updateDept(dept);
return user;
}

View File

@ -28,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deptAbbreviation" column="dept_abbreviation" />
<result property="remark" column="remark" />
<result property="logo" column="logo" />
<result property="adminUserId" column="admin_user_id" />
<result property="initPassword" column="init_password" />
</resultMap>
@ -52,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.dept_abbreviation,
d.remark,
d.logo,
d.admin_user_id,
d.init_password
from sys_dept d
</sql>
@ -226,6 +228,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptAbbreviation != null and deptAbbreviation != ''">dept_abbreviation = #{deptAbbreviation},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="logo != null and logo != ''">logo = #{logo},</if>
<if test="adminUserId != null and adminUserId != 0">admin_user_id = #{adminUserId},</if>
<if test="initPassword != null and initPassword != ''">init_password = #{initPassword},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
@ -260,12 +263,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCompanyAdminByDept" resultType="com.bonus.system.api.domain.SysUser">
select su.nick_name as nickName, su.user_name as userName, su.phonenumber as phonenumber,
su.user_id as userId, sr.role_id as roleId, sd.dept_id as deptId
su.user_id as userId, sd.dept_id as deptId
from sys_dept sd
left join sys_role_dept srd on sd.dept_id = srd.dept_id
left join sys_role sr on srd.role_id = sr.role_id
left join sys_user_role sur on sur.role_id = sr.role_id
left join sys_user su on su.user_id = sur.user_id
where sd.dept_id = #{deptId} and sr.role_key LIKE 'company_%_admin'
left join sys_user su on su.user_id = sd.admin_user_id
where sd.dept_id = #{deptId}
</select>
</mapper>