1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package logic
- import (
- "context"
- "git.i2edu.net/i2/i2-bill-erp/utils"
- "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 GetErpActiveLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewGetErpActiveLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetErpActiveLogic {
- return &GetErpActiveLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- func (l *GetErpActiveLogic) GetErpActive(in *transform.GetErpActiveReq) (*transform.GetErpActiveRes, error) {
- // todo: add your logic here and delete this line
- type Active struct {
- MaName string `json:"ma_name"`
- ActiveId int64 `json:"active_id"`
- }
- //acts := new([]*Active)
- actives := new([]*transform.Active)
- var parmas = make(map[string]interface{})
- parmas["school_id"] = in.SchId
- //sql := `
- // select
- // act.id active_id,act.ma_name
- // from
- // mkt_activity act
- // left join
- // mkt_activities_school act_sch
- // on
- // act.id = act_sch.ma_id
- // where
- // act.del_flag = 0
- // and act_sch.school_id = ? `
- result, err := utils.AllSearch(l.svcCtx.DB, "mkt_activity", "all", "mkt_activity", parmas)
- //err := l.svcCtx.DB.SQL(sql, in.SchId).Find(acts)
- if err != nil {
- logx.Error(err.Error())
- return nil, err
- }
- for _, act := range result {
- active := new(transform.Active)
- active.MaName = act["ma_name"].(string)
- active.ActiveId = act["active_id"].(int64)
- *actives = append(*actives, active)
- }
- return &transform.GetErpActiveRes{Active: *actives}, nil
- }
|