|  |  |  | 
|---|
|  |  |  | <result property="updateBy" column="update_by"/> | 
|---|
|  |  |  | <result property="updateTime" column="update_time"/> | 
|---|
|  |  |  | <!-- 子查询,关联 ard_dispatch_police_user 表 --> | 
|---|
|  |  |  | <collection property="ardDispatchPoliceUserList" ofType="java.lang.String" select="getUserIdsByMainTableId" | 
|---|
|  |  |  | column="id"/> | 
|---|
|  |  |  | <collection property="sysUserList" ofType="java.util.List" select="getSysUserListByMainTableId" column="id"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <select id="getUserIdsByMainTableId" resultType="java.lang.String"> | 
|---|
|  |  |  | SELECT user_id | 
|---|
|  |  |  | FROM ard_dispatch_police_user | 
|---|
|  |  |  | <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"> | 
|---|
|  |  |  | <collection property="ardDispatchPoliceUserList" notNullColumn="sub_dispatch_id" javaType="java.util.List" | 
|---|
|  |  |  | resultMap="ArdDispatchPoliceUserResult"/> | 
|---|
|  |  |  | <collection property="sysUserList" notNullColumn="sub_dispatch_id" javaType="java.util.List" | 
|---|
|  |  |  | resultMap="SysUserListResult"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <resultMap type="ArdDispatchPoliceUser" id="ArdDispatchPoliceUserResult"> | 
|---|
|  |  |  | <result property="dispatchId" column="sub_dispatch_id"/> | 
|---|
|  |  |  | <resultMap type="SysUser" id="SysUserListResult"> | 
|---|
|  |  |  | <result property="userId" column="sub_user_id"/> | 
|---|
|  |  |  | <result property="nickName" column="sub_nick_name"/> | 
|---|
|  |  |  | <result property="deptId" column="sub_dept_id"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="selectArdDispatchPoliceVo"> | 
|---|
|  |  |  | 
|---|
|  |  |  | a.create_time, | 
|---|
|  |  |  | a.update_by, | 
|---|
|  |  |  | a.update_time, | 
|---|
|  |  |  | b.dispatch_id as sub_dispatch_id, | 
|---|
|  |  |  | b.user_id     as sub_user_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} | 
|---|