mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-16 03:55:06 +08:00
新增 MyBatis XML 文件的生成
This commit is contained in:
@ -40,4 +40,6 @@ public interface TestDemoMapper extends BaseMapperX<TestDemoDO> {
|
||||
.orderByDesc(TestDemoDO::getId));
|
||||
}
|
||||
|
||||
List<TestDemoDO> selectList2();
|
||||
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ public class CodegenEngine {
|
||||
javaModuleImplMainFilePath("dal/dataobject/${table.businessName}/${table.className}DO"))
|
||||
.put(javaTemplatePath("dal/mapper"),
|
||||
javaModuleImplMainFilePath("dal/mysql/${table.businessName}/${table.className}Mapper"))
|
||||
.put(javaTemplatePath("dal/mapper.xml"), mapperXmlFilePath())
|
||||
.put(javaTemplatePath("service/serviceImpl"),
|
||||
javaModuleImplMainFilePath("service/${table.businessName}/${table.className}ServiceImpl"))
|
||||
.put(javaTemplatePath("service/service"),
|
||||
@ -213,6 +214,12 @@ public class CodegenEngine {
|
||||
"src/" + src + "/java/${basePackage}/module/${table.moduleName}/" + path + ".java";
|
||||
}
|
||||
|
||||
private static String mapperXmlFilePath() {
|
||||
return "yudao-module-${table.moduleName}/" + // 顶级模块
|
||||
"yudao-module-${table.moduleName}-impl/" + // 子模块
|
||||
"src/resources/mapper/${table.businessName}/${table.className}Mapper.xml";
|
||||
}
|
||||
|
||||
private static String vueTemplatePath(String path) {
|
||||
return "codegen/vue/" + path + ".vm";
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ public class TestDemoServiceImpl implements TestDemoService {
|
||||
|
||||
@Override
|
||||
public PageResult<TestDemoDO> getTestDemoPage(TestDemoPageReqVO pageReqVO) {
|
||||
// testDemoMapper.selectList2();
|
||||
return testDemoMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${basePackage}.module.${table.moduleName}.dal.mysql.${table.businessName}.${table.className}Mapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.infra.dal.mysql.test.TestDemoMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectList2" resultType="TestDemoDO">
|
||||
SELECT * FROM infra_test_demo
|
||||
</select>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user