Skip to content

Commit

Permalink
发布3.5.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nieqiurong committed Nov 3, 2023
1 parent 9da6eef commit 7840566
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## [v3.5.4.1] 2023.11.4
- fix: 修复Aop增强Mapper层导致的转换错误.

## [v3.5.4] 2023.10.22

- fix: 修复Insert无字段时执行SQL报错.
Expand Down
2 changes: 1 addition & 1 deletion changelog-temp.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* fix: 修复Aop增强Mapper层导致的转换错误.

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_VERSION=3.5.5-SNAPSHOT
APP_VERSION=3.5.4.1
APP_GROUP=com.baomidou
signing.keyId=1FD337F9
signing.password=243194995
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

package com.baomidou.mybatisplus.test.h2.issues.repositoryscan;

import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.session.SqlSessionFactory;
import org.h2.Driver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.SimpleDriverDataSource;

import javax.sql.DataSource;

/**
* @author nieqiurong
*/
@Configuration
@ComponentScan("com.baomidou.mybatisplus.test.h2.issues.repositoryscan")
public class AppConfig {

@Bean
public DataSource dataSource() {
SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
dataSource.setDriver(new Driver());
dataSource.setUrl("jdbc:h2:mem:testa;MODE=mysql;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE");
dataSource.setUsername("sa");
dataSource.setPassword("");
return dataSource;
}

@Bean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
mybatisSqlSessionFactoryBean.setDataSource(dataSource);
mybatisSqlSessionFactoryBean.setConfiguration(new MybatisConfiguration());
return mybatisSqlSessionFactoryBean.getObject();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

package com.baomidou.mybatisplus.test.h2.issues.repositoryscan;

import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.session.SqlSessionFactory;
import org.h2.Driver;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
import org.springframework.stereotype.Repository;

import javax.sql.DataSource;

/**
* @author nieqiurong
*/
@Configuration
@ComponentScan("com.baomidou.mybatisplus.test.h2.issues.repositoryscan")
@MapperScan(value = "com.baomidou.mybatisplus.test.h2.issues.repositoryscan.mapper", annotationClass = Repository.class)
public class AppConfigWithMapperScan {

@Bean
public DataSource dataSource() {
SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
dataSource.setDriver(new Driver());
dataSource.setUrl("jdbc:h2:mem:testa;MODE=mysql;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE");
dataSource.setUsername("sa");
dataSource.setPassword("");
return dataSource;
}

@Bean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
MybatisSqlSessionFactoryBean mybatisSqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
mybatisSqlSessionFactoryBean.setDataSource(dataSource);
mybatisSqlSessionFactoryBean.setConfiguration(new MybatisConfiguration());
return mybatisSqlSessionFactoryBean.getObject();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.baomidou.mybatisplus.test.h2.issues.repositoryscan;

import com.baomidou.mybatisplus.test.h2.issues.repositoryscan.entity.Demo;
import com.baomidou.mybatisplus.test.h2.issues.repositoryscan.service.IDemoRepositoryService;
import org.apache.ibatis.jdbc.SqlRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.List;

/**
* @author nieqiurong
*/
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {AppConfig.class})
public class RepositoryDefaultScanTest {

@Autowired
private IDemoRepositoryService demoService;

@Autowired
private DataSource dataSource;

@Test
void test() throws SQLException {
new SqlRunner(dataSource.getConnection()).run(
"""
CREATE TABLE IF NOT EXISTS demo (
id BIGINT NOT NULL AUTO_INCREMENT,
name VARCHAR(30) NULL DEFAULT NULL ,
PRIMARY KEY (id)
);
"""
);
demoService.save(new Demo());
demoService.saveBatch(List.of(new Demo()));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.baomidou.mybatisplus.test.h2.issues.repositoryscan;

import com.baomidou.mybatisplus.test.h2.issues.repositoryscan.entity.Demo;
import com.baomidou.mybatisplus.test.h2.issues.repositoryscan.service.IDemoRepositoryService;
import org.apache.ibatis.jdbc.SqlRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.List;

/**
* @author nieqiurong
*/
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {AppConfigWithMapperScan.class})
public class RepositoryMapperScanTest {

@Autowired
private IDemoRepositoryService demoService;

@Autowired
private DataSource dataSource;

@Test
void test() throws SQLException {
new SqlRunner(dataSource.getConnection()).run(
"""
CREATE TABLE IF NOT EXISTS demo (
id BIGINT NOT NULL AUTO_INCREMENT,
name VARCHAR(30) NULL DEFAULT NULL ,
PRIMARY KEY (id)
);
"""
);
demoService.save(new Demo());
demoService.saveBatch(List.of(new Demo()));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.baomidou.mybatisplus.test.h2.issues.repositoryscan.entity;

import lombok.Data;

/**
* @author nieqiurong
*/
@Data
public class Demo {

private Long id;

private String name;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.baomidou.mybatisplus.test.h2.issues.repositoryscan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.test.h2.issues.repositoryscan.entity.Demo;
import org.springframework.stereotype.Repository;

/**
* @author nieqiurong
*/
@Repository
public interface DemoRepositoryMapper extends BaseMapper<Demo> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.baomidou.mybatisplus.test.h2.issues.repositoryscan.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.test.h2.issues.repositoryscan.entity.Demo;

/**
* @author nieqiurong
*/
public interface IDemoRepositoryService extends IService<Demo> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.baomidou.mybatisplus.test.h2.issues.repositoryscan.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.test.h2.issues.repositoryscan.entity.Demo;
import com.baomidou.mybatisplus.test.h2.issues.repositoryscan.mapper.DemoRepositoryMapper;
import com.baomidou.mybatisplus.test.h2.issues.repositoryscan.service.IDemoRepositoryService;
import org.springframework.stereotype.Service;

/**
* @author nieqiurong
*/
@Service
public class DemoRepositoryServiceImpl extends ServiceImpl<DemoRepositoryMapper, Demo> implements IDemoRepositoryService {

}

0 comments on commit 7840566

Please sign in to comment.