|
@@ -0,0 +1,53 @@
|
|
|
+package com.pj.tb_goods;
|
|
|
+
|
|
|
+import com.pj.project4sp.SP;
|
|
|
+import com.pj.utils.sg.AjaxJson;
|
|
|
+import com.pj.utils.so.SoMap;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ *app端:商品管理
|
|
|
+ * @author yzs
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/app/TbGoods/")
|
|
|
+public class AppTbGoodsController {
|
|
|
+
|
|
|
+ /** 底层 Service 对象 */
|
|
|
+ @Autowired
|
|
|
+ TbGoodsService tbGoodsService;
|
|
|
+
|
|
|
+ /** 增添加商品 */
|
|
|
+ @RequestMapping("add")
|
|
|
+// @SaCheckPermission(TbGoods.PERMISSION_CODE_ADD)
|
|
|
+ public AjaxJson add(TbGoods t){
|
|
|
+ tbGoodsService.add(t);
|
|
|
+ t = tbGoodsService.getById(SP.publicMapper.getPrimarykey());
|
|
|
+ return AjaxJson.getSuccessData(t);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 查 - 根据id */
|
|
|
+ @RequestMapping("getById")
|
|
|
+// @SaCheckPermission(TbGoods.PERMISSION_CODE)
|
|
|
+ public AjaxJson getById(String id){
|
|
|
+ TbGoods t = tbGoodsService.getById(id);
|
|
|
+ return AjaxJson.getSuccessData(t);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
|
|
|
+ @RequestMapping("getList")
|
|
|
+// @SaCheckPermission(TbGoods.PERMISSION_CODE)
|
|
|
+ public AjaxJson getList() {
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ List<TbGoods> list = tbGoodsService.getList(so.startPage());
|
|
|
+ return AjaxJson.getPageData(so.getDataCount(), list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|