123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package models
- import (
- "database/sql"
- "lttc-go-adm-znaf/orm"
- )
- type Vehicle struct {
- Guid sql.NullString `json:"guid"`
- InfoNO sql.NullString `json:"info_no"`
- LicensePlateNO sql.NullString `json:"license_plate_no"`
- Brand sql.NullString `json:"brand"`
- Model sql.NullString `json:"model"`
- Type sql.NullString `json:"type"`
- Color sql.NullString `json:"color"`
- PurDate sql.NullTime `json:"pur_date"`
- OtherInfo sql.NullString `json:"other_info"`
- EmployeeNO sql.NullString `json:"employee_no"`
- EmployeeName sql.NullString `json:"employee_name"`
- DeptName sql.NullString `json:"dept_name"`
- FactoryArea sql.NullString `json:"factory_area"`
- PhoneNumber sql.NullString `json:"phone_number"`
- JobPositions sql.NullString `json:"job_positions"`
- ClassSystem sql.NullString `json:"class_system"`
- ClassType sql.NullString `json:"class_type"`
- DimissionDate sql.NullTime `json:"dimission_date"`
- ParkLocale sql.NullString `json:"park_locale"`
- ParkCertName sql.NullString `json:"park_cert_name"`
- SubmitDate sql.NullTime `json:"submit_date"`
- GrantDate sql.NullTime `json:"grant_date"`
- IsOftenDrive sql.NullString `json:"is_often_drive"`
- Note sql.NullString `json:"note"`
- EditUser sql.NullString `json:"edit_user"`
- EditTime sql.NullTime `json:"edit_time"`
- SealUser sql.NullString `json:"seal_user"`
- SealTime sql.NullTime `json:"seal_time"`
- }
- func GetAllVehicles() ([]Vehicle, error) {
- var (
- vehicles []Vehicle
- err error
- )
- err = orm.DB.Select(&vehicles, "select top 1 guid, infono, licenseplateno, brand, model, type, color, purdate, otherinfo, employeeno, employeename, deptname, factoryarea, phonenumber, jobpositions, classsystem, classtype, dimissiondate, parklocale, parkcertname, submitdate, grantdate, isoftendrive, note, edituser, edittime, sealuser, sealtime from dbo.ADM_ZNAF_VehicleMng_VehicleInfo order by EditTime desc ")
- if err != nil {
- return nil, err
- }
- return vehicles, nil
- }
|