package org.springblade.system.expand.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.cloud.openfeign.SpringQueryMap;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springblade.system.expand.entity.WxConf;
import org.springblade.system.expand.vo.WxConfVO;
import org.springblade.system.expand.service.IWxConfService;
import org.springblade.core.boot.ctrl.BladeController;
import java.util.List;
/**
 * 微信配置参数 client
 *
 * @author lianghanqiang
 * @since 2021-04-23
 */

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

public class WxConfClient implements IWxConfClient {

    private final IWxConfService wxConfService;

        /**
     * 详情
     */
    @Override
    @GetMapping("/detail")
    public WxConf detail(@SpringQueryMap WxConf wxConf) {
        WxConf detail = wxConfService.getOne(Condition.getQueryWrapper(wxConf));
        return detail;
        }

    /**
     * 查询 微信配置参数
     */
    @Override
    @GetMapping("/list")
    public List<WxConf> list(@SpringQueryMap WxConf wxConf) {
        return wxConfService.list(Condition.getQueryWrapper(wxConf));
        }


    /**
     * 新增 微信配置参数
     */
    @Override
    @PostMapping("/save")
    public boolean save(@Valid @RequestBody WxConf wxConf) {
        return wxConfService.save(wxConf);
        }

    /**
     * 修改 微信配置参数
     */
    @Override
    @PostMapping("/update")
    public boolean update(@Valid @RequestBody WxConf wxConf) {
        return wxConfService.updateById(wxConf);
        }

    /**
     * 新增或修改 微信配置参数
     */
    @Override
    @PostMapping("/submit")
    public boolean submit(@Valid @RequestBody WxConf wxConf) {
        return wxConfService.saveOrUpdate(wxConf);
        }


    /**
     * 删除 微信配置参数
     */
    @Override
    @PostMapping("/remove")
    public boolean remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return wxConfService.removeByIds(Func.toLongList(ids));
        }


}
