package com.heyu.api.controller.vv;


import com.heyu.api.data.service.impl.AppBaseRequest;
import com.heyu.api.common.annotation.Describe;
import com.heyu.api.data.dao.vv.VvScrollConfigDao;
import com.heyu.api.data.entity.vv.VvScrollConfigEntity;
import com.heyu.api.data.utils.R;
import com.heyu.api.data.utils.SanUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/app/scroll")
public class AppScrollController {

    @Autowired
    private VvScrollConfigDao vvScrollConfigDao;

    // http://localhost:8888/app/scroll/list
    @Describe("查询滚动")
    @RequestMapping("/list")
    public R query(@RequestBody AppBaseRequest request) {
        List<VvScrollConfigEntity> vvScrollConfigEntityList = vvScrollConfigDao.selectVvScrollConfigAll();
        Map<String, List<VvScrollConfigEntity>> configMap = SanUtils.groupByFiled2MapList(vvScrollConfigEntityList, VvScrollConfigEntity::getType);
        return R.ok().setData(configMap);
    }
}
