|
@@ -29,7 +29,7 @@ func SaveInspection(standard *models.XtQualityControlStandard) error {
|
29
|
29
|
return err
|
30
|
30
|
}
|
31
|
31
|
|
32
|
|
-func GetConfigurationlist(orgid int64) (standard []*models.QualityControlStandard, err error) {
|
|
32
|
+func GetConfigurationlist(orgid int64, limit int64, page int64) (standard []*models.QualityControlStandard, total int64, err error) {
|
33
|
33
|
|
34
|
34
|
//err = XTReadDB().Model(&standard).Where("user_org_id = ? and status =1", orgid).Order("sort asc,created_time desc").Find(&standard).Error
|
35
|
35
|
//return standard,err
|
|
@@ -40,7 +40,8 @@ func GetConfigurationlist(orgid int64) (standard []*models.QualityControlStandar
|
40
|
40
|
}
|
41
|
41
|
table := XTReadDB().Table("xt_inspection_reference as s")
|
42
|
42
|
fmt.Println(table)
|
43
|
|
- err = db.Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,s.unit,s.project_name,s.item_name").
|
44
|
|
- Joins("left join xt_inspection_reference as s on s.id = x.inspection_minor").Order("x.sort asc,x.created_time desc").Scan(&standard).Error
|
45
|
|
- return standard, err
|
|
43
|
+ offset := (page - 1) * limit
|
|
44
|
+ err = db.Order("x.sort asc").Group("x.id").Select("x.id,x.inspection_major,x.inspection_minor,x.min_range,x.large_range,x.sort,x.user_org_id,s.unit,s.project_name,s.item_name").Count(&total).
|
|
45
|
+ Joins("left join xt_inspection_reference as s on s.id = x.inspection_minor").Offset(offset).Limit(limit).Scan(&standard).Error
|
|
46
|
+ return standard, total, err
|
46
|
47
|
}
|