123456789101112131415161718192021222324 |
- package company
- import (
- "errors"
- "hongze/hongze_yb/global"
- "hongze/hongze_yb/utils"
- )
- // GetByCompanyId 根据客户id获取信息
- func GetByCompanyId(companyId int64) (item *Company, err error) {
- err = global.DEFAULT_MYSQL.Where("company_id = ? ", companyId).First(&item).Error
- return
- }
- // GetByWhereMap 根据查询条件map获取信息
- func GetByWhereMap(where map[string]interface{}) (item *Company, 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
- }
|