| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- package oilsupplier
- import (
- "encoding/json"
- "fmt"
- // "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 RegCapitalRange struct {
- RegCapital1 string
- RegCapital2 string
- }
- type UpSearch struct {
- SupplierName string
- }
- type UpInfoSearch struct {
- SupplierName string
- SupplierTypeCode string
- SupplierTypeName string
- AllUpNum int
- HeGeNum int
- UnHeGeNum int
- Reason string
- }
- type NeedFileTypeStruct struct {
- NeedFileType []string
- }
- // @Title 获取所有
- // @Description
- // @Success 200 {object}
- // @router /getcompanylist [post]
- func (this *SelectController) GetTList() {
- var model supplier.OilSupplierView
- var model1 RegCapitalRange
- var model2 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"
- orderby := "a.Id"
- asc := false
- Order := this.GetString("Order")
- Prop := this.GetString("Prop")
- fmt.Println(Prop)
- if Order != "" && Prop != "" {
- orderby = Prop
- if Order == "asc" {
- asc = true
- }
- }
- if model.AccessCardNo != "" {
- where = where + " and b.AccessCardNo like '%" + model.AccessCardNo + "%'"
- }
- if model.SupplierName != "" {
- where = where + " and a.SupplierName like '%" + model.SupplierName + "%'"
- }
- if model.SupplierTypeCode != "" {
- where = where + " and b.SupplierTypeCode = '" + model.SupplierTypeCode + "'"
- }
- 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.CompanyType != "" {
- where = where + " and a.CompanyType like '%" + model.CompanyType + "%'"
- }
- HseTraining := this.GetString("HseTraining")
- if HseTraining != "" {
- where = where + " and a.HseTraining = '" + HseTraining + "'"
- }
- BusinessScope := this.GetString("BusinessScope")
- if BusinessScope != "" {
- where = where + " and a.BusinessScope like '%" + BusinessScope + "%'"
- }
- OldSupplierName := this.GetString("OldSupplierName")
- if OldSupplierName != "" {
- where = where + " and c.OldSupplierName like '%" + OldSupplierName + "%'"
- }
- Province := this.GetString("Province")
- if Province != "" {
- where = where + " and a.Province = '" + Province + "'"
- }
- City := this.GetString("City")
- if City != "" {
- where = where + " and a.City = '" + City + "'"
- }
- Street := this.GetString("Street")
- if Street != "" {
- where = where + " and a.Street = '" + Street + "'"
- }
- Address := this.GetString("Address")
- if Address != "" {
- where = where + " and a.Address like '%" + Address + "%'"
- }
- LinkProvince := this.GetString("LinkProvince")
- if LinkProvince != "" {
- where = where + " and a.LinkProvince = '" + LinkProvince + "'"
- }
- LinkCity := this.GetString("LinkCity")
- if LinkCity != "" {
- where = where + " and a.LinkCity = '" + LinkCity + "'"
- }
- LinkStreet := this.GetString("LinkStreet")
- if LinkStreet != "" {
- where = where + " and a.LinkStreet = '" + LinkStreet + "'"
- }
- LinkAddress := this.GetString("LinkAddress")
- if LinkAddress != "" {
- where = where + " and a.LinkAddress like '%" + LinkAddress + "%'"
- }
- DepositBank := this.GetString("DepositBank")
- if DepositBank != "" {
- where = where + " and a.DepositBank like '%" + DepositBank + "%'"
- }
- 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 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] + ")"
- }
- svc := selectbusiness.GetSelectService(utils.DBE)
- var list []supplier.OilSupplierView
- total := svc.GetMyPagingEntitiesWithOrderBytbl(OilSupplierName, OilSupplierCertName, OilInfoChangeName, OilSupplierFileName, page.CurrentPage, page.Size, orderby, 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 /up [post]
- func (this *SelectController) Up() {
- var model UpSearch
- var jsonBlob = this.Ctx.Input.RequestBody
- json.Unmarshal(jsonBlob, &model)
- // //获取分页信息
- page := this.GetPageInfoForm()
- where := " 1=1"
- asc := false
- Order := this.GetString("Order")
- Prop := this.GetString("Prop")
- if Order != "" && Prop != "" {
- if Order == "asc" {
- asc = true
- }
- }
- if model.SupplierName != "" {
- where = where + " and SupplierName like '%" + model.SupplierName + "%'"
- }
- svc := selectbusiness.GetSelectService(utils.DBE)
- var list []UpInfoSearch
- total := svc.GetUp(OilSupplierName, OilSupplierCertName, OilSupplierCertSubName, 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()
- }
|