新增公司
This commit is contained in:
parent
340a724dfc
commit
3796dd92ef
|
|
@ -110,6 +110,11 @@ public class SysDept extends BaseEntity {
|
|||
*/
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* 公司用户初始密码
|
||||
*/
|
||||
private String initPassword;
|
||||
|
||||
private SysUser sysUser;
|
||||
|
||||
/**
|
||||
|
|
@ -188,6 +193,14 @@ public class SysDept extends BaseEntity {
|
|||
this.logo = logo;
|
||||
}
|
||||
|
||||
public String getInitPassword() {
|
||||
return initPassword;
|
||||
}
|
||||
|
||||
public void setInitPassword(String initPassword) {
|
||||
this.initPassword = initPassword;
|
||||
}
|
||||
|
||||
public SysUser getSysUser() {
|
||||
return sysUser;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,5 +133,5 @@ public interface SysDeptMapper
|
|||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
public SysUser selectCompanyAdminByDept(Long deptId);
|
||||
public SysUser selectCompanyAdminByDept(@Param("deptId") Long deptId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.bonus.config.SystemConfig;
|
||||
import com.bonus.system.api.domain.*;
|
||||
|
|
@ -198,9 +199,10 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
public SysDept selectDeptById(Long deptId)
|
||||
{
|
||||
SysDept sysDept = deptMapper.selectDeptById(deptId);
|
||||
if (Objects.nonNull(sysDept.getParentId()) && sysDept.getParentId().equals(0L)) {
|
||||
if (systemConfig.isAddRootCompany() && Objects.nonNull(sysDept.getParentId()) && sysDept.getParentId().equals(0L)) {
|
||||
SysUser sysUser = deptMapper.selectCompanyAdminByDept(deptId);
|
||||
sysDept.setSysUser(sysUser);
|
||||
sysDept.setInitPassword(Sm4Utils.encrypt(sysDept.getInitPassword()));
|
||||
}
|
||||
return sysDept;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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="initPassword" column="init_password" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeptVo">
|
||||
|
|
@ -50,7 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
d.address,
|
||||
d.dept_abbreviation,
|
||||
d.remark,
|
||||
d.logo
|
||||
d.logo,
|
||||
d.init_password
|
||||
from sys_dept d
|
||||
</sql>
|
||||
|
||||
|
|
@ -172,6 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deptAbbreviation != null and deptAbbreviation != ''">dept_abbreviation,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="logo != null and logo != ''">logo,</if>
|
||||
<if test="initPassword != null and initPassword != ''">init_password,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="templateId != null">template_id,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
|
|
@ -192,6 +195,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deptAbbreviation != null and deptAbbreviation != ''">#{deptAbbreviation},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="logo != null and logo != ''">#{logo},</if>
|
||||
<if test="initPassword != null and initPassword != ''">#{initPassword},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
|
|
@ -216,6 +220,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="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>
|
||||
update_time = sysdate()
|
||||
|
|
@ -248,13 +253,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<select id="selectCompanyAdminByDept" resultType="com.bonus.system.api.domain.SysUser">
|
||||
select su.nick_name as nickName,su.user_name as userName,su.password as password,su.phonenumber as phonenumber,
|
||||
sr.role_name as roleName,su.user_id as userId,sr.role_id as roleId, sd.dept_id as deptId
|
||||
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
|
||||
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 and sr.role_key LIKE 'dept_%_admin'
|
||||
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}
|
||||
where sd.dept_id = #{deptId} and sr.role_key LIKE 'dept_%_admin'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue