|
|
@@ -1,5 +1,8 @@
|
|
|
package org.springblade.applet;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -10,6 +13,8 @@ import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.modules.pl.client.entity.ClientEntity;
|
|
|
+import org.springblade.modules.pl.client.service.IClientService;
|
|
|
import org.springblade.modules.pl.product.entity.ProductEntity;
|
|
|
import org.springblade.modules.pl.product.service.IProductService;
|
|
|
import org.springblade.modules.pl.product.vo.ProductVO;
|
|
|
@@ -19,9 +24,12 @@ import org.springblade.modules.pl.productBatch.vo.ProductBatchVO;
|
|
|
import org.springblade.modules.pl.productModel.entity.ProductModelEntity;
|
|
|
import org.springblade.modules.pl.productModel.service.IProductModelService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
|
@@ -36,6 +44,41 @@ public class ProductApiController {
|
|
|
|
|
|
private final IProductModelService productModelService;
|
|
|
|
|
|
+ private final IClientService clientService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 产品表 分页
|
|
|
+ */
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入product")
|
|
|
+ public R<IPage<ProductVO>> list(@ApiIgnore @RequestParam Map<String, Object> product, Query query) {
|
|
|
+ query.setDescs("create_time");
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ product.put("factoryId",user.getFactoryId());
|
|
|
+ QueryWrapper<ProductEntity> wrapper = Condition.getQueryWrapper(product,ProductEntity.class);
|
|
|
+ IPage<ProductEntity> pages = productService.page(Condition.getPage(query),wrapper);
|
|
|
+ return R.data(ProductWrapper.build().pageVO(pages));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 产品表 统计
|
|
|
+ */
|
|
|
+ @GetMapping("/countProduct")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入product")
|
|
|
+ public R<Object> countProduct(@ApiIgnore @RequestParam Map<String, Object> product, Query query) {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ long countAll = productService.count(Wrappers.<ProductEntity>lambdaQuery().eq(ProductEntity::getFactoryId,user.getFactoryId()));
|
|
|
+ product.put("factoryId",user.getFactoryId());
|
|
|
+ QueryWrapper<ProductEntity> wrapper = Condition.getQueryWrapper(product,ProductEntity.class);
|
|
|
+ long count = productService.count(wrapper);
|
|
|
+ Map<String,Object> result = new HashMap<>();
|
|
|
+ result.put("countAll",countAll);
|
|
|
+ result.put("count",count);
|
|
|
+ return R.data(result);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 产品表 详情
|
|
|
@@ -65,6 +108,23 @@ public class ProductApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 客户表 下拉框
|
|
|
+ */
|
|
|
+ @GetMapping("/clientSelect")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "下拉框", notes = "传入factory")
|
|
|
+ public R<List<ClientEntity>> select(ClientEntity factory, Query query) {
|
|
|
+ BladeUser user = AuthUtil.getUser();
|
|
|
+ if(user.getUserCategory()==2){
|
|
|
+ factory.setFactoryId(user.getFactoryId());
|
|
|
+ }
|
|
|
+ List<ClientEntity> list = clientService.list(Condition.getQueryWrapper(factory));
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 产品型号表 下拉框
|
|
|
*/
|