mongodb
This commit is contained in:
parent
2f93dded99
commit
bd7b4fd77d
|
@ -926,7 +926,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
|||
map1.put("tableName",mainDb);
|
||||
//map1.put("dataStatus", "Y");
|
||||
map1.put("addStatus", "0");
|
||||
map1.put("size", 20);
|
||||
map1.put("size", 100);
|
||||
objects = mdmModuleDao.queryMdmSTs(map1);
|
||||
objects = toLowerCaseKeys(objects);
|
||||
|
||||
|
|
|
@ -8,6 +8,14 @@ logging:
|
|||
# 日志保存路径
|
||||
path: /Users/apple/Desktop/log/local
|
||||
spring:
|
||||
data:
|
||||
mongodb:
|
||||
host: 192.168.2.237
|
||||
port: 27017
|
||||
database: businesscenter
|
||||
auto-index-creation: true
|
||||
# password: hzya1314
|
||||
# username: hzya
|
||||
flyway:
|
||||
# 启动flyway migration, 默认为true
|
||||
enabled: false
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -173,6 +174,37 @@ public class temButtom {
|
|||
System.out.println(b);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private MongoTemplate mongoTemplate;
|
||||
|
||||
@Test
|
||||
public void mongodbinsert() {
|
||||
//新增数据
|
||||
JSONObject jsonStr = new JSONObject();
|
||||
jsonStr.put("id","1");
|
||||
jsonStr.put("name","张三");
|
||||
jsonStr.put("code","001");
|
||||
mongoTemplate.insert(jsonStr,"user");
|
||||
System.out.println(jsonStr.toJSONString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mongodbSave() {
|
||||
//新增数据
|
||||
JSONObject jsonStr = new JSONObject();
|
||||
jsonStr.put("id","1");
|
||||
jsonStr.put("name","张三2");
|
||||
jsonStr.put("code","001");
|
||||
mongoTemplate.save(jsonStr,"user");
|
||||
System.out.println(jsonStr.toJSONString());
|
||||
}
|
||||
@Test
|
||||
public void mongodbquery() {
|
||||
//查询所有
|
||||
List<JSONObject> list = mongoTemplate.findAll(JSONObject.class, "user");
|
||||
System.out.println(list.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
5
pom.xml
5
pom.xml
|
@ -379,7 +379,10 @@
|
|||
<artifactId>tlog-all-spring-boot-starter</artifactId>
|
||||
<version>1.5.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -174,8 +174,8 @@
|
|||
<include refid="AcctVouchInfoEntity_Base_Column_List" />
|
||||
from acct_vouch_info
|
||||
<trim prefix="where" prefixOverrides="and">
|
||||
<if test="acct_year != null and acct_year != ''"> and acct_year like '%${acct_year}%' </if>
|
||||
<if test="acct_month != null and acct_month != ''"> and acct_month like '%${acct_month}%' </if>
|
||||
<if test="acct_year != null and acct_year != ''"> and acct_year = '${acct_year}' </if>
|
||||
<if test="acct_month != null and acct_month != ''"> and acct_month = '${acct_month}' </if>
|
||||
<if test="dept_code != null and dept_code != ''"> and dept_code like '%${dept_code}%' </if>
|
||||
<if test="dept_name != null and dept_name != ''"> and dept_name like '%${dept_name}%' </if>
|
||||
<if test="acct_subj_code != null and acct_subj_code != ''"> and acct_subj_code like '%${acct_subj_code}%' </if>
|
||||
|
|
Loading…
Reference in New Issue