Browse Source

调整性别数据

dzx 1 năm trước cách đây
mục cha
commit
ff8f01e539

+ 39 - 0
src/main/java/com/xjrsoft/common/enums/GenderDictionaryEnum.java

@@ -0,0 +1,39 @@
+package com.xjrsoft.common.enums;
+
+public enum GenderDictionaryEnum {
+    /**
+     * 男
+     */
+    MALE("SB10001", "男"),
+    /**
+     * 女
+     */
+    FEMALE("SB10002", "女");
+
+    final String code;
+    final String value;
+
+    public String getCode() {
+        return this.code;
+    }
+
+    public String getValue() {
+        return this.value;
+    }
+
+    public static String getValue(String code) {
+        for (GenderDictionaryEnum item : values()) {
+            if (item.getCode().equals(code)) {
+                return  item.getValue();
+            }
+        }
+        return null;
+    }
+
+    GenderDictionaryEnum(final String code, final String message) {
+        this.code = code;
+        this.value = message;
+    }
+
+
+}

+ 4 - 0
src/main/java/com/xjrsoft/module/organization/controller/RoleController.java

@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.xjrsoft.common.annotation.XjrLog;
 import com.xjrsoft.common.constant.GlobalConstant;
+import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.enums.YesOrNoEnum;
 import com.xjrsoft.common.model.result.R;
 import com.xjrsoft.common.page.ConventPage;
@@ -177,6 +178,9 @@ public class RoleController {
         List<Long> userIds = list.stream().map(UserRoleRelation::getUserId).collect(Collectors.toList());
         List<User> users = userService.list(Wrappers.<User>query().lambda().in(User::getId, userIds).select(User.class, x -> VoToColumnUtil.fieldsToColumns(UserRoleVo.class).contains(x.getProperty())));
         List<UserRoleVo> userRoleVos = BeanUtil.copyToList(users, UserRoleVo.class);
+        for (UserRoleVo userRoleVo : userRoleVos) {
+            userRoleVo.setGenderCn(GenderDictionaryEnum.getValue(userRoleVo.getGender()));
+        }
         return R.ok(userRoleVos);
 
     }

+ 9 - 1
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -13,6 +13,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.constant.GlobalConstant;
 import com.xjrsoft.common.enums.EnabledMark;
+import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.enums.RoleEnum;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.model.result.R;
@@ -30,6 +31,7 @@ import com.xjrsoft.module.organization.service.*;
 import com.xjrsoft.module.organization.utils.OrganizationUtil;
 import com.xjrsoft.module.organization.vo.*;
 import com.xjrsoft.module.oss.factory.OssFactory;
+import com.xjrsoft.module.system.entity.DictionaryDetail;
 import com.xjrsoft.module.workflow.service.IWorkflowExecuteService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -136,7 +138,9 @@ public class UserController {
                     .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, User::getId)
                     .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId);
             IPage<UserPageVo> page = userService.selectJoinListPage(ConventPage.getPage(dto), UserPageVo.class, queryUser);
-
+            for (UserPageVo record : page.getRecords()) {
+                record.setGenderCn(GenderDictionaryEnum.getValue(record.getGender()));
+            }
 
             PageOutput<UserPageVo> pageOutput = ConventPage.getPageOutput(page, UserPageVo.class);
 
@@ -171,6 +175,9 @@ public class UserController {
                             .leftJoin(UserRoleRelation.class, UserRoleRelation::getUserId, User::getId)
                             .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId);
             IPage<UserPageVo> page = userService.selectJoinListPage(ConventPage.getPage(dto), UserPageVo.class,queryUser);
+            for (UserPageVo record : page.getRecords()) {
+                record.setGenderCn(GenderDictionaryEnum.getValue(record.getGender()));
+            }
             PageOutput<UserPageVo> pageOutput = ConventPage.getPageOutput(page, UserPageVo.class);
             return R.ok(pageOutput);
         }
@@ -184,6 +191,7 @@ public class UserController {
             R.error("找不到此用户!");
         }
         UserVo userVo = BeanUtil.toBean(user, UserVo.class);
+        userVo.setGenderCn(GenderDictionaryEnum.getValue(userVo.getGender()));
         List<Long> deptIds = userDeptRelationService.list(Wrappers.lambdaQuery(UserDeptRelation.class)
                         .eq(UserDeptRelation::getUserId, user.getId()))
                 .stream().map(UserDeptRelation::getDeptId).collect(Collectors.toList());

+ 6 - 1
src/main/java/com/xjrsoft/module/organization/vo/UserPageVo.java

@@ -43,7 +43,12 @@ public class UserPageVo implements Serializable {
     /**
      * 性别
      */
-    private Integer gender;
+    private String gender;
+
+    /**
+     * 性别中文
+     */
+    private String genderCn;
 
     /**
      * 手机号

+ 6 - 1
src/main/java/com/xjrsoft/module/organization/vo/UserRoleVo.java

@@ -21,5 +21,10 @@ public class UserRoleVo {
      */
     private String code;
 
-    private Integer gender;
+    private String gender;
+
+    /**
+     * 性别中文
+     */
+    private String genderCn;
 }

+ 6 - 1
src/main/java/com/xjrsoft/module/organization/vo/UserVo.java

@@ -41,7 +41,12 @@ public class UserVo implements Serializable {
     /**
      * 性别
      */
-    private Integer gender;
+    private String gender;
+
+    /**
+     * 性别中文
+     */
+    private String genderCn;
 
     /**
      * 手机号

+ 4 - 1
src/main/java/com/xjrsoft/module/student/controller/StudentManagerController.java

@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.yulichang.toolkit.MPJWrappers;
+import com.xjrsoft.common.enums.GenderDictionaryEnum;
 import com.xjrsoft.common.model.result.R;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
@@ -118,7 +119,9 @@ public class StudentManagerController {
         if (baseStudentUser == null) {
             return R.error("找不到此数据!");
         }
-        return R.ok(BeanUtil.toBean(baseStudentUser, BaseStudentUserVo.class));
+        BaseStudentUserVo userVo = BeanUtil.toBean(baseStudentUser, BaseStudentUserVo.class);
+        userVo.setGenderCn(GenderDictionaryEnum.getValue(userVo.getGender()));
+        return R.ok(userVo);
     }
 
 

+ 8 - 1
src/main/java/com/xjrsoft/module/student/vo/BaseStudentUserVo.java

@@ -36,7 +36,14 @@ public class BaseStudentUserVo {
      * 性别
      */
     @ApiModelProperty("性别")
-    private Integer gender;
+    private String gender;
+
+    /**
+     * 性别中文
+     */
+    @ApiModelProperty("性别中文")
+    private String genderCn;
+
     /**
      * 手机号
      */