src/main/java/com/whyc/controller/DocUserController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/controller/UserInfController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/mapper/DocUserMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/DocFace.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/pojo/DocUser.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/DocUserService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/DocUserMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/controller/DocUserController.java
New file @@ -0,0 +1,24 @@ package com.whyc.controller; import com.whyc.dto.Response; import com.whyc.service.DocUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @Api(tags = "用户管理") @RequestMapping("docUser") public class DocUserController { @Autowired private DocUserService service; @ApiOperation(value = "查询所有用户信息",notes = "默认排除指定用户:sys_admin") @GetMapping("getAllUser") private Response getAllUser(){ return service.getAllUser(); } } src/main/java/com/whyc/controller/UserInfController.java
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /* @RestController @Api(tags = "用户管理") @RequestMapping("UserInf") @@ -24,3 +25,4 @@ } } */ src/main/java/com/whyc/mapper/DocUserMapper.java
@@ -2,5 +2,9 @@ import com.whyc.pojo.DocUser; import java.util.List; public interface DocUserMapper extends CustomMapper<DocUser>{ //查询所有用户信息 List<DocUser> getAllUser(); } src/main/java/com/whyc/pojo/DocFace.java
@@ -28,12 +28,16 @@ private static final long serialVersionUID = 1L; @ApiModelProperty(value = "face_id") @TableId(value = "id", type = IdType.AUTO) private Integer id; @ApiModelProperty(value = "人脸图片url") private String url; @ApiModelProperty(value = "face_id") private Integer faceId; } src/main/java/com/whyc/pojo/DocUser.java
@@ -1,6 +1,7 @@ package com.whyc.pojo; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -56,5 +57,16 @@ @ApiModelProperty(value = "创建时间") private Date creTime; @TableField(exist = false) @ApiModelProperty(value = "部门信息") private DocDepart depart; @TableField(exist = false) @ApiModelProperty(value = "权限信息") private DocRole drole; @TableField(exist = false) @ApiModelProperty(value = "人脸信息") private DocFace dface; } src/main/java/com/whyc/service/DocUserService.java
@@ -1,11 +1,23 @@ package com.whyc.service; import com.github.pagehelper.PageInfo; import com.whyc.dto.Response; import com.whyc.mapper.DocUserMapper; import com.whyc.pojo.DocUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class DocUserService { @Autowired @Autowired(required = false) private DocUserMapper mapper; //查询所有用户信息 public Response getAllUser() { List<DocUser> list=mapper.getAllUser(); PageInfo pageInfo=new PageInfo(list); return new Response().setII(1,list!=null?true:false,pageInfo,"数据返回"); } } src/main/resources/mapper/DocUserMapper.xml
@@ -1,6 +1,44 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.whyc.mapper.DocUserMapper"> <resultMap id="getAllUser" type="docUser"> <id column="id" property="id" ></id> <result column="sn_id" property="snId"></result> <result column="name" property="name"></result> <result column="tel" property="tel"></result> <result column="name" property="phone"></result> <result column="cre_time" property="creTime"></result> <result column="depart_id" property="departId"></result> <result column="face_id" property="faceId"></result> <result column="role_id" property="roleId"></result> <association property="drole" javaType="docRole"> <id column="rid" property="id" ></id> <result column="rrole_name" property="roleName"></result> <result column="rrole_id" property="roleId"></result> </association> <association property="depart" javaType="docDepart"> <id column="did" property="id" ></id> <result column="ddepart_name" property="departName"></result> <result column="ddepart_id" property="departId"></result> </association> <association property="dface" javaType="docFace"> <id column="fid" property="id" ></id> <result column="furl" property="url"></result> <result column="fface_id" property="faceId"></result> </association> </resultMap> <select id="getAllUser" resultMap="getAllUser"> SELECT u.* ,r.id rid,r.role_name rrole_name,r.role_id rrole_id ,d.id did,d.depart_name ddepart_name,d.depart_id ddepart_id ,f.id fid,f.face_id fface_id,f.url furl from tb_doc_user u LEFT JOIN tb_doc_role r on u.role_id=r.role_id LEFT JOIN tb_doc_depart d on u.depart_id=d.depart_id LEFT JOIN tb_doc_face f on u.face_id=f.face_id <where> u.name!="sys_admin" </where> </select> </mapper>