package logic import ( "context" "errors" "git.i2edu.net/i2/go-zero/core/stores/sqlx" "git.i2edu.net/i2/i2-bill-erp/model" "git.i2edu.net/i2/i2-bill-erp/internal/svc" "git.i2edu.net/i2/i2-bill-erp/transform" "git.i2edu.net/i2/go-zero/core/logx" ) type GetErpOptionsetLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewGetErpOptionsetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetErpOptionsetLogic { return &GetErpOptionsetLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } func (l *GetErpOptionsetLogic) GetErpOptionset(in *transform.OptionCode) (*transform.Options, error) { // todo: add your logic here and delete this line code := in.Code if code == "" { return nil, errors.New("请输入code参数") } var optionSet = new(model.SysOptionset) sql := `select * from sys_optionset where sys_optionset.del_flag = 0 and code = ?` err := l.svcCtx.SqlConn.QueryRow(optionSet, sql, code) if err != nil && err != sqlx.ErrNotFound { return nil, err } return &transform.Options{Code: optionSet.Code, Name: optionSet.Name, Value: optionSet.Value}, nil }