package com.boco.nbd.wios.manage.controller; import cn.hutool.core.lang.Assert; import com.boco.nbd.cams.core.constant.MessageConstant; import com.boco.nbd.wios.manage.entity.bo.ExpandPrice; import com.boco.nbd.wios.manage.service.impl.ExpandPriceService; import com.ihidea.component.api.v2.BaseResponse; 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.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; import java.util.List; /** * 报装价格管理接口 * * @author * @version */ @RestController @RequestMapping("api") @Api(tags = "报装价格管理接口") @ApiIgnore public class ExpandPriceController { @Autowired private ExpandPriceService expandPriceService; /** * 添加价格 * * @param expandPrice * @return */ @PostMapping(value = "expandPrice/add") @ApiOperation(value = "添加价格") public BaseResponse<Object> add(ExpandPrice expandPrice) { expandPriceService.add(expandPrice); return new BaseResponse<>(); } /** * 更新价格 * * @param expandPrice * @return */ @PostMapping(value = "expandPrice/update") @ApiOperation(value = "更新价格") @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "主键id", dataType = "int", paramType = "query", required = true),}) public BaseResponse<Object> update(ExpandPrice expandPrice) { Assert.notNull(expandPrice.getId(), MessageConstant.MISSING_PARAM); expandPriceService.update(expandPrice.getId(), expandPrice); return new BaseResponse<>(); } /** * 查询列表 * * @param regionId * @return */ @GetMapping(value = "expandPrice/all") @ApiOperation(value = "查询列表") @ApiImplicitParams({@ApiImplicitParam(paramType = "query", name = "regionId", value = "区域id", required = false, dataType = "int"),}) public BaseResponse<List<ExpandPrice>> getList(Integer regionId) { List<ExpandPrice> list = expandPriceService.getByRegionId(regionId); return new BaseResponse<>(list); } }