|
|
@@ -0,0 +1,63 @@
|
|
|
+package com.goafanti.admin.controller;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+
|
|
|
+import com.goafanti.admin.service.AdminVarietiesService;
|
|
|
+import com.goafanti.common.bo.Result;
|
|
|
+import com.goafanti.common.constant.ErrorConstants;
|
|
|
+import com.goafanti.common.controller.BaseController;
|
|
|
+import com.goafanti.common.model.Admin;
|
|
|
+import com.goafanti.common.model.BusinessVarieties;
|
|
|
+import com.goafanti.common.utils.StringUtils;
|
|
|
+@RestController
|
|
|
+@RequestMapping("api/admin/Varieties")
|
|
|
+public class AdminVarietiesApiController extends BaseController{
|
|
|
+ @Resource
|
|
|
+ private AdminVarietiesService adminVarietiesService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增品类
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/addVarieties" , method = RequestMethod.GET)
|
|
|
+ public Result addVarieties(String cname,String superId) {
|
|
|
+ Result res=new Result();
|
|
|
+ if (StringUtils.isBlank(cname)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "登录帐号为空", "登录帐号"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(superId)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "上级用户为空", "上级用户"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ res.setData(adminVarietiesService.insert(cname,superId));
|
|
|
+
|
|
|
+ return res;
|
|
|
+
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 搜索品类
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/vtList" ,method=RequestMethod.GET)
|
|
|
+ public Result vtList(String cname,String super_id,Integer layer,
|
|
|
+ String status,String pageNo, String pageSize) {
|
|
|
+ Result res = new Result();
|
|
|
+ Integer pNo = 1;
|
|
|
+ Integer pSize = 10;
|
|
|
+ if (StringUtils.isNumeric(pageSize)) {
|
|
|
+ pSize = Integer.parseInt(pageSize);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNumeric(pageNo)) {
|
|
|
+ pNo = Integer.parseInt(pageNo);
|
|
|
+ }
|
|
|
+ res.setData(adminVarietiesService);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|