ExpandPriceController.java 2.5 KB
Newer Older
苗卫卫 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
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);
    }
}