fix pagination and search
This commit is contained in:
@@ -11,12 +11,19 @@ type CreateDto struct {
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
IndName string `json:"indName"`
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string `json:"-"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
IndName string `json:"indName"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
|
||||
@@ -17,6 +17,7 @@ type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string `json:"-"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,18 @@ type CreateDto struct {
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Search string `json:"search"`
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string `json:"-"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
|
||||
@@ -17,6 +17,7 @@ type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string `json:"-"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string `json:"-"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,18 @@ type CreateDto struct {
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
|
||||
@@ -13,10 +13,17 @@ type CreateDto struct {
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string `json:"-"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Scope_Code *ere.CheckupScopeCode `json:"scope-code"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
|
||||
@@ -10,11 +10,18 @@ type CreateDto struct {
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string `json:"-"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
|
||||
@@ -10,11 +10,18 @@ type CreateDto struct {
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string `json:"-"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
|
||||
@@ -11,10 +11,17 @@ type CreateDto struct {
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string `json:"-"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Regency_Code string `json:"regency-code"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
|
||||
@@ -11,13 +11,19 @@ type CreateDto struct {
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
IndName string `json:"indName"`
|
||||
Search string `json:"search"`
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Preloads []string `json:"-"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
IndName string `json:"indName"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.De
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Device{}).
|
||||
|
||||
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(input.Includes) > 0 {
|
||||
input.Preloads = pu.GetPreloads(input.Includes)
|
||||
}
|
||||
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -47,9 +47,17 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if len(input.Preloads) > 0 {
|
||||
for _, preload := range input.Preloads {
|
||||
tx = tx.Preload(preload)
|
||||
}
|
||||
}
|
||||
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.DiagnoseSrc{}).
|
||||
Scopes(gh.Filter(input)).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
Scopes(gh.Paginate(input, &pagination)).
|
||||
Order("\"CreatedAt\" DESC")
|
||||
|
||||
@@ -53,6 +53,8 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
|
||||
}
|
||||
}
|
||||
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.DivisionPosition{}).
|
||||
Preload("Division").
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
if input.OnlyHaveChildren {
|
||||
tx = tx.Where(`
|
||||
|
||||
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(input.Includes) > 0 {
|
||||
input.Preloads = pu.GetPreloads(input.Includes)
|
||||
}
|
||||
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Et
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Ethnic{}).
|
||||
Scopes(gh.Filter(input)).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
Scopes(gh.Paginate(input, &pagination)).
|
||||
Order("\"CreatedAt\" DESC")
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
if input.OnlyHaveChildren {
|
||||
tx = tx.Where(`
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Installation{}).
|
||||
|
||||
@@ -53,6 +53,8 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
|
||||
}
|
||||
}
|
||||
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.InsuranceCompany{}).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
|
||||
@@ -53,6 +53,8 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.It
|
||||
}
|
||||
}
|
||||
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Item{}).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
|
||||
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(input.Includes) > 0 {
|
||||
input.Preloads = pu.GetPreloads(input.Includes)
|
||||
}
|
||||
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.La
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Language{}).
|
||||
Scopes(gh.Filter(input)).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
Scopes(gh.Paginate(input, &pagination)).
|
||||
Order("\"CreatedAt\" DESC")
|
||||
|
||||
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(input.Includes) > 0 {
|
||||
input.Preloads = pu.GetPreloads(input.Includes)
|
||||
}
|
||||
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -47,9 +47,17 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Mc
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if len(input.Preloads) > 0 {
|
||||
for _, preload := range input.Preloads {
|
||||
tx = tx.Preload(preload)
|
||||
}
|
||||
}
|
||||
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.McuSrcCategory{}).
|
||||
Scopes(gh.Filter(input)).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
Scopes(gh.Paginate(input, &pagination)).
|
||||
Order("\"CreatedAt\" DESC")
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Mc
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.McuSrc{}).
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Mc
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.McuSubSrc{}).
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.MedicalActionSrc{}).
|
||||
|
||||
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(input.Includes) > 0 {
|
||||
input.Preloads = pu.GetPreloads(input.Includes)
|
||||
}
|
||||
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -47,9 +47,17 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if len(input.Preloads) > 0 {
|
||||
for _, preload := range input.Preloads {
|
||||
tx = tx.Preload(preload)
|
||||
}
|
||||
}
|
||||
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.MedicineGroup{}).
|
||||
Scopes(gh.Filter(input)).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
Scopes(gh.Paginate(input, &pagination)).
|
||||
Order("\"CreatedAt\" DESC")
|
||||
|
||||
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(input.Includes) > 0 {
|
||||
input.Preloads = pu.GetPreloads(input.Includes)
|
||||
}
|
||||
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -47,9 +47,17 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if len(input.Preloads) > 0 {
|
||||
for _, preload := range input.Preloads {
|
||||
tx = tx.Preload(preload)
|
||||
}
|
||||
}
|
||||
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.MedicineMethod{}).
|
||||
Scopes(gh.Filter(input)).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
Scopes(gh.Paginate(input, &pagination)).
|
||||
Order("\"CreatedAt\" DESC")
|
||||
|
||||
@@ -53,9 +53,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Me
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
tx = tx.Debug().
|
||||
Model(&e.Medicine{}).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
|
||||
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(input.Includes) > 0 {
|
||||
input.Preloads = pu.GetPreloads(input.Includes)
|
||||
}
|
||||
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -47,9 +47,17 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Ph
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if len(input.Preloads) > 0 {
|
||||
for _, preload := range input.Preloads {
|
||||
tx = tx.Preload(preload)
|
||||
}
|
||||
}
|
||||
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.PharmacyCompany{}).
|
||||
Scopes(gh.Filter(input)).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
Scopes(gh.Paginate(input, &pagination)).
|
||||
Order("\"CreatedAt\" DESC")
|
||||
|
||||
@@ -87,6 +87,9 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(input.Includes) > 0 {
|
||||
input.Preloads = pu.GetPreloads(input.Includes)
|
||||
}
|
||||
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Pr
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.ProcedureSrc{}).
|
||||
Scopes(gh.Filter(input)).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
Scopes(gh.Paginate(input, &pagination)).
|
||||
Order("\"CreatedAt\" DESC")
|
||||
|
||||
@@ -53,9 +53,9 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Pr
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
tx = tx.Debug().
|
||||
Model(&e.Province{}).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Re
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Regency{}).
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Sp
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Specialist{}).
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Su
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Subspecialist{}).
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Un
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Unit{}).
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Uo
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Uom{}).
|
||||
|
||||
@@ -53,7 +53,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Vi
|
||||
}
|
||||
}
|
||||
|
||||
plh.SearchCodeOrName(input.Search, tx)
|
||||
tx = plh.SearchCodeOrName(input.Search, tx)
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Village{}).
|
||||
|
||||
@@ -8,10 +8,12 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func SearchCodeOrName(search string, tx *gorm.DB) {
|
||||
func SearchCodeOrName(search string, tx *gorm.DB) *gorm.DB {
|
||||
if search != "" {
|
||||
tx.Where("\"Code\" ILIKE ? OR \"Name\" ILIKE ?", "%"+search+"%", "%"+search+"%")
|
||||
tx = tx.Where("\"Code\" ILIKE ? OR \"Name\" ILIKE ?", "%"+search+"%", "%"+search+"%")
|
||||
}
|
||||
|
||||
return tx
|
||||
}
|
||||
|
||||
func HandleCreateError(input any, event *pl.Event, err error) error {
|
||||
|
||||
Reference in New Issue
Block a user