丁云鹏 11 months ago
parent
commit
cf7ac10340
13 changed files with 1222 additions and 71 deletions
  1. BIN
      long-article-recommend-service/src/main/.DS_Store
  2. 2 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/Application.java
  3. 1 2
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/MBG.java
  4. 6 6
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/crawler/ArticleUserGroupRepository.java
  5. 1 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/entity/crawler/ArticleUserGroupNew.java
  6. 102 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/mapper/crawler/ArticleUserGroupMapper.java
  7. 168 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/model/ArticleUserGroup.java
  8. 621 0
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/model/ArticleUserGroupExample.java
  9. 14 12
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/UserManagementService.java
  10. 0 45
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/UserManagementTransactionalService.java
  11. 4 1
      long-article-recommend-service/src/main/resources/application.yml
  12. 9 4
      long-article-recommend-service/src/main/resources/generatorConfig.xml
  13. 294 0
      long-article-recommend-service/src/main/resources/mapper/crawler/ArticleUserGroupMapper.xml

BIN
long-article-recommend-service/src/main/.DS_Store


+ 2 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/Application.java

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server;
 
 
 import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
+import org.mybatis.spring.annotation.MapperScan;
 import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -25,6 +26,7 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
         "com.tzld.longarticle.recommend.server.util",
         "com.tzld.longarticle.recommend.server.repository",
 })
