26 lines
769 B
Go
26 lines
769 B
Go
package allocaterequest
|
|
|
|
import (
|
|
"context"
|
|
"github.com/gogf/gf/v2/errors/gerror"
|
|
"git.5iot.com/iotlcm-public/iotlcm-app/internal/dao"
|
|
"git.5iot.com/iotlcm-public/iotlcm-app/internal/model/entity"
|
|
)
|
|
|
|
func Find(ctx context.Context, tenant string, user int64, requestID string) (*entity.BatchMain, error) {
|
|
key, err := Key(tenant, user, requestID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
var batch *entity.BatchMain
|
|
columns := dao.BatchMain.Columns()
|
|
scope := dao.BatchMain.Ctx(ctx).Where(columns.TenantId, tenant).Where(columns.CreatedBy, user)
|
|
if err = scope.Clone().Where(columns.BatchNo, "ALC"+key[:60]).Scan(&batch); err != nil {
|
|
return nil, gerror.Wrap(err, "查询历史划拨请求失败")
|
|
}
|
|
if batch != nil {
|
|
return batch, nil
|
|
}
|
|
return nil, nil
|
|
}
|