123456789101112131415161718192021222324252627282930313233343536 |
- package company_product
- import (
- "errors"
- "hongze/hongze_yb/global"
- "hongze/hongze_yb/utils"
- )
- // GetByCompany2ProductId 根据客户id和产品id获取信息
- func GetByCompany2ProductId(companyId, productId int64) (item *CompanyProduct, err error) {
- err = global.DEFAULT_MYSQL.Where("company_id = ? and product_id=?", companyId, productId).First(&item).Error
- return
- }
- // GetListByCompanyId 根据客户id获取所有的产品信息列表
- func GetListByCompanyId(companyId int64) (items []*CompanyProduct, err error) {
- err = global.DEFAULT_MYSQL.Where("company_id = ? ", companyId).Find(&items).Error
- return
- }
- // GetByEmail 根据邮箱号号获取信息
- func GetByEmail(email string) (item *CompanyProduct, err error) {
- err = global.DEFAULT_MYSQL.Where("email = ? ", email).First(&item).Error
- return
- }
- // GetByWhereMap 根据查询条件map获取信息
- func GetByWhereMap(where map[string]interface{}) (item *CompanyProduct, err error) {
- cond, whereVal, buildErr := utils.WhereBuild(where)
- if buildErr != nil {
- err = errors.New("系统异常,生成查询语句失败")
- return
- }
- err = global.DEFAULT_MYSQL.Where(cond, whereVal...).First(&item).Error
- return
- }
|