package final import ( "errors" "fmt" _ "image/gif" _ "image/jpeg" _ "image/png" "zhiyuan/pkg/db" "github.com/gin-gonic/gin" ) type FinalMaterialOrderItem struct { ID int64 `json:"id" prop:"add:false"` ItemId int64 `json:"item_id" label:"项目类型ID" type:"int"` OrderId int64 `json:"order_id" label:"订单号" type:"int" prop:"add:false" search:"="` Name string `json:"name" label:"项目名称" type:"string" prop:"add:false"` MatId int64 `json:"mat_id" label:"材料ID" type:"int" prop:"add"` Price float64 `json:"price" label:"单价" type:"float" prop:"add" default:"0"` Num float64 `json:"num" label:"数量" type:"float" prop:"add edit"` Total float64 `json:"total" label:"金额" type:"float" prop:"add edit"` Remark string `json:"remark" label:"备注" type:"string" prop:"edit"` DeletedAt int64 `json:"deleted_at" prop:"add:false select:false"` CreatedAt int64 `json:"created_at" prop:"add:false"` UpdatedAt int64 `json:"updated_at" prop:"add:false"` db.BaseModel } func (FinalMaterialOrderItem) TableName() string { return "zy_final_material_order_item" } func (model FinalMaterialOrderItem) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool { return true } func (FinalMaterialOrderItem) AddPrivilege(c *gin.Context, data map[string]interface{}, post map[string]interface{}) error { return errors.New("没有权限") } func (FinalMaterialOrderItem) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error { return errors.New("没有权限") } func (FinalMaterialOrderItem) DelPrivilege(c *gin.Context, id int64) error { return errors.New("没有权限") } func (FinalMaterialOrderItem) Page() bool { return false } func (FinalMaterialOrderItem) Count() bool { return false } type FinalMaterialOrderItemMobile struct { Typename string `json:"type_name" label:"类型名称" prop:"select:finalmattype.name" search:"like"` Unit string `json:"unit" label:"单位" prop:"select:finalmattype.unit" search:"like"` IsCustom int64 `json:"is_custom" label:"是否定制" prop:"select:finalmattype.is_custom" search:"="` MatName string `json:"mat_name" type:"string" prop:"select:concat(finalmat.brand,'\\t',finalmat.series,'\\t',finalmat.model,'\\t',finalmat.specs,'\\t',finalmat.color)"` MatPrice float64 `json:"mat_price" type:"float" prop:"select:finalmat.price"` ItemName string `json:"item_name" label:"项目名称" prop:"select:finalmatitem.name"` FinalMaterialOrderItem } func (model FinalMaterialOrderItemMobile) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error { return model.FinalMaterialOrderItem.EditPrivilege(c, id, data, post) } func (model FinalMaterialOrderItemMobile) GroupBy() string { return fmt.Sprintf("`%s`.`id`", model.TableName()) } func (model FinalMaterialOrderItemMobile) LeftJoin(data map[string]interface{}, s *db.Select) []db.JoinModel { return append(model.FinalMaterialOrderItem.LeftJoin(data, s), db.JoinModel{ Model: FinalMat{}, As: "finalmat", On: []string{"`finalmat`.`id` = " + model.TableName() + ".`mat_id` AND `finalmat`.`deleted_at` = 0"}, }, db.JoinModel{ Model: FinalMatType{}, As: "finalmattype", On: []string{"`finalmattype`.`id` = `finalmat`.`type_id` AND `finalmattype`.`deleted_at` = 0"}, }, db.JoinModel{ Model: FinalMatItem{}, As: "finalmatitem", On: []string{"`finalmatitem`.`id` = " + model.TableName() + ".`item_id`"}, }) }