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.

27 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">
3 years ago
SELECT t1.departmentId,t1.creatAt,t2.department as departmentName ,t3.id as userId,t3.name as userName
3 years ago
from qywxDepartmentGroupLink as t1
3 years ago
INNER JOIN (SELECT t.*,d.name as department from qywxDepartmentUserLink t left join qywxDepartment d on
t.departmentId = d.departmentId) as t2 on t1.departmentId = t2.departmentId
INNER JOIN user as t3 on t3.openid = t2.openid
where t1.groupId = #{groupId}
GROUP BY groupId, departmentId ,userId
3 years ago
ORDER BY creatAt DESC
</select>
3 years ago
3 years ago
</mapper>