|
@@ -155,23 +155,46 @@ func (d *SafeDao) GetStatusByProjectAndAccount(projectId int, projectAccountId i
|
|
|
return datalist
|
|
|
}
|
|
|
|
|
|
-// 获得某年份下的安全
|
|
|
+// 获得某年份下的审批记录
|
|
|
func (d *SafeDao) GetTypeYear(bidsectionId int, year int) []viewmodels.SafeSurveyList {
|
|
|
|
|
|
startYear := fmt.Sprintf("%d-01-01:00.00.00", year)
|
|
|
endYear := fmt.Sprintf("%d-12-31:23.59.59", year)
|
|
|
|
|
|
datalist := make([]viewmodels.SafeSurveyList, 0)
|
|
|
- _ = d.engine.Table("`cm_approver` as cs").
|
|
|
- Select("cs.data_id as id, cs.`update_time`, s.`inspection_detail`, cs.status, pa.`name` as `audit_name`").
|
|
|
- Where("cs.bidsection_id = ? and status=1 and progress=1 and data_type=1 and cs.update_time>='"+startYear+"' and cs.update_time<='"+endYear+"' ", bidsectionId).
|
|
|
- Join("left", "cm_safe as s", "s.id = cs.data_id").
|
|
|
- Join("left", "cm_project_account as pa", "pa.id = cs.audit_id").
|
|
|
+ _ = d.engine.Table("`cm_safe` as cs").
|
|
|
+ Select("cs.id , s.`update_time`, cs.`create_time`, cs.`inspection_detail`, cs.status, pa.`name` as `audit_name`").
|
|
|
+ Where("cs.bidsection_id = ? and cs.create_time>='"+startYear+"' and cs.create_time<='"+endYear+"' ", bidsectionId).
|
|
|
+ Join("left", "cm_approver as s", "cs.id = s.data_id and s.data_id=1").
|
|
|
+ Join("left", "cm_project_account as pa", "pa.id = s.audit_id").
|
|
|
Desc("id").
|
|
|
Find(&datalist)
|
|
|
+ // _ = d.engine.Table("`cm_approver` as cs").
|
|
|
+ // Select("cs.data_id as id, cs.`update_time`, s.`inspection_detail`, cs.status, pa.`name` as `audit_name`").
|
|
|
+ // Where("cs.bidsection_id = ? and status=1 and progress=1 and data_type=1 and cs.update_time>='"+startYear+"' and cs.update_time<='"+endYear+"' ", bidsectionId).
|
|
|
+ // Join("left", "cm_safe as s", "s.id = cs.data_id").
|
|
|
+ // Join("left", "cm_project_account as pa", "pa.id = cs.audit_id").
|
|
|
+ // Desc("id").
|
|
|
+ // Find(&datalist)
|
|
|
return datalist
|
|
|
}
|
|
|
|
|
|
+// // 获得某年份下的安全
|
|
|
+// func (d *SafeDao) GetTypeYear(bidsectionId int, year int) []viewmodels.SafeSurveyList {
|
|
|
+
|
|
|
+// startYear := fmt.Sprintf("%d-01-01:00.00.00", year)
|
|
|
+// endYear := fmt.Sprintf("%d-12-31:23.59.59", year)
|
|
|
+
|
|
|
+// datalist := make([]viewmodels.SafeSurveyList, 0)
|
|
|
+// _ = d.engine.Table("`cm_safe` as cs").
|
|
|
+// Select("cs.id, cs.`create_time`, cs.`inspection_detail`, cs.status, pa.`name` as `audit_name`").
|
|
|
+// Where("cs.bidsection_id = ? and cs.create_time>='"+startYear+"' and cs.create_time<='"+endYear+"' ", bidsectionId).
|
|
|
+// Join("left", "cm_project_account as pa", "pa.id = cs.uid").
|
|
|
+// Desc("id").
|
|
|
+// Find(&datalist)
|
|
|
+// return datalist
|
|
|
+// }
|
|
|
+
|
|
|
// 根据bid
|
|
|
func (d *SafeDao) GetCountsByBid(bidsectionId int, status int, isAll bool) (int64, error) {
|
|
|
data := &models.CmSafe{}
|