<?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="com.testor.ddd.safetyControl.infrastructure.repository.riskMap.dao.TSafeRiskMapElementDao"> <!-- 开启二级缓存 --> <!-- <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> --> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.testor.ddd.safetyControl.infrastructure.repository.riskMap.entity.TSafeRiskMapElementDO"> <id column="id" property="id"/> <id column="map_id" property="mapId"/> <id column="space_id" property="spaceId"/> <id column="real_level_id" property="realLevelId"/> <id column="inherent_level_id" property="inherentLevelId"/> <id column="department_id" property="departmentId"/> <id column="user_id" property="userId"/> <id column="map_json" property="mapJson"/> <id column="inherent_level_code" property="inherentLevelCode"/> <id column="real_level_code" property="realLevelIdCode"/> <id column="level_type" property="levelType"/> </resultMap> <sql id="select_base_column"> rs.id, rs.map_id mapId, rs.space_id spaceId, rs.real_level_id realLevelId, rs.inherent_level_id inherentLevelId, rs.level_type levelType, rs.department_id departmentId, rs.user_id userId, rs.map_json mapJson, rs.inherent_level_code inherentLevelCode, rs.real_level_code realLevelIdCode, rs.status, rs.remarks, rs.create_by createBy, rs.create_date createDate, rs.update_by as updateBy, rs.update_date updateDate </sql> <sql id="common_where_if"> <if test="query.id!=null and query.id!=''"> and rs.id=#{query.id} </if> <if test="query.mapId!=null and query.mapId!=''"> and rs.map_id=#{query.mapId} </if> <if test="query.levelType!=null and query.levelType!=''"> and rs.level_type=#{query.levelType} </if> <if test="query.spaceId!='' and query.spaceId!=null"> and rs.space_id like concat('%',#{query.spaceId},'%') </if> <if test="query.realLevelId!='' and query.realLevelId!=null"> and rs.real_level_id=#{query.realLevelId} </if> <if test="query.inherentLevelId!='' and query.inherentLevelId!=null"> and rs.inherent_level_id=#{query.inherentLevelId} </if> <if test="query.departmentId!='' and query.departmentId!=null"> and rs.department_id=#{query.departmentId} </if> </sql> <select id="listPage" resultType="com.testor.ddd.safetyControl.interfaces.model.vo.riskMap.TSafeRiskMapElementVO" parameterType="com.testor.ddd.safetyControl.interfaces.model.dto.riskMap.TSafeRiskMapElementDTOParam"> select dpo.org_name as departmentName,su.user_name userName, <include refid="select_base_column" /> from t_safe_risk_map_element rs left join t_sys_user su on su.user_id = rs.user_id left join t_sys_org dpo on dpo.org_id = rs.department_id <where> rs.status = '0' <include refid="common_where_if"></include> </where> <if test="query.orderBy!='' and query.orderBy!=null and query.orderType!='' and query.orderType!=null" > order by ${query.orderBy} ${query.orderType} </if> </select> </mapper>