|
|
|
@ -1,7 +1,10 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.daoimpl;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.apiservice.dao.ITestDao;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysTool;
|
|
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -9,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.persistence.EntityManager;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 多表测试
|
|
|
|
@ -24,6 +28,39 @@ public class TestDaoImpl implements ITestDao {
|
|
|
|
|
@Autowired
|
|
|
|
|
private EntityManager entityManager;
|
|
|
|
|
|
|
|
|
|
public static final String TEXT = "党的十八大提出,倡导富强、民主、文明、和谐,倡导自由、平等、公正、法治,倡导爱国、敬业、诚信、友善,积极培育和践行社会主义核心价值观。富强、民主、文明、和谐是国家层面的价值目标,自由、平等、公正、法治是社会层面的价值取向,爱国、敬业、诚信、友善是公民个人层面的价值准则,这24个字是社会主义核心价值观的基本内容。";
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void insertBatch(int num, int waitTime) {
|
|
|
|
|
long t1 = System.currentTimeMillis();
|
|
|
|
|
SysTool sysTool = new SysTool();
|
|
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
|
SnowflakeIdMaker snf = new SnowflakeIdMaker();
|
|
|
|
|
for (int i = 0; i < num * 1000; i++) {
|
|
|
|
|
sysTool = new SysTool();
|
|
|
|
|
sysTool.setId(snf.nextId() + System.currentTimeMillis());
|
|
|
|
|
sysTool.setName(RandomStringUtils.random(10, TEXT));
|
|
|
|
|
sysTool.setToolTypeNameRdd(RandomStringUtils.random(10, TEXT));
|
|
|
|
|
sysTool.setToolTypeId(System.currentTimeMillis());
|
|
|
|
|
sysTool.setToolIp(RandomStringUtils.random(10, TEXT));
|
|
|
|
|
sysTool.setToolPort((int) (Math.random() * i));
|
|
|
|
|
sysTool.setToolDescription(RandomStringUtils.random(10, TEXT));
|
|
|
|
|
|
|
|
|
|
sb.append("insert into sys_tool (id,name,tool_type_name_rdd,tool_type_id,tool_ip,tool_port,tool_description) ");
|
|
|
|
|
sb.append(" values("+sysTool.getId()+",'"+sysTool.getName()+"','"+sysTool.getToolTypeNameRdd()+"',"+sysTool.getToolTypeId()+",'"
|
|
|
|
|
+sysTool.getToolIp()+"',"+sysTool.getToolPort()+",'"+sysTool.getToolDescription()+"')");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
entityManager.createNativeQuery(sb.toString());
|
|
|
|
|
LOGGER.info("插入耗时:" + (System.currentTimeMillis() - t1) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void insertMongoDBBatch(int num, int waitTime) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Object> queryToolAndToolType(Pager pager) {
|
|
|
|
|
String hql = "select t,tt from SysTool as t " +
|
|
|
|
|