feat: 提交项目代码
This commit is contained in:
@@ -0,0 +1,733 @@
|
||||
<?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.adc.da.sys.dao.OrgEODao">
|
||||
<!-- Result Map-->
|
||||
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.OrgEO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="valid_flag" property="validFlag"/>
|
||||
<result column="org_name" property="orgName"/>
|
||||
<result column="org_desc" property="orgDesc"/>
|
||||
<result column="org_code" property="orgCode"/>
|
||||
<result column="org_type" property="orgType"/>
|
||||
<result column="parent_id" property="pId"/>
|
||||
<result column="parent_ids" property="parentIds"/>
|
||||
<result column="is_show" property="isShow"/>
|
||||
<result column="remarks" property="remarks"/>
|
||||
<result column="creation_time" property="creationTime"/>
|
||||
<result column="modify_time" property="modifyTime"/>
|
||||
<result column="shot_name" property="shotName"/>
|
||||
<!--liwenxuan:-->
|
||||
<result column="userName" property="userName"/>
|
||||
<result column="usId" property="usId"/>
|
||||
<result column="roleId" property="roleId"/>
|
||||
<result column="roleName" property="roleName"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<resultMap id="SSOResultMap" type="com.adc.da.sys.entity.OrgEO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="sso_id" property="ssoId"/>
|
||||
<result column="sso_org_id" property="ssoOrgId"/>
|
||||
<result column="valid_flag" property="validFlag"/>
|
||||
<result column="org_name" property="orgName"/>
|
||||
<result column="org_desc" property="orgDesc"/>
|
||||
<result column="org_code" property="orgCode"/>
|
||||
<result column="org_type" property="orgType"/>
|
||||
<result column="parent_id" property="pId"/>
|
||||
<result column="parent_ids" property="parentIds"/>
|
||||
<result column="is_show" property="isShow"/>
|
||||
<result column="remarks" property="remarks"/>
|
||||
<result column="creation_time" property="creationTime"/>
|
||||
<result column="modify_time" property="modifyTime"/>
|
||||
<result column="shot_name" property="shotName"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="SSO_Column_List">
|
||||
id, valid_flag, org_name, org_desc,org_code,parent_id, parent_ids, is_show, remarks,shot_name,sso_id,sso_org_id,creation_time,modify_time
|
||||
</sql>
|
||||
|
||||
<!-- TS_ORG table all fields -->
|
||||
<sql id="Base_Column_List">
|
||||
TS_ORG.id, TS_ORG.valid_flag, TS_ORG.org_name, TS_ORG.org_desc,TS_ORG.org_code,TS_ORG.parent_id, TS_ORG.parent_ids, TS_ORG.is_show, TS_ORG.remarks,TS_ORG.shot_name
|
||||
</sql>
|
||||
|
||||
<sql id="Base_Column_Lista">
|
||||
TS_ORG.id, TS_ORG.valid_flag, TS_ORG.org_name, TS_ORG.org_desc,TS_ORG.org_code,TS_ORG.parent_id, TS_ORG.parent_ids, TS_ORG.is_show, TS_ORG.remarks,TS_ORG.shot_name,TS_ORG.org_type
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
where 1=1
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
and id ${idOperator} #{id}
|
||||
</if>
|
||||
<if test="validFlag != null">
|
||||
and valid_flag ${validFlagOperator} #{validFlag}
|
||||
</if>
|
||||
<if test="orgName != null">
|
||||
and org_name ${nameOperator} #{orgName}
|
||||
</if>
|
||||
<if test="orgDesc != null">
|
||||
and org_desc ${orgDescOperator} #{orgDesc}
|
||||
</if>
|
||||
<if test="orgCode != null">
|
||||
and org_code ${orgCodeOperator} #{orgCode}
|
||||
</if>
|
||||
<if test="orgType != null">
|
||||
and org_type ${orgTypeOperator} #{orgType}
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
and parent_id ${parentIdOperator} #{pId}
|
||||
</if>
|
||||
<if test="parentIds != null">
|
||||
and parent_ids ${parentIdsOperator} #{parentIds}
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
and is_show ${isShowOperator} #{isShow}
|
||||
</if>
|
||||
<if test="remarks != null">
|
||||
and remarks ${remarksOperator} #{remarks}
|
||||
</if>
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
<update id="deleteLogic" parameterType="java.lang.String">
|
||||
update TS_ORG
|
||||
set valid_flag = 1
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 根据id查询 组织机构 -->
|
||||
<update id="updateOrgOfSSOById" parameterType="com.adc.da.sys.entity.OrgEO">
|
||||
update TS_ORG
|
||||
<set>
|
||||
<if test="validFlag != null">
|
||||
valid_flag = #{validFlag},
|
||||
</if>
|
||||
<if test="orgName != null">
|
||||
org_name = #{orgName},
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
parent_id = #{pId},
|
||||
</if>
|
||||
<if test="parentIds != null">
|
||||
parent_ids = #{parentIds},
|
||||
</if>
|
||||
<if test="orgDesc != null">
|
||||
org_desc = #{orgDesc},
|
||||
</if>
|
||||
<if test="orgCode != null">
|
||||
org_code = #{orgCode},
|
||||
</if>
|
||||
<if test="orgType != null">
|
||||
org_type = #{orgType},
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
is_show = #{isShow},
|
||||
</if>
|
||||
<if test="remarks != null">
|
||||
remarks = #{remarks},
|
||||
</if>
|
||||
<if test="shotName != null">
|
||||
shot_name = #{shotName},
|
||||
</if>
|
||||
<if test="ssoId != null">
|
||||
sso_id = #{ssoId}
|
||||
</if>
|
||||
<if test="ssoOrgId != null">
|
||||
sso_org_id = #{ssoOrgId}
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 根据id查询 组织机构 -->
|
||||
<select id="getOrgEOById" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_Lista"/>
|
||||
from TS_ORG
|
||||
where id = #{id} and valid_flag=0
|
||||
</select>
|
||||
|
||||
<!-- 根据SSOOrgId查询 组织机构 -->
|
||||
<select id="getOrgInfoBySSOOrgId" resultMap="SSOResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="SSO_Column_List"/>
|
||||
from TS_ORG
|
||||
where sso_org_id = #{SSOOrgId}
|
||||
</select>
|
||||
|
||||
<!--liwenxuan:添加了判断-->
|
||||
<select id="getOrgEOByNameAndPid" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_ORG
|
||||
WHERE 1=1
|
||||
<if test="orgName != null">
|
||||
AND org_name = #{orgName}
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
AND parent_id = #{pId}
|
||||
</if>
|
||||
and valid_flag = 0
|
||||
|
||||
</select>
|
||||
<!--liwenxuan:添加了入参-->
|
||||
<select id="getOrgEOByPid" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_ORG WHERE
|
||||
parent_id = #{pId} AND valid_flag = 0
|
||||
</select>
|
||||
|
||||
<!--liwenxuan:判断组织机构名不重复-->
|
||||
<select id="getOrgEOByorgNameAndPidAndId" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_ORG
|
||||
WHERE 1=1
|
||||
<if test="orgName != null">
|
||||
AND org_name = #{orgName}
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
AND parent_id = #{pId}
|
||||
</if>
|
||||
<if test="id != null">
|
||||
AND id != #{id}
|
||||
</if>
|
||||
and valid_flag = 0
|
||||
</select>
|
||||
|
||||
<!--liwenxuan:判断组织机构简称不重复-->
|
||||
<select id="getOrgEOByShotNameAndPidAndId" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_ORG
|
||||
WHERE 1=1
|
||||
<if test="shotName != null">
|
||||
AND shot_name = #{shotName}
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
AND parent_id = #{pId}
|
||||
</if>
|
||||
<if test="id != null">
|
||||
AND id != #{id}
|
||||
</if>
|
||||
and valid_flag = 0
|
||||
</select>
|
||||
<select id="queryOrgByList" resultMap="BaseResultMap" >
|
||||
select <include refid="Base_Column_List"/> from TS_ORG
|
||||
WHERE ORG_NAME = #{orgName} AND VALID_FLAG =0
|
||||
</select>
|
||||
|
||||
<select id="listOrgEOByOrgName" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
,TS_DICTYPE.DIC_TYPE_NAME AS org_type FROM
|
||||
(SELECT
|
||||
<include refid="Base_Column_Lista"/>
|
||||
FROM TS_ORG right join (
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM TS_ORG
|
||||
WHERE TS_ORG.valid_flag !=1
|
||||
<if test="orgName != null">
|
||||
AND TS_ORG.ORG_NAME LIKE '%${orgName}%'
|
||||
</if>
|
||||
) b on TS_ORG.id=b.id
|
||||
<if test="orgName != null">
|
||||
or b.parent_ids like '%'||TS_ORG.id||'%'
|
||||
</if>
|
||||
)
|
||||
TS_ORG
|
||||
left join TS_DICTYPE on TS_ORG.ORG_TYPE = TS_DICTYPE.id
|
||||
WHERE TS_ORG.valid_flag !=1
|
||||
ORDER BY TS_ORG.modify_time DESC
|
||||
</select>
|
||||
<!--liwenuxan:获取所有节点-->
|
||||
<select id="selectOrgAllNode" resultMap="BaseResultMap">
|
||||
SELECT id, org_name, parent_id,parent_ids,shot_name, org_desc,
|
||||
org_code, org_type, is_show,remarks FROM TS_ORG WHERE valid_flag = 0
|
||||
</select>
|
||||
|
||||
<select id="getChildDept" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
id, org_name, parent_id,parent_ids,shot_name, org_desc,
|
||||
org_code, org_type, is_show,remarks
|
||||
FROM
|
||||
TS_ORG START WITH "ID" = #{orgId} CONNECT BY PARENT_ID = PRIOR "ID"
|
||||
AND VALID_FLAG = 0
|
||||
</select>
|
||||
|
||||
<select id="selectRootNode" resultMap="BaseResultMap" parameterType="java.util.LinkedList">
|
||||
SELECT id, org_name, parent_id, is_show,shot_name FROM TS_ORG WHERE valid_flag = 0 AND parent_id IS NULL
|
||||
</select>
|
||||
|
||||
<select id="selectNodeByPid" resultMap="BaseResultMap" parameterType="java.util.LinkedList">
|
||||
SELECT id, org_name, parent_id,shot_name, org_desc,
|
||||
org_code, org_type, is_show FROM TS_ORG WHERE valid_flag = 0 and parent_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryByObject" resultMap="BaseResultMap" parameterType="com.adc.da.sys.entity.OrgEO">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_ORG
|
||||
<include refid="Base_Where_Clause"/>
|
||||
</select>
|
||||
<delete id="delOrgRelatedUser" parameterType="com.adc.da.sys.entity.UserOrgEO">
|
||||
DELETE FROM TS_USER_ORG WHERE USER_ID = #{userId} AND ORG_ID = #{orgId}
|
||||
</delete>
|
||||
<delete id="delOrgRelatedUserByUserId" parameterType="java.lang.String">
|
||||
DELETE FROM TS_USER_ORG WHERE USER_ID = #{usId}
|
||||
</delete>
|
||||
|
||||
<insert id="addOrgRelatedUsers" parameterType="java.util.List">
|
||||
insert into TS_USER_ORG
|
||||
(
|
||||
user_id,
|
||||
org_id
|
||||
) SELECT A.*
|
||||
FROM (
|
||||
<foreach collection="list" item="item" index="index" separator="UNION ALL">
|
||||
SELECT
|
||||
#{item.userId,jdbcType=VARCHAR},
|
||||
#{item.orgId,jdbcType=VARCHAR}
|
||||
FROM DUAL
|
||||
</foreach>
|
||||
)A
|
||||
</insert>
|
||||
<insert id="addOrgRelatedUser" parameterType="com.adc.da.sys.entity.UserEO">
|
||||
insert into TS_USER_ORG
|
||||
(user_id,org_id)
|
||||
values
|
||||
(#{userId,jdbcType=VARCHAR},
|
||||
#{orgId,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<update id="updateUserOrg" parameterType="com.adc.da.sys.entity.UserOrgEO">
|
||||
update TS_USER_ORG
|
||||
set org_id = #{orgId}
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
<!--liwenxuan:根据组织机构id删除组织机构和用户关联关系-->
|
||||
<delete id="deleteUserOrgByOrgId" parameterType="java.lang.String">
|
||||
DELETE FROM TS_USER_ORG WHERE ORG_ID = #{orgId}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="getOrgListOfSSO" resultMap="SSOResultMap">
|
||||
SELECT
|
||||
<include refid="SSO_Column_List"/>
|
||||
FROM TS_ORG
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="addOrgOfSSO" parameterType="com.adc.da.sys.entity.OrgEO">
|
||||
insert into TS_ORG
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="validFlag != null">valid_flag,</if>
|
||||
<if test="orgName != null">org_name,</if>
|
||||
<if test="orgDesc != null">org_desc,</if>
|
||||
<if test="orgCode != null">org_code,</if>
|
||||
<if test="orgType != null">org_type,</if>
|
||||
<if test="pId != null">parent_id,</if>
|
||||
<if test="parentIds != null">parent_ids,</if>
|
||||
<if test="isShow != null">is_show,</if>
|
||||
<if test="remarks != null">remarks,</if>
|
||||
<if test="creationTime != null">creation_time,</if>
|
||||
<if test="modifyTime != null">modify_time,</if>
|
||||
<if test="shotName != null">shot_name,</if>
|
||||
<if test="ssoId != null">sso_id</if>,
|
||||
<if test="ssoOrgId != null">sso_org_id</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="validFlag != null">#{validFlag},</if>
|
||||
<if test="orgName != null">#{orgName},</if>
|
||||
<if test="orgDesc != null">#{orgDesc},</if>
|
||||
<if test="orgCode != null">#{orgCode},</if>
|
||||
<if test="orgType != null">#{orgType},</if>
|
||||
<if test="pId != null">#{pId},</if>
|
||||
<if test="parentIds != null">#{parentIds},</if>
|
||||
<if test="isShow != null">#{isShow},</if>
|
||||
<if test="remarks != null">#{remarks},</if>
|
||||
<if test="creationTime != null">#{creationTime},</if>
|
||||
<if test="modifyTime != null">#{modifyTime},</if>
|
||||
<if test="shotName != null">#{shotName},</if>
|
||||
<if test="ssoOrgId != null">#{ssoOrgId}</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 修改记录,只修改不为空的字段 -->
|
||||
<update id="updateOrgOfSSO" parameterType="com.adc.da.sys.entity.OrgEO">
|
||||
update TS_ORG
|
||||
<set>
|
||||
<if test="validFlag != null">
|
||||
valid_flag = #{validFlag},
|
||||
</if>
|
||||
<if test="orgName != null">
|
||||
org_name = #{orgName},
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
parent_id = #{pId},
|
||||
</if>
|
||||
<if test="parentIds != null">
|
||||
parent_ids = #{parentIds},
|
||||
</if>
|
||||
<if test="orgDesc != null">
|
||||
org_desc = #{orgDesc},
|
||||
</if>
|
||||
<if test="orgCode != null">
|
||||
org_code = #{orgCode},
|
||||
</if>
|
||||
<if test="orgType != null">
|
||||
org_type = #{orgType},
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
is_show = #{isShow},
|
||||
</if>
|
||||
<if test="remarks != null">
|
||||
remarks = #{remarks},
|
||||
</if>
|
||||
<if test="shotName != null">
|
||||
shot_name = #{shotName},
|
||||
</if>
|
||||
<if test="modifyTime != null">
|
||||
modify_time = #{modifyTime},
|
||||
</if>
|
||||
<if test="ssoId != null">
|
||||
sso_id = #{ssoId},
|
||||
</if>
|
||||
<if test="ssoOrgId != null">
|
||||
sso_org_id = #{ssoOrgId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<!--根据角色名称获取组织结构用户树-->
|
||||
<!--liwenxuan:根据角色名称,查找该角色的用户(用于流程中心)-->
|
||||
<select id="getTreeByRole1" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
SELECT
|
||||
tu.uname as userName,tu.usid as id,tg.id as pId,tg.org_name as orgName
|
||||
FROM TS_USER tu
|
||||
LEFT JOIN TS_USER_ROLE tur ON tu.usid = tur.user_id
|
||||
LEFT JOIN TS_ROLE tr ON tr. ID = tur.role_id
|
||||
LEFT JOIN TS_USER_ORG tuo ON tuo.user_id = tu.usid
|
||||
LEFT JOIN TS_ORG tg ON tg.id = tuo.org_id
|
||||
WHERE
|
||||
tr. NAME = #{roleName}
|
||||
AND TU.VALID_FLAG = '0'
|
||||
AND TR.VALID_FLAG = '0'
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND tu.DISABLE_FLAG = '0'
|
||||
</select>
|
||||
|
||||
<!--liwenxuan:根据用户查找其组织结构,筛选出唯一的组织结构-->
|
||||
<select id="getTreeByRole2" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
SELECT
|
||||
tg.id,tg.org_name,tg.parent_id as pId
|
||||
FROM
|
||||
TS_USER tu
|
||||
LEFT JOIN TS_USER_ROLE tur ON tu.usid = tur.user_id
|
||||
LEFT JOIN TS_ROLE tr ON tr. ID = tur.role_id
|
||||
LEFT JOIN TS_USER_ORG tuo ON tuo.user_id = tu.usid
|
||||
LEFT JOIN TS_ORG tg ON tg.id = tuo.org_id
|
||||
WHERE
|
||||
tr. NAME = #{roleName}
|
||||
AND TU.VALID_FLAG = '0'
|
||||
AND TR.VALID_FLAG = '0'
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND TU.DISABLE_FLAG = '0'
|
||||
GROUP BY tg.id,tg.org_name,tg.parent_id
|
||||
</select>
|
||||
|
||||
<!--根据用户获取其所在组织结构下某个角色的用户-->
|
||||
<!--liwenxuan:1.查找该用户所在的组织结构,拿到parent_ids-->
|
||||
<select id="getLeaderByUserId1" parameterType="java.lang.String" resultType="com.adc.da.sys.entity.OrgEO">
|
||||
SELECT
|
||||
tg2.id,tg2.parent_ids AS parentIds,tg2.org_type as orgType,tg2.org_name as orgName
|
||||
FROM
|
||||
TS_ORG tg2
|
||||
LEFT JOIN TS_USER_ORG tuo ON TG2.ID = tuo.org_id
|
||||
WHERE tuo.user_id = #{usId} and tg2.VALID_FLAG ='0'
|
||||
</select>
|
||||
|
||||
<!--liwenxuan:2.根据第一步返回的parent_ids,和id 组成list ,使用in查询,筛选组织结构-->
|
||||
<select id="getLeaderByUserId2" resultType="java.lang.String">
|
||||
SELECT
|
||||
TG.id
|
||||
FROM
|
||||
TS_ORG tg
|
||||
WHERE 1=1
|
||||
<if test="orgType != null">
|
||||
AND TG.ORG_TYPE = #{orgType}
|
||||
</if>
|
||||
AND tg.id IN
|
||||
<if test="parentIds!=null">
|
||||
<foreach collection="parentIds" item="item" index="index" open="(" separator="," close=")" >
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
and tg.VALID_FLAG='0'
|
||||
|
||||
</select>
|
||||
|
||||
<!--liwenxuan:3.根据2中获取的id,和角色名称roleName删选用户-->
|
||||
<select id="getLeaderByUserId3" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
TU.usid,tu.uname as userName
|
||||
FROM
|
||||
TS_ORG tg
|
||||
LEFT JOIN TS_USER_ORG tuo ON TG.ID = TUO.ORG_ID
|
||||
LEFT JOIN TS_USER tu ON tu.usid = tuo.user_Id
|
||||
LEFT JOIN TS_USER_ROLE tur on tur.User_Id = tu.usid
|
||||
LEFT JOIN TS_ROLE tro ON tro. ID = tur.role_id
|
||||
WHERE
|
||||
tro. NAME = #{roleName}
|
||||
AND (TG.PARENT_IDS LIKE '%${id}%' or TG.id = #{id})
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND tu.VALID_FLAG = '0'
|
||||
AND tro.VALID_FLAG = '0'
|
||||
</select>
|
||||
|
||||
<!--根据orgId查找所有组织结构-->
|
||||
<select id="getAllOrgbyOrgId" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select TS_ORG.id,TS_ORG.org_name,TS_ORG.parent_ids,TS_ORG.org_Type from TS_ORG WHERE TS_ORG.id = #{orgId}
|
||||
and TS_ORG.VALID_FLAG = '0'
|
||||
</select>
|
||||
|
||||
|
||||
<!--liwenxuan:根据角色名称和部门id获取组织结构用户树-->
|
||||
<!--liwenxuan:1.根据角色名称和部门id获取组织结构用户树 :向下查找组织结构-->
|
||||
<select id="getTreeByRoleAndOrgId1" resultType="java.lang.String">
|
||||
select TS_ORG.id from TS_ORG WHERE TS_ORG.parent_ids LIKE '%${orgId}%' and TS_ORG.VALID_FLAG = '0'
|
||||
</select>
|
||||
<!--liwenxuan:2.根据parentIds获取所有组织机构树-->
|
||||
<select id="getTreeByRoleAndOrgId2" resultMap="BaseResultMap">
|
||||
select <include refid="Base_Column_List"/> from TS_ORG where TS_ORG.id IN
|
||||
<if test="ids != null">
|
||||
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" >
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
and TS_ORG.VALID_FLAG = '0'
|
||||
</select>
|
||||
<!--liwenxuan:3.根据组织机构和角色获取其下所有用户-->
|
||||
<select id="getTreeByRoleAndOrgId3" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
tu.uname AS userName,
|
||||
tu.usid AS usId,
|
||||
tg. ID AS pId,
|
||||
tu.usid AS id,
|
||||
tg.org_name AS orgName,
|
||||
tr. ID AS roleId,
|
||||
tr. NAME AS roleName
|
||||
FROM
|
||||
TS_USER tu
|
||||
LEFT JOIN TS_USER_ROLE tur ON tu.usid = tur.user_id
|
||||
LEFT JOIN TS_ROLE tr ON tr. ID = tur.role_id
|
||||
LEFT JOIN TS_USER_ORG tuo ON tuo.user_id = tu.usid
|
||||
LEFT JOIN TS_ORG tg ON tg. ID = tuo.org_id
|
||||
WHERE
|
||||
tr. NAME = #{roleName}
|
||||
|
||||
<foreach item="tsOrg" collection="orgEOList" index="index" open="AND tg. ID IN (" close=")" separator=",">
|
||||
#{tsOrg.id}
|
||||
</foreach>
|
||||
AND TU.VALID_FLAG = '0'
|
||||
AND TR.VALID_FLAG = '0'
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND TU.DISABLE_FLAG = '0'
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getManagerByOrgId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
tu.uname AS userName,
|
||||
tu.usid AS usId,
|
||||
tg. ID AS pId,
|
||||
tu.usid AS id,
|
||||
tg.org_name AS orgName,
|
||||
tr. ID AS roleId,
|
||||
tr. NAME AS roleName
|
||||
FROM
|
||||
TS_USER tu
|
||||
LEFT JOIN TS_USER_ROLE tur ON tu.usid = tur.user_id
|
||||
LEFT JOIN TS_ROLE tr ON tr. ID = tur.role_id
|
||||
LEFT JOIN TS_USER_ORG tuo ON tuo.user_id = tu.usid
|
||||
LEFT JOIN TS_ORG tg ON tg. ID = tuo.org_id
|
||||
WHERE
|
||||
tr. NAME = #{roleName}
|
||||
AND tg. ID = #{orgId}
|
||||
AND TU.VALID_FLAG = '0'
|
||||
AND TR.VALID_FLAG = '0'
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND TU.DISABLE_FLAG = '0'
|
||||
</select>
|
||||
|
||||
<!--根据orgType查询查询部及以上组织结构-->
|
||||
<select id="getIdsByorgType" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/> from TS_ORG where (org_type='DEPART'
|
||||
OR org_name = '广汽研究院') AND VALID_FLAG = 0
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getIdByName" resultMap="BaseResultMap">
|
||||
select * from TS_ORG where org_name = #{orgName}
|
||||
and TS_ORG.VALID_FLAG = '0'
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!--liwenxuan:1.根据orgId,roleId查看用户-->
|
||||
<select id="getLeaderByOrgIdAndRoleId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
TU.usid,tu.uname as userName
|
||||
FROM
|
||||
TS_ORG tg
|
||||
LEFT JOIN TS_USER_ORG tuo ON TG.ID = TUO.ORG_ID
|
||||
LEFT JOIN TS_USER tu ON tu.usid = tuo.user_Id
|
||||
LEFT JOIN TS_USER_ROLE tur on tur.User_Id = tu.usid
|
||||
LEFT JOIN TS_ROLE tro ON tro. ID = tur.role_id
|
||||
WHERE
|
||||
(tur.role_id = 'YK5P33FZ29TPN2VPDP6E' or tur.role_id = 'GQSBB2N3KURYYC6AUFER')
|
||||
<foreach item="item" collection="orgIds" index="index" open="AND tuo.org_Id IN (" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND tu.VALID_FLAG = '0'
|
||||
AND tro.VALID_FLAG = '0'
|
||||
</select>
|
||||
|
||||
|
||||
<!--liwenxuan:根据orgIds查询下面的用户集合-->
|
||||
<select id="getLeaderByUserId4" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
TU.usid,tu.uname as userName
|
||||
FROM
|
||||
TS_ORG tg
|
||||
LEFT JOIN TS_USER_ORG tuo ON TG.ID = TUO.ORG_ID
|
||||
LEFT JOIN TS_USER tu ON tu.usid = tuo.user_Id
|
||||
LEFT JOIN TS_USER_ROLE tur on tur.User_Id = tu.usid
|
||||
LEFT JOIN TS_ROLE tro ON tro. ID = tur.role_id
|
||||
WHERE 1 = 1 AND (
|
||||
<foreach collection="id" item="item" separator="or" index="index">
|
||||
(TG.PARENT_IDS LIKE '%${item}%' or TG.id = #{item})
|
||||
</foreach>
|
||||
)
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND tu.VALID_FLAG = '0'
|
||||
AND tro.VALID_FLAG = '0'
|
||||
</select>
|
||||
|
||||
<!--根据orgId和roleId确定是否有一个用户 科级负责人:YK5P33FZ29TPN2VPDP6E-->
|
||||
<select id="getHeadOfSection" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
TU.usid,tu.uname as userName
|
||||
FROM
|
||||
TS_ORG tg
|
||||
LEFT JOIN TS_USER_ORG tuo ON TG.ID = TUO.ORG_ID
|
||||
LEFT JOIN TS_USER tu ON tu.usid = tuo.user_Id
|
||||
LEFT JOIN TS_USER_ROLE tur on tur.User_Id = tu.usid
|
||||
LEFT JOIN TS_ROLE tro ON tro. ID = tur.role_id
|
||||
WHERE
|
||||
tur.role_id = 'YK5P33FZ29TPN2VPDP6E' AND tuo.org_Id = #{orgId}
|
||||
<if test="userId !=null and userId !=''">
|
||||
AND tu.USID != #{userId}
|
||||
</if>
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND tu.VALID_FLAG = '0'
|
||||
AND tro.VALID_FLAG = '0'
|
||||
</select>
|
||||
<!---->
|
||||
<!--根据orgId和roleId确定是否有一个用户 部门负责人:GQSBB2N3KURYYC6AUFER-->
|
||||
<select id="getDepartmentHeads" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
TU.usid,tu.uname as userName
|
||||
FROM
|
||||
TS_ORG tg
|
||||
LEFT JOIN TS_USER_ORG tuo ON TG.ID = TUO.ORG_ID
|
||||
LEFT JOIN TS_USER tu ON tu.usid = tuo.user_Id
|
||||
LEFT JOIN TS_USER_ROLE tur on tur.User_Id = tu.usid
|
||||
LEFT JOIN TS_ROLE tro ON tro. ID = tur.role_id
|
||||
WHERE
|
||||
tur.role_id = 'GQSBB2N3KURYYC6AUFER' AND tuo.org_Id = #{orgId}
|
||||
<if test="userId !=null and userId !=''">
|
||||
AND tu.USID != #{userId}
|
||||
</if>
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND tu.VALID_FLAG = '0'
|
||||
AND tro.VALID_FLAG = '0'
|
||||
</select>
|
||||
|
||||
<select id="getTreeByRole4" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
SELECT
|
||||
tg.id,tg.org_name,tg.parent_id as pId
|
||||
FROM
|
||||
TS_USER tu
|
||||
LEFT JOIN TS_USER_ROLE tur ON tu.usid = tur.user_id
|
||||
LEFT JOIN TS_ROLE tr ON tr. ID = tur.role_id
|
||||
LEFT JOIN TS_USER_ORG tuo ON tuo.user_id = tu.usid
|
||||
LEFT JOIN TS_ORG tg ON tg.id = tuo.org_id
|
||||
WHERE
|
||||
tr.id = #{roleId}
|
||||
AND TU.VALID_FLAG = '0'
|
||||
AND TR.VALID_FLAG = '0'
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND TU.DISABLE_FLAG = '0'
|
||||
GROUP BY tg.id,tg.org_name,tg.parent_id
|
||||
</select>
|
||||
|
||||
<select id="getTreeByRole3" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
SELECT
|
||||
tu.uname as userName,tu.usid as id,tg.id as pId,tg.org_name as orgName
|
||||
FROM TS_USER tu
|
||||
LEFT JOIN TS_USER_ROLE tur ON tu.usid = tur.user_id
|
||||
LEFT JOIN TS_ROLE tr ON tr. ID = tur.role_id
|
||||
LEFT JOIN TS_USER_ORG tuo ON tuo.user_id = tu.usid
|
||||
LEFT JOIN TS_ORG tg ON tg.id = tuo.org_id
|
||||
WHERE
|
||||
tr.id = #{roleId}
|
||||
AND TU.VALID_FLAG = '0'
|
||||
AND TR.VALID_FLAG = '0'
|
||||
AND tg.VALID_FLAG = '0'
|
||||
AND tu.DISABLE_FLAG = '0'
|
||||
</select>
|
||||
|
||||
<select id="getOrgInfoByOrgId" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_ORG
|
||||
where id = #{value}
|
||||
and VALID_FLAG = '0'
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getOrgParentInfoOrgId" resultMap="BaseResultMap" parameterType="com.adc.da.sys.entity.OrgEO">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from TS_ORG
|
||||
where id in
|
||||
<foreach collection="parentIdsList" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and VALID_FLAG = '0'
|
||||
and ORG_TYPE = 'SUBUS'
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getOrgRootTree" resultMap="BaseResultMap" >
|
||||
select <include refid="Base_Column_List"/> from TS_ORG
|
||||
WHERE 1=1
|
||||
AND VALID_FLAG =0
|
||||
AND ORG_TYPE = 'SUBUS'
|
||||
AND parent_id IS NOT NULL
|
||||
AND parent_idS IS NOT NULL
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user