| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?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.jzg.organization.mapper.SysOrganizationUserLinkServiceMapper">
- <!-- 结果映射 -->
- <resultMap id="BaseResultMap" type="com.jzg.commons.entity.po.SysOrganizationUserLink">
- <id column="id" property="id" jdbcType="VARCHAR"/>
- <result column="user_id" property="userId" jdbcType="VARCHAR"/>
- <result column="organization_id" property="organizationId" jdbcType="VARCHAR"/>
- </resultMap>
- <!-- 基础列 -->
- <sql id="Base_Column_List">
- id
- , user_id, organization_id
- </sql>
- <!-- 一个人只有一个团队,更新时修改团队去掉旧团队 AND organization_id = #{orgId} -->
- <delete id="deleteOrganizationUser">
- DELETE
- FROM sys_organization_user_link
- WHERE user_id = #{userId}
- </delete>
- <!-- 根据用户ID获取组织关联信息 -->
- <select id="getOrganizationUser" resultMap="BaseResultMap">
- SELECT
- a.id,
- a.user_id,
- a.organization_id
- FROM sys_organization_user_link a
- JOIN sys_organization b ON a.organization_id = b.id AND b.is_delete = 0
- <where>
- a.is_delete = 0
- AND user_id = #{userId,jdbcType=DECIMAL}
- </where>
- ORDER BY a.id DESC
- </select>
- </mapper>
|