package com.sptg.gateway.controller;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.estate.api.dto.NoticeDto;
import com.sptg.estate.api.entity.Notice;
import com.sptg.estate.api.feigns.NoticeFeign;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * title: NoticeController
 * package: com.sptg.estate.biz.security
 * description: 住户管理控制器
 *
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/app/notice")
public class NoticeController {

    private final NoticeFeign noticeFeign;

    @PostMapping(value = "/noticeList")
    private Map<String,Object> getNoticeList(@RequestBody NoticeDto noticeDto){
        Map<String,Object> map = new HashMap<>();
//        NoticeDto
        ResultBean<List<Notice>> list = this.noticeFeign.getList(noticeDto);
        if(list != null){
            map.put("noticeList",list.getData());
        }
        return map;
    }
}
