用户完善情况搜索,算一算价格修改
This commit is contained in:
+19
-9
@@ -184,15 +184,25 @@ func (r *UserDao) GetUserPageSearch(req requests.GetUserPage, page, pageSize int
|
||||
|
||||
// 信息完善状态
|
||||
if req.IsInfoComplete != nil {
|
||||
subQuery := global.Db.Model(&model.UserInfo{}).
|
||||
Where("user_info.user_id = user.user_id").
|
||||
Where("user_info.height != '' ").
|
||||
Where("user_info.weight != '' ").
|
||||
Where("user_info.is_family_history is not NULL").
|
||||
Where("user_info.province_id is not NULL").
|
||||
Select("1")
|
||||
|
||||
query = query.Where("EXISTS (?)", subQuery)
|
||||
if *req.IsInfoComplete == true {
|
||||
subQuery := global.Db.Model(&model.UserInfo{}).
|
||||
Where("user_info.user_id = user.user_id").
|
||||
Where("user_info.height != '' ").
|
||||
Where("user_info.weight != '' ").
|
||||
Where("user_info.is_family_history is not NULL").
|
||||
Where("user_info.province_id is not NULL").
|
||||
Select("1")
|
||||
query = query.Where("EXISTS (?)", subQuery)
|
||||
} else {
|
||||
subQuery := global.Db.Model(&model.UserInfo{}).
|
||||
Where("user_info.user_id = user.user_id").
|
||||
Or("user_info.height = '' ").
|
||||
Or("user_info.weight = '' ").
|
||||
Or("user_info.is_family_history is NULL").
|
||||
Or("user_info.province_id is NULL").
|
||||
Select("1")
|
||||
query = query.Where("EXISTS (?)", subQuery)
|
||||
}
|
||||
}
|
||||
|
||||
// 排序
|
||||
|
||||
Reference in New Issue
Block a user