<?xml version="1.0" encoding="UTF-8"?><!DOCTYPEmapperPUBLIC"-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mappernamespace="cn.microvideo.yingyun.jsxtzhdd.services.emergencysupplies.mapper.MaterialCategoryMapper"><resultMapid="nodeList"type="cn.microvideo.yingyun.jsxtzhdd.services.emergencysupplies.entity.MaterialCategoryDto"><idcolumn="F_VC_ID"property="id"/><resultcolumn="F_DT_DATA_CREATE_TIME"property="dataCreateTime"/><resultcolumn="F_DT_DATA_UPDATE_TIME"property="dataUpdateTime"/><resultcolumn="F_VC_MATERIAL_TYPE"property="materialType"/><resultcolumn="F_VC_CODE"property="code"/><resultcolumn="F_VC_NAME"property="name"/><resultcolumn="F_VC_PARENT_ID"property="parentId"/><resultcolumn="F_VC_OPERATION_ID"property="operationId"/><resultcolumn="F_VC_OPERATION_NAME"property="operationName"/><resultcolumn="F_INT_MATERIAL_NUM"property="materialNum"/><resultcolumn="F_VC_SYSTEM_DEPT_ID"property="systemDeptId"/><resultcolumn="F_VC_SYSTEM_DEPT_NAME"property="systemDeptName"/><collectionproperty="materialCategoryList"select="getNodeByParentId"column="id=F_VC_ID"/></resultMap><selectid="queryAll"resultMap="nodeList">
select *
from T_DF_MATERIAL_CATEGORY
WHERE F_VC_PARENT_ID IS NULL
<iftest="code != null and code != ''">
AND F_VC_CODE LIKE CONCAT( '%',#{code}, '%')
</if><iftest="name != null and name != ''">
AND F_VC_NAME LIKE CONCAT( '%',#{name}, '%')
</if><iftest="operationName != null and operationName != ''">
AND F_VC_OPERATION_NAME LIKE CONCAT( '%',#{operationName}, '%')
</if><iftest="systemDeptId != null and systemDeptId != ''">
AND F_VC_SYSTEM_DEPT_ID LIKE CONCAT(#{systemDeptId}, '%')
</if>
ORDER BY F_DT_DATA_CREATE_TIME DESC
</select><!-- 查询子节点,返回值类型应该使用正确的resultMap --><selectid="getNodeByParentId"resultMap="nodeList">
select *
from T_DF_MATERIAL_CATEGORY
WHERE F_VC_PARENT_ID = #{id}
ORDER BY F_DT_DATA_CREATE_TIME DESC
</select></mapper>