提交 632dbb42 编写于 作者: zhouweidong's avatar zhouweidong

add

上级 e77887d7
......@@ -9,9 +9,4 @@ import java.util.List;
public interface ${item.getCodeName()}Mapper extends BaseMapper<${item.getCodeName()}>{
<#if item.getAllPSDEDataSets()??>
<#list item.getAllPSDEDataSets() as dedataset>
List<${item.getCodeName()}> search${dedataset.getCodeName()}() ;
</#list>
</#if>
}
\ No newline at end of file
......@@ -6,4 +6,15 @@ INSERT INTO T_CATEGORY (categoryid, categoryname) VALUES
(2, '军事'),
(3, '历史'),
(4, '计算机'),
(5, '农业');
\ No newline at end of file
(5, '农业');
INSERT INTO T_PUBLISHER (publisherid, publishername) VALUES
(1, '清华大学出版社'),
(2, '北京大学出版社');
INSERT INTO T_BOOK (bookid, bookname,publisherid,pubyearisbn) VALUES
(1, 'java程序设计',1,'2017-12'),
(2, 'c语言程序设计',1,'2018-12'),
(3, 'pythod从入门到精通',2,'2019-2');
\ No newline at end of file
......@@ -9,4 +9,29 @@ create table IF NOT EXISTS T_CATEGORY
createdate DATE,
categoryname VARCHAR2(200),
updatedate DATE
);
create table IF NOT EXISTS T_PUBLISHER
(
publisherid VARCHAR2(100) not null,
createman VARCHAR2(60),
updateman VARCHAR2(60),
createdate DATE,
publishername VARCHAR2(200),
updatedate DATE
);
create table IF NOT EXISTS T_BOOK
(
bookid VARCHAR2(100) not null,
createman VARCHAR2(60),
updateman VARCHAR2(60),
createdate DATE,
bookname VARCHAR2(200),
updatedate DATE,
publisherid VARCHAR2(200),
price NUMBER,
pubyearisbn VARCHAR2(200)
);
\ No newline at end of file
......@@ -26,17 +26,6 @@ TARGET=PSDATAENTITY
</#list>
</#if>
<#comment>实体数据查询</#comment>
<#list item.getAllPSDEDataQueries() as singleQuery>
<#list singleQuery.getAllPSDEDataQueryCodes() as dedqcode>
<select id="search${singleQuery.getCodeName()}" resultMap="${de.codeName}ResultMap">
<![CDATA[select t1.* from (
${srfjavasqlcode('${dedqcode.getQueryCode()}')}
)t1]]>
</select>
</#list>
</#list>
<#comment>mybatis返回结果映射</#comment>
<resultMap id="${de.codeName}ResultMap" type="${pub.getPKGCodeName()}.${item.getPSSystemModule().codeName?lower_case}.domain.${item.codeName}" autoMapping="true">
<id property="${item.getKeyPSDEField().codeName?lower_case}" column="${item.getKeyPSDEField().getName()?lower_case}" /><!--主键字段映射-->
......
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
import cn.ibizhub.demo.demoMain;
import cn.ibizhub.demo.quickstart.domain.CATEGORY;
import cn.ibizhub.demo.quickstart.mapper.CATEGORYMapper;
......
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
import cn.ibizhub.demo.demoMain;
import cn.ibizhub.demo.quickstart.domain.CATEGORY;
import cn.ibizhub.demo.quickstart.mapper.CATEGORYMapper;
import cn.ibizhub.demo.relations.domain.BOOK;
import cn.ibizhub.demo.relations.domain.PUBLISHER;
import cn.ibizhub.demo.relations.mapper.BOOKMapper;
import cn.ibizhub.demo.relations.mapper.PUBLISHERMapper;
import org.junit.Assert;
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.test.context.junit4.SpringRunner;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = demoMain.class)
public class RelationsTest {
@Autowired
private PUBLISHERMapper publisherMapper;
@Test
public void testMain() {
System.out.println(("----- selectAll method test ------"));
List<PUBLISHER> userList = publisherMapper.selectList(null);
for(PUBLISHER publisher: userList){
System.out.println(String.format("[%s]出版社共出版的书籍数为[%s]",publisher.getPublishername(),publisher.getBooks().size()));
}
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册