123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package logic
- import (
- "context"
- "fmt"
- "git.i2edu.net/i2/i2-bill-erp/internal/svc"
- "git.i2edu.net/i2/i2-bill-erp/model"
- "git.i2edu.net/i2/i2-bill-erp/transform"
- "git.i2edu.net/i2/go-zero/core/logx"
- )
- type GetCityIdsLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewGetCityIdsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetCityIdsLogic {
- return &GetCityIdsLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- func (l *GetCityIdsLogic) GetCityIds(in *transform.CityIdsReq) (*transform.CityIdsRes, error) {
- var city []model.BaseOrgan
- err := l.svcCtx.SqlConn.QueryRowsPartial(&city, fmt.Sprintf("select id, name from base_organ where name in (%v) and del_flag!=1", in.Names))
- if err != nil {
- return nil, err
- }
- tc := transform.CityIdsRes{}
- for i := range city {
- if tc.MapList == nil {
- tc.MapList = map[string]int64{}
- }
- tc.MapList[city[i].Name.String] = city[i].Id
- }
- return &tc, nil
- }
|