1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?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="cn.com.ty.lift.business.project.dao.mapper.ProjectUserMapper" >
- <resultMap id="BaseResultMap" type="cn.com.ty.lift.business.project.dao.entity.ProjectUser" >
- <id column="project_id" property="projectId" jdbcType="BIGINT" />
- <id column="user_id" property="userId" jdbcType="BIGINT" />
- <id column="user_role" property="userRole" jdbcType="VARCHAR" />
- <result column="mt_company_id" property="mtCompanyId" jdbcType="BIGINT" />
- <result column="is_monitor" property="isMonitor" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="Base_Column_List" >
- project_id, user_id, user_role, mt_company_id, is_monitor
- </sql>
- <select id="findUserListById" resultType="cn.com.ty.lift.business.project.dao.entity.model.response.ProjectUserResponse" parameterType="java.lang.Long">
- SELECT pu.project_id AS projectId,
- pu.user_id AS userId,
- pu.user_role AS userRole,
- pu.mt_company_id AS mtCompanyId,
- pu.is_monitor AS isMonitor,
- ui.name AS userName
- FROM project_user pu
- LEFT JOIN user_info ui ON pu.user_id = ui.user_id
- WHERE 1=1
- <if test="projectId!=null and projectId!=''">
- AND project_id = #{projectId,jdbcType=BIGINT}
- </if>
- <if test="mtCompanyId!=null and mtCompanyId!=''">
- AND mt_company_id = #{mtCompanyId,jdbcType=BIGINT}
- </if>
- </select>
- <!--app端 根据项目id获取项目人员名称和头像地址 -->
- <select id="findProjectUserListById" resultType="cn.com.ty.lift.business.project.dao.entity.model.ProjectAppUser"
- parameterType="cn.com.ty.lift.business.project.dao.entity.model.request.ProjectRequest">
- SELECT
- ui.name,
- pu.user_role AS userRole,
- pu.user_id AS userId,
- ui.avatar_url AS avatarUrl
- FROM project_user pu
- LEFT JOIN user_info ui ON pu.user_id = ui.user_id
- WHERE 1=1
- <if test="request.id!=null and request.id!=''">
- AND project_id = #{request.id,jdbcType=BIGINT}
- </if>
- <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
- AND mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
- </if>
- </select>
- <!--根据项目id、用户id、用户角色删除项目组成员 -->
- <delete id="batchRemoveWithParams" parameterType="cn.com.ty.lift.business.project.dao.entity.model.request.ProjectRequest">
- DELETE
- FROM
- project_user
- WHERE
- <foreach collection="userList" item="item" index="index" separator="or">
- ( project_id = #{item.projectId}
- AND user_id = #{item.userId}
- AND user_role = #{item.userRole} )
- </foreach>
- </delete>
- <!-- 获取用户关联的项目 -->
- <select id="findProjectListByUserId"
- parameterType="cn.com.ty.lift.business.project.dao.entity.model.request.ProjectRequest"
- resultType="cn.com.ty.lift.business.project.dao.entity.model.response.ProjectRelevanceResponse">
- select
- pu.project_id as projectId,
- p.project_name as projectName,
- p.project_code as projectCode
- from
- project_user pu
- left join
- project p
- on
- pu.project_id = p.id
- where
- pu.mt_company_id = #{mtCompanyId}
- and
- pu.user_id = #{workerId}
- </select>
- </mapper>
|