作者 唐旭辉

bug修改

... ... @@ -16,6 +16,7 @@ import (
type SqlData struct {
Id int64 `orm:"column(id)"`
UserId int64 `orm:"column(user_id)"`
NickName string `orm:"column(nick_name)"`
DepartmentId int64 `orm:"column(department_id)"`
AuditTemplateId int64 `orm:"column(audit_template_id)"`
ChanceTypeId int `orm:"column(chance_type_id)"`
... ... @@ -166,9 +167,9 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
return returnData, protocol.NewErrWithMessage("1")
}
s1 := `SELECT a.id,a.user_id,a.department_id,a.audit_template_id,a.chance_type_id
s1 := `SELECT a.id,a.department_id,a.audit_template_id,a.chance_type_id
,a.publish_status,a.create_at,a.review_status,a.enable_status
,a.discovery_score,a.comment_total ,a.code,d.nick_name
,a.discovery_score,a.comment_total ,a.code,d.nick_name,d.id as user_id
FROM chance AS a
JOIN user_company AS c ON c.id = a.user_id
JOIN user AS d ON c.user_id = d.id
... ... @@ -251,8 +252,15 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
datasql.WriteString(s)
countsql.WriteString(s)
}
if param.DepartmentID > 0 {
//提交的部门
cond = append(cond, param.DepartmentID)
s := ` And a.department_id=? `
datasql.WriteString(s)
countsql.WriteString(s)
}
dataStart := (param.PageIndex - 1) * param.PageSize
datasql.WriteString(fmt.Sprintf(` limit %d,%d `, dataStart, param.PageSize))
datasql.WriteString(fmt.Sprintf(` ORDER BY a.create_at DESC limit %d,%d `, dataStart, param.PageSize))
err = utils.ExecuteQueryOne(&cnt, countsql.String(), cond...)
if err != nil {
log.Error("EXCUTE SQL ERR:%s", err)
... ... @@ -279,6 +287,7 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
Code: v.Code,
DiscoveryScore: v.DiscoveryScore,
CommentTotal: v.CommentTotal,
UserName: v.NickName,
}
if t < 0 {
... ... @@ -286,9 +295,6 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
} else {
item.CreateTime = t
}
if u, err := models.GetUserById(v.UserId); err == nil {
item.UserName = u.NickName
}
if d, err := models.GetDepartmentById(v.DepartmentId); err == nil {
item.Department = d.Name
}
... ...