|
@@ -4,6 +4,8 @@ import (
|
|
|
"eta/eta_api/global"
|
|
|
"eta/eta_api/utils"
|
|
|
"time"
|
|
|
+
|
|
|
+ "gorm.io/gorm"
|
|
|
)
|
|
|
|
|
|
// EdbInspectionConfig
|
|
@@ -99,9 +101,13 @@ func GetListBySource(source int) (list []*EdbInspectionConfig, err error) {
|
|
|
}
|
|
|
|
|
|
func GetConfigListBySourceAndTerminalCode(source int, terminalCode string) (list []*EdbInspectionConfigItem, err error) {
|
|
|
- condition := " c.source = ? "
|
|
|
+ condition := " 1=1 "
|
|
|
var pars []interface{}
|
|
|
- pars = append(pars, source)
|
|
|
+
|
|
|
+ if source > 0 {
|
|
|
+ condition += " AND c.source = ? "
|
|
|
+ pars = append(pars, source)
|
|
|
+ }
|
|
|
|
|
|
if terminalCode != "" {
|
|
|
condition += " AND c.terminal_code = ? "
|
|
@@ -112,6 +118,11 @@ func GetConfigListBySourceAndTerminalCode(source int, terminalCode string) (list
|
|
|
err = global.DbMap[utils.DbNameIndex].Raw(sql, pars...).Find(&list).Error
|
|
|
return
|
|
|
}
|
|
|
+func(c *EdbInspectionConfigItem) AfterFind(tx *gorm.DB) (err error) {
|
|
|
+ c.CreateTime = utils.GormDateStrToDateTimeStr(c.CreateTime)
|
|
|
+ c.ModifyTime = utils.GormDateStrToDateTimeStr(c.ModifyTime)
|
|
|
+ return
|
|
|
+}
|
|
|
|
|
|
type EdbInspectionConfigAddReq struct {
|
|
|
ConfigId int64
|
|
@@ -151,6 +162,8 @@ type EdbInspectionConfigItem struct {
|
|
|
Status int8 `description:"状态"`
|
|
|
DateType int8
|
|
|
InspectionTime string `description:"巡检时间"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ ModifyTime string `description:"修改时间"`
|
|
|
}
|
|
|
|
|
|
type EdbInspectionConfigStatusReq struct {
|