caipin %!s(int64=4) %!d(string=hai) anos
pai
achega
1b759528f3
Modificáronse 4 ficheiros con 12 adicións e 11 borrados
  1. 8 8
      dao/safe_dao.go
  2. 2 2
      models/cm_rule.go
  3. 1 0
      models/cm_safe.go
  4. 1 1
      services/safe_service.go

+ 8 - 8
dao/safe_dao.go

@@ -102,14 +102,14 @@ func (d *SafeDao) GetStatus(bidsectionId int, status int) []models.CmSafe {
 }
 
 // 获得某状态下的安全
-// func (d *SafeDao) GetStatusByProjectAndAccount(projectId int, projectAccountId int, status int) []models.CmSafe {
-// 	datalist := make([]models.CmSafe, 0)
-// 	_ = d.engine.
-// 		Where("bidsection_id = ? and status=? ", bidsectionId, status).
-// 		Desc("id").
-// 		Find(&datalist)
-// 	return datalist
-// }
+func (d *SafeDao) GetStatusByProjectAndAccount(projectId int, projectAccountId int, status int) []models.CmSafe {
+	datalist := make([]models.CmSafe, 0)
+	_ = d.engine.
+		Where("projectId = ? and projectAccountId= ? and status=? ", projectId, projectAccountId, status).
+		Desc("id").
+		Find(&datalist)
+	return datalist
+}
 
 // 获得某年份下的安全
 func (d *SafeDao) GetTypeYear(bidsectionId int, year int) []viewmodels.SafeSurveyList {

+ 2 - 2
models/cm_rule.go

@@ -6,6 +6,6 @@ type CmRule struct {
 	BidsectionId       int    `xorm:"not null default 0 comment('标段ID') INT(11)"`
 	SafeRule           string `xorm:"comment('安全巡检编号规则') VARCHAR(255)"`
 	QualityRule        string `xorm:"comment('质量巡检编号规则') VARCHAR(255)"`
-	ContractReturnRule string `xorm:"comment('收入合同编号规则') VARCHAR(255)"`
-	ContractPaidRule   string `xorm:"comment('支出合同编号规则') VARCHAR(255)"`
+	ContractReturnRule string `xorm:"comment('合同收入编号规则') VARCHAR(255)"`
+	ContractPaidRule   string `xorm:"comment('合同支出编号规则') VARCHAR(255)"`
 }

+ 1 - 0
models/cm_safe.go

@@ -7,6 +7,7 @@ import (
 type CmSafe struct {
 	Id               int       `xorm:"not null pk autoincr comment('自增id') INT(11)"`
 	BidsectionId     int       `xorm:"not null default 0 comment('标段id') INT(11)"`
+	ProjectId        int       `xorm:"not null default 0 comment('项目ID') INT(11)"`
 	AuditId          string    `xorm:"comment('当前审核人') VARCHAR(32)"`
 	Code             string    `xorm:"comment('编号') VARCHAR(128)"`
 	CreateTime       time.Time `xorm:"comment('检查时间') DATETIME"`

+ 1 - 1
services/safe_service.go

@@ -320,7 +320,7 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
 // 获得账号下需要审批的巡检
 func (s *safeService) GetPending(projectId int, projectAccountId int) []viewmodels.SafeList {
 
-	// s.daoSafe.GetStatus()
+	s.daoSafe.GetStatusByProjectAndAccount(projectId, projectAccountId, 2)
 
 	return nil
 }