|
|
@@ -18,7 +18,7 @@ func NewUserRepo(engine *xorm.Engine) *UserRepo {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-func (d *UserRepo) GetById(ocId int64, userId int64)(*viewmodels.UserInfo, error){
|
|
|
+func (d *UserRepo) GetById(ocId, groupId, userId int64)(*viewmodels.UserInfo, error){
|
|
|
sqlSelect := ` SELECT A.gm_id,
|
|
|
A.oc_id,
|
|
|
A.group_id,
|
|
|
@@ -42,14 +42,16 @@ func (d *UserRepo) GetById(ocId int64, userId int64)(*viewmodels.UserInfo, error
|
|
|
F.gmpg_id,
|
|
|
F.grant_group_id,
|
|
|
G.group_name AS grant_group_name `
|
|
|
- sqlFrom := ` FROM s_group_member AS A
|
|
|
- LEFT JOIN account AS B ON ( A.oc_id = B.oc_id AND A.account_id = B.account_id )
|
|
|
- LEFT JOIN s_group AS C ON ( A.oc_id = C.oc_id AND A.group_id = C.group_id )
|
|
|
- LEFT JOIN s_group_member_position AS E ON ( A.oc_id = E.oc_id AND A.account_id = E.account_id AND E.group_id= #{groupId ,jdbcType=BIGINT} )
|
|
|
- LEFT JOIN s_group_member_position_grant AS F ON ( E.oc_id = F.oc_id AND E.account_id = F.account_id AND E.position_id = F.position_id AND F.group_id = #{groupId ,jdbcType=BIGINT} )
|
|
|
- LEFT JOIN s_group AS G ON ( G.oc_id = F.oc_id AND G.group_id = F.grant_group_id )
|
|
|
- LEFT JOIN s_position AS H ON ( A.oc_id = E.oc_id AND H.position_id = E.position_id ) `
|
|
|
- sqlWhere := ` WHERE B.deleted_flag = 0 AND A.oc_id = ` + fmt.Sprintf("%d", ocId)
|
|
|
+ sqlFrom := ` FROM s_group_member AS A `
|
|
|
+ sqlFrom += ` LEFT JOIN account AS B ON ( A.oc_id = B.oc_id AND A.account_id = B.account_id ) `
|
|
|
+ sqlFrom += ` LEFT JOIN s_group AS C ON ( A.oc_id = C.oc_id AND A.group_id = C.group_id ) `
|
|
|
+ sqlFrom += fmt.Sprintf(` LEFT JOIN s_group_member_position AS E ON ( A.oc_id = E.oc_id AND A.account_id = E.account_id AND E.group_id= %d )`, groupId)
|
|
|
+ sqlFrom += fmt.Sprintf(` LEFT JOIN s_group_member_position_grant AS F ON ( E.oc_id = F.oc_id AND E.account_id = F.account_id AND E.position_id = F.position_id AND F.group_id = %d )`, groupId)
|
|
|
+ sqlFrom += ` LEFT JOIN s_group AS G ON ( G.oc_id = F.oc_id AND G.group_id = F.grant_group_id ) `
|
|
|
+ sqlFrom += ` LEFT JOIN s_position AS H ON ( A.oc_id = E.oc_id AND H.position_id = E.position_id ) `
|
|
|
+
|
|
|
+ sqlWhere := ` WHERE B.deleted_flag = 0 `
|
|
|
+ sqlWhere += ` AND A.oc_id = ` + fmt.Sprintf("%d", ocId)
|
|
|
sqlWhere += ` AND A.account_id = ` + fmt.Sprintf("%d", userId)
|
|
|
|
|
|
data := &viewmodels.UserInfo{}
|
|
|
@@ -62,11 +64,11 @@ func (d *UserRepo) GetById(ocId int64, userId int64)(*viewmodels.UserInfo, error
|
|
|
}
|
|
|
|
|
|
func (d *UserRepo) GetPage(m map[string]interface{})(*viewmodels.PageResult, error){
|
|
|
- ocId := m["ocId"].(int64)
|
|
|
- limit := m["limit"].(int)
|
|
|
- page := m["page"].(int)
|
|
|
+ ocId := m["ocId"].(int64)
|
|
|
+ limit := m["limit"].(int)
|
|
|
+ page := m["page"].(int)
|
|
|
|
|
|
- sqlSelect := `SELECT
|
|
|
+ sqlSelect := ` SELECT
|
|
|
DISTINCT(A.account_id),
|
|
|
A.gm_id,
|
|
|
A.oc_id,
|
|
|
@@ -87,12 +89,12 @@ func (d *UserRepo) GetPage(m map[string]interface{})(*viewmodels.PageResult, err
|
|
|
E.gmpg_id,
|
|
|
E.grant_group_id,
|
|
|
F.group_name as grant_group_name `
|
|
|
- sqlFrom := `FROM s_group_member AS A
|
|
|
- LEFT JOIN account AS B ON (A.oc_id = B.oc_id AND A.account_id = B.account_id)
|
|
|
- LEFT JOIN s_group AS C ON (A.oc_id = C.oc_id AND A.group_id = C.group_id)
|
|
|
- LEFT JOIN s_group_member_position_grant AS E ON (B.oc_id = E.oc_id AND B.account_id = E.account_id)
|
|
|
- LEFT JOIN s_group AS F ON (E.oc_id = F.oc_id AND E.grant_group_id = F.group_id)
|
|
|
- LEFT JOIN (
|
|
|
+ sqlFrom := ` FROM s_group_member AS A
|
|
|
+ LEFT JOIN account AS B ON (A.oc_id = B.oc_id AND A.account_id = B.account_id )
|
|
|
+ LEFT JOIN s_group AS C ON (A.oc_id = C.oc_id AND A.group_id = C.group_id )
|
|
|
+ LEFT JOIN s_group_member_position_grant AS E ON (B.oc_id = E.oc_id AND B.account_id = E.account_id )
|
|
|
+ LEFT JOIN s_group AS F ON (E.oc_id = F.oc_id AND E.grant_group_id = F.group_id )
|
|
|
+ LEFT JOIN (
|
|
|
SELECT
|
|
|
M.oc_id,
|
|
|
M.account_id,
|
|
|
@@ -177,9 +179,9 @@ func (d *UserRepo) GetList(m map[string]interface{})([]viewmodels.UserInfo, erro
|
|
|
F.group_name as grant_group_name `
|
|
|
sqlFrom := ` FROM s_group_member AS A
|
|
|
LEFT JOIN account AS B ON (A.oc_id = B.oc_id AND A.account_id = B.account_id)
|
|
|
- LEFT JOIN s_group AS C ON (A.oc_id = C.oc_id AND A.group_id = C.group_id)
|
|
|
+ LEFT JOIN s_group AS C ON (A.oc_id = C.oc_id AND A.group_id = C.group_id )
|
|
|
LEFT JOIN s_group_member_position_grant AS E ON (B.oc_id = E.oc_id AND B.account_id = E.account_id)
|
|
|
- LEFT JOIN s_group AS F ON (E.oc_id = F.oc_id AND E.grant_group_id = F.group_id)
|
|
|
+ LEFT JOIN s_group AS F ON (E.oc_id = F.oc_id AND E.grant_group_id = F.group_id )
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
M.oc_id,
|