Skip to content

Commit

Permalink
解决搜索用户时返回用户类型问题
Browse files Browse the repository at this point in the history
  • Loading branch information
heavyrian2012 committed Jul 8, 2023
1 parent 57314e6 commit 45b1b9c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions broker/src/main/java/io/moquette/persistence/DatabaseStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ List<WFCMessage.User> searchUserByNameMobile(String keyword, int searchType, int
", `_company`" +
", `_social`" +
", `_extra`" +
", `_dt` from t_user";
", `_dt`, `_type` from t_user";

if(searchType == SearchUserType_Name) {
sql += " where `_name` = ? ";
Expand Down Expand Up @@ -258,6 +258,9 @@ List<WFCMessage.User> searchUserByNameMobile(String keyword, int searchType, int
long longValue = rs.getLong(index++);
builder.setUpdateDt(longValue);

int type = rs.getInt(index++);
builder.setType( type);

WFCMessage.User user = builder.build();

out.add(user);
Expand Down Expand Up @@ -321,7 +324,7 @@ List<WFCMessage.User> searchUserByDisplayName(String keyword, int page) {

try {
connection = DBUtil.getConnection();
String sql = "select u._uid, u._name, u._display_name, u._portrait, u._mobile, u._gender, u._email, u._address, u._company, u._social, u._extra, u._dt " +
String sql = "select u._uid, u._name, u._display_name, u._portrait, u._mobile, u._gender, u._email, u._address, u._company, u._social, u._extra, u._dt, u._type " +
" from t_user u left join (select _uid, _value from t_user_setting where _scope = 27) s on u._uid = s._uid " +
" where u._display_name like ? and u._type <> 2 and u._deleted = 0 and (s._value is null or (s._value <> 1 and s._value <> 3 and s._value <> 5 and s._value <> 7)) limit 20";

Expand Down Expand Up @@ -382,6 +385,9 @@ List<WFCMessage.User> searchUserByDisplayName(String keyword, int page) {
long longValue = rs.getLong(index++);
builder.setUpdateDt(longValue);

int type = rs.getInt(index++);
builder.setType(type);

WFCMessage.User user = builder.build();

out.add(user);
Expand Down

0 comments on commit 45b1b9c

Please sign in to comment.