package com.yh.saas.plugin.configuration.announcement.controller;


import com.yh.saas.common.support.plugin.PluginFeature;
import com.yh.saas.plugin.configuration.announcement.entity.AnnoTypeInfo;
import com.yh.saas.plugin.configuration.announcement.service.IAnnoTypeInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *     公告分类 模块 controller
 * </p>
 * @Auther ZhangMingYu
 * @since 2019年8月14日15:48:56
 */
@RestController
@RequestMapping("/announcementTypes")
@PluginFeature(id = "Announcement", name = "公告")
public class AnnoTypeInfoController {

    @Autowired
    private IAnnoTypeInfoService annoTypeInfoService;

    @PostMapping("/api/create")
    @PluginFeature(id = "AnnouncementType-Set", name = "公告类型管理_设定")
    public Boolean create(@RequestBody AnnoTypeInfo annoTypeInfo) {
        return annoTypeInfoService.create(annoTypeInfo);
    }

    @PostMapping("/api/remove")
    @PluginFeature(id = "AnnouncementType-Delete", name = "公告类型管理_删除")
    public void remove(@RequestBody AnnoTypeInfo annoTypeInfo) {
        annoTypeInfoService.remove(annoTypeInfo);
    }

    @PostMapping("/api/change")
    @PluginFeature(id = "AnnouncementType-Set", name = "公告类型管理_设定")
    public void change(@RequestBody List<AnnoTypeInfo> annoTypeInfos) {
        annoTypeInfoService.change(annoTypeInfos);
    }

    @GetMapping("/query/list")
    public List<AnnoTypeInfo> queryList(AnnoTypeInfo annoTypeInfo) {
        return annoTypeInfoService.queryList(annoTypeInfo);
    }


}
