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.CwBdAccassitem;
import com.dhcc.finance.main.domain.CwBdParametric;
import com.dhcc.finance.main.domain.CwBdProductcell;
import com.dhcc.finance.main.service.CwBdProductcellService;
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;

/**
 * 功能描述：项目单元Controller
 * @author dml
 * @date 2019年10月2日 上午10:20:02
 * @修改日志：
 */
@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwBdProductcellController.API_PREFIX, 
  	          produces = {MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "项目单元controller", tags = { "项目单元操作接口" })
public class CwBdProductcellController {
	// 产品单元操作接口地址前缀
	public static final String API_PREFIX = "/cw_bd_productcell";
	
	@Autowired
	CwBdProductcellService cwBdProductcellService;
	
	/**
	 * 功能描述：查询全部项目单元
	 * @return RestfulResponse<List<CwBdProductcell>,CurrencyMeta>
	 * @author dml
	 * @date 2019年10月2日 上午10:22:48
	 * @修改日志：
	 */
	@ApiOperation(value = "查询全部项目单元", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = { "/searchCwBdProductcellAllData" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public 	RestfulResponse<List<CwBdProductcell>, CurrencyMeta> searchCwBdProductcellAllData(){
		return cwBdProductcellService.searchCwBdProductcellAllData();
	}
	/**
	 * 功能描述 获取项目单元表数据列表
	 *@param code
	 *@param name
	 *@param pageNum
	 *@param pageSize
	 *@param navigatePages
	 *@return RestfulResponse<PageInfo<CwBdProductcell>,CurrencyMeta>
	 *@author huangpeng
	 *@date 2019年10月5日 下午1:37:49
	 *修改日志:
	 */
	@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 = "name", 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 = { "/searchCwBdProductcellOfList" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<PageInfo<CwBdProductcell>, CurrencyMeta> searchCwBdProductcellOfList(
			@RequestParam(value="code",required=false) String code,
			@RequestParam(value="name",required=false) String name,
			@RequestParam("pageNum") int pageNum,
    		@RequestParam("pageSize") int pageSize,
    		@RequestParam("navigatePages") int navigatePages){
		return cwBdProductcellService.searchCwBdProductcellOfList(code,name,pageNum, pageSize, navigatePages);
}
	/**
	 * 功能描述  删除单元数据
	 *@param idList
	 *@return RestfulResponse<Object,CurrencyMeta>
	 *@author huangpeng
	 *@date 2019年10月5日 下午2:37:11
	 *修改日志:
	 */
	@ApiOperation(value = "删除单元数据", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = { "/deleteCwBdProductcellById" }, method = RequestMethod.PUT, consumes = MediaType.ALL_VALUE)
	public 	RestfulResponse<Object, CurrencyMeta> deleteCwBdProductcellById(@RequestBody List<String> idList){
		return cwBdProductcellService.deleteCwBdProductcellById(idList);
	}
}
