作者 陈志颖

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

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