45 lines
1.6 KiB
XML
45 lines
1.6 KiB
XML
<?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.gxwebsoft.apps.mapper.BcAgentMapper">
|
|
|
|
<!-- 关联查询sql -->
|
|
<sql id="selectSql">
|
|
SELECT a.*,b.nickname,c.nickname as parentName
|
|
FROM apps_bc_agent a
|
|
LEFT JOIN sys_user b ON a.user_id = b.user_id
|
|
LEFT JOIN sys_user c ON a.parent_id = c.user_id
|
|
<where>
|
|
<if test="param.agentId != null">
|
|
AND a.agent_id = #{param.agentId}
|
|
</if>
|
|
<if test="param.userId != null">
|
|
AND a.user_id = #{param.userId}
|
|
</if>
|
|
<if test="param.parentId != null">
|
|
AND a.parent_id = #{param.parentId}
|
|
</if>
|
|
<if test="param.status != null">
|
|
AND a.status = #{param.status}
|
|
</if>
|
|
<if test="param.createTimeStart != null">
|
|
AND a.create_time >= #{param.createTimeStart}
|
|
</if>
|
|
<if test="param.createTimeEnd != null">
|
|
AND a.create_time <= #{param.createTimeEnd}
|
|
</if>
|
|
AND b.deleted = 0 AND c.deleted = 0
|
|
</where>
|
|
</sql>
|
|
|
|
<!-- 分页查询 -->
|
|
<select id="selectPageRel" resultType="com.gxwebsoft.apps.entity.BcAgent">
|
|
<include refid="selectSql"></include>
|
|
</select>
|
|
|
|
<!-- 查询全部 -->
|
|
<select id="selectListRel" resultType="com.gxwebsoft.apps.entity.BcAgent">
|
|
<include refid="selectSql"></include>
|
|
</select>
|
|
|
|
</mapper>
|