<?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.wisenergy.chnmuseum.party.mapper.RunLogMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.RunLog"> <id column="id" property="id" /> <result column="mac_addr" property="macAddr" /> <result column="organ_id" property="organId" /> <result column="learning_content_id" property="learningContentId" /> <result column="start_time" property="startTime" /> <result column="end_time" property="endTime" /> <result column="org_name" property="orgName" /> <result column="learn_name" property="learnName" /> </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> id, mac_addr, organ_id, learning_content_id, start_time, end_time </sql> <select id="pageList" resultMap="BaseResultMap"> SELECT r.*,o.name org_name,l.name learn_name FROM run_log r left join t_organ o on o.id = r.organ_id left join learning_content l on l.id =r.learning_content_id where 1=1 <if test=" runLog.organId != null and runLog.organId != '' "> and r.organ_id = #{runLog.organId} </if> <if test=" runLog.startDate != null"> and r.start_time <![CDATA[>=]]> #{runLog.startDate} </if> <if test=" runLog.endDate != null"> and r.start_time <![CDATA[<=]]> #{runLog.endDate} </if> order by r.start_time desc </select> </mapper>