feat:优化信息

This commit is contained in:
henry
2021-11-23 09:38:59 +08:00
parent 7eacb35ae8
commit ee5a4b9cf6
5 changed files with 10 additions and 2 deletions

View File

@ -52,7 +52,7 @@ func (m *SysMenu) UserMenu(uid uint64) ([]*SysMenuScene, error) {
db := orm.GetDB().Table(mSysUserRole.TableName()+" AS u_r").
Select("m.id, m.parent_id, m.name, m.kind, m.link, m.component, m.icon, 1 AS scene_id").
Joins(fmt.Sprintf("LEFT JOIN %s AS r_m ON u_r.role_id = r_m.id AND r_m.is_deleted = %d",
Joins(fmt.Sprintf("LEFT JOIN %s AS r_m ON u_r.role_id = r_m.role_id AND r_m.is_deleted = %d",
mSysRoleMenu.TableName(), model.DeleteStatusForNot)).
Joins(fmt.Sprintf("LEFT JOIN %s AS m ON r_m.menu_id = m.id AND m.status = %d AND m.is_deleted = %d",
m.TableName(), model.SysMenuStatusForNormal, model.DeleteStatusForNot)).

View File

@ -32,7 +32,9 @@ func (m *SysUser) IsAdminUser() bool {
}
func (m *SysUser) GetByAccountOrMobile(param string) (bool, error) {
db := orm.GetDB().Table(m.TableName()).Where("(account = ? OR mobile = ?)", param, param).
db := orm.GetDB().Table(m.TableName()).Select("id", "tenant_id", "uuid", "name", "account", "avatar", "mobile",
"password", "salt", "is_admin", "status").
Where("(account = ? OR mobile = ?)", param, param).
Where("is_deleted = ?", model.DeleteStatusForNot)
if err := db.First(m.SysUser).Error; err != nil {