package com.dhcc.finance.main.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.dhcc.common.model.CurrencyMeta;
import com.dhcc.common.model.response.RestfulResponse;
import com.dhcc.finance.constant.MsConfigConsts;
import com.dhcc.finance.main.domain.CwBdVouchtempB;
import com.dhcc.finance.main.model.CwBdVouchtempBUpd;
import com.dhcc.finance.main.model.VouchtempBForTable;
import com.dhcc.finance.main.service.CwBdVouchtempBService;
import com.github.pagehelper.PageInfo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * 功能描述：凭证模板分录配置
 * @author dml
 * @date 2019年3月27日 下午3:52:53
 * @修改日志：
 */
@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwBdVouchtempBController.API_PREFIX, 
  	          produces = {MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "凭证模板分录配置Controller", tags = { "凭证模板分录配置操作接口" })
public class CwBdVouchtempBController {
	
	// 凭证模板分录操作接口地址前缀
	public static final String API_PREFIX = "/cw_bd_vouchtemp_b";
	
	@Autowired
	CwBdVouchtempBService cwBdVouchtempBService;
	
	/**
	 * 功能描述：获取全部凭证模板分录配置
	 * @param pageNum
	 * @param pageSize
	 * @param navigatePages
	 * @return RestfulResponse<PageInfo<CwBdVouchtempB>,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月27日 下午3:56:27
	 * @修改日志：
	 */
	@ApiOperation(value = "获取某凭证模板下全部分录配置", notes = "获取某凭证模板下全部分录配置", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pkVouchtemp", value = "凭证模板配置主键", required = true, dataType = "String", paramType="query")
    }) 
	@RequestMapping(value = { "/searchCwBdVouchtempBAllData" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public 	RestfulResponse<PageInfo<CwBdVouchtempB>, CurrencyMeta> searchCwBdVouchtempBAllData(
			@RequestParam("pageNum") int pageNum,
    		@RequestParam("pageSize") int pageSize,
    		@RequestParam("navigatePages") int navigatePages,
    		@RequestParam("pkVouchtemp") String pkVouchtemp){
		return cwBdVouchtempBService.searchCwBdVouchtempBAllData(pageNum, pageSize, navigatePages,pkVouchtemp);
	}
	
	/**
	 * 功能描述：新增凭证模板分录配置
	 * @param cwBdVouchtempB
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月27日 下午3:58:06
	 * @修改日志：
	 */
	@ApiOperation(value = "新增凭证模板分录配置-传递复杂对象", notes = "新增凭证模板分录配置", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "cwBdVouchtempB", value = "凭证模板分录配置对象实体", required = true, dataType = "CwBdVouchtempB")
	@RequestMapping(value = "/addCwBdVouchtempB", method = RequestMethod.POST)
	public RestfulResponse<Object, CurrencyMeta> addCwBdVouchtempB(@RequestBody CwBdVouchtempB cwBdVouchtempB){
		return cwBdVouchtempBService.addCwBdVouchtempB(cwBdVouchtempB);
	}
	
	/**
	 * 功能描述：修改凭证模板分录配置
	 * @param cwBdVouchtempB
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月27日 下午3:59:33
	 * @修改日志：
	 */
	@ApiOperation(value = "修改凭证模板分录配置-传递复杂对象", notes = "修改凭证模板分录配置", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "cwBdVouchtempBUpd", value = "修改凭证模板分录配置对象实体", required = true, dataType = "CwBdVouchtempBUpd")
	@RequestMapping(value = "/updateCwBdVouchtempBByPk", method = RequestMethod.PUT)
	public RestfulResponse<Object, CurrencyMeta> updateCwBdVouchtempBByPk(@RequestBody CwBdVouchtempBUpd cwBdVouchtempBUpd){
		return cwBdVouchtempBService.updateCwBdVouchtempBByPk(cwBdVouchtempBUpd);
	}
	
	/**
	 * 功能描述：删除凭证模板分录配置
	 * @param pkVouchtempB
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月27日 下午4:01:16
	 * @修改日志：
	 */
	@ApiOperation(value = "逻辑删除凭证模板分录配置", notes = "删除凭证模板分录配置", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "pkVouchtempB", value = "凭证模板分录配置主键", required = true, dataType = "String")
	@RequestMapping(value = "/deleteCwBdVouchtempBByPk", method = RequestMethod.DELETE , consumes = MediaType.ALL_VALUE)
	public RestfulResponse<Object, CurrencyMeta> deleteCwBdVouchtempBByPk(@RequestParam("pkVouchtempB") String pkVouchtempB){
		return cwBdVouchtempBService.deleteCwBdVouchtempBByPk(pkVouchtempB);
	}
	/**
	 * 功能描述：查询某分录模板下所有分录信息不分页
	 * @param pkVouchtemp
	 * @return RestfulResponse<List<CwBdVouchtempB>,CurrencyMeta>
	 * @author dml
	 * @date 2019年4月10日 下午2:30:00
	 * @修改日志：
	 */
	@ApiOperation(value = "查询某分录模板下所有分录信息不分页", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParam(name = "pkVouchtemp", value = "凭证模板配置主键", required = true, dataType = "String", paramType="query")
	@RequestMapping(value = { "/searchCwBdVouchtempB" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public 	RestfulResponse<List<CwBdVouchtempB>, CurrencyMeta> searchCwBdVouchtempB(@RequestParam("pkVouchtemp") String pkVouchtemp){
		return cwBdVouchtempBService.searchCwBdVouchtempB(pkVouchtemp);
	}
	
	/**
	 * 功能描述  查询计算编辑器表名
	 *@param tableName
	 *@return RestfulResponse<List<VouchtempBForTable>,CurrencyMeta>
	 *@author huangpeng
	 *@date 2020年1月9日 上午11:55:20
	 *修改日志:
	 */
	@ApiOperation(value = "查询计算编辑器表名", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParam(name = "tableName", value = "表名", required = true, dataType = "String", paramType="query")
	@RequestMapping(value = { "/searchCwBdVouchtempBForTableName" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public 	RestfulResponse<List<VouchtempBForTable>, CurrencyMeta> searchCwBdVouchtempBForTableName(@RequestParam("tableName") String tableName){
		return cwBdVouchtempBService.searchCwBdVouchtempBForTableName(tableName);
	}
}
