123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- package final
- import (
- "errors"
- "fmt"
- _ "image/gif"
- _ "image/jpeg"
- _ "image/png"
- "zhiyuan/pkg/db"
- "github.com/gin-gonic/gin"
- )
- type FinalSelectMaterialItem struct {
- ID int64 `json:"id" prop:"add:false"`
- SelectId int64 `json:"select_id" label:"订单号" type:"int" prop:"add:false" search:"="`
- ItemId int64 `json:"item_id" label:"项目类型ID" type:"int"`
- MatId int64 `json:"mat_id" label:"材料ID" type:"int" prop:"add"`
- Num float64 `json:"num" label:"数量" type:"float" prop:"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 (FinalSelectMaterialItem) TableName() string {
- return "zy_final_select_material_item"
- }
- func (model FinalSelectMaterialItem) ListPrivilege(c *gin.Context, data map[string]interface{}, s *db.Select) bool {
- return true
- }
- func (FinalSelectMaterialItem) AddPrivilege(c *gin.Context, data map[string]interface{}, post map[string]interface{}) error {
- return errors.New("没有权限")
- }
- func (FinalSelectMaterialItem) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error {
- return nil
- }
- func (FinalSelectMaterialItem) DelPrivilege(c *gin.Context, id int64) error {
- return errors.New("没有权限")
- }
- func (FinalSelectMaterialItem) Page() bool {
- return false
- }
- func (FinalSelectMaterialItem) Count() bool {
- return false
- }
- type FinalSelectMaterialItemMobile struct {
- Typename string `json:"type_name" label:"类型名称" prop:"select:finalmattype.name" search:"like"`
- Unit string `json:"unit" label:"单位" prop:"select:finalmattype.unit" search:"like"`
- 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"`
- Type int64 `json:"type" label:"类型" type:"int" prop:"select:finalmattype.type" search:"="`
- IsCustom int64 `json:"is_custom" label:"是否定制" prop:"select:finalmattype.is_custom" search:"="`
- PType string `json:"ptype" prop:"select:finalmatitem.ptype"`
- TypeId int64 `json:"type_id" label:"类型" type:"int" prop:"select:finalmat.type_id"`
- SupplierId int64 `json:"supplier_id" label:"材料商ID" prop:"select:finalmat.supplier_id"`
- SupplierName string `json:"supplier_name" type:"string" prop:"select:supplier.name"`
- SupplierAdminId string `json:"supplier_admin_id" type:"string" prop:"select:supplier.adminId"`
- FinalSelectMaterialItem
- }
- func (model FinalSelectMaterialItemMobile) EditPrivilege(c *gin.Context, id int64, data map[string]interface{}, post map[string]interface{}) error {
- return model.FinalSelectMaterialItem.EditPrivilege(c, id, data, post)
- }
- func (model FinalSelectMaterialItemMobile) GroupBy() string {
- return fmt.Sprintf("`%s`.`id`", model.TableName())
- }
- func (model FinalSelectMaterialItemMobile) LeftJoin(data map[string]interface{}, s *db.Select) []db.JoinModel {
- return append(model.FinalSelectMaterialItem.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`"},
- }, db.JoinModel{
- Model: FinalSupplier{},
- As: "supplier",
- On: []string{"`supplier`.`id` = `finalmat`.`supplier_id`"},
- })
- }
|