zhongrj
2024-01-15 f7d0f1659701e75c91415cbb8c4736e5051e0bf1
用户详情查询修改,返回机构信息
3 files modified
25 ■■■■ changed files
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml 21 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/vo/UserDetailVO.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -107,10 +107,25 @@
        and (account = #{phoneNumber} or phone = #{phoneNumber})
    </select>
    <!--用户详情map-->
    <resultMap id="selectUserDetailMap" type="org.springblade.modules.system.vo.UserDetailVO" autoMapping="true">
        <id property="id" column="id" />
        <collection property="deptList"  javaType="java.util.List"
                    ofType="org.springblade.modules.system.entity.Dept" autoMapping="true">
            <id property="id" column="cid"/>
        </collection>
    </resultMap>
    <!--用户详情接口-->
    <select id="getUserInfo" resultType="org.springblade.modules.system.vo.UserDetailVO">
        SELECT * FROM blade_user where is_deleted = 0
        and id = #{userId}
    <select id="getUserInfo" resultMap="selectUserDetailMap">
        SELECT
        bu.*,
        bd.id as cid,bd.parent_id,bd.ancestors,bd.dept_category,bd.dept_name,bd.full_name,bd.sort,bd.region_code
        FROM blade_user bu
        left join blade_user_dept bud on bud.user_id = bu.id
        left join blade_dept bd on bud.dept_id = bd.id and bd.is_deleted = 0
        where bu.is_deleted = 0
        and bu.id = #{userId}
    </select>
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -482,6 +482,7 @@
        // 根据用户id 获取用户详情信息
        UserDetailVO userVO = baseMapper.getUserInfo(userId);
        if (null!=userVO){
            // 设置机构
            userVO.setPassword(null);
        }
        // 返回
src/main/java/org/springblade/modules/system/vo/UserDetailVO.java
@@ -22,6 +22,7 @@
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.Role;
import org.springblade.modules.system.entity.User;
@@ -40,4 +41,6 @@
    private static final long serialVersionUID = 1L;
    private List<Role> roleList = new ArrayList<>();
    private List<Dept> deptList = new ArrayList<>();
}