Commit e8344bb9 by songyinghui

feat: 好办sharding 分表

parent 64758415
...@@ -178,7 +178,7 @@ ...@@ -178,7 +178,7 @@
<dependency> <dependency>
<groupId>com.gic</groupId> <groupId>com.gic</groupId>
<artifactId>gic-sharding-sdk</artifactId> <artifactId>gic-sharding-sdk</artifactId>
<version>3.0-SNAPSHOT</version> <version>4.0-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -29,7 +29,7 @@ public interface TabHaobanInteractRecordMapper { ...@@ -29,7 +29,7 @@ public interface TabHaobanInteractRecordMapper {
* @param pageable 分页对象 * @param pageable 分页对象
* @return 对象列表 * @return 对象列表
*/ */
List<TabHaobanInteractRecord> queryAllByLimit(TabHaobanInteractRecord tabHaobanInteractRecord, @Param("pageable") Pageable pageable); List<TabHaobanInteractRecord> queryAllByLimit(TabHaobanInteractRecord tabHaobanInteractRecord);
/** /**
* 统计总行数 * 统计总行数
......
...@@ -42,7 +42,7 @@ public class TabHaobanInteractRecordServiceImpl implements TabHaobanInteractReco ...@@ -42,7 +42,7 @@ public class TabHaobanInteractRecordServiceImpl implements TabHaobanInteractReco
@Override @Override
public Page<TabHaobanInteractRecord> queryByPage(TabHaobanInteractRecord tabHaobanInteractRecord, PageRequest pageRequest) { public Page<TabHaobanInteractRecord> queryByPage(TabHaobanInteractRecord tabHaobanInteractRecord, PageRequest pageRequest) {
long total = this.tabHaobanInteractRecordMapper.count(tabHaobanInteractRecord); long total = this.tabHaobanInteractRecordMapper.count(tabHaobanInteractRecord);
return new PageImpl<>(this.tabHaobanInteractRecordMapper.queryAllByLimit(tabHaobanInteractRecord, pageRequest), pageRequest, total); return new PageImpl<>(this.tabHaobanInteractRecordMapper.queryAllByLimit(tabHaobanInteractRecord), pageRequest, total);
} }
/** /**
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<import resource="classpath*:kafka-setting.xml"/> <import resource="classpath*:kafka-setting.xml"/>
<import resource="classpath:dubbo-haoban-manage-service.xml" /> <import resource="classpath:dubbo-haoban-manage-service.xml" />
<import resource="classpath:dubbo-setting-test.xml"/> <import resource="classpath:dubbo-setting-test.xml"/>
<import resource="classpath:jdbc-haoban-manage-service.xml" /> <!-- <import resource="classpath:jdbc-haoban-manage-service.xml" />-->
<!-- <import resource="classpath*:jdbc-haoban-manage-service-sharding.xml" />--> <import resource="classpath*:jdbc-haoban-manage-service-sharding.xml" />
<import resource="classpath*:log-record-init.xml" /> <import resource="classpath*:log-record-init.xml" />
</beans> </beans>
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<context:annotation-config /> <context:annotation-config />
<!-- <import resource="classpath*:applicationContext-db-only-with-emoji.xml"/>--> <!-- <import resource="classpath*:applicationContext-db-only-with-emoji.xml"/>-->
<import resource="classpath*:applicationContext-sharding-db-mybatis.xml" /> <import resource="classpath*:applicationContext-sharding-db.xml" />
<bean class="com.gic.haoban.common.init.HaobanSqlSessionFactoryBean" id="sqlSessionFactory"> <bean class="com.gic.haoban.common.init.HaobanSqlSessionFactoryBean" id="sqlSessionFactory">
<property name="dataSource" ref="dataSource" /> <property name="dataSource" ref="dataSource" />
......
...@@ -52,59 +52,10 @@ ...@@ -52,59 +52,10 @@
event_type, duration_time, times, delete_flag, extend_info, create_time, update_time event_type, duration_time, times, delete_flag, extend_info, create_time, update_time
from tab_haoban_interact_record from tab_haoban_interact_record
<where> <where>
<if test="id != null">
and id = #{id}
</if>
<if test="enterpriseId != null and enterpriseId != ''">
and enterprise_id = #{enterpriseId}
</if>
<if test="memberId != null and memberId != ''">
and member_id = #{memberId}
</if>
<if test="unionId != null and unionId != ''">
and union_id = #{unionId}
</if>
<if test="clerkId != null and clerkId != ''"> <if test="clerkId != null and clerkId != ''">
and clerk_id = #{clerkId} clerk_id = #{clerkId} or member_id = #{clerkId}
</if>
<if test="traceId != null and traceId != ''">
and trace_id = #{traceId}
</if>
<if test="bizId != null and bizId != ''">
and biz_id = #{bizId}
</if>
<if test="bizType != null">
and biz_type = #{bizType}
</if>
<if test="storeId != null and storeId != ''">
and store_id = #{storeId}
</if>
<if test="channelSource != null">
and channel_source = #{channelSource}
</if>
<if test="eventType != null">
and event_type = #{eventType}
</if>
<if test="durationTime != null">
and duration_time = #{durationTime}
</if>
<if test="times != null">
and times = #{times}
</if>
<if test="deleteFlag != null">
and delete_flag = #{deleteFlag}
</if>
<if test="extendInfo != null and extendInfo != ''">
and extend_info = #{extendInfo}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if> </if>
</where> </where>
limit #{pageable.offset}, #{pageable.pageSize}
</select> </select>
<!--统计总行数--> <!--统计总行数-->
......
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.UniqueIdUtils; import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.enums.content.MaterialReportType; import com.gic.haoban.manage.api.enums.content.MaterialReportType;
import com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService; import com.gic.haoban.manage.api.service.content.task.QywxGroupMsgTaskApiService;
...@@ -7,10 +8,12 @@ import com.gic.haoban.manage.service.service.content.MaterialReportService; ...@@ -7,10 +8,12 @@ import com.gic.haoban.manage.service.service.content.MaterialReportService;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @Author MUSI * @Author MUSI
...@@ -68,6 +71,8 @@ public class MaterialReportServiceTest { ...@@ -68,6 +71,8 @@ public class MaterialReportServiceTest {
temp.setCreateTime(new Date()); temp.setCreateTime(new Date());
temp.setUpdateTime(new Date()); temp.setUpdateTime(new Date());
temp.setBizId(UniqueIdUtils.uniqueLong()+""); temp.setBizId(UniqueIdUtils.uniqueLong()+"");
int insert = interactRecordMapper.insert(temp); // int insert = interactRecordMapper.insert(temp);
List<TabHaobanInteractRecord> tabHaobanInteractRecords = interactRecordMapper.queryAllByLimit(temp);
System.out.println(JSON.toJSONString(tabHaobanInteractRecords));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment