提交 c22dd52a 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 addce899
<!--test-->
<?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.ibizlab.core.dict.mapper.IBZDictMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="IBZDictResultMap" databaseId="mysql">
<![CDATA[ select t1.* from (
SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`ENABLE`, t1.`IBZDICTID`, t1.`IBZDICTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICT` t1
)t1 where ibzdictid=#{id}]]>
</select>
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="IBZDictResultMap" type="cn.ibizlab.core.dict.domain.IBZDict" autoMapping="true">
<id property="dictId" column="ibzdictid" /><!--主键字段映射-->
<!--通过mybatis自动注入关系属性[关系实体],fetchType="lazy"为懒加载配置 -->
<collection property="items" ofType="cn.ibizlab.core.dict.domain.IBZDictItem" column="ibzdictid" select="cn.ibizlab.core.dict.mapper.IBZDictItemMapper.selectBydictid" fetchType="lazy"></collection>
</resultMap>
<!--数据集合[Default]-->
<select id="searchDefault" parameterType="cn.ibizlab.core.dict.filter.IBZDictSearchContext" resultMap="IBZDictResultMap">
select t1.* from (
<include refid="Default" />
)t1
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据查询[Default]-->
<sql id="Default" databaseId="mysql">
select t1.* from (
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`ENABLE`, t1.`IBZDICTID`, t1.`IBZDICTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICT` t1 ]]>
<![CDATA[
WHERE
t1.ENABLE = 1
]]>
)t1
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
select t1.* from (
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`ENABLE`, t1.`IBZDICTID`, t1.`IBZDICTNAME`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICT` t1 ]]>
<![CDATA[
WHERE
t1.ENABLE = 1
]]>
)t1
</sql>
</mapper>
<!--test-->
<?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.ibizlab.core.dict.mapper.IBZDictItemMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="IBZDictItemResultMap" databaseId="mysql">
<![CDATA[ select t1.* from (
SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`DICTID`, t1.`DICTITEMVAL`, t1.`IBZDICTITEMID`, t1.`IBZDICTITEMNAME`, t1.`ITEMCLS`, t1.`ITEMFILTER`, t1.`ITEMICON`, t1.`PITEMVAL`, t1.`SHOWORDER`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICTITEM` t1
)t1 where ibzdictitemid=#{id}]]>
</select>
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="IBZDictItemResultMap" type="cn.ibizlab.core.dict.domain.IBZDictItem" autoMapping="true">
<id property="itemId" column="ibzdictitemid" /><!--主键字段映射-->
<result property="dictid" column="dictid" /><!--关系字段映射-->
<!--通过mybatis自动注入关系属性[主实体],fetchType="lazy"为懒加载配置 -->
<association property="dict" javaType="cn.ibizlab.core.dict.domain.IBZDict" column="dictid" select="cn.ibizlab.core.dict.mapper.IBZDictMapper.selectById" fetchType="lazy"></association>
</resultMap>
<!--关系实体暴露select方法供主实体通过外键查询关系实体数据[实体关系名称:DER1N_IBZDICTITEM_IBZDICT_DICTID] -->
<select id="selectBydictid" resultMap="IBZDictItemResultMap">
select t1.* from (
<include refid="Default" />
)t1
where dictid=#{dictid}
</select>
<!--数据集合[Default]-->
<select id="searchDefault" parameterType="cn.ibizlab.core.dict.filter.IBZDictItemSearchContext" resultMap="IBZDictItemResultMap">
select t1.* from (
<include refid="Default" />
)t1
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<!--数据查询[Default]-->
<sql id="Default" databaseId="mysql">
select t1.* from (
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`DICTID`, t1.`DICTITEMVAL`, t1.`IBZDICTITEMID`, t1.`IBZDICTITEMNAME`, t1.`ITEMCLS`, t1.`ITEMFILTER`, t1.`ITEMICON`, t1.`PITEMVAL`, t1.`SHOWORDER`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICTITEM` t1 ]]>
<![CDATA[ ]]>
)t1
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
select t1.* from (
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`CREATEMAN`, t1.`DICTID`, t1.`DICTITEMVAL`, t1.`IBZDICTITEMID`, t1.`IBZDICTITEMNAME`, t1.`ITEMCLS`, t1.`ITEMFILTER`, t1.`ITEMICON`, t1.`PITEMVAL`, t1.`SHOWORDER`, t1.`UPDATEDATE`, t1.`UPDATEMAN` FROM `IBZDICTITEM` t1 ]]>
<![CDATA[ ]]>
)t1
</sql>
</mapper>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册