|
|
@@ -47,6 +47,45 @@ func (s *OilSupplierCertAppendSubService) GetQualPagingEntities(FileName, qualCh
|
|
|
s.DBE.SQL(sql).Find(entitiesPtr)
|
|
|
resultsSlice, _ = s.DBE.Query(sqlCount)
|
|
|
|
|
|
+ if len(resultsSlice) > 0 {
|
|
|
+ results := resultsSlice[0]
|
|
|
+ for _, value := range results {
|
|
|
+ total, _ = strconv.ParseInt(string(value), 10, 64)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return total
|
|
|
+}
|
|
|
+func (s *OilSupplierCertAppendSubService) GetQualPagingEntitiesStatus(FileName, qualChangeName string, pageIndex, itemsPerPage int64, orderby string, asc bool, entitiesPtr interface{}, where, MInfoId string) (total int64) {
|
|
|
+ var resultsSlice []map[string][]byte
|
|
|
+
|
|
|
+ //获取总记录数
|
|
|
+ sqlCount := `select count(*) from ` + FileName + ` a `
|
|
|
+ sqlCount += ` left join ` + qualChangeName + " b on b.FileId = a.Id"
|
|
|
+ sqlCount += ` where ` + where
|
|
|
+
|
|
|
+ var sql string
|
|
|
+ sql = `select a.Id Id, a.SupplierId SupplierId, a.SupplierTypeCode SupplierTypeCode, a.SupplierCertSubId SupplierCertSubId, a.CertSubName CertSubName,a.OtherRemark Remark, `
|
|
|
+ sql += ` a.NeedFileType NeedFileType, a.NeedFileCode NeedFileCode, a.FileExt FileExt, a.FileType FileType, `
|
|
|
+ sql += ` a.EffectDate OldEffectDate, a.FileUrl OldFileUrl, a.FileName OldFileName, `
|
|
|
+ sql += ` '' as EffectDate, '' as FileUrl, '' as FileName, `
|
|
|
+ sql += ` b.EffectDate EffectDate, b.FileUrl FileUrl, b.FileName FileName, b.ParentId, b.OtherRemark Remark1, a.IsDelete `
|
|
|
+ sql += ` from ` + FileName + ` a `
|
|
|
+ if MInfoId != "" {
|
|
|
+ sql += ` left join ` + qualChangeName + " b on b.FileId = a.Id AND b.ParentId =" + MInfoId
|
|
|
+ } else {
|
|
|
+ sql += ` left join ` + qualChangeName + " b on b.FileId = a.Id"
|
|
|
+ }
|
|
|
+ sql += ` where ` + where
|
|
|
+ if asc {
|
|
|
+ sql += ` order by ` + orderby + ` ASC `
|
|
|
+ } else {
|
|
|
+ sql += ` order by ` + orderby + ` DESC `
|
|
|
+ }
|
|
|
+ //sql += ` limit ` + utils.ToStr((pageIndex-1)*itemsPerPage) + "," + utils.ToStr(itemsPerPage)
|
|
|
+ s.DBE.SQL(sql).Find(entitiesPtr)
|
|
|
+ resultsSlice, _ = s.DBE.Query(sqlCount)
|
|
|
+
|
|
|
if len(resultsSlice) > 0 {
|
|
|
results := resultsSlice[0]
|
|
|
for _, value := range results {
|