package com.sundot.airport.web.controller.exam;

import com.sundot.airport.exam.common.HttpResult;
import com.sundot.airport.exam.common.PageData;
import com.sundot.airport.exam.logic.manage.model.params.*;
import com.sundot.airport.exam.logic.manage.model.result.TestPaperAddResult;
import com.sundot.airport.exam.logic.manage.model.result.TestPaperGetResult;
import com.sundot.airport.exam.logic.manage.model.result.TestPaperPageResult;
import com.sundot.airport.exam.logic.manage.service.TestPaperBizService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <b>功能名：</b>TestPaperController<br>
 * <b>说明：</b> 试卷表管理 <br>
 * <b>著作权：</b> Copyright (C) 2021 HUIFANEDU  CORPORATION<br>
 * <b>修改履历：
 *
 * @author 2021-06-22 liangxiao
 */
@RestController
@RequestMapping("/v1/cs/manage/test_paper")
public class TestPaperController extends BaseController {

    @Resource
    private TestPaperBizService testPaperBizService;

    /**
     * <b>方法名: </b> page <br>
     * <b>说明: </b> 试卷表分页列表 <br>
     *
     * @param param com.sundot.airport.model.params.TestPaperPageParam 试卷表分页列表请求参数
     * @return com.huifanedu.kernel.model.response.HttpResult<com.huifanedu.kernel.model.pager.PageData < com.sundot.airport.model.result.TestPaperPageResult>>
     * <b>修改履历: </b>
     * @author 2021-06-22 liangxiao
     */
    @PostMapping("/list")
//    @Log(key = 225151, value = "试卷表分页列表", mobile = SystemConstant.YGHD_LIANG_XIAO)
    public HttpResult<PageData<TestPaperPageResult>> page(@RequestBody TestPaperPageParam param) {
        return testPaperBizService.pageList(param);
    }

    /**
     * <b>方法名: </b> get <br>
     * <b>说明: </b> 试卷表详情 <br>
     *
     * @param tpId java.lang.String 试卷业务id
     * @return com.huifanedu.kernel.model.response.HttpResult<com.sundot.airport.model.result.TestPaperGetResult>
     * <b>修改履历: </b>
     * @author 2021-06-22 liangxiao
     */
    @GetMapping("")
//    @Log(key = 225152, value = "试卷表详情", mobile = SystemConstant.YGHD_LIANG_XIAO)
    public HttpResult<TestPaperGetResult> get(@RequestParam("tpId") String tpId) {
        return testPaperBizService.get(tpId);
    }

    /**
     * <b>方法名: </b> add <br>
     * <b>说明: </b> 试卷表添加 <br>
     *
     * @param param com.sundot.airport.model.params.TestPaperAddParam 试卷表添加请求参数
     * @return com.huifanedu.kernel.model.response.HttpResult<com.sundot.airport.model.result.TestPaperAddResult>
     * <b>修改履历: </b>
     * @author 2021-06-22 liangxiao
     */
    @PostMapping("")
//    @Log(key = 225153, value = "试卷表添加", mobile = SystemConstant.YGHD_LIANG_XIAO)
    public HttpResult<TestPaperAddResult> add(@Valid @RequestBody TestPaperAddParam param) {
        return testPaperBizService.add(param);
    }

    /**
     * <b>方法名: </b> delete <br>
     * <b>说明: </b> 试卷表删除 <br>
     *
     * @param param com.sundot.airport.model.params.TestPaperDelParam 试卷表删除请求参数
     * @return com.huifanedu.kernel.model.response.HttpResult<java.lang.Boolean>
     * <b>修改履历: </b>
     * @author 2021-06-22 liangxiao
     */
    @DeleteMapping("")
//    @Log(key = 225154, value = "试卷表删除", mobile = SystemConstant.YGHD_LIANG_XIAO)
    public HttpResult<Boolean> del(@Valid @RequestBody TestPaperDelParam param) {
        return testPaperBizService.delete(param);
    }

    /**
     * <b>方法名: </b> update <br>
     * <b>说明: </b> 试卷表修改 <br>
     *
     * @param param com.sundot.airport.model.params.TestPaperUpdParam 试卷表修改请求参数
     * @return com.huifanedu.kernel.model.response.HttpResult<java.lang.Boolean>
     * <b>修改履历: </b>
     * @author 2021-06-22 liangxiao
     */
    @PutMapping("")
//    @Log(key = 225155, value = "试卷表修改", mobile = SystemConstant.YGHD_LIANG_XIAO)
    public HttpResult<Boolean> update(@Valid @RequestBody TestPaperUpdParam param) {
        return testPaperBizService.update(param);
    }


    /**
     * <b>方法名: </b> update <br>
     * <b>说明: </b> 试卷分类转移 <br>
     *
     * @param param com.sundot.airport.model.params.TestPaperUpdCatParam 试卷修改分类请求参数
     * @return com.huifanedu.kernel.model.response.HttpResult<java.lang.Boolean>
     * <b>修改履历: </b>
     * @author 2021-06-18 liangxiao
     */
    @PutMapping("/cat")
    //@Log(key = 225156, value = "试卷分类转移", mobile = SystemConstant.YGHD_LIANG_XIAO)
    public HttpResult<Boolean> batchUpdCat(@Valid @RequestBody TestPaperUpdCatParam param) {
        return testPaperBizService.batchCatUpdate(param);
    }

    /**
     * <b>方法名: </b> copy <br>
     * <b>说明: </b> 试卷复制 <br>
     *
     * @param param com.sundot.airport.model.params.TestPaperAddParam 试卷表添加请求参数
     * @return com.huifanedu.kernel.model.response.HttpResult<com.sundot.airport.model.result.TestPaperAddResult>
     * <b>修改履历: </b>
     * @author 2021-06-22 liangxiao
     */
    @PostMapping("/copy")
    //@Log(key = 225157, value = "试卷复制", mobile = SystemConstant.YGHD_LIANG_XIAO)
    public HttpResult<Boolean> copy(@Valid @RequestBody TestPaperCopyParam param) {
        return testPaperBizService.copy(param);
    }
}
