You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.3 KiB

3 years ago
<?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.zh.project0512.mapper.QywxDepartmentGroupLinkMapper">
3 years ago
<resultMap id="departmentListMap" type="java.util.Map" autoMapping="false">
3 years ago
<id property="departmentId" column="departmentId"/>
<result column="departmentName" property="departmentName"/>
<result column="creatAt" property="creatAt"/>
<collection property="userList" ofType="java.util.Map" javaType="java.util.List" autoMapping="false">
<id column="userId" property="userId"/>
<result column="userName" property="userName"/>
</collection>
</resultMap>
<select id="departmentList" resultMap="departmentListMap">
SELECT t1.*,t2.name,t3.name as departmentName
,t4.id as userId,t4.name as userName
from qywxDepartmentGroupLink as t1
LEFT JOIN qywxDepartmentGroup as t2 on t1.groupId = t2.id
INNER JOIN qywxDepartment as t3 on t3.departmentId = t1.departmentId
LEFT JOIN user as t4 on t4.main_department = t1.departmentId
where t2.id = #{groupId}
GROUP BY groupId, departmentId
,userName
ORDER BY creatAt DESC
</select>
3 years ago
3 years ago
</mapper>