123456789101112131415161718192021222324252627282930 |
- package yb_apply_record
- import (
- "errors"
- "hongze/hongze_yb/global"
- "hongze/hongze_yb/utils"
- )
- // GetByWhereMap 根据查询条件map获取信息
- func GetByWhereMap(where map[string]interface{}) (item *YbApplyRecord, 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
- }
- // GetByRecordId 根据apply_record_id获取申请记录信息
- func GetByRecordId(recordId int) (item *YbApplyRecord, err error) {
- err = global.DEFAULT_MYSQL.Where("apply_record_id = ? ", recordId).First(&item).Error
- return
- }
- // GetLastNotOpRecordByUserId 根据用户id获取最近的一条未被操作过的申请记录信息
- func GetLastNotOpRecordByUserId(userId int) (item *YbApplyRecord, err error) {
- err = global.DEFAULT_MYSQL.Where("user_id = ? AND op_status = 0", userId).Order("apply_record_id desc").First(&item).Error
- return
- }
|