feat:完善项目信息

This commit is contained in:
henry
2022-01-07 16:12:43 +08:00
parent 657fdc5750
commit 2bf3c01702
21 changed files with 379 additions and 129 deletions

View File

@ -38,7 +38,8 @@ func (m *SysUser) GetByAccountOrMobile(account string, tenantID uint64) (bool, e
db := orm.GetDB().Table(m.TableName()).
Select("id", "uuid", "tenant_id", "name", "mobile", "password", "salt", "is_admin", "status").
Where("tenant_id = ?", tenantID).
Where("(account = ? OR mobile = ?)", account, account).
//Where("(email = ? OR mobile = ?)", account, account).
Where("mobile = ?", account).
Where("is_deleted = ?", model.DeleteStatusForNot)
if err := db.First(m.SysUser).Error; err != nil {
@ -50,6 +51,23 @@ func (m *SysUser) GetByAccountOrMobile(account string, tenantID uint64) (bool, e
return true, nil
}
func (m *SysUser) CheckByAccountOrMobile(account string, tenantID uint64) (bool, error) {
db := orm.GetDB().Table(m.TableName()).
Where("tenant_id = ?", tenantID).
Where("(account = ? OR mobile = ?)", account, account).
Where("is_deleted = ?", model.DeleteStatusForNot)
var count int64
if err := db.Count(&count).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return false, nil
}
return false, err
}
return true, nil
}
// Users 用户信息
func (m *SysUser) Users(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*SysUserInfo, error) {
db := orm.GetDB().Table(m.TableName()+" AS u").