瀏覽代碼

Merge branch 'master' of http://git.shengws.com/csx/XT_New

XMLWAN 4 年之前
父節點
當前提交
3157e7afb9
共有 3 個文件被更改,包括 8 次插入7 次删除
  1. 0 5
      .gitignore
  2. 1 1
      controllers/inspection_api_controller.go
  3. 7 1
      service/inspection_service.go

+ 0 - 5
.gitignore 查看文件

@@ -1,5 +0,0 @@
1
-.svn
2
-.git
3
-XT.ext
4
-/*.exe
5
-/*.exe~

+ 1 - 1
controllers/inspection_api_controller.go 查看文件

@@ -432,7 +432,7 @@ func (c *InspectionApiController) GetPatientInspections() {
432 432
 
433 433
 	date := ""
434 434
 	if len(inspections) > 0 {
435
-		date = time.Unix(dateTime, 0).Format("2006-01-02")
435
+		date = time.Unix(dateTime, 0).Format("2006-01-02 15:04")
436 436
 	}
437 437
 
438 438
 	c.ServeSuccessJSON(map[string]interface{}{

+ 7 - 1
service/inspection_service.go 查看文件

@@ -8,7 +8,13 @@ import (
8 8
 )
9 9
 
10 10
 func GetInspectionReference(orgId int64) (reference []*models.InspectionReference, err error) {
11
-	err = readDb.Model(&models.InspectionReference{}).Where("(org_id=0 OR org_id=?) and status=1", orgId).Order("project_id").Find(&reference).Error
11
+	var count int
12
+	err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1", orgId).Count(&count).Error
13
+	if count > 0 {
14
+		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1", orgId).Order("project_id").Find(&reference).Error
15
+	} else {
16
+		err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1").Order("project_id").Find(&reference).Error
17
+	}
12 18
 	return
13 19
 }
14 20