Fix leftover department references after rename to position

FindAll search query and tests still referenced the old column name,
causing vet errors and runtime SQL failures.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Frudrax Cheng
2026-05-26 10:41:01 +08:00
parent 0d82260fd9
commit 1029d5966b
2 changed files with 17 additions and 17 deletions
+2 -2
View File
@@ -117,14 +117,14 @@ func (s *EmployeeSerialsService) FindAll(page int, limit int, search string) ([]
// 搜索条件
if search != "" {
db = db.Where("serial_number LIKE ? OR company_name LIKE ? OR department LIKE ? OR employee_name LIKE ?",
db = db.Where("serial_number LIKE ? OR company_name LIKE ? OR position LIKE ? OR employee_name LIKE ?",
"%"+search+"%", "%"+search+"%", "%"+search+"%", "%"+search+"%")
}
// 获取总数
countQuery := db.Model(&models.EmployeeSerial{})
if search != "" {
countQuery = countQuery.Where("serial_number LIKE ? OR company_name LIKE ? OR department LIKE ? OR employee_name LIKE ?",
countQuery = countQuery.Where("serial_number LIKE ? OR company_name LIKE ? OR position LIKE ? OR employee_name LIKE ?",
"%"+search+"%", "%"+search+"%", "%"+search+"%", "%"+search+"%")
}
countQuery.Count(&total)