作者 唐旭辉

修改

... ... @@ -2,8 +2,8 @@ package protocol
//RequestPageInfo 分页获取数据
type RequestPageInfo struct {
PageIndex int `json:"page_index"`
PageSize int `json:"page_size"`
PageIndex int `json:"pageNumber"`
PageSize int `json:"pageSize"`
}
//ResponsePageInfo 分页信息
... ...
package protocol
var NullData = struct{}{}
var (
NullData = struct{}{}
NullSlice = []interface{}{}
)
//CustomErrParse 解析自定义错误结构体
type CustomErrParse interface {
... ... @@ -94,9 +97,9 @@ func NewReturnResponse(data interface{}, eRR error) (msg *ResponseMessage) {
if data == nil {
data = NullData
}
if eRR == nil {
msg = NewMessage("0")
msg.Data = data
return msg
}
... ...
... ... @@ -377,25 +377,26 @@ func GetDepartmentUser(companyid int64, departmentid int64) ([]protocol.DepartUs
department *models.Department
err error
)
var (
returnData []protocol.DepartUserBase
)
department, err = models.GetDepartmentById(departmentid)
if err != nil {
log.Error("获取部门失败:%s", err)
return nil, nil
return returnData, nil
}
if department.CompanyId != companyid {
log.Error("deparment.CompanyId err")
return nil, protocol.NewErrWithMessage("1")
return returnData, protocol.NewErrWithMessage("1")
}
const dataSql string = `SELECT b.nick_name,a.user_company_id FROM user_department AS a
JOIN user_company AS b ON a.user_company_id = b.id
WHERE a.department_id=? AND b.delete_at=0 AND a.enable_status = 1 `
var (
returnData []protocol.DepartUserBase
)
err = utils.ExecuteQueryAll(&returnData, dataSql, department.Id)
if err != nil {
log.Error("EXECUTE SQL err:%s", err)
return nil, protocol.NewErrWithMessage("1")
return returnData, protocol.NewErrWithMessage("1")
}
return returnData, nil
}
... ...