test: 新 APT 生成器测试。

This commit is contained in:
Suomm 2023-06-23 16:02:15 +08:00
parent 7f9ffa15aa
commit 1eb91bfef7
5 changed files with 53 additions and 7 deletions

View File

@ -23,5 +23,5 @@ import com.mybatisflex.annotation.Table;
* @since 2023-06-16 * @since 2023-06-16
*/ */
@Table("test") @Table("test")
public class Test { public class TestEntity {
} }

View File

@ -1,3 +1,5 @@
processor.mappersGenerateEnable = true processor.mappersGenerateEnable=true
processor.entity.ignoreSuffixes=Entity
#processor.allInTables=true
#processor.baseMapperClass=com.test.mapper.ExBaseMapper #processor.baseMapperClass=com.test.mapper.ExBaseMapper

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mybatisflex.test.mapper;
import com.mybatisflex.core.BaseMapper;
import com.mybatisflex.test.model.Account;
/**
* @author 王帅
* @since 2023-06-23
*/
public interface AccountMapper extends BaseMapper<Account> {
}

View File

@ -1,3 +1,4 @@
processor.mappersGenerateEnable = true processor.mappersGenerateEnable=false
processor.tablesNameStyle = lowerCase processor.tablesNameStyle=lowerCase
processor.tablesDefSuffix = Def processor.tablesDefSuffix=Def
processor.allInTables=true

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mybatisflex.test; package com.mybatisflex.test;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
@ -14,7 +30,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.List; import java.util.List;
import static com.mybatisflex.test.model.table.AccountTableDef.accountDef; import static com.mybatisflex.test.model.table.Tables.account_def;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = AppConfig.class) @ContextConfiguration(classes = AppConfig.class)
@ -33,7 +49,7 @@ public class AccountTest implements WithAssertions {
@Test @Test
public void testSelectByQuery() { public void testSelectByQuery() {
QueryWrapper queryWrapper = QueryWrapper.create() QueryWrapper queryWrapper = QueryWrapper.create()
.where(accountDef.age.eq(18)); .where(account_def.age.eq(18));
List<Account> accounts = accountMapper.selectListByQuery(queryWrapper); List<Account> accounts = accountMapper.selectListByQuery(queryWrapper);
assertThat(accounts.size()).isEqualTo(1); assertThat(accounts.size()).isEqualTo(1);
assertThat(accounts.get(0).getAge()).isEqualTo(18); assertThat(accounts.get(0).getAge()).isEqualTo(18);