|
@@ -63,6 +63,7 @@
|
|
p.project_name like concat('%',#{keyName},'%')
|
|
p.project_name like concat('%',#{keyName},'%')
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
|
|
+ GROUP BY p.id
|
|
order by p.id desc
|
|
order by p.id desc
|
|
</select>
|
|
</select>
|
|
<!--一对多的子查询 queryCustomCompaniesId-->
|
|
<!--一对多的子查询 queryCustomCompaniesId-->
|
|
@@ -143,7 +144,7 @@
|
|
u.id id, u.username username, u.indate indate, u.head_imgurl head_imgurl, u.subordinate_type subordinate_type
|
|
u.id id, u.username username, u.indate indate, u.head_imgurl head_imgurl, u.subordinate_type subordinate_type
|
|
from
|
|
from
|
|
tb_project_user pu
|
|
tb_project_user pu
|
|
- left join
|
|
|
|
|
|
+ RIGHT join
|
|
tb_user u
|
|
tb_user u
|
|
on
|
|
on
|
|
pu.user_id = u.id
|
|
pu.user_id = u.id
|
|
@@ -154,26 +155,57 @@
|
|
<resultMap id="BaseResultMapPowerList" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
|
|
<resultMap id="BaseResultMapPowerList" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
|
|
<id column="id" property="id" />
|
|
<id column="id" property="id" />
|
|
<result column="project_name" property="projectName" />
|
|
<result column="project_name" property="projectName" />
|
|
- <result column="project_no" property="projectNo" />
|
|
|
|
- <result column="start_time" property="startTime" />
|
|
|
|
- <result column="end_time" property="endTime" />
|
|
|
|
- <result column="content" property="content" />
|
|
|
|
- <result column="creator_id" property="creatorId" />
|
|
|
|
- <result column="creator" property="creator" />
|
|
|
|
- <result column="is_delete" property="isDelete" />
|
|
|
|
- <result column="owner_company" property="ownerCompany" />
|
|
|
|
- <result column="owner_company_name" property="ownerCompanyName" />
|
|
|
|
- <result column="indate" property="indate" />
|
|
|
|
- <result column="manager_id" property="managerId" />
|
|
|
|
- <result column="manager" property="manager" />
|
|
|
|
- <!--以下是分页插件的一对多-->
|
|
|
|
- <collection property="powers" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.Power"
|
|
|
|
- select="queryPowerListById" column="id" >
|
|
|
|
- </collection>
|
|
|
|
|
|
+ <result column="project_id" property="projectId" />
|
|
|
|
+ <result column="user_id" property="userId" />
|
|
|
|
+ <result column="company_name" property="companyName" />
|
|
|
|
+ <result column="powerString" property="powerString" />
|
|
</resultMap>
|
|
</resultMap>
|
|
-
|
|
|
|
<select id="selectUserPowerList" resultMap="BaseResultMapPowerList">
|
|
<select id="selectUserPowerList" resultMap="BaseResultMapPowerList">
|
|
-
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ tbpu.user_id ,tbpu.project_id ,GROUP_CONCAT(tbpu.power_type) powerString,
|
|
|
|
+ tbu.username ,tbc.company_name,
|
|
|
|
+ tbp.project_name
|
|
|
|
+ FROM `tb_project_user` tbpu
|
|
|
|
+ left join
|
|
|
|
+ tb_project tbp
|
|
|
|
+ on tbp.id = tbpu.project_id
|
|
|
|
+ left join
|
|
|
|
+ tb_user tbu
|
|
|
|
+ on tbpu.user_id = tbu.id
|
|
|
|
+ left join
|
|
|
|
+ tb_company tbc
|
|
|
|
+ on tbc.id = tbu.company_id
|
|
|
|
+ <where>
|
|
|
|
+ <if test="user.projectId != null">
|
|
|
|
+ tbpu.project_id = #{user.projectId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="user.companyId != null">
|
|
|
|
+ tbpu.project_id = #{user.companyId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="user.keyName != null and user.keyName != ''">
|
|
|
|
+ tbu.username like concat('%',#{user.keyName},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="type == 0">
|
|
|
|
+ tbp.creator_id = #{user.id}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="type == 1">
|
|
|
|
+ tbp.manager_id = #{user.id}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ GROUP BY tbpu.user_id ,tbpu.project_id;
|
|
|
|
+ order by tbpu.user_id
|
|
</select>
|
|
</select>
|
|
|
|
+ <!--<resultMap id="PowerMap" type="com.hssx.cloudmodel.entity.Power">-->
|
|
|
|
+ <!--<id column="id" property="id" />-->
|
|
|
|
+ <!--<result column="power_type" property="powerType" />-->
|
|
|
|
+ <!--<result column="user_id" property="userId" />-->
|
|
|
|
+ <!--<result column="project_id" property="projectId" />-->
|
|
|
|
+ <!--<result column="indate" property="indate" />-->
|
|
|
|
+ <!--<result column="operating_documents_type" property="operatingDocumentsType" />-->
|
|
|
|
+ <!--</resultMap>-->
|
|
|
|
+ <!--<!–以下是分页插件的一对多的子集sql–>-->
|
|
|
|
+ <!--<select id="queryPowerListById" resultMap="PowerMap">-->
|
|
|
|
+
|
|
|
|
+ <!--</select>-->
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|