+@MapperScan("com.tzld.longarticle.recommend.server.repository.mapper")
 @EnableAspectJAutoProxy
 @EnableApolloConfig
 public class Application {

+ 1 - 2
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/MBG.java

@@ -18,9 +18,8 @@ public class MBG {
     public static void main(String[] args) throws Exception {
         List<String> warnings = new ArrayList<String>();
         boolean overwrite = true;
-        File configFile = new File("generatorConfig.xml");
         ConfigurationParser cp = new ConfigurationParser(warnings);
-        Configuration config = cp.parseConfiguration(configFile);
+        Configuration config = cp.parseConfiguration(new File("/Users/dingyunpeng/Desktop/code/changwen/long-article-recommend/long-article-recommend-service/src/main/resources/generatorConfig.xml"));
         DefaultShellCallback callback = new DefaultShellCallback(overwrite);
         MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
         myBatisGenerator.generate(null);

+ 6 - 6
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/crawler/ArticleUserGroupRepository.java

@@ -1,6 +1,6 @@
 package com.tzld.longarticle.recommend.server.repository.crawler;
 
-import com.tzld.longarticle.recommend.server.repository.entity.crawler.ArticleUserGroup;
+import com.tzld.longarticle.recommend.server.repository.entity.crawler.ArticleUserGroupNew;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
@@ -10,17 +10,17 @@ import org.springframework.stereotype.Repository;
 import java.util.List;
 
 @Repository
-public interface ArticleUserGroupRepository extends JpaRepository<ArticleUserGroup, Long> {
-    @Query("select distinct userGroupId from ArticleUserGroup where gzhId = :gzhId and isDelete = 0")
+public interface ArticleUserGroupRepository extends JpaRepository<ArticleUserGroupNew, Long> {
+    @Query("select distinct userGroupId from ArticleUserGroupNew where gzhId = :gzhId and isDelete = 0")
     List<Integer> findAllUserGroupId(String gzhId);
 
-    ArticleUserGroup findFirstByGzhIdAndOpenId(String gzhId, String openId);
+    ArticleUserGroupNew findFirstByGzhIdAndOpenId(String gzhId, String openId);
 
-    @Query("select distinct openId from ArticleUserGroup where gzhId = :gzhId" +
+    @Query("select distinct openId from ArticleUserGroupNew where gzhId = :gzhId" +
             " and userGroupId = :userGroupId and isDelete = 0")
     List<String> findAllOpenId(String gzhId, int userGroupId);
 
     @Modifying
-    @Query("UPDATE ArticleUserGroup a SET a.userGroupId = a.id % :groupNum WHERE a.gzhId = :gzhId")
+    @Query("UPDATE ArticleUserGroupNew a SET a.userGroupId = a.id % :groupNum WHERE a.gzhId = :gzhId")
     void updateUserGroupIdWithMod(@Param("gzhId") String gzhId, @Param("groupNum") int groupNum);
 }

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/entity/crawler/ArticleUserGroup.java → long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/entity/crawler/ArticleUserGroupNew.java

@@ -10,7 +10,7 @@ import javax.persistence.*;
 @Data
 @Entity
 @Table(name = "article_user_group")
-public class ArticleUserGroup {
+public class ArticleUserGroupNew {
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;

+ 102 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/mapper/crawler/ArticleUserGroupMapper.java

@@ -0,0 +1,102 @@
+package com.tzld.longarticle.recommend.server.repository.mapper.crawler;
+
+import com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup;
+import com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroupExample;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+@Mapper
+public interface ArticleUserGroupMapper {
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    long countByExample(ArticleUserGroupExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    int deleteByExample(ArticleUserGroupExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    int deleteByPrimaryKey(Long id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    int insert(ArticleUserGroup row);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    int insertSelective(ArticleUserGroup row);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    List<ArticleUserGroup> selectByExample(ArticleUserGroupExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    ArticleUserGroup selectByPrimaryKey(Long id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    int updateByExampleSelective(@Param("row") ArticleUserGroup row, @Param("example") ArticleUserGroupExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    int updateByExample(@Param("row") ArticleUserGroup row, @Param("example") ArticleUserGroupExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    int updateByPrimaryKeySelective(ArticleUserGroup row);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    int updateByPrimaryKey(ArticleUserGroup row);
+
+    int insertBatch(List<ArticleUserGroup> list);
+}

+ 168 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/model/ArticleUserGroup.java

@@ -0,0 +1,168 @@
+package com.tzld.longarticle.recommend.server.repository.model;
+
+public class ArticleUserGroup {
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column article_user_group.id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    private Long id;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column article_user_group.gzh_id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    private String gzhId;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column article_user_group.user_group_id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    private Integer userGroupId;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column article_user_group.open_id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    private String openId;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column article_user_group.is_delete
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    private Integer isDelete;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column article_user_group.id
+     *
+     * @return the value of article_user_group.id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public Long getId() {
+        return id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column article_user_group.id
+     *
+     * @param id the value for article_user_group.id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column article_user_group.gzh_id
+     *
+     * @return the value of article_user_group.gzh_id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public String getGzhId() {
+        return gzhId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column article_user_group.gzh_id
+     *
+     * @param gzhId the value for article_user_group.gzh_id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public void setGzhId(String gzhId) {
+        this.gzhId = gzhId == null ? null : gzhId.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column article_user_group.user_group_id
+     *
+     * @return the value of article_user_group.user_group_id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public Integer getUserGroupId() {
+        return userGroupId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column article_user_group.user_group_id
+     *
+     * @param userGroupId the value for article_user_group.user_group_id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public void setUserGroupId(Integer userGroupId) {
+        this.userGroupId = userGroupId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column article_user_group.open_id
+     *
+     * @return the value of article_user_group.open_id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public String getOpenId() {
+        return openId;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column article_user_group.open_id
+     *
+     * @param openId the value for article_user_group.open_id
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public void setOpenId(String openId) {
+        this.openId = openId == null ? null : openId.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column article_user_group.is_delete
+     *
+     * @return the value of article_user_group.is_delete
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public Integer getIsDelete() {
+        return isDelete;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column article_user_group.is_delete
+     *
+     * @param isDelete the value for article_user_group.is_delete
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public void setIsDelete(Integer isDelete) {
+        this.isDelete = isDelete;
+    }
+}

+ 621 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/model/ArticleUserGroupExample.java

@@ -0,0 +1,621 @@
+package com.tzld.longarticle.recommend.server.repository.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ArticleUserGroupExample {
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    protected String orderByClause;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    protected boolean distinct;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    protected List<Criteria> oredCriteria;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public ArticleUserGroupExample() {
+        oredCriteria = new ArrayList<>();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdIsNull() {
+            addCriterion("gzh_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdIsNotNull() {
+            addCriterion("gzh_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdEqualTo(String value) {
+            addCriterion("gzh_id =", value, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdNotEqualTo(String value) {
+            addCriterion("gzh_id <>", value, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdGreaterThan(String value) {
+            addCriterion("gzh_id >", value, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdGreaterThanOrEqualTo(String value) {
+            addCriterion("gzh_id >=", value, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdLessThan(String value) {
+            addCriterion("gzh_id <", value, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdLessThanOrEqualTo(String value) {
+            addCriterion("gzh_id <=", value, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdLike(String value) {
+            addCriterion("gzh_id like", value, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdNotLike(String value) {
+            addCriterion("gzh_id not like", value, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdIn(List<String> values) {
+            addCriterion("gzh_id in", values, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdNotIn(List<String> values) {
+            addCriterion("gzh_id not in", values, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdBetween(String value1, String value2) {
+            addCriterion("gzh_id between", value1, value2, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andGzhIdNotBetween(String value1, String value2) {
+            addCriterion("gzh_id not between", value1, value2, "gzhId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdIsNull() {
+            addCriterion("user_group_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdIsNotNull() {
+            addCriterion("user_group_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdEqualTo(Integer value) {
+            addCriterion("user_group_id =", value, "userGroupId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdNotEqualTo(Integer value) {
+            addCriterion("user_group_id <>", value, "userGroupId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdGreaterThan(Integer value) {
+            addCriterion("user_group_id >", value, "userGroupId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdGreaterThanOrEqualTo(Integer value) {
+            addCriterion("user_group_id >=", value, "userGroupId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdLessThan(Integer value) {
+            addCriterion("user_group_id <", value, "userGroupId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdLessThanOrEqualTo(Integer value) {
+            addCriterion("user_group_id <=", value, "userGroupId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdIn(List<Integer> values) {
+            addCriterion("user_group_id in", values, "userGroupId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdNotIn(List<Integer> values) {
+            addCriterion("user_group_id not in", values, "userGroupId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdBetween(Integer value1, Integer value2) {
+            addCriterion("user_group_id between", value1, value2, "userGroupId");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserGroupIdNotBetween(Integer value1, Integer value2) {
+            addCriterion("user_group_id not between", value1, value2, "userGroupId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdIsNull() {
+            addCriterion("open_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdIsNotNull() {
+            addCriterion("open_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdEqualTo(String value) {
+            addCriterion("open_id =", value, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdNotEqualTo(String value) {
+            addCriterion("open_id <>", value, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdGreaterThan(String value) {
+            addCriterion("open_id >", value, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdGreaterThanOrEqualTo(String value) {
+            addCriterion("open_id >=", value, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdLessThan(String value) {
+            addCriterion("open_id <", value, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdLessThanOrEqualTo(String value) {
+            addCriterion("open_id <=", value, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdLike(String value) {
+            addCriterion("open_id like", value, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdNotLike(String value) {
+            addCriterion("open_id not like", value, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdIn(List<String> values) {
+            addCriterion("open_id in", values, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdNotIn(List<String> values) {
+            addCriterion("open_id not in", values, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdBetween(String value1, String value2) {
+            addCriterion("open_id between", value1, value2, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdNotBetween(String value1, String value2) {
+            addCriterion("open_id not between", value1, value2, "openId");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIsNull() {
+            addCriterion("is_delete is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIsNotNull() {
+            addCriterion("is_delete is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteEqualTo(Integer value) {
+            addCriterion("is_delete =", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotEqualTo(Integer value) {
+            addCriterion("is_delete <>", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteGreaterThan(Integer value) {
+            addCriterion("is_delete >", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) {
+            addCriterion("is_delete >=", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteLessThan(Integer value) {
+            addCriterion("is_delete <", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteLessThanOrEqualTo(Integer value) {
+            addCriterion("is_delete <=", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIn(List<Integer> values) {
+            addCriterion("is_delete in", values, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotIn(List<Integer> values) {
+            addCriterion("is_delete not in", values, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteBetween(Integer value1, Integer value2) {
+            addCriterion("is_delete between", value1, value2, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) {
+            addCriterion("is_delete not between", value1, value2, "isDelete");
+            return (Criteria) this;
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table article_user_group
+     *
+     * @mbg.generated do_not_delete_during_merge Thu Aug 22 20:53:08 CST 2024
+     */
+    public static class Criteria extends GeneratedCriteria {
+        protected Criteria() {
+            super();
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table article_user_group
+     *
+     * @mbg.generated Thu Aug 22 20:53:08 CST 2024
+     */
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 14 - 12
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/UserManagementService.java

@@ -3,7 +3,9 @@ package com.tzld.longarticle.recommend.server.service;
 import com.tzld.longarticle.recommend.server.model.WxUserGetResponse;
 import com.tzld.longarticle.recommend.server.remote.WxUserManagementRemoteService;
 import com.tzld.longarticle.recommend.server.repository.crawler.ArticleUserGroupRepository;
-import com.tzld.longarticle.recommend.server.repository.entity.crawler.ArticleUserGroup;
+import com.tzld.longarticle.recommend.server.repository.entity.crawler.ArticleUserGroupNew;
+import com.tzld.longarticle.recommend.server.repository.mapper.crawler.ArticleUserGroupMapper;
+import com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup;
 import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
@@ -14,10 +16,7 @@ import org.dom4j.Element;
 import org.dom4j.io.SAXReader;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
 import java.util.*;
 
 /**
@@ -32,7 +31,7 @@ public class UserManagementService {
     private ArticleUserGroupRepository articleUserGroupRepository;
 
     @Autowired
-    private UserManagementTransactionalService userManagementTransactionalService;
+    private ArticleUserGroupMapper articleUserGroupMapper;
 
     public void addGZH(String gzhId, int groupNum) {
 
@@ -59,11 +58,12 @@ public class UserManagementService {
                 ug.setGzhId(gzhId);
                 ug.setOpenId(s);
                 ug.setUserGroupId(RandomUtils.nextInt(groupNum));
+                ug.setIsDelete(0);
                 return ug;
             });
 
             //articleUserGroupRepository.saveAll(userGroups);
-            userManagementTransactionalService.insertAll(userGroups);
+            articleUserGroupMapper.insertBatch(userGroups);
         }
 
         while (StringUtils.isNotBlank(nextOpenId)) {
@@ -82,16 +82,18 @@ public class UserManagementService {
                     ArticleUserGroup ug = new ArticleUserGroup();
                     ug.setGzhId(gzhId);
                     ug.setOpenId(s);
-                    // ug.setUserGroupId(RandomUtils.nextInt(groupNum));
+                    ug.setUserGroupId(RandomUtils.nextInt(groupNum));
+                    ug.setIsDelete(0);
+                    ug.setUserGroupId(RandomUtils.nextInt(groupNum));
                     return ug;
                 });
-                userManagementTransactionalService.insertAll(userGroups);
+                articleUserGroupMapper.insertBatch(userGroups);
                 // articleUserGroupRepository.saveAll(userGroups);
             }
         }
 
         log.info("end sync user gzhId={}", gzhId);
-        log.info("start group gzhId={}", gzhId);
+//        log.info("start group gzhId={}", gzhId);
 
 
     }
@@ -167,14 +169,14 @@ public class UserManagementService {
 
     private void handleSubscribe(String gzhId, String openId) {
         //
-        ArticleUserGroup group = articleUserGroupRepository.findFirstByGzhIdAndOpenId(gzhId, openId);
+        ArticleUserGroupNew group = articleUserGroupRepository.findFirstByGzhIdAndOpenId(gzhId, openId);
         if (group == null) {
             // insert
             // 查库,知道所有分组
             List<Integer> ugIds = articleUserGroupRepository.findAllUserGroupId(gzhId);
             // 随机选一个组
             int ugId = ugIds.get(RandomUtils.nextInt(ugIds.size()));
-            group = new ArticleUserGroup();
+            group = new ArticleUserGroupNew();
             group.setGzhId(gzhId);
             group.setOpenId(openId);
             group.setUserGroupId(ugId);
@@ -188,7 +190,7 @@ public class UserManagementService {
     }
 
     private void handleUnsubscribe(String gzhId, String openId) {
-        ArticleUserGroup group = articleUserGroupRepository.findFirstByGzhIdAndOpenId(gzhId, openId);
+        ArticleUserGroupNew group = articleUserGroupRepository.findFirstByGzhIdAndOpenId(gzhId, openId);
         if (group != null) {
             group.setIsDelete(1);
             articleUserGroupRepository.save(group);

+ 0 - 45
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/UserManagementTransactionalService.java

@@ -1,45 +0,0 @@
-package com.tzld.longarticle.recommend.server.service;
-
-import com.tzld.longarticle.recommend.server.model.WxUserGetResponse;
-import com.tzld.longarticle.recommend.server.remote.WxUserManagementRemoteService;
-import com.tzld.longarticle.recommend.server.repository.crawler.ArticleUserGroupRepository;
-import com.tzld.longarticle.recommend.server.repository.entity.crawler.ArticleUserGroup;
-import com.tzld.longarticle.recommend.server.util.CommonCollectionUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang.math.RandomUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.dom4j.Document;
-import org.dom4j.Element;
-import org.dom4j.io.SAXReader;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import java.util.*;
-
-/**
- * @author dyp
- */
-@Slf4j
-@Service
-public class UserManagementTransactionalService {
-
-    @PersistenceContext
-    private EntityManager entityManager;
-
-    @Transactional
-    public void insertAll(Iterable<ArticleUserGroup> entities) {
-        Iterator<ArticleUserGroup> iterator = entities.iterator();
-
-        while (iterator.hasNext()) {
-            ArticleUserGroup next = iterator.next();
-            entityManager.persist(next);
-        }
-        entityManager.flush();
-        entityManager.clear();
-    }
-
-}

+ 4 - 1
long-article-recommend-service/src/main/resources/application.yml

@@ -51,4 +51,7 @@ apollo:
   bootstrap:
     enabled: true
     namespaces: application
-  cacheDir: /datalog/apollo-cache-dir
+  cacheDir: /datalog/apollo-cache-dir
+
+mybatis:
+  mapper-locations: classpath:/mapper/*.xml

+ 9 - 4
long-article-recommend-service/src/main/resources/generatorConfig.xml

@@ -5,8 +5,11 @@
 
 <generatorConfiguration>
     <context id="simple" targetRuntime="MyBatis3">
+        <commentGenerator>
+            <property name="suppressAllComments" value="false"/>
+        </commentGenerator>
         <jdbcConnection driverClass="com.mysql.jdbc.Driver"
-                        connectionURL="jdbc:mysql://rm-bp1159bu17li9hi94.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false"
+                        connectionURL="jdbc:mysql://rm-bp1159bu17li9hi94.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&amp;characterEncoding=utf-8&amp;zeroDateTimeBehavior=convertToNull&amp;useSSL=false"
                         userId="crawler"
                         password="crawler123456@">
         </jdbcConnection>
@@ -15,16 +18,18 @@
             <property name="forceBigDecimals" value="false" />
         </javaTypeResolver>
 
-        <javaModelGenerator targetPackage="model" targetProject="./target">
+        <javaModelGenerator targetPackage="com.tzld.longarticle.recommend.server.repository.model" targetProject="/Users/dingyunpeng/Desktop/code/changwen/long-article-recommend/long-article-recommend-service/src/main/java">
             <property name="enableSubPackages" value="true" />
             <property name="trimStrings" value="true" />
         </javaModelGenerator>
 
-        <sqlMapGenerator targetPackage="xml"  targetProject="./src/resources/mapper">
+        <sqlMapGenerator targetPackage="crawler"  targetProject="/Users/dingyunpeng/Desktop/code/changwen/long-article-recommend/long-article-recommend-service/src/main/resources/mapper">
             <property name="enableSubPackages" value="true" />
         </sqlMapGenerator>
 
-        <javaClientGenerator type="XMLMAPPER" targetPackage="mapper"  targetProject="./target">
+        <javaClientGenerator type="XMLMAPPER"
+                             targetPackage="com.tzld.longarticle.recommend.server.repository.mapper.crawler"
+                             targetProject="/Users/dingyunpeng/Desktop/code/changwen/long-article-recommend/long-article-recommend-service/src/main/java">
             <property name="enableSubPackages" value="true" />
         </javaClientGenerator>
 

+ 294 - 0
long-article-recommend-service/src/main/resources/mapper/crawler/ArticleUserGroupMapper.xml

@@ -0,0 +1,294 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.tzld.longarticle.recommend.server.repository.mapper.crawler.ArticleUserGroupMapper">
+  <resultMap id="BaseResultMap" type="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="gzh_id" jdbcType="VARCHAR" property="gzhId" />
+    <result column="user_group_id" jdbcType="INTEGER" property="userGroupId" />
+    <result column="open_id" jdbcType="VARCHAR" property="openId" />
+    <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    id, gzh_id, user_group_id, open_id, is_delete
+  </sql>
+  <select id="selectByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroupExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from article_user_group
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from article_user_group
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    delete from article_user_group
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroupExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    delete from article_user_group
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into article_user_group (gzh_id, user_group_id, open_id, 
+      is_delete)
+    values (#{gzhId,jdbcType=VARCHAR}, #{userGroupId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, 
+      #{isDelete,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into article_user_group
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="gzhId != null">
+        gzh_id,
+      </if>
+      <if test="userGroupId != null">
+        user_group_id,
+      </if>
+      <if test="openId != null">
+        open_id,
+      </if>
+      <if test="isDelete != null">
+        is_delete,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="gzhId != null">
+        #{gzhId,jdbcType=VARCHAR},
+      </if>
+      <if test="userGroupId != null">
+        #{userGroupId,jdbcType=INTEGER},
+      </if>
+      <if test="openId != null">
+        #{openId,jdbcType=VARCHAR},
+      </if>
+      <if test="isDelete != null">
+        #{isDelete,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroupExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    select count(*) from article_user_group
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    update article_user_group
+    <set>
+      <if test="row.id != null">
+        id = #{row.id,jdbcType=BIGINT},
+      </if>
+      <if test="row.gzhId != null">
+        gzh_id = #{row.gzhId,jdbcType=VARCHAR},
+      </if>
+      <if test="row.userGroupId != null">
+        user_group_id = #{row.userGroupId,jdbcType=INTEGER},
+      </if>
+      <if test="row.openId != null">
+        open_id = #{row.openId,jdbcType=VARCHAR},
+      </if>
+      <if test="row.isDelete != null">
+        is_delete = #{row.isDelete,jdbcType=INTEGER},
+      </if>
+    </set>
+    <if test="example != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    update article_user_group
+    set id = #{row.id,jdbcType=BIGINT},
+      gzh_id = #{row.gzhId,jdbcType=VARCHAR},
+      user_group_id = #{row.userGroupId,jdbcType=INTEGER},
+      open_id = #{row.openId,jdbcType=VARCHAR},
+      is_delete = #{row.isDelete,jdbcType=INTEGER}
+    <if test="example != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    update article_user_group
+    <set>
+      <if test="gzhId != null">
+        gzh_id = #{gzhId,jdbcType=VARCHAR},
+      </if>
+      <if test="userGroupId != null">
+        user_group_id = #{userGroupId,jdbcType=INTEGER},
+      </if>
+      <if test="openId != null">
+        open_id = #{openId,jdbcType=VARCHAR},
+      </if>
+      <if test="isDelete != null">
+        is_delete = #{isDelete,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.tzld.longarticle.recommend.server.repository.model.ArticleUserGroup">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Thu Aug 22 20:53:08 CST 2024.
+    -->
+    update article_user_group
+    set gzh_id = #{gzhId,jdbcType=VARCHAR},
+      user_group_id = #{userGroupId,jdbcType=INTEGER},
+      open_id = #{openId,jdbcType=VARCHAR},
+      is_delete = #{isDelete,jdbcType=INTEGER}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+
+  <insert id="insertBatch" parameterType="list">
+    INSERT INTO article_user_group (gzh_id, user_group_id, open_id, is_delete)
+    VALUES
+    <foreach collection="list" item="item" separator=",">
+      (#{item.gzhId}, #{item.userGroupId}, #{item.openId}, #{item.isDelete})
+    </foreach>
+  </insert>
+</mapper>