123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- package dto
- import (
- "gas-cylinder-api/app/admin/model"
- "gas-cylinder-api/common/dto"
- common "gas-cylinder-api/common/model"
- )
- type GoodsGetPageReq struct {
- dto.Pagination `search:"-"`
- Name string `form:"name" search:"type:contains;column:name;table:goods"` // 商品名称
- MediaType string `form:"mediaType" search:"type:contains;column:media_type;table:goods"` // 介质类型
- IsShow int `form:"isShow" search:"-"` // 是否展示 1-展示 2-不展示
- GoodsOrder
- }
- type GoodsOrder struct {
- CreatedAtOrder string `search:"type:order;column:created_at;table:goods" form:"createdAtOrder" default:"desc"`
- }
- func (m *GoodsGetPageReq) GetNeedSearch() interface{} {
- return *m
- }
- type GoodsInsertReq struct {
- Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
- Name string `json:"name" vd:"len($)>0;msg:'商品名称不能为空'"` // 商品名称
- Price float64 `json:"price"` // 价格
- MediaType string `json:"mediaType"` // 介质类型
- IsShow bool `json:"isShow"` // 是否显示
- ShowStartTime common.Time `json:"showStartTime"` // 展示开始时间
- ShowEndTime common.Time `json:"showEndTime"` // 展示结束时间
- Img string `json:"img"` // 图片
- Remark string `json:"remark"` // 备注
- common.ControlBy `swaggerignore:"true"`
- common.DeptBy `swaggerignore:"true"`
- }
- func (s *GoodsInsertReq) Generate(model *model.Goods) {
- if s.Id != 0 {
- model.Id = s.Id
- }
- model.Name = s.Name
- model.Price = s.Price
- model.MediaType = s.MediaType
- model.IsShow = s.IsShow
- model.ShowStartTime = s.ShowStartTime
- model.ShowEndTime = s.ShowEndTime
- model.Img = s.Img
- model.Remark = s.Remark
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- if s.DeptBy.DeptId != 0 {
- model.DeptId = s.DeptId
- }
- }
- func (s *GoodsInsertReq) GetId() interface{} {
- return s.Id
- }
- type GoodsUpdateReq struct {
- Id int `json:"id" comment:"编码"` // 编码
- Name string `json:"name" vd:"len($)>0;msg:'商品名称不能为空'"` // 商品名称
- Price float64 `json:"price"` // 价格
- MediaType string `json:"mediaType"` // 介质类型
- IsShow bool `json:"isShow"` // 是否显示
- ShowStartTime common.Time `json:"showStartTime"` // 展示开始时间
- ShowEndTime common.Time `json:"showEndTime"` // 展示结束时间
- Img string `json:"img"` // 图片
- Remark string `json:"remark"` // 备注
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *GoodsUpdateReq) Generate(model *model.Goods) {
- if s.Id != 0 {
- model.Id = s.Id
- }
- model.Name = s.Name
- model.Price = s.Price
- model.MediaType = s.MediaType
- model.IsShow = s.IsShow
- model.ShowStartTime = s.ShowStartTime
- model.ShowEndTime = s.ShowEndTime
- model.Img = s.Img
- model.Remark = s.Remark
- if s.ControlBy.UpdateBy != 0 {
- model.UpdateBy = s.UpdateBy
- }
- if s.ControlBy.CreateBy != 0 {
- model.CreateBy = s.CreateBy
- }
- }
- func (s *GoodsUpdateReq) GetId() interface{} {
- return s.Id
- }
- type GoodsGetReq struct {
- Id int `uri:"id"`
- }
- func (s *GoodsGetReq) GetId() interface{} {
- return s.Id
- }
- type GoodsDeleteReq struct {
- Id int `json:"id"`
- common.ControlBy `swaggerignore:"true"`
- }
- func (s *GoodsDeleteReq) GetId() interface{} {
- return s.Id
- }
- type AppletGoodsGetPageReq struct {
- dto.Pagination `search:"-"`
- StoreId int `form:"storeId" search:"type:exact;column:dept_id;table:goods" vd:"$>0;msg:'门店id不能为空'"`
- Name string `form:"name" search:"type:contains;column:name;table:goods"` // 商品名称
- MediaType string `form:"mediaType" search:"type:contains;column:media_type;table:goods"` // 介质类型
- IsShow int `form:"isShow" search:"-"` // 是否展示 1-展示 2-不展示
- GoodsOrder
- }
- func (m *AppletGoodsGetPageReq) GetNeedSearch() interface{} {
- return *m
- }
|