<select id="getDdataList" parameterType="com.itwxn.ddata.vo.DdataQuery" resultMap="DdataAccount"> select * from ddata join account on ddata.aplatform = account.aplatform and ddata.username = account.username <include refid="getListWhere"/> limit #{start},#{limit} </select>
<sql id="getListWhere"> <where> <if test="username != null"> ddata.username like '%' #{username} '%' </if> <if test="startDate != null"> <![CDATA[ and ddata.mdate >= #{startDate} ]]> </if> <if test="endDate != null"> <![CDATA[ and ddata.mdate <= #{endDate} ]]> </if> </where> </sql>
进行多表查询的时候,不能给表起别名