|
@@ -31,22 +31,21 @@ func NewCompatible(mgo *MongodbSim, baseService, mainMysql *mysql.Mysql, middleg
|
|
}
|
|
}
|
|
|
|
|
|
//根据mgo库user表_id,或者企业身份的职位id查询
|
|
//根据mgo库user表_id,或者企业身份的职位id查询
|
|
-//根据mgo库user表_id,或者企业身份的职位id查询
|
|
|
|
-func (c *Compatible) Select(id string, fd interface{}) *map[string]interface{} {
|
|
|
|
|
|
+func (c *Compatible) Select(id string, field interface{}) *map[string]interface{} {
|
|
var identity *pb.Identity
|
|
var identity *pb.Identity
|
|
if !IsObjectIdHex(id) {
|
|
if !IsObjectIdHex(id) {
|
|
identity = c.Middleground.UserCenter.IdentityByPositionId(util.Int64All(id))
|
|
identity = c.Middleground.UserCenter.IdentityByPositionId(util.Int64All(id))
|
|
}
|
|
}
|
|
- return c.selectDo(id, identity, fd)
|
|
|
|
|
|
+ return c.selectDo(id, identity, field)
|
|
}
|
|
}
|
|
|
|
|
|
-//根据mgo库user表_id,或者企业身份的职位id查询
|
|
|
|
-func (c *Compatible) SelectByEntUserId(id string, fd interface{}) *map[string]interface{} {
|
|
|
|
|
|
+//根据mgo库user表_id,或者企业身份的企业员工id查询
|
|
|
|
+func (c *Compatible) SelectByEntUserId(id string, field interface{}) *map[string]interface{} {
|
|
var identity *pb.Identity
|
|
var identity *pb.Identity
|
|
if !IsObjectIdHex(id) {
|
|
if !IsObjectIdHex(id) {
|
|
identity = c.Middleground.UserCenter.IdentityByEntUserId(util.Int64All(id))
|
|
identity = c.Middleground.UserCenter.IdentityByEntUserId(util.Int64All(id))
|
|
}
|
|
}
|
|
- return c.selectDo(id, identity, fd)
|
|
|
|
|
|
+ return c.selectDo(id, identity, field)
|
|
}
|
|
}
|
|
|
|
|
|
//
|
|
//
|
|
@@ -131,10 +130,27 @@ func (c *Compatible) selectDo(id string, identity *pb.Identity, fd interface{})
|
|
|
|
|
|
//根据mgo库user表_id,或者企业身份的职位id更新
|
|
//根据mgo库user表_id,或者企业身份的职位id更新
|
|
func (c *Compatible) Update(id string, update map[string]interface{}) bool {
|
|
func (c *Compatible) Update(id string, update map[string]interface{}) bool {
|
|
|
|
+ var identity *pb.Identity
|
|
|
|
+ if !IsObjectIdHex(id) {
|
|
|
|
+ identity = c.Middleground.UserCenter.IdentityByPositionId(util.Int64All(id))
|
|
|
|
+ }
|
|
|
|
+ return c.updateDo(id, identity, update)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//根据mgo库user表_id,或者企业身份的企业员工id更新
|
|
|
|
+func (c *Compatible) UpdateByEntUserId(id string, update map[string]interface{}) bool {
|
|
|
|
+ var identity *pb.Identity
|
|
|
|
+ if !IsObjectIdHex(id) {
|
|
|
|
+ identity = c.Middleground.UserCenter.IdentityByEntUserId(util.Int64All(id))
|
|
|
|
+ }
|
|
|
|
+ return c.updateDo(id, identity, update)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//
|
|
|
|
+func (c *Compatible) updateDo(id string, identity *pb.Identity, update map[string]interface{}) bool {
|
|
if IsObjectIdHex(id) {
|
|
if IsObjectIdHex(id) {
|
|
return c.Mgo.UpdateById("user", id, update)
|
|
return c.Mgo.UpdateById("user", id, update)
|
|
} else {
|
|
} else {
|
|
- identity := c.Middleground.UserCenter.IdentityByPositionId(util.Int64All(id))
|
|
|
|
if identity == nil {
|
|
if identity == nil {
|
|
return false
|
|
return false
|
|
}
|
|
}
|