zhongrj
2024-01-18 bf7532c954e1c978955b0d03eaa97cea34a88317
用户详情查询修改
2 files modified
1 files added
55 ■■■■■ changed files
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml 7 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/vo/DeptDetailVO.java 46 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/vo/UserDetailVO.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -111,8 +111,9 @@
    <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">
                    ofType="org.springblade.modules.system.vo.DeptDetailVO" autoMapping="true">
            <id property="id" column="cid"/>
            <id property="level" column="region_level"/>
        </collection>
    </resultMap>
@@ -120,10 +121,12 @@
    <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
        bd.id as cid,bd.parent_id,bd.ancestors,bd.dept_category,bd.dept_name,bd.full_name,bd.sort,bd.region_code,
        br.region_level
        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
        left join blade_region br on br.code = bd.region_code
        where bu.is_deleted = 0
        and bu.id = #{userId}
    </select>
src/main/java/org/springblade/modules/system/vo/DeptDetailVO.java
New file
@@ -0,0 +1,46 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tool.node.INode;
import org.springblade.modules.system.entity.Dept;
import java.util.ArrayList;
import java.util.List;
/**
 * 视图实体类
 *
 * @author Chill
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "DeptVO对象", description = "DeptVO对象")
public class DeptDetailVO extends Dept {
    private static final long serialVersionUID = 1L;
    /**
     * 层级
     */
    private Integer level;
}
src/main/java/org/springblade/modules/system/vo/UserDetailVO.java
@@ -42,5 +42,5 @@
    private List<Role> roleList = new ArrayList<>();
    private List<Dept> deptList = new ArrayList<>();
    private List<DeptDetailVO> deptList = new ArrayList<>();
}