|
@@ -6,6 +6,7 @@ import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.sop.business.entity.TBProduct;
|
|
|
import com.qmth.sop.business.service.TBProductService;
|
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
|
+import com.qmth.sop.common.enums.ProductTypeEnum;
|
|
|
import com.qmth.sop.common.util.Result;
|
|
|
import com.qmth.sop.common.util.ResultUtil;
|
|
|
import io.swagger.annotations.*;
|
|
@@ -15,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -39,8 +39,15 @@ public class TBProductController {
|
|
|
@ApiOperation(value = "获取产品信息列表接口")
|
|
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "产品信息列表", response = TBProduct.class)})
|
|
|
- public Result list(@ApiParam(value = "是否启用", required = false) @RequestParam(required = false) Boolean enable) {
|
|
|
- return ResultUtil.ok(tbProductService.list(new QueryWrapper<TBProduct>().lambda().eq(Objects.nonNull(enable), TBProduct::getEnable, enable)));
|
|
|
+ public Result list(@ApiParam(value = "是否启用") @RequestParam(required = false) Boolean enable,
|
|
|
+ @ApiParam(value = "产品类型") @RequestParam(required = false) ProductTypeEnum productType) {
|
|
|
+ QueryWrapper<TBProduct> queryWrapper = new QueryWrapper<>();
|
|
|
+ if (enable != null) {
|
|
|
+ queryWrapper.lambda().eq(TBProduct::getEnable, enable);
|
|
|
+ }
|
|
|
+ if (productType != null) {
|
|
|
+ queryWrapper.lambda().eq(TBProduct::getCode, productType);
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(tbProductService.list(queryWrapper));
|
|
|
}
|
|
|
-
|
|
|
}
|