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.CwBdParametric;
import com.dhcc.finance.main.service.CwBdParametricService;
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;

@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwBdParametricController.API_PREFIX, 
  	          produces = {MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "财务参数化配置Controller", tags = { "财务参数化配置" })
public class CwBdParametricController {
	    // 凭证模板分录操作接口地址前缀
		public static final String API_PREFIX = "/cw_bd_parametric";
		
		@Autowired
		CwBdParametricService cwBdParametricService;
		/**
		 * 功能描述  获取全部参数信息配置
		 * @param code
		 * @param pageNum
		 * @param pageSize
		 * @param navigatePages
		 * @return RestfulResponse<PageInfo<CwBdParametric>,CurrencyMeta>
		 * @author huangpeng
		 * @date 2019年6月13日 下午4:50:48
		 * 修改日志
		 */
		@ApiOperation(value = "获取全部参数信息配置", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
		@ApiImplicitParams({
			@ApiImplicitParam(name = "code", value = "参数编码", required = false, dataType = "String", paramType="query"),
			@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")
	    }) 
		@RequestMapping(value = { "/searchCwBdParametricAllData" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
		public RestfulResponse<PageInfo<CwBdParametric>, CurrencyMeta> searchCwBdParametricAllData(
				@RequestParam(value="code",required=false) String code,
				@RequestParam("pageNum") int pageNum,
	    		@RequestParam("pageSize") int pageSize,
	    		@RequestParam("navigatePages") int navigatePages){
			return cwBdParametricService.searchCwBdParametricAllData(code,pageNum, pageSize, navigatePages);
}
		/**
		 * 功能描述 逻辑删除参数配置
		 * @param pkParametric
		 * @return RestfulResponse<Object,CurrencyMeta>
		 * @author huangpeng
		 * @date 2019年6月13日 下午2:48:24
		 * 修改日志
		 */
		@ApiOperation(value = "逻辑删除参数配置", notes = "逻辑删除参数配置", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
		@ApiImplicitParam(name = "pkParametric", value = "主键", required = true, dataType = "String")
		@RequestMapping(value = "/deleteCwBdParametricByPk", method = RequestMethod.DELETE , consumes = MediaType.ALL_VALUE)
		public RestfulResponse<Object, CurrencyMeta> deleteCwBdParametricByPk(@RequestParam("pkParametric") String pkParametric){
			return cwBdParametricService.deleteCwBdParametricBypk(pkParametric);
		}
		/**
		 * 新增账套数据
		 * @param cwBdAccass
		 * @return RestfulResponse<Object,CurrencyMeta>
		 *@author huangpeng
		 *@date 2019年3月30日 下午12:06:52
		 *@修改日志：
		 */
		@ApiOperation(value = "新增参数配置", notes = "新增参数配置", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
		@ApiImplicitParam(name = "cwBdParametric", value = "财务参数配置实体", required = true, dataType = "CwBdParametric")
		@RequestMapping(value = "/addCwBdParametric", method = RequestMethod.POST)
		RestfulResponse<Object, CurrencyMeta> addCwBdParametric(@RequestBody CwBdParametric cwBdParametric){
			return cwBdParametricService.addCwBdParametric(cwBdParametric);
		}
		/**
		 * 功能描述  修改财务参数配置
		 * @param cwBdParametric
		 * @return RestfulResponse<Object,CurrencyMeta>
		 * @author huangpeng
		 * @date 2019年6月13日 下午3:10:43
		 * 修改日志
		 */
		@ApiOperation(value = "修改财务参数配置", notes = "修改财务参数配置", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
		@ApiImplicitParam(name = "cwBdParametric", value = "财务参数配置实体", required = true, dataType = "CwBdParametric")
		@RequestMapping(value = "/updateCwBdParametric", method = RequestMethod.PUT)
		RestfulResponse<Object, CurrencyMeta> updateCwBdParametric(@RequestBody CwBdParametric cwBdParametric){
			return cwBdParametricService.updateCwBdParametric(cwBdParametric);
		}
		/**
		 * 获取全部参数信息配置
		 * @return RestfulResponse<List<CwBdGlorgbookAndOther>,CurrencyMeta>
		 *@author huangpeng
		 *@date 2019年3月30日 上午11:02:40
		 *@修改日志：
		 */
		@ApiOperation(value = "获取全部参数信息配置不分页", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
		@RequestMapping(value = { "/searchCwBdParametricAll" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
		public RestfulResponse<List<CwBdParametric>, CurrencyMeta> searchCwBdParametricAll(){
			return cwBdParametricService.searchCwBdParametricAll();
}
}
