|  |  |  | 
|---|
|  |  |  | <result property="createTime" column="create_time"/> | 
|---|
|  |  |  | <result property="updateBy" column="update_by"/> | 
|---|
|  |  |  | <result property="updateTime" column="update_time"/> | 
|---|
|  |  |  | <collection property="sysUserList" javaType="java.util.List" resultMap="SysUserListResult"/> | 
|---|
|  |  |  | <!-- 子查询,关联 ard_dispatch_police_user 表 --> | 
|---|
|  |  |  | <collection property="sysUserList" ofType="java.util.List" select="getSysUserListByMainTableId" column="id"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <select id="getSysUserListByMainTableId" resultType="SysUser"> | 
|---|
|  |  |  | SELECT u.* | 
|---|
|  |  |  | FROM ard_dispatch_police_user b | 
|---|
|  |  |  | left join sys_user u on b.user_id = u.user_id | 
|---|
|  |  |  | WHERE dispatch_id = #{id} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <resultMap id="ArdDispatchPoliceArdDispatchPoliceUserResult" type="ArdDispatchPolice" | 
|---|
|  |  |  | extends="ArdDispatchPoliceResult"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="selectArdDispatchPoliceVo"> | 
|---|
|  |  |  | SELECT adp.ID, | 
|---|
|  |  |  | adp.NAME, | 
|---|
|  |  |  | adp.text, | 
|---|
|  |  |  | adp.longitude, | 
|---|
|  |  |  | adp.latitude, | 
|---|
|  |  |  | adp.dept_id, | 
|---|
|  |  |  | adp.user_id, | 
|---|
|  |  |  | adp.create_by, | 
|---|
|  |  |  | adp.create_time, | 
|---|
|  |  |  | adp.update_by, | 
|---|
|  |  |  | adp.update_time, | 
|---|
|  |  |  | u.user_id     as sub_user_id, | 
|---|
|  |  |  | u.nick_name   as sub_nick_name, | 
|---|
|  |  |  | u.dept_id     as sub_dept_id | 
|---|
|  |  |  | FROM ard_dispatch_police adp | 
|---|
|  |  |  | left join ard_dispatch_police_user b on b.dispatch_id = adp.id | 
|---|
|  |  |  | left join sys_user u on b.user_id = u.user_id | 
|---|
|  |  |  | SELECT ID, | 
|---|
|  |  |  | NAME, | 
|---|
|  |  |  | text, | 
|---|
|  |  |  | longitude, | 
|---|
|  |  |  | latitude, | 
|---|
|  |  |  | dept_id, | 
|---|
|  |  |  | user_id, | 
|---|
|  |  |  | create_by, | 
|---|
|  |  |  | create_time, | 
|---|
|  |  |  | update_by, | 
|---|
|  |  |  | update_time | 
|---|
|  |  |  | FROM ard_dispatch_police | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectArdDispatchPoliceList" parameterType="ArdDispatchPolice" resultMap="ArdDispatchPoliceResult"> | 
|---|
|  |  |  | 
|---|
|  |  |  | a.create_time, | 
|---|
|  |  |  | a.update_by, | 
|---|
|  |  |  | a.update_time, | 
|---|
|  |  |  | b.user_id     as sub_user_id, | 
|---|
|  |  |  | b.nick_name   as sub_nick_name, | 
|---|
|  |  |  | b.dept_id     as sub_dept_id | 
|---|
|  |  |  | b.user_id   as sub_user_id, | 
|---|
|  |  |  | b.nick_name as sub_nick_name, | 
|---|
|  |  |  | b.dept_id   as sub_dept_id | 
|---|
|  |  |  | from ard_dispatch_police a | 
|---|
|  |  |  | left join ard_dispatch_police_user b on b.dispatch_id = a.id | 
|---|
|  |  |  | where a.id = #{id} | 
|---|