package com.miaxis.pc.controller.wx;

import com.miaxis.common.core.controller.BaseController;
import com.miaxis.common.core.page.ResponsePageInfo;
import com.miaxis.wx.domain.WxForeverCode;
import com.miaxis.wx.service.IWxForeverCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 【微信永久二维码口令】Controller
 *
 * @author miaxis
 * @date 2022-01-17
 */
@RestController
@RequestMapping("/wx/code")
@Api(tags={"【pc-微信永久二维码口令】"})
public class WxForeverCodeController extends BaseController{
    @Autowired
    private IWxForeverCodeService wxForeverCodeService;

    /**
     * 查询微信永久二维码口令列表
     */
    @PreAuthorize("@ss.hasPermi('wx:code:list')")
    @GetMapping("/list")
    @ApiOperation("查询微信永久二维码口令列表")
        @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
    })
    public ResponsePageInfo<WxForeverCode> list(){
        startPage();
        List<WxForeverCode> list = wxForeverCodeService.selectWxForeverCodeList(new WxForeverCode());
        return toResponsePageInfo(list);
    }

//    /**
//     * 导出微信永久二维码口令列表
//     */
//    @PreAuthorize("@ss.hasPermi('wx:code:export')")
//    @Log(title = "微信永久二维码口令", businessType = BusinessTypeEnum.EXPORT)
//    @GetMapping("/export")
//    @ApiOperation("导出微信永久二维码口令列表Excel")
//    public Response<String> export(@ModelAttribute WxForeverCode wxForeverCode){
//        List<WxForeverCode> list = wxForeverCodeService.selectWxForeverCodeList(wxForeverCode);
//        ExcelUtil<WxForeverCode> util = new ExcelUtil<WxForeverCode>(WxForeverCode.class);
//        return util.exportExcel(list, "code");
//    }

//    /**
//     * 获取微信永久二维码口令详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('wx:code:query')")
//    @GetMapping(value = "/{id}")
//    @ApiOperation("获取微信永久二维码口令详细信息")
//    public Response<WxForeverCode> getInfo(
//            @ApiParam(name = "id", value = "微信永久二维码口令参数", required = true)
//            @PathVariable("id") Long id
//    ){
//        return Response.success(wxForeverCodeService.getById(id));
//    }

//    /**
//     * 新增微信永久二维码口令
//     */
//    @PreAuthorize("@ss.hasPermi('wx:code:add')")
//    @Log(title = "微信永久二维码口令", businessType = BusinessTypeEnum.INSERT)
//    @PostMapping
//    @ApiOperation("新增微信永久二维码口令")
//    public Response<Integer> add(@RequestBody WxForeverCode wxForeverCode){
//        return toResponse(wxForeverCodeService.save(wxForeverCode) ? 1 : 0);
//    }
//
//    /**
//     * 修改微信永久二维码口令
//     */
//    @PreAuthorize("@ss.hasPermi('wx:code:edit')")
//    @Log(title = "微信永久二维码口令", businessType = BusinessTypeEnum.UPDATE)
//    @PutMapping
//    @ApiOperation("修改微信永久二维码口令")
//    public Response<Integer> edit(@RequestBody WxForeverCode wxForeverCode){
//        return toResponse(wxForeverCodeService.updateById(wxForeverCode) ? 1 : 0);
//    }
//
//    /**
//     * 删除微信永久二维码口令
//     */
//    @PreAuthorize("@ss.hasPermi('wx:code:remove')")
//    @Log(title = "微信永久二维码口令", businessType = BusinessTypeEnum.DELETE)
//	@DeleteMapping("/{ids}")
//    @ApiOperation("删除微信永久二维码口令")
//    public  Response<Integer> remove(
//            @ApiParam(name = "ids", value = "微信永久二维码口令ids参数", required = true)
//            @PathVariable Long[] ids
//    ){
//        return toResponse(wxForeverCodeService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
//    }
}
