Forráskód Böngészése

用户设置增加生日设置

weifanli 2 éve
szülő
commit
35f99f6609

+ 16 - 0
cooleshow-auth/auth-api/src/main/java/com/yonge/cooleshow/auth/api/dto/UserSetReq.java

@@ -1,8 +1,12 @@
 package com.yonge.cooleshow.auth.api.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.yonge.cooleshow.common.enums.UserGenderEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 /**
  * @Author: liweifan
@@ -16,6 +20,10 @@ public class UserSetReq {
     private String username;
     @ApiModelProperty(value = "性别 0女 1男")
     private Integer gender;
+    @ApiModelProperty(value = "出生日期")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date birthdate;
 
     public String getAvatar() {
         return avatar;
@@ -40,4 +48,12 @@ public class UserSetReq {
     public void setGender(Integer gender) {
         this.gender = gender;
     }
+
+    public Date getBirthdate() {
+        return birthdate;
+    }
+
+    public void setBirthdate(Date birthdate) {
+        this.birthdate = birthdate;
+    }
 }

+ 16 - 0
cooleshow-auth/auth-api/src/main/java/com/yonge/cooleshow/auth/api/vo/UserSetVo.java

@@ -1,7 +1,11 @@
 package com.yonge.cooleshow.auth.api.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 /**
  *
@@ -20,6 +24,10 @@ public class UserSetVo {
     private String phone;
     @ApiModelProperty(value = "是否实名")
     private Boolean real;
+    @ApiModelProperty(value = "出生日期")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date birthdate;
 
     public String getAvatar() {
         return avatar;
@@ -60,4 +68,12 @@ public class UserSetVo {
     public void setReal(Boolean real) {
         this.real = real;
     }
+
+    public Date getBirthdate() {
+        return birthdate;
+    }
+
+    public void setBirthdate(Date birthdate) {
+        this.birthdate = birthdate;
+    }
 }

+ 4 - 0
cooleshow-auth/auth-server/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -233,6 +233,7 @@
             u.username_ as username,
             u.gender_ as gender,
             u.phone_ as phone,
+            u.birthdate_ as birthdate,
             (case when isnull(u.id_card_no_) then 0 else 1 end) as isReal
         FROM sys_user u
         where u.id_ = #{id}
@@ -250,6 +251,9 @@
         <if test="param.gender != null">
             gender_ = #{param.gender},
         </if>
+        <if test="param.birthdate != null">
+            birthdate_ = #{param.birthdate},
+        </if>
         update_time_ = now()
         WHERE id_ = #{id}
     </update>