Ver código fonte

人员选择组件,接口更新

dzx 3 meses atrás
pai
commit
29b171eb4e

+ 11 - 0
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.github.yulichang.toolkit.MPJWrappers;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
@@ -39,6 +40,7 @@ import com.xjrsoft.module.hikvision.util.DataUtil;
 import com.xjrsoft.module.organization.dto.AddUserDto;
 import com.xjrsoft.module.organization.dto.BindOpenidDto;
 import com.xjrsoft.module.organization.dto.LoginResetPasswordDto;
+import com.xjrsoft.module.organization.dto.PersonPageDto;
 import com.xjrsoft.module.organization.dto.RegisterDto;
 import com.xjrsoft.module.organization.dto.ResetPasswordDto;
 import com.xjrsoft.module.organization.dto.UpdateInfoDto;
@@ -68,6 +70,7 @@ import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.organization.service.IUserStudentService;
 import com.xjrsoft.module.organization.utils.OrganizationUtil;
 import com.xjrsoft.module.organization.vo.PendingCountDto;
+import com.xjrsoft.module.organization.vo.PersonPageVo;
 import com.xjrsoft.module.organization.vo.ResetUserPageVo;
 import com.xjrsoft.module.organization.vo.ResetUserRoleVo;
 import com.xjrsoft.module.organization.vo.UserDeptVo;
@@ -284,6 +287,14 @@ public class UserController {
         }
     }
 
