Commit 1416c0b1 authored by honghuiliu's avatar honghuiliu 💬

日常提交

parent 9308c6db
......@@ -8,13 +8,14 @@ import (
// QshPartol 结构体
type QshPatrol struct {
global.GVA_MODEL
Content string `json:"content" form:"content" gorm:"column:content;comment:巡检内容;"`
Description string `json:"description" form:"description" gorm:"column:description;comment:异常描述;size:300;"`
Image string `json:"image" form:"image" gorm:"column:image;comment:巡检图片多个逗号分隔;"`
PartolName string `json:"partolName" form:"partolName" gorm:"column:partol_name;comment:巡视人;size:255;"`
Title string `json:"title" form:"title" gorm:"column:title;comment:工单标题;size:255;"`
ToiletId *int `json:"toiletId" form:"toiletId" gorm:"column:toilet_id;comment:巡检公厕;size:10;"`
Type *int `json:"type" form:"type" gorm:"column:type;comment:巡检类型 1=>一体化设备 2=>玻璃钢;"`
Content string `json:"content" form:"content" gorm:"column:content;comment:巡检内容;"`
Description string `json:"description" form:"description" gorm:"column:description;comment:异常描述;size:300;"`
Image string `json:"image" form:"image" gorm:"column:image;comment:巡检图片多个逗号分隔;"`
PartolName string `json:"partolName" form:"partolName" gorm:"column:partol_name;comment:巡视人;size:255;"`
Title string `json:"title" form:"title" gorm:"column:title;comment:工单标题;size:255;"`
ToiletId int `json:"toiletId" form:"toiletId" gorm:"column:toilet_id;comment:巡检公厕;size:10;"`
Type int `json:"type" form:"type" gorm:"column:type;comment:巡检类型 1=>一体化设备 2=>玻璃钢;"`
Toilet QshToilet `json:"toilet" form:"toilet" gorm:"foreignkey:ID;references:ToiletId"`
}
// TableName QshPartol 表名
......
......@@ -57,13 +57,13 @@ func (qshPartolService *QshPartolService) GetQshPartolInfoList(info adminReq.Qsh
if info.Title != "" {
db = db.Where("title LIKE ?", "%"+info.Title+"%")
}
if info.Type != nil {
if info.Type != 0 {
db = db.Where("type = ?", info.Type)
}
err = db.Count(&total).Error
if err != nil {
return
}
err = db.Limit(limit).Offset(offset).Find(&qshPartols).Error
err = db.Limit(limit).Offset(offset).Preload("Toilet").Find(&qshPartols).Error
return qshPartols, total, err
}
......@@ -32,7 +32,7 @@ func (l *PatrolService) GetPatrolList(arg request.PatrolList) ([]admin.QshPatrol
if err != nil {
return patrolList, total, err
}
err = db.Limit(limit).Offset(offset).Find(&patrolList).Error
err = db.Limit(limit).Offset(offset).Preload("Toilet").Find(&patrolList).Error
if err != nil {
return patrolList, total, err
}
......@@ -44,7 +44,7 @@ func (l *PatrolService) GetPatrolDetail(arg request.GetPatrolId) (admin.QshPatro
db := global.GVA_DB.Model(admin.QshPatrol{})
db.Where("id = ?", arg.ID)
err := db.First(&patrolList).Error
err := db.First(&patrolList).Preload("Toilet").Error
if err != nil {
return patrolList, err
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment