|
@@ -0,0 +1,50 @@
|
|
|
|
+package com.jpsoft.machinery.modules.open;
|
|
|
|
+
|
|
|
|
+import com.github.pagehelper.Page;
|
|
|
|
+import com.jpsoft.machinery.modules.base.entity.Catalogues;
|
|
|
|
+import com.jpsoft.machinery.modules.base.service.CataloguesService;
|
|
|
|
+import com.jpsoft.machinery.modules.common.dto.MessageResult;
|
|
|
|
+import com.jpsoft.machinery.modules.common.dto.QueryListDTO;
|
|
|
|
+import com.jpsoft.machinery.modules.common.dto.Sort;
|
|
|
|
+import com.jpsoft.machinery.modules.common.utils.PojoUtils;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import java.util.*;
|
|
|
|
+
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/open/cataloguesApi")
|
|
|
|
+@Api(description = "商品类型")
|
|
|
|
+public class CataloguesApiController {
|
|
|
|
+ private Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CataloguesService cataloguesService;
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="根据父ID获取列表")
|
|
|
|
+ @RequestMapping(value = "findListByParentId",method = RequestMethod.POST)
|
|
|
|
+ public MessageResult<List<Catalogues>> findListByParentId(String parentId){
|
|
|
|
+ MessageResult<List<Catalogues>> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("sort_","asc"));
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(parentId) && !"null".equals(parentId)) {
|
|
|
|
+ searchParams.put("parentId",parentId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Page<Catalogues> page = cataloguesService.pageSearch(searchParams,1,100,false,sortList);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(page.getResult());
|
|
|
|
+
|
|
|
|
+ return msgResult;
|
|
|
|
+ }
|
|
|
|
+}
|