feat:完善项目
This commit is contained in:
@ -9,20 +9,16 @@ import (
|
||||
type ManageEquipmentMaterial struct {
|
||||
*model.ManageEquipmentMaterial
|
||||
}
|
||||
type ManageEquipmentMaterialInfo struct {
|
||||
ID uint64 `json:"id"`
|
||||
ManageMaterialBasic
|
||||
}
|
||||
|
||||
// Materials 器材信息
|
||||
func (m *ManageEquipmentMaterial) Materials(equipmentID uint64) ([]*ManageEquipmentMaterialInfo, error) {
|
||||
func (m *ManageEquipmentMaterial) Materials(equipmentID uint64) ([]*ManageMaterialBasic, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS e").
|
||||
Select("e.id", "m.code", "m.title", "m.unit", "s.name AS manufacturer_name").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS m ON e.material_id = m.id", model.NewManageMaterial().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS s ON m.manufacturer_id = s.id", model.NewManageSupplier().TableName())).
|
||||
Where("e.equipment_id = ? AND e.is_deleted = ?", equipmentID, model.DeleteStatusForNot)
|
||||
|
||||
out := make([]*ManageEquipmentMaterialInfo, 0)
|
||||
out := make([]*ManageMaterialBasic, 0)
|
||||
|
||||
err := db.Scan(&out).Error
|
||||
|
||||
|
@ -13,7 +13,7 @@ type ManageMaterial struct {
|
||||
type (
|
||||
// ManageMaterialBasic 基本信息
|
||||
ManageMaterialBasic struct {
|
||||
ID uint64 `json:"id"`
|
||||
ID uint64 `json:"-"`
|
||||
Code string `json:"code"`
|
||||
Title string `json:"title"`
|
||||
Price float64 `json:"price"`
|
||||
|
@ -49,7 +49,7 @@ func (m *SysUser) Users(page, pageSize int, count *int64, where ...*model.ModelW
|
||||
mSysTenant := model.NewSysTenant()
|
||||
|
||||
db := orm.GetDB().Table(m.TableName()+" As u").Select("u.id", "u.uuid", "account", "u.name", "u.avatar",
|
||||
"u.mobile", "u.email", "u.status", "t.name AS tenant_name", "u.created_at").
|
||||
"u.mobile", "u.email", "u.gender", "u.status", "t.name AS tenant_name", "u.created_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON u.tenant_id = t.id", mSysTenant.TableName())).
|
||||
Where("u.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
|
Reference in New Issue
Block a user