Commit 72be54da authored by shiyu's avatar shiyu

根据用户id查询

parent 6a15e86b
...@@ -11,7 +11,7 @@ import org.springframework.util.StringUtils; ...@@ -11,7 +11,7 @@ import org.springframework.util.StringUtils;
/** /**
* @author shiyu * @author shiyu
* @date 2023/11/01 * @date 2024/06/06
*/ */
@Data @Data
public class User implements Entity { public class User implements Entity {
...@@ -115,6 +115,11 @@ public class User implements Entity { ...@@ -115,6 +115,11 @@ public class User implements Entity {
*/ */
private String wechatId; private String wechatId;
/**
* 微信二维码
*/
private String wechatQrCode;
/** /**
* 0 可用, 1 禁用, 2 注销 * 0 可用, 1 禁用, 2 注销
*/ */
...@@ -245,6 +250,7 @@ public class User implements Entity { ...@@ -245,6 +250,7 @@ public class User implements Entity {
sb.append(", weixinUnionid=").append(weixinUnionid); sb.append(", weixinUnionid=").append(weixinUnionid);
sb.append(", alipayUserId=").append(alipayUserId); sb.append(", alipayUserId=").append(alipayUserId);
sb.append(", wechatId=").append(wechatId); sb.append(", wechatId=").append(wechatId);
sb.append(", wechatQrCode=").append(wechatQrCode);
sb.append(", status=").append(status); sb.append(", status=").append(status);
sb.append(", addTime=").append(addTime); sb.append(", addTime=").append(addTime);
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);
...@@ -285,6 +291,7 @@ public class User implements Entity { ...@@ -285,6 +291,7 @@ public class User implements Entity {
&& (this.getWeixinUnionid() == null ? other.getWeixinUnionid() == null : this.getWeixinUnionid().equals(other.getWeixinUnionid())) && (this.getWeixinUnionid() == null ? other.getWeixinUnionid() == null : this.getWeixinUnionid().equals(other.getWeixinUnionid()))
&& (this.getAlipayUserId() == null ? other.getAlipayUserId() == null : this.getAlipayUserId().equals(other.getAlipayUserId())) && (this.getAlipayUserId() == null ? other.getAlipayUserId() == null : this.getAlipayUserId().equals(other.getAlipayUserId()))
&& (this.getWechatId() == null ? other.getWechatId() == null : this.getWechatId().equals(other.getWechatId())) && (this.getWechatId() == null ? other.getWechatId() == null : this.getWechatId().equals(other.getWechatId()))
&& (this.getWechatQrCode() == null ? other.getWechatQrCode() == null : this.getWechatQrCode().equals(other.getWechatQrCode()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime())) && (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
...@@ -314,6 +321,7 @@ public class User implements Entity { ...@@ -314,6 +321,7 @@ public class User implements Entity {
result = prime * result + ((getWeixinUnionid() == null) ? 0 : getWeixinUnionid().hashCode()); result = prime * result + ((getWeixinUnionid() == null) ? 0 : getWeixinUnionid().hashCode());
result = prime * result + ((getAlipayUserId() == null) ? 0 : getAlipayUserId().hashCode()); result = prime * result + ((getAlipayUserId() == null) ? 0 : getAlipayUserId().hashCode());
result = prime * result + ((getWechatId() == null) ? 0 : getWechatId().hashCode()); result = prime * result + ((getWechatId() == null) ? 0 : getWechatId().hashCode());
result = prime * result + ((getWechatQrCode() == null) ? 0 : getWechatQrCode().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode()); result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
...@@ -359,6 +367,7 @@ public class User implements Entity { ...@@ -359,6 +367,7 @@ public class User implements Entity {
weixinUnionid("weixin_unionid", "weixinUnionid", "VARCHAR", false), weixinUnionid("weixin_unionid", "weixinUnionid", "VARCHAR", false),
alipayUserId("alipay_user_id", "alipayUserId", "VARCHAR", false), alipayUserId("alipay_user_id", "alipayUserId", "VARCHAR", false),
wechatId("wechat_id", "wechatId", "VARCHAR", false), wechatId("wechat_id", "wechatId", "VARCHAR", false),
wechatQrCode("wechat_qr_code", "wechatQrCode", "VARCHAR", false),
status("status", "status", "TINYINT", true), status("status", "status", "TINYINT", true),
addTime("add_time", "addTime", "TIMESTAMP", false), addTime("add_time", "addTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false), updateTime("update_time", "updateTime", "TIMESTAMP", false),
......
...@@ -2539,6 +2539,148 @@ public class UserExample { ...@@ -2539,6 +2539,148 @@ public class UserExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andWechatQrCodeIsNull() {
addCriterion("wechat_qr_code is null");
return (Criteria) this;
}
public Criteria andWechatQrCodeIsNotNull() {
addCriterion("wechat_qr_code is not null");
return (Criteria) this;
}
public Criteria andWechatQrCodeEqualTo(String value) {
addCriterion("wechat_qr_code =", value, "wechatQrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andWechatQrCodeEqualToColumn(User.Column column) {
addCriterion(new StringBuilder("wechat_qr_code = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andWechatQrCodeNotEqualTo(String value) {
addCriterion("wechat_qr_code <>", value, "wechatQrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andWechatQrCodeNotEqualToColumn(User.Column column) {
addCriterion(new StringBuilder("wechat_qr_code <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andWechatQrCodeGreaterThan(String value) {
addCriterion("wechat_qr_code >", value, "wechatQrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andWechatQrCodeGreaterThanColumn(User.Column column) {
addCriterion(new StringBuilder("wechat_qr_code > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andWechatQrCodeGreaterThanOrEqualTo(String value) {
addCriterion("wechat_qr_code >=", value, "wechatQrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andWechatQrCodeGreaterThanOrEqualToColumn(User.Column column) {
addCriterion(new StringBuilder("wechat_qr_code >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andWechatQrCodeLessThan(String value) {
addCriterion("wechat_qr_code <", value, "wechatQrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andWechatQrCodeLessThanColumn(User.Column column) {
addCriterion(new StringBuilder("wechat_qr_code < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andWechatQrCodeLessThanOrEqualTo(String value) {
addCriterion("wechat_qr_code <=", value, "wechatQrCode");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andWechatQrCodeLessThanOrEqualToColumn(User.Column column) {
addCriterion(new StringBuilder("wechat_qr_code <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andWechatQrCodeLike(String value) {
addCriterion("wechat_qr_code like", value, "wechatQrCode");
return (Criteria) this;
}
public Criteria andWechatQrCodeNotLike(String value) {
addCriterion("wechat_qr_code not like", value, "wechatQrCode");
return (Criteria) this;
}
public Criteria andWechatQrCodeIn(List<String> values) {
addCriterion("wechat_qr_code in", values, "wechatQrCode");
return (Criteria) this;
}
public Criteria andWechatQrCodeNotIn(List<String> values) {
addCriterion("wechat_qr_code not in", values, "wechatQrCode");
return (Criteria) this;
}
public Criteria andWechatQrCodeBetween(String value1, String value2) {
addCriterion("wechat_qr_code between", value1, value2, "wechatQrCode");
return (Criteria) this;
}
public Criteria andWechatQrCodeNotBetween(String value1, String value2) {
addCriterion("wechat_qr_code not between", value1, value2, "wechatQrCode");
return (Criteria) this;
}
public Criteria andStatusIsNull() { public Criteria andStatusIsNull() {
addCriterion("`status` is null"); addCriterion("`status` is null");
return (Criteria) this; return (Criteria) this;
......
...@@ -7,7 +7,7 @@ import lombok.Data; ...@@ -7,7 +7,7 @@ import lombok.Data;
public class UserRequestDto implements Entity { public class UserRequestDto implements Entity {
private String user; private String user;
private Long id;
// 用户id // 用户id
private Long userId; private Long userId;
// 手机号 // 手机号
...@@ -55,7 +55,10 @@ public class UserRequestDto implements Entity { ...@@ -55,7 +55,10 @@ public class UserRequestDto implements Entity {
* 备注 * 备注
*/ */
private String remark; private String remark;
/**
* 微信二维码
*/
private String wechatQrCode;
/** /**
* 玩物得志登录后token * 玩物得志登录后token
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<result column="weixin_unionid" jdbcType="VARCHAR" property="weixinUnionid" /> <result column="weixin_unionid" jdbcType="VARCHAR" property="weixinUnionid" />
<result column="alipay_user_id" jdbcType="VARCHAR" property="alipayUserId" /> <result column="alipay_user_id" jdbcType="VARCHAR" property="alipayUserId" />
<result column="wechat_id" jdbcType="VARCHAR" property="wechatId" /> <result column="wechat_id" jdbcType="VARCHAR" property="wechatId" />
<result column="wechat_qr_code" jdbcType="VARCHAR" property="wechatQrCode" />
<result column="status" jdbcType="TINYINT" property="status" /> <result column="status" jdbcType="TINYINT" property="status" />
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" /> <result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
...@@ -87,7 +88,8 @@ ...@@ -87,7 +88,8 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level, id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id, nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time, update_time, deleted, share_user_id, remark wechat_id, wechat_qr_code, `status`, add_time, update_time, deleted, share_user_id,
remark
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.UserExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.UserExample" resultMap="BaseResultMap">
select select
...@@ -124,7 +126,8 @@ ...@@ -124,7 +126,8 @@
<otherwise> <otherwise>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level, id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id, nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time, update_time, deleted, share_user_id, remark wechat_id, wechat_qr_code, `status`, add_time, update_time, deleted, share_user_id,
remark
</otherwise> </otherwise>
</choose> </choose>
from user from user
...@@ -177,7 +180,8 @@ ...@@ -177,7 +180,8 @@
<otherwise> <otherwise>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level, id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id, nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time, update_time, deleted, share_user_id, remark wechat_id, wechat_qr_code, `status`, add_time, update_time, deleted, share_user_id,
remark
</otherwise> </otherwise>
</choose> </choose>
from user from user
...@@ -202,17 +206,17 @@ ...@@ -202,17 +206,17 @@
user_level, nickname, mobile, user_level, nickname, mobile,
avatar, profile, background, avatar, profile, background,
weixin_openid, weixin_unionid, alipay_user_id, weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time, wechat_id, wechat_qr_code, `status`,
update_time, deleted, share_user_id, add_time, update_time, deleted,
remark) share_user_id, remark)
values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT}, values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT},
#{birthday,jdbcType=DATE}, #{lastLoginTime,jdbcType=TIMESTAMP}, #{lastLoginIp,jdbcType=VARCHAR}, #{birthday,jdbcType=DATE}, #{lastLoginTime,jdbcType=TIMESTAMP}, #{lastLoginIp,jdbcType=VARCHAR},
#{userLevel,jdbcType=TINYINT}, #{nickname,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{userLevel,jdbcType=TINYINT}, #{nickname,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR},
#{avatar,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR}, #{background,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR}, #{background,jdbcType=VARCHAR},
#{weixinOpenid,jdbcType=VARCHAR}, #{weixinUnionid,jdbcType=VARCHAR}, #{alipayUserId,jdbcType=VARCHAR}, #{weixinOpenid,jdbcType=VARCHAR}, #{weixinUnionid,jdbcType=VARCHAR}, #{alipayUserId,jdbcType=VARCHAR},
#{wechatId,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{addTime,jdbcType=TIMESTAMP}, #{wechatId,jdbcType=VARCHAR}, #{wechatQrCode,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT},
#{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{shareUserId,jdbcType=BIGINT}, #{addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT},
#{remark,jdbcType=VARCHAR}) #{shareUserId,jdbcType=BIGINT}, #{remark,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertBySelfId" parameterType="com.wwdz.ch.db.domain.User"> <insert id="insertBySelfId" parameterType="com.wwdz.ch.db.domain.User">
...@@ -221,7 +225,7 @@ ...@@ -221,7 +225,7 @@
user_level, nickname, mobile, user_level, nickname, mobile,
avatar, profile, background, avatar, profile, background,
weixin_openid, weixin_unionid, alipay_user_id, weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time, wechat_id, wechat_qr_code,`status`, add_time,
update_time, deleted, share_user_id, update_time, deleted, share_user_id,
remark) remark)
values (#{id,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT}, values (#{id,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT},
...@@ -229,7 +233,7 @@ ...@@ -229,7 +233,7 @@
#{userLevel,jdbcType=TINYINT}, #{nickname,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{userLevel,jdbcType=TINYINT}, #{nickname,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR},
#{avatar,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR}, #{background,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR}, #{background,jdbcType=VARCHAR},
#{weixinOpenid,jdbcType=VARCHAR}, #{weixinUnionid,jdbcType=VARCHAR}, #{alipayUserId,jdbcType=VARCHAR}, #{weixinOpenid,jdbcType=VARCHAR}, #{weixinUnionid,jdbcType=VARCHAR}, #{alipayUserId,jdbcType=VARCHAR},
#{wechatId,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{addTime,jdbcType=TIMESTAMP}, #{wechatId,jdbcType=VARCHAR}, #{wechatQrCode,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{addTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{shareUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{shareUserId,jdbcType=BIGINT},
#{remark,jdbcType=VARCHAR}) #{remark,jdbcType=VARCHAR})
</insert> </insert>
...@@ -289,6 +293,9 @@ ...@@ -289,6 +293,9 @@
<if test="wechatId != null"> <if test="wechatId != null">
wechat_id, wechat_id,
</if> </if>
<if test="wechatQrCode != null">
wechat_qr_code,
</if>
<if test="status != null"> <if test="status != null">
`status`, `status`,
</if> </if>
...@@ -357,6 +364,9 @@ ...@@ -357,6 +364,9 @@
<if test="wechatId != null"> <if test="wechatId != null">
#{wechatId,jdbcType=VARCHAR}, #{wechatId,jdbcType=VARCHAR},
</if> </if>
<if test="wechatQrCode != null">
#{wechatQrCode,jdbcType=VARCHAR},
</if>
<if test="status != null"> <if test="status != null">
#{status,jdbcType=TINYINT}, #{status,jdbcType=TINYINT},
</if> </if>
...@@ -437,6 +447,9 @@ ...@@ -437,6 +447,9 @@
<if test="record.wechatId != null"> <if test="record.wechatId != null">
wechat_id = #{record.wechatId,jdbcType=VARCHAR}, wechat_id = #{record.wechatId,jdbcType=VARCHAR},
</if> </if>
<if test="record.wechatQrCode != null">
wechat_qr_code = #{record.wechatQrCode,jdbcType=VARCHAR},
</if>
<if test="record.status != null"> <if test="record.status != null">
`status` = #{record.status,jdbcType=TINYINT}, `status` = #{record.status,jdbcType=TINYINT},
</if> </if>
...@@ -479,6 +492,7 @@ ...@@ -479,6 +492,7 @@
weixin_unionid = #{record.weixinUnionid,jdbcType=VARCHAR}, weixin_unionid = #{record.weixinUnionid,jdbcType=VARCHAR},
alipay_user_id = #{record.alipayUserId,jdbcType=VARCHAR}, alipay_user_id = #{record.alipayUserId,jdbcType=VARCHAR},
wechat_id = #{record.wechatId,jdbcType=VARCHAR}, wechat_id = #{record.wechatId,jdbcType=VARCHAR},
wechat_qr_code = #{record.wechatQrCode,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=TINYINT}, `status` = #{record.status,jdbcType=TINYINT},
add_time = #{record.addTime,jdbcType=TIMESTAMP}, add_time = #{record.addTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
...@@ -540,6 +554,9 @@ ...@@ -540,6 +554,9 @@
<if test="wechatId != null"> <if test="wechatId != null">
wechat_id = #{wechatId,jdbcType=VARCHAR}, wechat_id = #{wechatId,jdbcType=VARCHAR},
</if> </if>
<if test="wechatQrCode != null">
wechat_qr_code = #{wechatQrCode,jdbcType=VARCHAR},
</if>
<if test="status != null"> <if test="status != null">
`status` = #{status,jdbcType=TINYINT}, `status` = #{status,jdbcType=TINYINT},
</if> </if>
...@@ -579,6 +596,7 @@ ...@@ -579,6 +596,7 @@
weixin_unionid = #{weixinUnionid,jdbcType=VARCHAR}, weixin_unionid = #{weixinUnionid,jdbcType=VARCHAR},
alipay_user_id = #{alipayUserId,jdbcType=VARCHAR}, alipay_user_id = #{alipayUserId,jdbcType=VARCHAR},
wechat_id = #{wechatId,jdbcType=VARCHAR}, wechat_id = #{wechatId,jdbcType=VARCHAR},
wechat_qr_code = #{wechatQrCode,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT}, `status` = #{status,jdbcType=TINYINT},
add_time = #{addTime,jdbcType=TIMESTAMP}, add_time = #{addTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
...@@ -622,7 +640,8 @@ ...@@ -622,7 +640,8 @@
<otherwise> <otherwise>
id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level, id, username, `password`, gender, birthday, last_login_time, last_login_ip, user_level,
nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id, nickname, mobile, avatar, profile, background, weixin_openid, weixin_unionid, alipay_user_id,
wechat_id, `status`, add_time, update_time, deleted, share_user_id, remark wechat_id, wechat_qr_code, `status`, add_time, update_time, deleted, share_user_id,
remark
</otherwise> </otherwise>
</choose> </choose>
from user from user
...@@ -654,5 +673,4 @@ ...@@ -654,5 +673,4 @@
update user set deleted = 1 update user set deleted = 1
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
package com.wwdz.ch.wx.dao; package com.wwdz.ch.wx.dao;
import com.wwdz.ch.core.consts.FollowFansEnum;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -54,5 +55,18 @@ public class UserInfo implements Serializable { ...@@ -54,5 +55,18 @@ public class UserInfo implements Serializable {
private Integer returnOrderNumber; private Integer returnOrderNumber;
/**
* 关系(已关注,互相关注,未关注)
*/
private String relation;
/**
* 关系(已关注,互相关注,未关注)
*/
private Integer relationCode;
/**
* 微信二维码
*/
private String wechatQrCode;
} }
...@@ -282,12 +282,16 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService { ...@@ -282,12 +282,16 @@ public class FollowFansRecordServiceImpl implements FollowFansRecordService {
//查询当前用户关注的人 //查询当前用户关注的人
FollowFansRecordRequestDto currentFollowDto = new FollowFansRecordRequestDto(); FollowFansRecordRequestDto currentFollowDto = new FollowFansRecordRequestDto();
currentFollowDto.setFansId(dto.getCurrentUserId()); currentFollowDto.setFansId(dto.getCurrentUserId());
currentFollowDto.setPage(1);
currentFollowDto.setLimit(9999);
List<FollowFansRecord> currentFollowFansRecordList = followFansRecordDao.findList(currentFollowDto); List<FollowFansRecord> currentFollowFansRecordList = followFansRecordDao.findList(currentFollowDto);
List<Long> currentFollowIdList = currentFollowFansRecordList.stream().map(FollowFansRecord::getFollowerId).collect(Collectors.toList()); List<Long> currentFollowIdList = currentFollowFansRecordList.stream().map(FollowFansRecord::getFollowerId).collect(Collectors.toList());
//查询当前用户的粉丝 //查询当前用户的粉丝
FollowFansRecordRequestDto currentFansDto = new FollowFansRecordRequestDto(); FollowFansRecordRequestDto currentFansDto = new FollowFansRecordRequestDto();
currentFansDto.setFollowerId(dto.getCurrentUserId()); currentFansDto.setFollowerId(dto.getCurrentUserId());
currentFansDto.setPage(1);
currentFansDto.setLimit(9999);
List<FollowFansRecord> currentFansRecordList = followFansRecordDao.findList(currentFansDto); List<FollowFansRecord> currentFansRecordList = followFansRecordDao.findList(currentFansDto);
List<Long> currentFansIdList = currentFansRecordList.stream().map(FollowFansRecord::getFansId).collect(Collectors.toList()); List<Long> currentFansIdList = currentFansRecordList.stream().map(FollowFansRecord::getFansId).collect(Collectors.toList());
......
...@@ -19,6 +19,7 @@ import com.wwdz.ch.core.util.bcrypt.BCryptPasswordEncoder; ...@@ -19,6 +19,7 @@ import com.wwdz.ch.core.util.bcrypt.BCryptPasswordEncoder;
import com.wwdz.ch.db.dao.*; import com.wwdz.ch.db.dao.*;
import com.wwdz.ch.db.dao.distribution.ShopWhiteListDao; import com.wwdz.ch.db.dao.distribution.ShopWhiteListDao;
import com.wwdz.ch.db.domain.AiAssistant; import com.wwdz.ch.db.domain.AiAssistant;
import com.wwdz.ch.db.domain.FollowFansRecord;
import com.wwdz.ch.db.domain.Switch; import com.wwdz.ch.db.domain.Switch;
import com.wwdz.ch.db.domain.User; import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.db.domain.distribution.ShopWhiteList; import com.wwdz.ch.db.domain.distribution.ShopWhiteList;
...@@ -539,6 +540,29 @@ public class UserServiceImpl implements UserService { ...@@ -539,6 +540,29 @@ public class UserServiceImpl implements UserService {
} }
} }
@Override
public Result updateQrCode(UserRequestDto dto) {
try {
User user = userDao.queryById(dto.getUserId());
if (Objects.isNull(user)) {
return Result.failed("数据异常,用户不存在");
}
user.setWechatQrCode(dto.getWechatQrCode());
userDao.updateById(user);
// 更新用户缓存
User resultUser = userDao.queryById(user.getId());
String userKey = MessageFormat.format(CacheCodeConstants.USER_INFO_KEY, user.getId());
redisUtil.set(userKey, resultUser, 2 * 60 * 60);
logger.info("【请求结束】用户修改微信二维码成功");
return Result.success();
} catch (Exception e) {
logger.error("用户修改微信二维码失败", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return Result.failed("用户修改微信二维码失败");
}
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public Result updateMobile(UserRequestDto dto) { public Result updateMobile(UserRequestDto dto) {
...@@ -824,4 +848,38 @@ public class UserServiceImpl implements UserService { ...@@ -824,4 +848,38 @@ public class UserServiceImpl implements UserService {
return result; return result;
} }
@Override
public Result findById(UserRequestDto dto) {
try {
User user = userDao.queryById(dto.getId());
if (user == null) {
return Result.failed("查询不到该用户信息");
}
UserInfo userInfo = new UserInfo();
userInfo.setUserId(dto.getUserId());
userInfo.setNickName(user.getNickname());
userInfo.setAvatarUrl(user.getAvatar());
userInfo.setProfile(user.getProfile());
userInfo.setBackground(user.getBackground());
userInfo.setIsFollowed(false);
userInfo.setFollowedId(null);
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(dto.getId());
followFansRecordRequestDto.setFansId(dto.getUserId());
Result result = followFansRecordService.findFollowRelation(followFansRecordRequestDto);
if (result.getSuccess()) {
HashMap<String, Object> map = (HashMap<String, Object>) result.getData();
userInfo.setIsFollowed((Boolean) map.get("isFollowed"));
if (Objects.nonNull(map.get("id"))) {
userInfo.setFollowedId((Integer) map.get("id"));
}
}
return Result.success(userInfo);
} catch (Exception e) {
logger.error("查询用户信息失败", e);
return Result.failed("查询用户信息失败");
}
}
} }
...@@ -74,6 +74,8 @@ public interface UserService { ...@@ -74,6 +74,8 @@ public interface UserService {
*/ */
Result updateAvatar(UserRequestDto dto); Result updateAvatar(UserRequestDto dto);
Result updateQrCode(UserRequestDto dto);
/** /**
* 修改手机号 * 修改手机号
* *
...@@ -115,4 +117,6 @@ public interface UserService { ...@@ -115,4 +117,6 @@ public interface UserService {
* @return * @return
*/ */
Result pageViews(UserRequestDto dto); Result pageViews(UserRequestDto dto);
Result findById(UserRequestDto dto);
} }
...@@ -191,6 +191,21 @@ public class WxUserController { ...@@ -191,6 +191,21 @@ public class WxUserController {
return userService.regCaptcha(dto); return userService.regCaptcha(dto);
} }
@ApiOperation(value = "上传微信二维码")
@PostMapping("/updateQrCode")
public Result updateQrCode(@RequestBody UserRequestDto dto) {
logger.info("【请求开始】修改头像,请求参数:{}", JSON.toJSONString(true));
if (Objects.isNull(dto.getUserId()) || dto.getUserId().equals(0L)) {
return Result.failed("用户id不能为空");
}
if (StringUtils.isBlank(dto.getWechatQrCode())) {
return Result.failed("请微信二维码");
}
return userService.updateQrCode(dto);
}
@ApiOperation(value = "修改手机号") @ApiOperation(value = "修改手机号")
@PostMapping("/updateMobile") @PostMapping("/updateMobile")
public Result updateMobile(@RequestBody UserRequestDto dto) { public Result updateMobile(@RequestBody UserRequestDto dto) {
...@@ -230,4 +245,12 @@ public class WxUserController { ...@@ -230,4 +245,12 @@ public class WxUserController {
logger.info("【请求开始】查询关注粉丝浏览量,请求参数:{}", JSON.toJSONString(dto)); logger.info("【请求开始】查询关注粉丝浏览量,请求参数:{}", JSON.toJSONString(dto));
return userService.pageViews(dto); return userService.pageViews(dto);
} }
@ApiOperation(value = "根据用户id查询用户信息")
@PostMapping("/findById")
public Result findById(@RequestBody UserRequestDto dto) {
logger.info("【请求开始】根据用户id查询用户信息,请求参数:{}", JSON.toJSONString(dto));
return userService.findById(dto);
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment