package oilsupplier import ( "dashoo.cn/backend/api/business/oilsupplier/annualaudit" "dashoo.cn/backend/api/business/oilsupplier/infochange" "dashoo.cn/backend/api/business/oilsupplier/qualchange" "dashoo.cn/backend/api/business/oilsupplier/suppliercert" "dashoo.cn/backend/api/business/oilsupplier/suppliercertappend" "dashoo.cn/backend/api/business/oilsupplier/supplierfile" "dashoo.cn/backend/api/business/register" "encoding/json" "fmt" "sort" "strconv" "strings" "time" // "fmt" "dashoo.cn/backend/api/business/oilsupplier/selectbusiness" "dashoo.cn/backend/api/business/oilsupplier/supplier" . "dashoo.cn/backend/api/controllers" "dashoo.cn/utils" ) type SelectController struct { BaseController } type UpSearch struct { FullName string } type UpInfoSearch struct { FullName string SupplierTypeName string HeGe int BuHeGe int ZongShu int Reason string } type Processinfo struct { Id int AccessCardNo string WorkflowId string ProcessKey string SupplierName string SupplierTypeCode string Status string Type string CreateOn time.Time AddinTime time.Time RecUnitName string ContactName string Mobile string } // @Title 获取所有 // @Description // @Success 200 {object} // @router /getcompanylist [post] func (this *SelectController) GetTList() { var model supplier.OilSupplierSelect var model1 supplier.RegCapitalRange //注册资金范围 //var model2 supplier.NeedFileTypeStruct //资质结构体 var jsonBlob = this.Ctx.Input.RequestBody json.Unmarshal(jsonBlob, &model) json.Unmarshal(jsonBlob, &model1) //json.Unmarshal(jsonBlob, &model2) // //获取分页信息 page := this.GetPageInfoForm() where := " 1=1 AND b.InFlag in (1,2,3) AND b.Status = '8' " orderby := "a.Id" asc := true Order := this.GetString("Order") Prop := this.GetString("Prop") if Order != "" && Prop != "" { orderby = Prop if Order == "desc" { asc = false } } leftjoin := "" //准入证号 if model.AccessCardNo != "" { where = where + " and b.AccessCardNo like '%" + model.AccessCardNo + "%'" } //企业名称 if model.SupplierName != "" { where = where + " and a.SupplierName like '%" + model.SupplierName + "%'" } if model.OldSupplierName != "" { where = where + " and OldSupplierName like '%" + model.OldSupplierName + "%'" } if model.FullName != "" { where = where + " and f.FullName like '%" + model.FullName + "%'" } if model.CheckUnitName != "" { where = where + " and g.CheckUnitName like '%" + model.CheckUnitName + "%'" } //准入类别(基建,物资,技术服务) if model.SupplierTypeCode != "" { where = where + " and b.SupplierTypeCode = '" + model.SupplierTypeCode + "'" } //准入标识 1 准入 2 暂停 3取消 if model.InFlag != "" { where = where + " and b.InFlag = '" + model.InFlag + "'" } //法人 if model.LegalPerson != "" { where = where + " and a.LegalPerson like '%" + model.LegalPerson + "%'" } //联系人 if model.ContactName != "" { where = where + " and a.ContactName like '%" + model.ContactName + "%'" } //统一社会信用代码 if model.CommercialNo != "" { where = where + " and a.CommercialNo like '%" + model.CommercialNo + "%'" } //开户银行 if model.DepositBank != "" { where = where + " and a.DepositBank like '%" + model.DepositBank + "%'" } //HSE审查 if model.HseTraining != "" { where = where + " and a.HseTraining = '" + model.HseTraining + "'" } //公司类型 if model.CompanyType != "" { where = where + " and a.CompanyType like '%" + model.CompanyType + "%'" } //成立时间 SetupTime := this.GetString("SetupTime") if SetupTime != "" { where = where + " and a.SetupTime ='" + SetupTime + "'" } //注册资金范围 if model1.RegCapital1 != "" { where = where + " and a.RegCapital >= '" + model1.RegCapital1 + "'" } if model1.RegCapital2 != "" { where = where + " and a.RegCapital <= '" + model1.RegCapital2 + "'" } //注册省份 if model.Province != "" { where = where + " and a.Province = '" + model.Province + "'" } //注册市 if model.City != "" { where = where + " and a.City = '" + model.City + "'" } //注册区 if model.Street != "" { where = where + " and a.Street = '" + model.Street + "'" } //注册详细地址 if model.Address != "" { where = where + " and a.Address like '%" + model.Address + "%'" } if model.LinkProvince != "" { where = where + " and a.LinkProvince = '" + model.LinkProvince + "'" } if model.LinkCity != "" { where = where + " and a.LinkCity = '" + model.LinkCity + "'" } if model.LinkStreet != "" { where = where + " and a.LinkStreet = '" + model.LinkStreet + "'" } if model.LinkAddress != "" { where = where + " and a.LinkAddress like '%" + model.LinkAddress + "%'" } //营业范围 if model.BusinessScope != "" { where = where + " and a.BusinessScope like '%" + model.BusinessScope + "%'" } CreateOn := this.GetString("CreateOn") if CreateOn != "" { dates := strings.Split(CreateOn, ",") if len(dates) == 2 { minDate := dates[0] maxDate := dates[1] where = where + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'" } } a := model.InStyle fmt.Println(a) //准入方式 if model.InStyle != "" { if model.InStyle == "0"{ where = where + " and b.InStyle in ('2','3','4','5')" }else{ where = where + " and b.InStyle ='" + model.InStyle + "'" } } //包含资质 //if model2.NeedFileType != nil && len(model2.NeedFileType) > 0 { // pararm := "" // for i := 0; i < len(model2.NeedFileType); i++ { // // pararm = pararm + "'" + model2.NeedFileType[i] + "'," // // } // fmt.Println(pararm[0 : len(pararm)-1]) // where = where + " and d.NeedFileType in (" + pararm[0:len(pararm)-1] + ")" //} having:="" //准入范围 if model.CerSubName!="" { having = " having CerSubName like '%"+model.CerSubName+"%' " leftjoin = "left join "+ OilSupplierCertSubName + " d on d.SupplierCertId = b.Id " } //资质 if model.NeedFileType!="" { having = " having NeedFileType like '%"+model.NeedFileType+"%' " } if model.CerSubName!=""&& model.NeedFileType!=""{ having = " having CerSubName like '%"+model.CerSubName+"%' and NeedFileType like '%"+model.NeedFileType+"%' " leftjoin = "left join "+ OilSupplierCertSubName + " d on d.SupplierCertId = b.Id " } svc := selectbusiness.GetSelectService(utils.DBE) var list []supplier.OilSupplierSelect total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, OilInfoChangeName,OilCorporateInfoName,OilSupplierCertSubName, OilSupplierFileName, page.CurrentPage, page.Size, orderby, asc, &list, where,having, leftjoin) var datainfo DataInfo datainfo.Items = list datainfo.CurrentItemCount = total datainfo.PageIndex = page.CurrentPage datainfo.ItemsPerPage = page.Size this.Data["json"] = &datainfo this.ServeJSON() } // @Title 获取所有 // @Description // @Success 200 {object} // @router /getbaseinfo [post] func (this *SelectController) GetBaseInfo() { Spesearch := this.GetString("Spesearch") spesearchs := strings.Split(Spesearch, ",") svc := selectbusiness.GetSelectService(utils.DBE) var infoIntelist []supplier.OilSupplierInte for _,item := range spesearchs { //var supplierinfo supplier.SupplierInfoInte var infoInte supplier.OilSupplierInte where := " where 1 = 1 AND a.SupplierName = '" + item + "'" svc.GetInfoByCompId(where,&infoInte.SupplierInfo) //var suplliersup []supplier.OilSupplierCertSubInte where = "where SupplierId=" + strconv.Itoa(infoInte.SupplierInfo.Id) + " and SupplierTypeCode='01'" svc.Getoilsuppliercertsub(OilSupplierCertSubName, where, &infoInte.WZsub) where = "where SupplierId=" + strconv.Itoa(infoInte.SupplierInfo.Id) + " and SupplierTypeCode='02'" svc.Getoilsuppliercertsub(OilSupplierCertSubName, where, &infoInte.JSsub) where = "where SupplierId=" + strconv.Itoa(infoInte.SupplierInfo.Id) + " and SupplierTypeCode='03'" svc.Getoilsuppliercertsub(OilSupplierCertSubName, where, &infoInte.JFsub) infoIntelist = append(infoIntelist, infoInte) } var datainfo DataInfo datainfo.Items = infoIntelist this.Data["json"] = &datainfo this.ServeJSON() } // @Title 获取所有 // @Description // @Success 200 {object} // @router /up [post] func (this *SelectController) Up() { var model UpSearch var jsonBlob = this.Ctx.Input.RequestBody json.Unmarshal(jsonBlob, &model) // //获取分页信息 page := this.GetPageInfoForm() where := "" asc := false Order := this.GetString("Order") Prop := this.GetString("Prop") CreateOn := this.GetString("CreateOn") if Order != "" && Prop != "" { if Order == "asc" { asc = true } } if CreateOn != "" { dates := strings.Split(CreateOn, ",") if len(dates) == 2 { minDate := dates[0] maxDate := dates[1] where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'" } } if model.FullName != "" { where = where + " and (select FullName from Base_Organize where Id = a.CommitComId) like '%" + model.FullName + "%'" } svc := selectbusiness.GetSelectService(utils.DBE) var list []UpInfoSearch total := svc.GetUp( OilSupplierCertName , page.CurrentPage, page.Size, Prop, asc, &list, where) var datainfo DataInfo datainfo.Items = list datainfo.CurrentItemCount = total datainfo.PageIndex = page.CurrentPage datainfo.ItemsPerPage = page.Size this.Data["json"] = &datainfo this.ServeJSON() } // @Title 获取所有资质名称 // @Description // @Success 200 {object} // @router /getnftoptions [post] func (this *SelectController) GetNFTOptions() { svc := selectbusiness.GetSelectService(utils.DBE) var list []map[string]string sql := "select distinct(Name) from " + BaseTableHeader + "" list, _ = svc.DBE.QueryString(sql) var datainfo DataInfo datainfo.Items = list this.Data["json"] = &datainfo this.ServeJSON() } // @Title 流程查询准入 // @Description // @Success 200 {object} // @router /getprocessauditlist [get] func (this *SelectController) GetProcessAuditList() { //获取分页信息 page := this.GetPageInfoForm() where := " 1=1 " orderby := "Id" asc := false Order := this.GetString("Order") Prop := this.GetString("Prop") if Order != "" && Prop != "" { orderby = Prop if Order == "asc" { asc = true } } svc := supplier.GetOilSupplierService(utils.DBE) tabinx := this.GetString("tabinx") supplierTypeCode := this.GetString("SupplierTypeCode") supplierName := this.GetString("SupplierName") CreateOn := this.GetString("CreateOn") //企业用户必须加创建人条件 var registerUser register.OilCorporateInfo sql := " UserName='" + this.User.Username + "'" svc.GetEntity(®isterUser,sql) var processinfolist []Processinfo if this.User.IsCompanyUser == 1 { where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='"+registerUser.CommercialNo+"')" } if supplierTypeCode != "" { where = where + " and b.SupplierTypeCode like '%" + supplierTypeCode + "%'" } if supplierName != "" { where = where + " and a.SupplierName like '%" + supplierName + "%'" } var total int64 = 0 var datainfo DataInfo if tabinx == "1" || tabinx == "0" { var list []Processinfo //[]supplier.OilSupplierView if CreateOn != "" { dates := strings.Split(CreateOn, ",") if len(dates) == 2 { minDate := dates[0] maxDate := dates[1] where = where + " and b.CreateOn>='" + minDate + "' and b.CreateOn<='" + maxDate + "'" } } total = total + svc.GetProcessInfoWithOrderBytbl(OilSupplierName, OilSupplierCertName, page.CurrentPage, page.Size, "b.Id", asc, &list, where) processinfolist = append(processinfolist, list...) //datainfo.Items = processinfolist } if tabinx == "2" || tabinx == "0" { whereapp := "1=1" //企业用户必须加创建人条件 if this.User.IsCompanyUser == 1 { whereapp = whereapp + " and a.CreateUserId = '" + this.User.Id + "'" } if supplierTypeCode != "" { whereapp = whereapp + " and a.AppendType like '%" + supplierTypeCode + "%'" } if supplierName != "" { whereapp = whereapp + " and a.SupplierName like '%" + supplierName + "%'" } if CreateOn != "" { dates := strings.Split(CreateOn, ",") if len(dates) == 2 { minDate := dates[0] maxDate := dates[1] whereapp = whereapp + " a.and CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'" } } var list []Processinfo//[]suppliercertappend.OilSupplierCertAppend svc := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE) total = total + svc.GetProcessInfoWithOrderBytbl(OilSupplierCertAppendName, page.CurrentPage, page.Size, "a.Id", asc, &list, whereapp) processinfolist = append(processinfolist, list...) //datainfo.Items = processinfolist } if tabinx == "3" || tabinx == "0" { whereapp := "1=1" //企业用户必须加创建人条件 if this.User.IsCompanyUser == 1 { whereapp = whereapp + " and a.CreateUserId = '" + this.User.Id + "'" } if supplierTypeCode != "" { whereapp = whereapp + " and a.SupplierTypeName like '%" + supplierTypeCode + "%'" } if supplierName != "" { whereapp = whereapp + " and a.SupplierName like '%" + supplierName + "%'" } if CreateOn != "" { dates := strings.Split(CreateOn, ",") if len(dates) == 2 { minDate := dates[0] maxDate := dates[1] whereapp = whereapp + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'" } } var list []Processinfo//[]annualaudit.OilAnnualAudit svc := annualaudit.GetOilAnnualAuditService(utils.DBE) total = total + svc.GetProcessInfoWithOrderBytbl(OilAnnualAuditName, page.CurrentPage, page.Size, orderby, asc, &list, whereapp) processinfolist = append(processinfolist, list...) //datainfo.Items = processinfolist } if tabinx == "4" || tabinx == "0" { whereapp := "1=1" //企业用户必须加创建人条件 if this.User.IsCompanyUser == 1 { whereapp = whereapp + " and a.CreateUserId = '" + this.User.Id + "'" } if supplierName != "" { whereapp = whereapp + " and a.SupplierName like '%" + supplierName + "%'" } if CreateOn != "" { dates := strings.Split(CreateOn, ",") if len(dates) == 2 { minDate := dates[0] maxDate := dates[1] whereapp = whereapp + " and a.CreateOn>='" + minDate + "' and a.CreateOn<='" + maxDate + "'" } } var list []Processinfo//[]infochange.OilInfoChange svc := infochange.GetInfoChangeService(utils.DBE) total = total + svc.GetProcessInfoWithOrderBytbl(OilInfoChangeName, page.CurrentPage, page.Size, orderby, asc, &list, whereapp) processinfolist = append(processinfolist, list...) //datainfo.Items = processinfolist } if tabinx == "5" { whereapp := "1=1" //企业用户必须加创建人条件 if this.User.IsCompanyUser == 1 { whereapp = whereapp + " and CreateUserId = '" + this.User.Id + "'" } if supplierName != "" { whereapp = whereapp + " and SupplierName like '%" + supplierName + "%'" } if CreateOn != "" { dates := strings.Split(CreateOn, ",") if len(dates) == 2 { minDate := dates[0] maxDate := dates[1] whereapp = whereapp + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'" } } svc := qualchange.GetQualChangeService(utils.DBE) var list []qualchange.OilQualChangeMain total = svc.GetPagingEntitiesWithOrderBytbl("", page.CurrentPage, page.Size, orderby, asc, &list, whereapp) datainfo.Items = list } sort.Slice(processinfolist, func(i, j int) bool { return processinfolist[i].CreateOn.Unix() > processinfolist[j].CreateOn.Unix() }) datainfo.Items = processinfolist datainfo.CurrentItemCount = total datainfo.PageIndex = page.CurrentPage datainfo.ItemsPerPage = page.Size this.Data["json"] = &datainfo this.ServeJSON() } // @Title 准入范围查询 // @Description // @Success 200 {object} // @router /zrfwselect [get] func (this *SelectController) ZrfwSelect() { //获取分页信息 page := this.GetPageInfoForm() limitCurrent:=(page.CurrentPage-1)*page.Size svc := selectbusiness.GetSelectService(utils.DBE) supplierTypeCode := this.GetString("SupplierTypeCode") certsub := this.GetString("certsub") //企业用户必须加创建人条件 var registerUser register.OilCorporateInfo var company supplier.OilSupplier sql := " UserName='" + this.User.Username + "'" svc.GetEntity(®isterUser,sql) if this.User.IsCompanyUser == 1 { sql1:= " CreateUserId = '" + this.User.Id + "' or CommercialNo='"+registerUser.CommercialNo+"'" svc.GetEntity(&company,sql1) } where := "" if certsub != "" { where = " and (Code like '%" + certsub + "%' or Name like '%" + certsub + "%')" } if company.SupplierName!=""{ sql2:="select distinct(Code),Name,SupplierId,CertSubStatus from OilSupplierCertSub where SupplierId='"+strconv.Itoa(company.Id)+"' and SupplierTypeCode='"+supplierTypeCode+"' " + where + " order by CertSubStatus desc,Code asc limit "+strconv.FormatInt(limitCurrent,10)+","+strconv.FormatInt(page.Size,10)+"" result,_:=svc.DBE.QueryString(sql2) sql3:="select count(distinct(Code)) total from OilSupplierCertSub where SupplierId='"+strconv.Itoa(company.Id)+"' and SupplierTypeCode='"+supplierTypeCode+"'" + where result1,_:=svc.DBE.QueryString(sql3) total,_:= strconv.ParseInt(result1[0]["total"], 10, 64) var datainfo DataInfo datainfo.Items = result datainfo.CurrentItemCount = total datainfo.PageIndex = page.CurrentPage datainfo.ItemsPerPage = page.Size this.Data["json"] = &datainfo this.ServeJSON() }else{ var datainfo DataInfo datainfo.Items = "" datainfo.PageIndex = page.CurrentPage datainfo.ItemsPerPage = page.Size this.Data["json"] = &datainfo this.ServeJSON() } } // @Title 获取所有 // @Description // @Success 200 {object} // @router /getallbusinesslist [post] func (this *SelectController) GetAllBusinesList() { perject := this.GetString("Perject") accessCardNo := this.GetString("AccessCardNo") supplierTypeCode := this.GetString("SupplierTypeCode") supplierName := this.GetString("SupplierName") var list []selectbusiness.SelectBusiness // 准入 if perject == "1" || perject == "" { where := "1=1 " if accessCardNo != "" { where = where + " and b.AccessCardNo='" + accessCardNo + "'" } if supplierTypeCode != "" { where = where + " and b.SupplierTypeCode='" + supplierTypeCode + "'" } if supplierName != "" { where =where + " and a.SupplierName like '%" + supplierName + "%'" } var zrlist []supplier.OilSupplierView zrsvc := supplier.GetOilSupplierService(utils.DBE) if this.User.IsCompanyUser == 1 { var registerUser register.OilCorporateInfo sql := " UserName='" + this.User.Username + "'" zrsvc.GetEntity(®isterUser,sql) where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')" } zrwhere := where + " and b.Status='" + suppliercert.STORE_STATUS + "'" zrsvc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, 1, 100, "b.Id", false , &zrlist, zrwhere) for _, item := range zrlist { var sele selectbusiness.SelectBusiness sele.SupplierName = item.SupplierName sele.CreateOn = item.CreateOn sele.AccessCardNo = item.AccessCardNo sele.TypeCode = item.SupplierTypeCode sele.TypeName = item.SupplierTypeName sele.Preject = "1" list = append(list, sele) } } // 增项 if perject == "2" || perject == "" { where := "1=1 " if accessCardNo != "" { where = where + " and b.AccessCardNo='" + accessCardNo + "'" } if supplierTypeCode != "" { where = where + " and b.AppendType='" + supplierTypeCode + "'" } if supplierName != "" { where =where + " and a.SupplierName like '%" + supplierName + "%'" } var zxlist []suppliercertappend.OilSupplierCertAppend zxsvc := suppliercertappend.GetOilSupplierCertAppendService(utils.DBE) if this.User.IsCompanyUser == 1 { var registerUser register.OilCorporateInfo sql := " UserName='" + this.User.Username + "'" zxsvc.GetEntity(®isterUser,sql) where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')" } zxwhere := where + " and b.Status='" + suppliercert.STORE_STATUS + "'" zxsvc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertAppendName, 1, 100, "b.Id", false, &zxlist, zxwhere) for _, item := range zxlist { var sele selectbusiness.SelectBusiness sele.SupplierName = item.SupplierName sele.CreateOn = item.CreateOn sele.AccessCardNo = item.AccessCardNo sele.TypeCode = item.AppendType sele.TypeName = "" sele.Preject = "2" list = append(list, sele) } } // 年审 if perject == "3" || perject == "" { where := "1=1 " if accessCardNo != "" { where = where + " and b.AccessCardNo='" + accessCardNo + "'" } if supplierTypeCode != "" { where = where + " and b.SupplierTypeName='" + supplierTypeCode + "'" } if supplierName != "" { where =where + " and a.SupplierName like '%" + supplierName + "%'" } var nslist []annualaudit.OilAnnualAudit nssvc := annualaudit.GetOilAnnualAuditService(utils.DBE) if this.User.IsCompanyUser == 1 { var registerUser register.OilCorporateInfo sql := " UserName='" + this.User.Username + "'" nssvc.GetEntity(®isterUser,sql) where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')" } zswhere := where + " and b.Status='" + suppliercert.DRAFT_STATUS + "'" nssvc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilAnnualAuditName,1, 100, "b.Id", false, &nslist, zswhere) for _, item := range nslist { var sele selectbusiness.SelectBusiness sele.SupplierName = item.SupplierName sele.CreateOn = item.CreateOn sele.AccessCardNo = item.AccessCardNo sele.TypeCode = item.SupplierTypeName sele.TypeName = "" sele.Preject = "3" list = append(list, sele) } } // 变更申请 if perject == "4" || perject == "" { where := "1=1 " if accessCardNo != "" { where = where + " and b.AccessCardNo='" + accessCardNo + "'" } if supplierTypeCode != "" { where = where + " and b.SupplierTypeCode='" + supplierTypeCode + "'" } if supplierName != "" { where =where + " and a.SupplierName like '%" + supplierName + "%'" } var bglist []infochange.SuppModelInfo bgsvc := infochange.GetInfoChangeService(utils.DBE) if this.User.IsCompanyUser == 1 { var registerUser register.OilCorporateInfo sql := " UserName='" + this.User.Username + "'" bgsvc.GetEntity(®isterUser,sql) where = where + " and (b.CreateUserId = '" + this.User.Id + "' or a.CommercialNo='" + registerUser.CommercialNo + "')" } bgwhere := where + " and b.Status='" + suppliercert.DRAFT_STATUS + "'" bgsvc.GetSuppPagingEntitiesWithOrderBytbl(OilSupplierName, OilInfoChangeName, 1, 100, "b.Id", false, &bglist, bgwhere) for _, item := range bglist { var sele selectbusiness.SelectBusiness sele.SupplierName = item.SupplierName sele.CreateOn = item.CreateOn sele.AccessCardNo = "" sele.TypeCode = item.SupplierTypeCode sele.TypeName = item.SupplierTypeName sele.Preject = "4" list = append(list, sele) } } var datainfo DataInfo datainfo.Items = list this.Data["json"] = &datainfo this.ServeJSON() } // @Title 文件上传 // @Description get user by tokenaddsubfile // @Success 200 {object} models.Userblood // @router /filelist [get] func (this *SelectController) FileList() { page := this.GetPageInfoForm() var list []supplierfile.OilSupplierFile svc := supplierfile.GetSupplierfileService(utils.DBE) where := " 1=1" orderby := "Id" asc := true Order := this.GetString("Order") Prop := this.GetString("Prop") subfilename := this.GetString("subfileName") supplierId := this.GetString("SupplierId") createOn := this.GetString("CreateOn") if Order != "" && Prop != "" { orderby = Prop if Order == "asc" { asc = true } } //企业用户必须加创建人条件 var registerUser register.OilCorporateInfo var company supplier.OilSupplier sql := " UserName='" + this.User.Username + "'" svc.GetEntity(®isterUser,sql) sql1:= " CreateUserId = '" + this.User.Id + "' or CommercialNo='"+registerUser.CommercialNo+"'" svc.GetEntity(&company,sql1) if supplierId != "0" { where = where + " and SupplierId=" + supplierId } else { where = where + " and SupplierId=" + strconv.Itoa(company.Id) } if subfilename != "" { where = where + " and NeedFileType like '%" + subfilename + "%'" } if createOn != "" { dates := strings.Split(createOn, ",") if len(dates) == 2 { minDate := dates[0] maxDate := dates[1] where = where + " and EffectDate>='" + minDate + "' and EffectDate<='" + maxDate + "'" } } total := svc.GetPagingEntitiesWithoutAccCode(page.CurrentPage, page.Size, orderby, asc, &list, where) var datainfo DataInfo datainfo.Items = list datainfo.CurrentItemCount = total this.Data["json"] = &datainfo this.ServeJSON() } // @Title 获取列表 // @Description // @Success 200 {object} // @router /totallist [get] func (this *SelectController) GetTotalList() { //获取分页信息 page := this.GetPageInfoForm() where := "0" orderby := "Id" asc := false Order := this.GetString("Order") Prop := this.GetString("Prop") if Order != "" && Prop != "" { orderby = Prop if Order == "asc" { asc = true } } Years := this.GetString("Years") if Years != "" { where = Years } //CreateOn := this.GetString("CreateOn") // //if CreateOn != "" { // dates := strings.Split(CreateOn, ",") // if len(dates) == 2 { // minDate := dates[0] // maxDate := dates[1] // where = where + " and ValidityTo>='" + minDate + "' and ValidityTo<='" + maxDate + "'" // } //} svc := selectbusiness.GetSelectService(utils.DBE) var list []selectbusiness.TotalCount svc.GetTotalInMonth(orderby, asc, &list, where) var datainfo DataInfo datainfo.Items = list datainfo.PageIndex = page.CurrentPage datainfo.ItemsPerPage = page.Size this.Data["json"] = &datainfo this.ServeJSON() }