123456789101112131415161718192021222324252627282930313233 |
- package imp
- import (
- "lot_interlligentControl/app/e"
- "lot_interlligentControl/global"
- "lot_interlligentControl/models"
- )
- type Product struct{}
- func (p Product) UpdateProduct(uid, id int, product models.ProductDto) e.Rescode {
- //TODO implement me
- tx := global.DBLink.Model(&models.Product{}).Where("id = ?", id).Updates(models.Product{
- ProductType: product.ProductType,
- CreateBy: uid,
- })
- if tx.RowsAffected > 0 {
- return e.SUCCESS
- }
- return e.ERROR
- }
- func (p Product) AddProduct(uid int, product models.ProductDto) e.Rescode {
- //TODO implement me
- var produ models.Product
- produ.ProductType = product.ProductType
- produ.CreateBy = uid
- tx := global.DBLink.Create(&produ)
- if tx.RowsAffected > 0 {
- return e.SUCCESS
- }
- return e.ERROR
- }
|