Преглед изворни кода

fix:修复删除购物车bug

李书文 пре 2 година
родитељ
комит
ddd45bc82d

+ 42 - 32
sp-service/level-one-server/src/main/java/com/pj/tb_goods_cart/TbGoodsCartApiController.java

@@ -6,56 +6,66 @@ import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Arrays;
 import java.util.List;
 
 
 /**
  * Controller: tb_goods_cart -- 购物车
- * @author qzy 
+ *
+ * @author qzy
  */
 @RestController
 @RequestMapping("/app/TbGoodsCart/")
 public class TbGoodsCartApiController {
 
-	/** 底层 Service 对象 */
-	@Autowired
-	TbGoodsCartService tbGoodsCartService;
+    /**
+     * 底层 Service 对象
+     */
+    @Autowired
+    TbGoodsCartService tbGoodsCartService;
 
 
-	/** 查 - 根据id */
-	@RequestMapping("getById")
+    /**
+     * 查 - 根据id
+     */
+    @RequestMapping("getById")
 //		@SaCheckPermission(TbGoodsCart.PERMISSION_CODE)
-	public AjaxJson getById(String id){
-		TbGoodsCart t = tbGoodsCartService.getById(id);
-		return AjaxJson.getSuccessData(t);
-	}
+    public AjaxJson getById(String id) {
+        TbGoodsCart t = tbGoodsCartService.getById(id);
+        return AjaxJson.getSuccessData(t);
+    }
 
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
-	@RequestMapping("getList")
-//		@SaCheckPermission(TbGoodsCart.PERMISSION_CODE)
-	public AjaxJson getList() {
-		SoMap so = SoMap.getRequestSoMap();
-		List<GoodsCartVo> list = tbGoodsCartService.getList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
-
-	/** 添加购物车 */
-	@RequestMapping("addGoodsInShopCart")
-	public AjaxJson addGoodsInShopCart(@Validated @RequestBody GoodsCartInfoDto goodsCartInfoDto){
-		AjaxJson ajaxJson = tbGoodsCartService.addGoodsInShopCart(goodsCartInfoDto);
-		return ajaxJson;
-	}
-
-	/** 清理购物车,可批量 */
-	@RequestMapping("cleanCart")
-	public AjaxJson cleanCart(@RequestBody List<Long> ids){
-		AjaxJson ajaxJson = AjaxJson.getSuccessData(tbGoodsCartService.cleanCart(ids));
-		return ajaxJson;
-	}
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    @RequestMapping("getList")
+    public AjaxJson getList() {
+        SoMap so = SoMap.getRequestSoMap();
+        return AjaxJson.getSuccessData(tbGoodsCartService.getList(so));
+    }
+
+    /**
+     * 添加购物车
+     */
+    @RequestMapping("addGoodsInShopCart")
+    public AjaxJson addGoodsInShopCart(@Validated @RequestBody GoodsCartInfoDto goodsCartInfoDto) {
+        AjaxJson ajaxJson = tbGoodsCartService.addGoodsInShopCart(goodsCartInfoDto);
+        return ajaxJson;
+    }
+
+    /**
+     * 清理购物车,可批量
+     */
+    @RequestMapping("cleanCart/{ids}")
+    public AjaxJson cleanCart(@PathVariable Long[] ids) {
+        return AjaxJson.getSuccessData(tbGoodsCartService.removeByIds(Arrays.asList(ids)));
+    }
 
 
 }

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNews.java

@@ -89,7 +89,7 @@ public class TbPortNews extends Model<TbPortNews> implements Serializable {
 	 * 发布时间
 	 *
 	 */
-//	@JsonFormat(pattern = "yyyy-MM-dd")
+	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date releaseTime;	
 
 	/**

+ 30 - 21
sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNewsAppController.java

@@ -1,17 +1,22 @@
 package com.pj.tb_port_news;
 
+import com.pj.enummj.DeleteStatus;
+import com.pj.tb_goods_transit.TbGoodsTransit;
 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.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
-*APP端口岸资讯
-*
-* @author loovi
-* @date
-*/
+ * APP端口岸资讯
+ *
+ * @author loovi
+ * @date
+ */
 @RestController
 @RequestMapping("/app/TbPortNews/")
 public class TbPortNewsAppController {
@@ -20,35 +25,39 @@ public class TbPortNewsAppController {
     TbPortNewsService tbPortNewsService;
 
     /**
-     *APP端获取最新的口岸资讯
+     * APP端获取最新的口岸资讯
      *
      * @author loovi
      * @date
      */
     @RequestMapping("getNewestList")
-    public AjaxJson getNewestList(Long limit){
+    public AjaxJson getNewestList(Long limit) {
         AjaxJson ajaxJson = tbPortNewsService.getNewestList(limit);
         return ajaxJson;
     }
+
     /**
-    *APP端获取口岸资讯列表
-    *
-    * @author loovi
-    * @date
-    */
+     * APP端获取口岸资讯列表
+     *
+     * @author loovi
+     * @date
+     */
     @RequestMapping("getPortNewsList")
-    public AjaxJson getPortNewsList(){
-        AjaxJson ajaxJson = tbPortNewsService.getPortNewsList();
-        return ajaxJson;
+    public AjaxJson getPortNewsList() {
+        SoMap so = SoMap.getRequestSoMap();
+        so.put("status", 1);
+        List<TbPortNews> list = tbPortNewsService.getList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
     }
+
     /**
-    *APP端获取口岸资讯详情
-    *
-    * @author loovi
-    * @date
-    */
+     * APP端获取口岸资讯详情
+     *
+     * @author loovi
+     * @date
+     */
     @RequestMapping("getPortNewsDetails")
-    public  AjaxJson getPortNewsDetails(Long id){
+    public AjaxJson getPortNewsDetails(Long id) {
         AjaxJson ajaxJson = tbPortNewsService.getPortNewsDetails(id);
         return ajaxJson;
     }

+ 31 - 31
sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNewsMapper.xml

@@ -20,37 +20,37 @@
 	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
 	<select id="getList" resultMap="model">
 		<include refid="select_sql"></include>
-<!--		<where>-->
-<!--			<if test=' this.has("id") '> and id = #{id} </if>-->
-<!--			<if test=' this.has("title") '> and title = #{title} </if>-->
-<!--			<if test=' this.has("url") '> and url = #{url} </if>-->
-<!--			<if test=' this.has("content") '> and content = #{content} </if>-->
-<!--			<if test=' this.has("source") '> and source = #{source} </if>-->
-<!--			<if test=' this.has("readCount") '> and read_count = #{readCount} </if>-->
-<!--			<if test=' this.has("isRelease") '> and is_release = #{isRelease} </if>-->
-<!--			<if test=' this.has("status") '> and status = #{status} </if>-->
-<!--			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>-->
-<!--			<if test=' this.has("createName") '> and create_name = #{createName} </if>-->
-<!--			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>-->
-<!--			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>-->
-<!--		</where>-->
-<!--		order by-->
-<!--		<choose>-->
-<!--			<when test='sortType == 1'> id desc </when>-->
-<!--			<when test='sortType == 2'> title desc </when>-->
-<!--			<when test='sortType == 3'> source desc </when>-->
-<!--			<when test='sortType == 4'> read_count desc </when>-->
-<!--			<when test='sortType == 5'> is_release desc </when>-->
-<!--			<when test='sortType == 6'> release_time desc </when>-->
-<!--			<when test='sortType == 7'> status desc </when>-->
-<!--			<when test='sortType == 8'> create_by desc </when>-->
-<!--			<when test='sortType == 9'> create_name desc </when>-->
-<!--			<when test='sortType == 10'> create_time desc </when>-->
-<!--			<when test='sortType == 11'> update_by desc </when>-->
-<!--			<when test='sortType == 12'> update_name desc </when>-->
-<!--			<when test='sortType == 13'> update_time desc </when>-->
-<!--			<otherwise> id desc </otherwise>-->
-<!--		</choose>-->
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("title") '> and title like concat('%', #{title}, '%') </if>
+			<if test=' this.has("url") '> and url = #{url} </if>
+			<if test=' this.has("content") '> and content = #{content} </if>
+			<if test=' this.has("source") '> and source = #{source} </if>
+			<if test=' this.has("readCount") '> and read_count = #{readCount} </if>
+			<if test=' this.has("isRelease") '> and is_release = #{isRelease} </if>
+			<if test=' this.has("status") '> and status = #{status} </if>
+			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
+			<if test=' this.has("createName") '> and create_name = #{createName} </if>
+			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>
+			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> title desc </when>
+			<when test='sortType == 3'> source desc </when>
+			<when test='sortType == 4'> read_count desc </when>
+			<when test='sortType == 5'> is_release desc </when>
+			<when test='sortType == 6'> release_time desc </when>
+			<when test='sortType == 7'> status desc </when>
+			<when test='sortType == 8'> create_by desc </when>
+			<when test='sortType == 9'> create_name desc </when>
+			<when test='sortType == 10'> create_time desc </when>
+			<when test='sortType == 11'> update_by desc </when>
+			<when test='sortType == 12'> update_name desc </when>
+			<when test='sortType == 13'> update_time desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
 	</select>