作者 陈志颖

fix:修复员工管理,筛除所有已禁用的员工

@@ -69,7 +69,7 @@ func (repository *EmployeeRepository) FindOne(queryOptions map[string]interface{ @@ -69,7 +69,7 @@ func (repository *EmployeeRepository) FindOne(queryOptions map[string]interface{
69 if companyId, ok := queryOptions["companyId"]; ok { 69 if companyId, ok := queryOptions["companyId"]; ok {
70 query = query.Where("employee.company_id = ?", companyId) 70 query = query.Where("employee.company_id = ?", companyId)
71 } 71 }
72 - //query = query.Where(`employee.status = ?`, 1) 72 + query = query.Where(`employee.status = ?`, 1)
73 if err := query.First(); err != nil { 73 if err := query.First(); err != nil {
74 if err.Error() == "pg: no rows in result set" { 74 if err.Error() == "pg: no rows in result set" {
75 return nil, fmt.Errorf("没有此员工") 75 return nil, fmt.Errorf("没有此员工")
@@ -95,9 +95,10 @@ func (repository *EmployeeRepository) Find(queryOptions map[string]interface{}) @@ -95,9 +95,10 @@ func (repository *EmployeeRepository) Find(queryOptions map[string]interface{})
95 if employeeNameMatch, ok := queryOptions["employeeNameMatch"]; ok && (employeeNameMatch != "") { 95 if employeeNameMatch, ok := queryOptions["employeeNameMatch"]; ok && (employeeNameMatch != "") {
96 query = query.Where("employee.employee_name LIKE ?", fmt.Sprintf("%%%s%%", employeeNameMatch.(string))) 96 query = query.Where("employee.employee_name LIKE ?", fmt.Sprintf("%%%s%%", employeeNameMatch.(string)))
97 } 97 }
98 - if status, ok := queryOptions["status"]; ok && (status != 0) {  
99 - query = query.Where(`employee.status = ?`, status)  
100 - } 98 + //if status, ok := queryOptions["status"]; ok && (status != 0) {
  99 + // query = query.Where(`employee.status = ?`, status)
  100 + //}
  101 + query = query.Where(`employee.status = ?`, 1)
101 if isPrincipal, ok := queryOptions["isPrincipal"]; ok && isPrincipal.(bool) != false { 102 if isPrincipal, ok := queryOptions["isPrincipal"]; ok && isPrincipal.(bool) != false {
102 query = query.Where("employee.is_principal = ? ", isPrincipal) 103 query = query.Where("employee.is_principal = ? ", isPrincipal)
103 } 104 }