feat: expand vehicle data platform capabilities
This commit is contained in:
@@ -24,6 +24,35 @@ const candidateQuery = `SELECT
|
||||
COALESCE(co.other_customer_id, co.customer_id),
|
||||
COALESCE(co.contract_code, r.contract_code, ''),
|
||||
COALESCE(co.project_name, r.project_name, ''),
|
||||
COALESCE(ci.customer_name, r.customer_name, ''),
|
||||
COALESCE(CAST(
|
||||
CASE WHEN co.other_customer_id IS NOT NULL
|
||||
THEN co.other_business_department_id
|
||||
ELSE co.business_department_id
|
||||
END AS CHAR
|
||||
), ''),
|
||||
COALESCE(
|
||||
CASE WHEN co.other_customer_id IS NOT NULL
|
||||
THEN co.other_business_department_name
|
||||
ELSE co.business_department_name
|
||||
END,
|
||||
r.business_dept,
|
||||
''
|
||||
),
|
||||
COALESCE(CAST(
|
||||
CASE WHEN co.other_customer_id IS NOT NULL
|
||||
THEN co.other_business_manager_id
|
||||
ELSE co.business_manager_id
|
||||
END AS CHAR
|
||||
), ''),
|
||||
COALESCE(
|
||||
CASE WHEN co.other_customer_id IS NOT NULL
|
||||
THEN co.other_business_manager_name
|
||||
ELSE co.business_manager_name
|
||||
END,
|
||||
r.business_manager,
|
||||
''
|
||||
),
|
||||
COALESCE(vs.operation_status, ''),
|
||||
dv.delivery_time,
|
||||
dv.update_time
|
||||
@@ -89,12 +118,14 @@ func ReadCandidates(ctx context.Context, db *sql.DB) ([]Candidate, error) {
|
||||
for rows.Next() {
|
||||
var vehicleID, vehicleProfileID, customerID, customerProfileID sql.NullInt64
|
||||
var contractID, contractProfileID, effectiveCustomerID sql.NullInt64
|
||||
var vin, plate, contractCode, projectName, operationStatus string
|
||||
var vin, plate, contractCode, projectName, customerName string
|
||||
var departmentID, departmentName, responsibleUserID, responsibleUserName, operationStatus string
|
||||
var scopeStart time.Time
|
||||
var updatedAt sql.NullTime
|
||||
if err := rows.Scan(
|
||||
&vehicleID, &vehicleProfileID, &vin, &plate, &customerID, &customerProfileID,
|
||||
&contractID, &contractProfileID, &effectiveCustomerID, &contractCode, &projectName,
|
||||
&customerName, &departmentID, &departmentName, &responsibleUserID, &responsibleUserName,
|
||||
&operationStatus, &scopeStart, &updatedAt,
|
||||
); err != nil {
|
||||
return nil, fmt.Errorf("scan OneOS scope candidate: %w", err)
|
||||
@@ -108,8 +139,11 @@ func ReadCandidates(ctx context.Context, db *sql.DB) ([]Candidate, error) {
|
||||
ContractID: contractID.Int64, ContractPresent: contractID.Valid,
|
||||
ContractProfileExists: contractProfileID.Valid,
|
||||
EffectiveCustomerID: effectiveCustomerID.Int64, EffectiveCustomerSet: effectiveCustomerID.Valid,
|
||||
ContractCode: contractCode, ProjectName: projectName, OperationStatus: operationStatus,
|
||||
ScopeStartAt: scopeStart,
|
||||
CustomerName: customerName, ContractCode: contractCode, ProjectName: projectName,
|
||||
DepartmentID: departmentID, DepartmentName: departmentName,
|
||||
ResponsibleUserID: responsibleUserID, ResponsibleUserName: responsibleUserName,
|
||||
OperationStatus: operationStatus,
|
||||
ScopeStartAt: scopeStart,
|
||||
}
|
||||
if updatedAt.Valid {
|
||||
value := updatedAt.Time
|
||||
|
||||
Reference in New Issue
Block a user