package org.springblade.party.feign;

import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import org.springblade.party.entity.Meeting;
import org.springblade.party.vo.MeetingVO;
import org.springblade.party.wrapper.MeetingWrapper;
import org.springblade.party.service.IMeetingService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.List;
/**
 * 会议列表表 client
 *
 * @author lianghanqiang
 * @since 2021-04-19
 */

@AllArgsConstructor
@RestController
@RequestMapping("/feign/meeting")

public class MeetingClient implements IMeetingClient {

    private final IMeetingService meetingService;

        /**
     * 详情
     */
    @Override
    @GetMapping("/detail")
    public MeetingVO detail(Meeting meeting) {
        Meeting detail = meetingService.getOne(Condition.getQueryWrapper(meeting));
        return MeetingWrapper.build().entityVO(detail);
        }

    /**
     * 查询 会议列表表
     */
    @Override
    @GetMapping("/list")
    public List<MeetingVO> list(Meeting meeting) {
        return MeetingWrapper.build().listVO(meetingService.list(Condition.getQueryWrapper(meeting)));
        }



    /**
     * 新增 会议列表表
     */
    @Override
    @PostMapping("/save")
    public boolean save(@Valid @RequestBody Meeting meeting) {
        return meetingService.save(meeting);
        }

    /**
     * 修改 会议列表表
     */
    @Override
    @PostMapping("/update")
    public boolean update(@Valid @RequestBody Meeting meeting) {
        return meetingService.updateById(meeting);
        }

    /**
     * 新增或修改 会议列表表
     */
    @Override
    @PostMapping("/submit")
    public boolean submit(@Valid @RequestBody Meeting meeting) {
        return meetingService.saveOrUpdate(meeting);
        }


    /**
     * 删除 会议列表表
     */
    @Override
    @PostMapping("/remove")
    public boolean remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return meetingService.deleteLogic(Func.toLongList(ids));
        }


}
