作者 yangfu

fix: 历史记录查询修改(已审核状态)

... ... @@ -41,5 +41,8 @@ func (d *HistoryProductRecord) LoadDto(m *domain.ProductRecord) *HistoryProductR
//log.Logger.Debug("not equal", map[string]interface{}{"t1": xtime.BeginningOfDay(), "t2": xtime.New(m.CreatedAt.Local()).BeginningOfDay()})
d.Status = domain.ProductRecordLogged
}
if m.ProductRecordType == domain.RecordTypeSecondLevelWeigh && m.ProductRecordInfo.ApproveStatus == domain.ProductRecordAutoApproved {
d.Status = domain.ProductRecordApproved
}
return d
}
... ...
... ... @@ -54,6 +54,8 @@ type HistoryProductRecordQuery struct {
ProductWorkerId int `cname:"生产员工ID" json:"productWorkerId"`
// 状态 0:全部 1:未审核 2:已审核 3:已撤回 4:已记录
Status int `cname:"状态" json:"status"`
// 状态 0:全部 1:未审核 2:已审核 3:已撤回 4:已记录
InStatus []int `cname:"匹配多个状态" json:"intStatus"`
// 开始时间
ProductBeginTime time.Time `cname:"开始时间" json:"productBeginTime"`
... ... @@ -108,6 +110,10 @@ func (cmd *HistoryProductRecordQuery) Valid(validation *validation.Validation) {
}
}
}
if cmd.ProductRecordType == domain.RecordTypeSecondLevelWeigh && cmd.Status == domain.ProductRecordApproved {
cmd.Status = 0
cmd.InStatus = []int{domain.ProductRecordApproved, domain.ProductRecordAutoApproved}
}
}
func (cmd *HistoryProductRecordQuery) ValidateQuery() error {
... ...
... ... @@ -6,6 +6,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/pg/transform"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
"time"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
... ... @@ -189,6 +190,9 @@ func (repository *ProductRecordRepository) Find(queryOptions map[string]interfac
if v, ok := queryOptions["status"]; ok && v.(int) > 0 {
query.Where(fmt.Sprintf(`product_record_info->>'approveStatus' = '%v'`, v))
}
if v, ok := queryOptions["inStatus"]; ok && len(v.([]int)) > 0 {
query.Where(`product_record_info->>'approveStatus' in (?)`, pg.In(utils.ToArrayString(v.([]int))))
}
if v, ok := queryOptions["lastProductRecordId"]; ok && v.(int) > 0 {
query.Where(`product_record_id < ?`, v)
}
... ...