| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- package oilsupplier
- import (
- "dashoo.cn/backend/api/business/oilsupplier/paymentselect"
- . "dashoo.cn/backend/api/controllers"
- "dashoo.cn/utils"
- "strings"
- )
- type PaymentSelectController struct {
- BaseController
- }
- // @Title 获取明细列表
- // @Description get user by token
- // @Success 200 {object} []paymentselect.PaymentselectList
- // @router /list [get]
- func (this *PaymentSelectController) GetEntityList() {
- //获取分页信息
- page := this.GetPageInfoForm()
- orderby := "p.PayDate"
- where := " 1=1 "
- asc := " DESC"
- SupplierTypeName := this.GetString("SupplierTypeName")
- SupplierName := this.GetString("SupplierName")
- CreateOn := this.GetString("CreateOn")
- if SupplierTypeName != "" {
- where = where + " and c.SupplierTypeName like '%" + SupplierTypeName + "%'"
- }
- if SupplierName != "" {
- where = where + " and s.SupplierName like '%" + SupplierName + "%'"
- }
- if CreateOn != "" {
- dates := strings.Split(CreateOn, ",")
- if len(dates) == 2 {
- minDate := dates[0]
- maxDate := dates[1]
- where = where + " and p.PayDate>='" + minDate + "' and p.PayDate<='" + maxDate + "'"
- }
- }
- //svc := suppliercert.GetOilSupplierCertService(utils.DBE)
- //var list []suppliercert.OilSupplierCert
- svc := paymentselect.GetPaymentSelectService(utils.DBE)
- var list []paymentselect.PaymentselectList
- total := svc.GetPaymentselectList( page.CurrentPage, page.Size, orderby, asc, &list, where)
- //total := svc.GetPagingEntitiesWithOrderBytbl("", 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} paymentselect.PaymentselectList
- // @router /sumlist [get]
- func (this *PaymentSelectController) GetEntitySumList() {
- orderby := "c.SupplierTypeName"
- where := " 1=1 "
- asc := " DESC"
- svc := paymentselect.GetPaymentSelectService(utils.DBE)
- var list []paymentselect.PaymentselectList
- svc.GetPaymentselectSumList(orderby, asc, &list, where)
- var datainfo DataInfo
- datainfo.Items = list
- this.Data["json"] = &datainfo
- this.ServeJSON()
- }
|