songjiaqing 5 years ago
parent
commit
95a22e7e2b

+ 1 - 2
whepi-web/src/main/java/com/bofeng/dao/ShShopMapper.java

@@ -3,7 +3,6 @@ package com.bofeng.dao;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.ShShop;
 import com.bofeng.entity.ShShop;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 import org.springframework.stereotype.Repository;
 
 
 import java.util.List;
 import java.util.List;
@@ -16,7 +15,7 @@ public interface ShShopMapper extends BaseMapper<ShShop> {
 
 
 //    ShShop queryById(Long taskId);
 //    ShShop queryById(Long taskId);
 
 
-    ShShop queryMyShop(Long userId);
+    List<ShShop> queryMyShShop(Long userId);
 
 
 //    List<ShShop> queryByHouseNumber(@Param("houseNumber") String houseNumber, @Param("status") Integer status);
 //    List<ShShop> queryByHouseNumber(@Param("houseNumber") String houseNumber, @Param("status") Integer status);
 //
 //

+ 11 - 0
whepi-web/src/main/java/com/bofeng/service/ShShopService.java

@@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.toolkit.IdWorker;
 import com.bofeng.dao.ShShopMapper;
 import com.bofeng.dao.ShShopMapper;
 import com.bofeng.entity.ShShop;
 import com.bofeng.entity.ShShop;
 import lombok.var;
 import lombok.var;
+import org.apache.commons.collections.CollectionUtils;
 import org.joda.time.DateTime;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import java.util.List;
+
 @Service
 @Service
 @Transactional(readOnly = true)
 @Transactional(readOnly = true)
 public class ShShopService {
 public class ShShopService {
@@ -63,6 +66,14 @@ public class ShShopService {
         return 0;
         return 0;
     }
     }
 
 
+    public List<ShShop> queryMyShShop(Long userId) throws Exception {
+        List<ShShop> shShopDb = shShopMapper.queryMyShShop(userId);
+        if (CollectionUtils.isEmpty(shShopDb)) {
+            throw new Exception("获取失败");
+        }
+        return shShopDb;
+    }
+
 //
 //
 //    public List<QzTask> selectAll() {
 //    public List<QzTask> selectAll() {
 //        return qzTaskDao.selectAll();
 //        return qzTaskDao.selectAll();

+ 89 - 0
whepi-web/src/main/java/com/bofeng/wx/controller/ShopMatController.java

@@ -0,0 +1,89 @@
+package com.bofeng.wx.controller;
+
+import com.bofeng.entity.ShShopMat;
+import com.bofeng.service.ShShopMatService;
+import com.bofeng.service.ShShopService;
+import com.yvan.Model;
+import com.yvan.ModelOps;
+import com.yvan.mvc.Pd;
+import com.yvan.platform.JsonWapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.util.List;
+
+@RestController
+public class ShopMatController {
+
+//    @Autowired
+//    private HomeService homeService;
+//
+//    @Autowired
+//    private QzTaskService qzTaskService;
+//
+//    @Autowired
+//    private QzTaskReplyService qzTaskReplyService;
+
+    @Autowired
+    private ShShopService shShopService;
+    @Autowired
+    private ShShopMatService shShopMatService;
+
+
+    @GetMapping("/shop/home.html")
+    public ModelAndView home(ModelMap model) {
+        //UserOpen userOpen = homeService.getUserOpen();
+        model.put("user", new JsonWapper("{\"www\": \"er\"}"));
+        return new ModelAndView("/shop/home.ftl", model);
+    }
+
+
+    //商品的新增
+    @PostMapping("/shop/shop/addShShopMat")
+    public ModelOps addShShopMat(@Pd(name = "userId") Long userId, @Pd(name = "matName") String matName, @Pd(name = "matNum") Integer matNum) throws Exception {
+        return ModelOps.newSuccess(shShopMatService.addShShopMat(userId, matName, matNum));
+    }
+
+    //商品的置顶2、下架0修改
+    @PostMapping("/shop/shop/editShShopMatStatus")
+    public ModelOps editShShopMatStatus(@Pd(name = "matId") Long matId, @Pd(name = "status") Integer status) throws Exception {
+        return ModelOps.newSuccess(shShopMatService.editShShopMatStatus(matId, status));
+    }
+
+    //    //我的商品
+    @GetMapping("/shop/shop/queryMyShShopMat")
+    public Model<List<ShShopMat>> queryMyShShopMat(@Pd(name = "userId"/*, required = false*/) Long userId) throws Exception {
+        return Model.newSuccess(shShopMatService.queryMyShShopMat(userId));
+    }
+
+
+//    //家庭求助
+//    @GetMapping("/home/home/addFimaly")
+//    public ModelOps family(@Pd(name = "taskTitle") String taskTitle,
+//                           @Pd(name = "taskTarget") String taskTarget,
+//                           @Pd(name = "remark") String remark) {
+//        return ModelOps.newSuccess(qzTaskService.addHelp(taskTitle, taskTarget, remark));
+//    }
+//
+//    //我的在求助的展示
+//    @GetMapping("/home/home/queryQzTask")
+//    public Model<List<QzTask>> queryQzTask(@Pd(name = "taskStatus", required = false) Integer taskStatus) {
+//        return Model.newSuccess(qzTaskService.queryQzTask(taskStatus));
+//    }
+//
+//    //小区求助的查看
+//    @GetMapping("/home/home/taskQuery")
+//    public Model<List<QzTaskReply>> taskQuery(@Pd(name = "taskId") Long taskId) {
+//        return Model.newSuccess(qzTaskReplyService.taskQuery(taskId));
+//    }
+//
+//    @GetMapping("/home/home_new.html")
+//    public ModelAndView hmoe_new(ModelMap model) {
+//        model.put("user", new JsonWapper("{\"www\": \"er\"}"));
+//        return new ModelAndView("/home/home_new.ftl", model);
+//    }
+}

+ 3 - 2
whepi-web/src/main/resources/mapper/ShShop.xml

@@ -10,8 +10,9 @@
     <!--select * from sh_shop where shop_id=#{shopId} and user_id=#{userId}-->
     <!--select * from sh_shop where shop_id=#{shopId} and user_id=#{userId}-->
     <!--</select>-->
     <!--</select>-->
 
 
-    <select id="queryMyShop" resultType="com.bofeng.entity.ShShop">
-    select * from sh_shop where  user_id=#{userId}
+    <select id="queryMyShShop" resultType="com.bofeng.entity.ShShop">
+        select * from sh_shop where  user_id=#{userId}
+        order by time_update desc
   </select>
   </select>
 
 
     <!--<select id="queryByHouseNumber" resultType="com.bofeng.entity.ShShop">-->
     <!--<select id="queryByHouseNumber" resultType="com.bofeng.entity.ShShop">-->