package selection import ( "context" "fmt" "github.com/gogf/gf/frame/g" "github.com/gogf/gf/net/ghttp" "youngmini_server/app/dao" ) var service = new(selectionService) type selectionService struct { } func (s *selectionService) List(r *ghttp.Request) (res ListSelectionRes, err error) { err = dao.YounggeeAssignmentInfo.Ctx(r.GetCtx()).Scan(&res.SelectionList) if err != nil { return } return } func GetDetailBySelectionId(ctx context.Context, selectionId string) (res ListSelectionSql, err error) { whereCondition := g.Map{ dao.YounggeeSelectionInfo.Columns.SelectionId: selectionId, } err = dao.YounggeeSelectionInfo.Ctx(ctx).Where(whereCondition).Scan(&res) if err != nil { return } return } func GetDetailByTaskId(ctx context.Context, taskId string) (res ListSelectionSql, err error) { var selectionId interface{} whereCondition := g.Map{ dao.YounggeeSecTaskInfo.Columns.TaskId: taskId, } selectionId, err = dao.YounggeeSecTaskInfo.Ctx(ctx).Fields(dao.YounggeeSecTaskInfo.Columns.SelectionId).Where(whereCondition).Value() if err != nil { return } whereCondition = g.Map{ dao.YounggeeSelectionInfo.Columns.SelectionId: selectionId, } fmt.Println("selectionId: ", selectionId) err = dao.YounggeeSelectionInfo.Ctx(ctx).Where(whereCondition).Scan(&res) if err != nil { return } return }