zoujiajian 2 ani în urmă
părinte
comite
03e3a0474f

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GoodsDonQa.java

@@ -38,6 +38,9 @@ public class GoodsDonQa extends BaseEntity{
 
 	private Boolean deleted;
 
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
+	private Integer sorted;
+
 	@DbIgnore
 	@TableField(exist = false)
 	private List<Long> goodsIds;

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonQaFrontView.java

@@ -15,7 +15,7 @@ import lombok.Setter;
 @Setter
 @SearchBean(tables = "goods_don_qa_relate gr inner join goods_don_qa ga on ga.id = gr.question_id",
 		where = "ga.status is true and ga.deleted is true",
-		orderBy = "ga.update_time desc")
+		orderBy = "ga.sorted asc,ga.update_time desc")
 public class GoodsDonQaFrontView {
 	@DbField("ga.id")
 	private Long id;

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GoodsDonQaView.java

@@ -35,6 +35,9 @@ public class GoodsDonQaView {
 	@DbField("gq.status")
 	private Boolean status;
 
+	@DbField("ga.sorted")
+	private Integer sorted;
+
 	@DbField("gq.created_time")
 	private Date createdTime;
 

+ 15 - 3
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/GoodsDonQuestionController.java

@@ -5,7 +5,6 @@ import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.model.entity.GoodsDonQa;
 import com.cyksj.model.views.GoodsDonQaView;
-import com.cyksj.redis.RedisService;
 import com.cyksj.service.mange.GoodsDonQaService;
 import com.cyksj.service.mange.RefreshCacheService;
 import com.ejlchina.searcher.BeanSearcher;
@@ -34,8 +33,6 @@ public class GoodsDonQuestionController {
 
 	private final HttpServletRequest request;
 
-	private final RedisService redisService;
-
 	private final RefreshCacheService refreshCacheService;
 
 
@@ -121,4 +118,19 @@ public class GoodsDonQuestionController {
 		GoodsDonQa byId = goodsDonQaService.getDetailById(id);
 		return GatewayResponse.SUCCESS.newBuilder().toResult(byId);
 	}
+
+	/**
+	 * 排序
+	 */
+	@PutMapping("/sorted")
+	public Result<String> sorted(@RequestBody GoodsDonQa goodsDonQa) {
+		Long id = goodsDonQa.getId();
+		Integer sorted = goodsDonQa.getSorted();
+		GoodsDonQa byId = goodsDonQaService.getById(id);
+		if (byId != null) {
+			byId.setSorted(sorted);
+			refreshCacheService.goodsQuestionCache();
+		}
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
 }