zoujiajian 2 年之前
父节点
当前提交
52c2fb5aee

+ 0 - 2
netflix-dao/src/main/java/com/cyksj/model/entity/GroupsRelationIndependentRenew.java

@@ -16,8 +16,6 @@ public class GroupsRelationIndependentRenew extends BaseEntity{
 
 	private Long relationId;
 
-	private Long accountId;
-
 	private Boolean isRenew;
 
 	private String operator;

+ 3 - 2
netflix-dao/src/main/java/com/cyksj/model/views/GroupsRelationIndependentView.java

@@ -18,8 +18,9 @@ import java.util.Date;
 @Getter
 @Setter
 @SearchBean(tables = "groups_relation gr inner join groups_trips gt on gt.id = gr.groups_id" +
-		" inner join account a on a.id = gt.account_id :condition:" +
-		" inner join user u on u.id = gr.user_id")
+		" inner join account a on a.id = gt.account_id" +
+		" inner join user u on u.id = gr.user_id",
+		where = ":condition:")
 public class GroupsRelationIndependentView {
 	@DbField("gr.id")
 	private Long relationId;

+ 11 - 5
netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsGroupRelationController.java

@@ -162,9 +162,16 @@ public class CmsGroupRelationController {
      * Chat GPT独立规格续费 列表
      */
     @GetMapping("/get/chatGPT/independent/renew")
-    public Result<SearchResult<GroupsRelationIndependentView>> getIndependentRenew() {
-        String condition = " and sku_id in (select id from goods_don_sku sku where sku.goods_id = 18 and sku.num = 1)" +
-                " and (select count(*) from order_don o where o.user_id = gr.user_id and o.relation_id = gr.relation_id and o.status not in ('close','noPayment','refund') and o.order_type = 2) > 0";
+    public Result<SearchResult<GroupsRelationIndependentView>> getIndependentRenew(Boolean isRenew) {
+        String condition = " sku_id in (select id from goods_don_sku sku where sku.goods_id = 18 and sku.num = 1)" +
+                " and exists (select id from order_don o where o.user_id = gr.user_id and o.relation_id = gr.id and o.status not in ('close','noPayment','refund') and o.order_type = 2 limit 1)";
+        if (isRenew != null) {
+            if (isRenew) {
+                condition += String.format(" and exists (select id from groups_relation_independent_renew gnr where gnr.user_id = gr.user_id and gnr.relation_id = gr.id and gnr.is_renew = 1 limit 1)");
+            } else {
+                condition += String.format(" and (select count(*) from groups_relation_independent_renew gnr where gnr.user_id = gr.user_id and gnr.relation_id = gr.id and gnr.is_renew = 1) = 0");
+            }
+        }
         SearchResult<GroupsRelationIndependentView> search = beanSearcher.search(GroupsRelationIndependentView.class, MapUtils.flatBuilder(request.getParameterMap())
                 .put("condition", condition)
                 .build());
@@ -193,13 +200,12 @@ public class CmsGroupRelationController {
         if (cmsUser != null) {
             groupsRelationIndependentRenew.setOperator(cmsUser.getNickname());
         }
-        if (groupsRelationIndependentRenew == null) {
+        if (groupsRelationIndependentRenew.getId() == null) {
             groupsRelationIndependentRenew.setRelationId(relationId);
             groupsRelationIndependentRenew.setUserId(userId);
             groupsRelationIndependentRenew.setIsRenew(isRenew);
             groupsRelationIndependentRenewMapper.insert(groupsRelationIndependentRenew);
         } else {
-            groupsRelationIndependentRenew.setOperator(cmsUser.getNickname());
             groupsRelationIndependentRenew.setIsRenew(isRenew);
             groupsRelationIndependentRenewMapper.updateById(groupsRelationIndependentRenew);
         }