mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🎨 #1580 企业微信成员信息里性别字段枚举类增加0值
This commit is contained in:
parent
d650bb64e6
commit
8bb6b02cba
@ -1,5 +1,8 @@
|
|||||||
package me.chanjar.weixin.cp.bean;
|
package me.chanjar.weixin.cp.bean;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* 性别枚举
|
* 性别枚举
|
||||||
@ -8,7 +11,13 @@ package me.chanjar.weixin.cp.bean;
|
|||||||
*
|
*
|
||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
public enum Gender {
|
public enum Gender {
|
||||||
|
/**
|
||||||
|
* 未定义
|
||||||
|
*/
|
||||||
|
UNDEFINED("未定义", "0"),
|
||||||
/**
|
/**
|
||||||
* 男
|
* 男
|
||||||
*/
|
*/
|
||||||
@ -18,28 +27,14 @@ public enum Gender {
|
|||||||
*/
|
*/
|
||||||
FEMALE("女", "2");
|
FEMALE("女", "2");
|
||||||
|
|
||||||
private String genderName;
|
private final String genderName;
|
||||||
private String code;
|
private final String code;
|
||||||
|
|
||||||
Gender(String genderName, String code) {
|
|
||||||
this.genderName = genderName;
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGenderName() {
|
|
||||||
return this.genderName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Gender fromCode(String code) {
|
public static Gender fromCode(String code) {
|
||||||
if ("1".equals(code)) {
|
for(Gender a: Gender.values()){
|
||||||
return Gender.MALE;
|
if(a.code.equals(code)){
|
||||||
}
|
return a;
|
||||||
if ("2".equals(code)) {
|
}
|
||||||
return Gender.FEMALE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user