common_service.go 780B

12345678910111213141516171819202122
  1. package service
  2. import "XT_New/models"
  3. func GetInspectionMajor(orgid int64) (inspection []*models.XtInspectionReference, err error) {
  4. err = XTReadDB().Model(&inspection).Where("org_id = ? and status = 1", orgid).Group("project_name").Order("id asc").Find(&inspection).Error
  5. return inspection, err
  6. }
  7. func GetInspectionMinor(projectid int64) (inspection []*models.XtInspectionReference, err error) {
  8. err = XTReadDB().Model(&inspection).Where("project_id = ? and status = 1", projectid).Find(&inspection).Error
  9. return inspection, err
  10. }
  11. func GetInspectionRange(id int64) (models.XtInspectionReference, error) {
  12. reference := models.XtInspectionReference{}
  13. err := XTReadDB().Model(&reference).Where("id=? and status = 1", id).Find(&reference).Error
  14. return reference, err
  15. }