From 1fab8f0f684d28ac8b996b345402b45e116eaed9 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期二, 30 四月 2024 17:30:51 +0800 Subject: [PATCH] 薪资报表查询与修改 --- models/salary_details.go | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/models/salary_details.go b/models/salary_details.go index 9427d3c..2375126 100644 --- a/models/salary_details.go +++ b/models/salary_details.go @@ -48,12 +48,28 @@ return slf } +func (slf *SalaryDetailsSearch) SetSalaryReportFormId(salaryReportFormId uint) *SalaryDetailsSearch { + slf.SalaryReportFormId = salaryReportFormId + return slf +} + +func (slf *SalaryDetailsSearch) SetSalaryTypeId(salaryTypeId uint) *SalaryDetailsSearch { + slf.SalaryTypeId = salaryTypeId + return slf +} + func (slf *SalaryDetailsSearch) build() *gorm.DB { var db = slf.Orm.Table(slf.TableName()) if slf.Preload { db = db.Model(SalaryDetails{}).Preload("SalaryType") } + if slf.SalaryReportFormId != 0 { + db = db.Where("salary_report_form_id = ?", slf.SalaryReportFormId) + } + if slf.SalaryTypeId != 0 { + db = db.Where("salary_type_id = ?", slf.SalaryTypeId) + } return db } -- Gitblit v1.8.0