org.springframework.jdbc.core.simple.SimpleJdbcInsert#execute ( )源码实例Demo

下面列出了org.springframework.jdbc.core.simple.SimpleJdbcInsert#execute ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: yue-library   文件: DbInsert.java
/**
 * 向表中插入一条数据
 * 
 * @param tableName 表名
 * @param paramJson 参数
 */
@Transactional
public void insertNotReturn(String tableName, JSONObject paramJson) {
	// 1. 移除空对象
	MapUtils.removeEmpty(paramJson);
	
	// 2. 插入源初始化
	tableName = dialect.getWrapper().wrap(tableName);
	paramJson = dialect.getWrapper().wrap(paramJson);
	SimpleJdbcInsert simpleJdbcInsert = insertInit(tableName, paramJson);
	
	// 3. 执行
	simpleJdbcInsert.execute(paramJson);
}
 
源代码2 项目: spring-cloud-task   文件: TaskStartTests.java
private void enableLock(String lockKey) {
	SimpleJdbcInsert taskLockInsert = new SimpleJdbcInsert(this.dataSource)
			.withTableName("TASK_LOCK");
	Map<String, Object> taskLockParams = new HashMap<>();
	taskLockParams.put("LOCK_KEY",
			UUID.nameUUIDFromBytes(lockKey.getBytes()).toString());
	taskLockParams.put("REGION", "DEFAULT");
	taskLockParams.put("CLIENT_ID", "aClientID");
	taskLockParams.put("CREATED_DATE", new Date());
	taskLockInsert.execute(taskLockParams);
}