+    @GetMapping(value = "/person-page")
+    @ApiOperation(value = "人员选择组件(分页)")
+    public R personPage(PersonPageDto dto) {
+        Page<PersonPageVo> voPage = userService.personPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        PageOutput<PersonPageVo> pageOutput = ConventPage.getPageOutput(voPage, PersonPageVo.class);
+        return R.ok(pageOutput);
+    }
+
     @GetMapping(value = "/info")
     @ApiOperation(value = "根据id查询用户信息")
     public R info(@RequestParam Long id) {

+ 40 - 0
src/main/java/com/xjrsoft/module/organization/dto/PersonPageDto.java

@@ -0,0 +1,40 @@
+package com.xjrsoft.module.organization.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.hibernate.validator.constraints.Length;
+
+/**
+ * @title: PersonPageDto
+ * @Author dzx
+ * @Date: 2024年8月15日
+ * @Version 1.0
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class PersonPageDto extends PageInput {
+
+    @ApiModelProperty("所属部门")
+    private Long departmentId;
+
+    @ApiModelProperty("用户名")
+    @Length(max = 20, message = "用户名长度不能超过20")
+    private String userName;
+
+    @ApiModelProperty("姓名")
+    @Length(max = 20, message = "姓名长度不能超过20")
+    private String name;
+
+    @ApiModelProperty("手机号")
+    @Length(max = 20, message = "手机号长度不能超过20")
+    private String mobile;
+
+    @ApiModelProperty("聘用类型")
+    private String employType;
+
+    @ApiModelProperty("聘用方式")
+    private String employWay;
+
+}

+ 4 - 0
src/main/java/com/xjrsoft/module/organization/mapper/UserMapper.java

@@ -2,8 +2,10 @@ package com.xjrsoft.module.organization.mapper;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.organization.dto.PersonPageDto;
 import com.xjrsoft.module.organization.dto.UserPageDto;
 import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.vo.PersonPageVo;
 import com.xjrsoft.module.organization.vo.ResetUserPageVo;
 import com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto;
 import com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo;
@@ -25,4 +27,6 @@ public interface UserMapper extends MPJBaseMapper<User> {
     Page<ResetUserPageVo> getResetUserPage(Page<ResetUserPageVo> page, UserPageDto dto);
 
     List<BaseStudentSompleInfoVo> getInfosByParam(@Param("dto") BaseStudentSimpleInfoDto dto);
+
+    Page<PersonPageVo> personPage(Page<PersonPageVo> page, @Param("dto") PersonPageDto dto);
 }

+ 6 - 0
src/main/java/com/xjrsoft/module/organization/service/IUserService.java

@@ -1,15 +1,18 @@
 package com.xjrsoft.module.organization.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.organization.dto.AddUserDto;
 import com.xjrsoft.module.organization.dto.BindOpenidDto;
+import com.xjrsoft.module.organization.dto.PersonPageDto;
 import com.xjrsoft.module.organization.dto.ResetPasswordDto;
 import com.xjrsoft.module.organization.dto.UpdatePasswordDto;
 import com.xjrsoft.module.organization.dto.UpdateUserDto;
 import com.xjrsoft.module.organization.dto.UserPageDto;
 import com.xjrsoft.module.organization.dto.WeChatPageDto;
 import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.vo.PersonPageVo;
 import com.xjrsoft.module.organization.vo.ResetUserPageVo;
 import com.xjrsoft.module.organization.vo.UserInfoVo;
 import com.xjrsoft.module.organization.vo.WeChatPageVO;
@@ -77,4 +80,7 @@ public interface IUserService extends MPJBaseService<User> {
     PageOutput<WeChatPageVO> getPage(WeChatPageDto dto);
 
     PageOutput<ResetUserPageVo> getResetUserPage(UserPageDto dto);
+
+    Page<PersonPageVo> personPage(Page<PersonPageVo> page, PersonPageDto dto);
+
 }

+ 9 - 0
src/main/java/com/xjrsoft/module/organization/service/impl/UserServiceImpl.java

@@ -23,6 +23,7 @@ import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.config.CommonPropertiesConfig;
 import com.xjrsoft.module.organization.dto.AddUserDto;
 import com.xjrsoft.module.organization.dto.BindOpenidDto;
+import com.xjrsoft.module.organization.dto.PersonPageDto;
 import com.xjrsoft.module.organization.dto.ResetPasswordDto;
 import com.xjrsoft.module.organization.dto.UpdatePasswordDto;
 import com.xjrsoft.module.organization.dto.UpdateUserDto;
@@ -38,6 +39,7 @@ import com.xjrsoft.module.organization.mapper.UserPostRelationMapper;
 import com.xjrsoft.module.organization.mapper.UserRoleRelationMapper;
 import com.xjrsoft.module.organization.service.IUserDeptRelationService;
 import com.xjrsoft.module.organization.service.IUserService;
+import com.xjrsoft.module.organization.vo.PersonPageVo;
 import com.xjrsoft.module.organization.vo.ResetUserPageVo;
 import com.xjrsoft.module.organization.vo.UserInfoVo;
 import com.xjrsoft.module.organization.vo.WeChatPageVO;
@@ -362,4 +364,11 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
         PageOutput<ResetUserPageVo> pageOutput = ConventPage.getPageOutput(resetUserPage, ResetUserPageVo.class);
         return pageOutput;
     }
+
+    @Override
+    public Page<PersonPageVo> personPage(Page<PersonPageVo> page, PersonPageDto dto) {
+        Page<PersonPageVo> result = userMapper.personPage(page, dto);
+        return result;
+    }
+
 }

+ 46 - 0
src/main/java/com/xjrsoft/module/organization/vo/PersonPageVo.java

@@ -0,0 +1,46 @@
+package com.xjrsoft.module.organization.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @title: PersonPageVo
+ * @Author dzx
+ * @Date: 2024年8月15日
+ * @Version 1.0
+ */
+@Data
+public class PersonPageVo implements Serializable {
+
+    /**
+     * 主键
+     */
+    @ApiModelProperty("主键")
+    private Long id;
+    /**
+     * 账户
+     */
+    @ApiModelProperty("工号/学号")
+    private String userName;
+
+    /**
+     * 姓名
+     */
+    @ApiModelProperty("姓名")
+    private String name;
+
+    @ApiModelProperty("性别-中文")
+    private String genderCn;
+
+    @ApiModelProperty("手机号")
+    private String mobile;
+
+    @ApiModelProperty("聘用类型")
+    private String employType;
+
+    @ApiModelProperty("聘用方式")
+    private String employWay;
+
+}

+ 29 - 0
src/main/resources/mapper/organization/UserMapper.xml

@@ -37,4 +37,33 @@
             AND t1.id = #{dto.userId}
         </if>
     </select>
+    <select id="personPage" parameterType="com.xjrsoft.module.organization.dto.PersonPageDto" resultType="com.xjrsoft.module.organization.vo.PersonPageVo">
+        SELECT t1.id,t1.name,t1.user_name,t1.mobile,t3.name AS gender_cn,t2.employ_type,t2.employ_way FROM xjr_user t1
+        LEFT JOIN base_teacher t2 ON t1.id = t2.user_id
+        LEFT JOIN xjr_dictionary_detail t3 ON t1.gender = t3.code
+        LEFT JOIN xjr_user_dept_relation t4 ON t1.id = t4.user_id
+        WHERE t1.delete_mark = 0
+        AND (
+            t1.id IN (SELECT user_id FROM base_student WHERE delete_mark = 0)
+            OR t1.id IN (SELECT user_id FROM base_teacher WHERE delete_mark = 0)
+        )
+        <if test="dto.employType != null and dto.employType != ''">
+            AND t2.employ_type = #{dto.employType}
+        </if>
+        <if test="dto.employWay != null and dto.employWay != ''">
+            AND t2.employ_way = #{dto.employWay}
+        </if>
+        <if test="dto.mobile != null and dto.mobile != ''">
+            AND t1.mobile like concat('%', #{dto.mobile}, '%')
+        </if>
+        <if test="dto.userName != null and dto.userName != ''">
+            AND t1.user_name like concat('%', #{dto.userName}, '%')
+        </if>
+        <if test="dto.name != null and dto.name != ''">
+            AND t1.name like concat('%', #{dto.name}, '%')
+        </if>
+        <if test="dto.departmentId != null">
+            AND t4.dept_id = #{dto.departmentId}
+        </if>
+    </select>
 </mapper>