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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user