|
|
@@ -10,17 +10,52 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.goafanti.business.service.JtBusinessService;
|
|
|
+import com.goafanti.business.service.JtBusinessServiceWithCategoryMapper;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.CertifyApiController;
|
|
|
import com.goafanti.common.model.JtBusinessCategory;
|
|
|
|
|
|
+import okhttp3.Request;
|
|
|
+
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/api/admin/jtBusiness")
|
|
|
public class AdminJtBusinessController extends CertifyApiController{
|
|
|
|
|
|
@Resource
|
|
|
private JtBusinessService jtBusinessService;
|
|
|
+
|
|
|
+ @Resource JtBusinessServiceWithCategoryMapper JtBusinessServiceWithCategoryMapper;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 删除品类
|
|
|
+ *
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/category/delete",method=RequestMethod.POST)
|
|
|
+ private Result deleteCetegoryById(String id) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(id==null) {result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","id"));
|
|
|
+ return result;}
|
|
|
+ result.setData(jtBusinessService.deleteCategoryById(id));
|
|
|
+ return result;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ *
|
|
|
+ * 品类详情
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/category/detail",method=RequestMethod.GET)
|
|
|
+ private Result getCategoryDetailById(String id)
|
|
|
+ {
|
|
|
+ Result result=new Result();
|
|
|
+ if(id==null) {result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","id"));
|
|
|
+ return result;}
|
|
|
+
|
|
|
+ result.setData(jtBusinessService.getCategoryById(id));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
/*
|
|
|
*
|
|
|
* 新增品類
|
|
|
@@ -36,6 +71,33 @@ public class AdminJtBusinessController extends CertifyApiController{
|
|
|
if(rc==-2)result.getError().add(buildError(ErrorConstants.PARAM_ERROR,"","父类Id与层数需要对应,"));
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 修改
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/category/update",method=RequestMethod.POST)
|
|
|
+ private Result updateCategory(JtBusinessCategory jtBusinessCategory) {
|
|
|
+ Result result=new Result();
|
|
|
+ //只允许修改3种字段
|
|
|
+ JtBusinessCategory jtBusinessCategory2=new JtBusinessCategory();
|
|
|
+ jtBusinessCategory2.setImgUrl(jtBusinessCategory.getImgUrl());
|
|
|
+ jtBusinessCategory2.setName(jtBusinessCategory.getName());
|
|
|
+ jtBusinessCategory2.setSummary(jtBusinessCategory.getSummary());
|
|
|
+ result.setData(jtBusinessService.updateCategory(jtBusinessCategory2));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 查询品类
|
|
|
+ *
|
|
|
+ * */
|
|
|
+ @RequestMapping(value="/category/list",method=RequestMethod.GET)
|
|
|
+ private Result getCategoryList(JtBusinessCategory jtBusinessCategory,Integer pageNo,Integer pageSize) {
|
|
|
+ Result result=new Result();
|
|
|
+
|
|
|
+ result.setData(JtBusinessServiceWithCategoryMapper.getCategoryListByCondition(jtBusinessCategory,pageNo,pageSize));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
private void disposeCateParam(Result result,JtBusinessCategory jtBusinessCategory ) {
|
|
|
if(jtBusinessCategory.getName() == null) {
|
|
|
result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "名称不可为空", "名称"));
|
|
|
@@ -54,4 +116,6 @@ public class AdminJtBusinessController extends CertifyApiController{
|
|
|
|
|
|
return ;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|