|
|
|
|
<?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.hisense.hiatmp.common.mapper.CommonUserMapper">
|
|
|
|
|
<select id="getUserInfo" parameterType="java.lang.String" resultType="com.hisense.hiatmp.model.common.entity.Operator">
|
|
|
|
|
select *
|
|
|
|
|
from operator t
|
|
|
|
|
where t.nuserid = #{userId, jdbcType=VARCHAR}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getDeptInfo" parameterType="java.lang.String" resultType="com.hisense.hiatmp.model.common.entity.Department">
|
|
|
|
|
select *
|
|
|
|
|
from department t
|
|
|
|
|
where t.cdepartmentid = #{deptId, jdbcType=VARCHAR}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getDeptLevel" parameterType="java.lang.String" resultType="com.hisense.hiatmp.model.common.entity.Department">
|
|
|
|
|
select nlevel
|
|
|
|
|
from department t
|
|
|
|
|
where t.cdepartmentid = #{deptId, jdbcType=VARCHAR}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getRoleIdList" parameterType="java.lang.String" resultType="String">
|
|
|
|
|
SELECT t.roleid
|
|
|
|
|
FROM USER_ROLE_RELATION t
|
|
|
|
|
where t.nuserid = #{userId, jdbcType=VARCHAR}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getOperationList" parameterType="java.lang.String" resultType="String">
|
|
|
|
|
SELECT DISTINCT ROR.OPERATIONID
|
|
|
|
|
FROM USER_ROLE_RELATION URR
|
|
|
|
|
LEFT JOIN ROLE_OPERATION_RELATION ROR ON ROR.ROLEID = URR.ROLEID
|
|
|
|
|
WHERE URR.NUSERID = #{userId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getDepartmentList" resultType="com.hisense.hiatmp.model.common.entity.Department">
|
|
|
|
|
select *
|
|
|
|
|
from department t
|
|
|
|
|
order by t.cdepartmentcode asc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getSysParamList" resultType="java.util.Map">
|
|
|
|
|
select * from sysparams t
|
|
|
|
|
<if test="paramIds != null">
|
|
|
|
|
where t.paramcode in
|
|
|
|
|
<foreach collection="paramIds" item="paramId" index="index" open="(" close=")" separator=",">
|
|
|
|
|
#{paramId, jdbcType=VARCHAR}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getMajorDeptList" resultType="com.hisense.hiatmp.model.common.entity.Department">
|
|
|
|
|
SELECT p.*
|
|
|
|
|
FROM department p
|
|
|
|
|
join district d on p.cdepartmentid = d.dept_id
|
|
|
|
|
where p.nlevel = '3'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getAllDeptIdsById" resultType="com.hisense.hiatmp.model.common.entity.Department">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="dataBase != null and dataBase != '' and dataBase == '1'.toString()">
|
|
|
|
|
WITH RECURSIVE cte (cdepartmentid, parentdepartment, deptshortname,departmenttype,departmentflag, nlevel, PATH, LEVEL, visited,
|
|
|
|
|
root_id)
|
|
|
|
|
AS (SELECT cdepartmentid,
|
|
|
|
|
parentdepartment,
|
|
|
|
|
deptshortname,
|
|
|
|
|
departmenttype,
|
|
|
|
|
departmentflag,
|
|
|
|
|
nlevel,
|
|
|
|
|
'/' || deptshortname,
|
|
|
|
|
1 AS LEVEL,
|
|
|
|
|
ARRAY[cdepartmentid]::varchar(12)[] AS visited,
|
|
|
|
|
cdepartmentid AS root_id
|
|
|
|
|
FROM department e
|
|
|
|
|
WHERE e.nlevel = #{nlevel}
|
|
|
|
|
AND e.cdepartmentid = #{deptId}
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT C.cdepartmentid,
|
|
|
|
|
C.parentdepartment,
|
|
|
|
|
C.deptshortname,
|
|
|
|
|
C.departmenttype,
|
|
|
|
|
C.departmentflag,
|
|
|
|
|
C.nlevel,
|
|
|
|
|
concat_ws('/', P.PATH, C.deptshortname),
|
|
|
|
|
P.LEVEL + 1,
|
|
|
|
|
(P.visited || C.cdepartmentid) ::varchar(12)[],
|
|
|
|
|
P.root_id
|
|
|
|
|
FROM department C
|
|
|
|
|
JOIN cte P ON P.cdepartmentid = C.parentdepartment
|
|
|
|
|
WHERE C.cdepartmentid != ALL ( P.visited )
|
|
|
|
|
)
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM cte
|
|
|
|
|
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
SELECT T
|
|
|
|
|
.cdepartmentid,
|
|
|
|
|
T.parentdepartment,
|
|
|
|
|
T.deptshortname,
|
|
|
|
|
T.nlevel,
|
|
|
|
|
T.departmenttype,
|
|
|
|
|
T.departmentflag,
|
|
|
|
|
level,
|
|
|
|
|
connect_by_root(T.cdepartmentid) as root_id,
|
|
|
|
|
sys_connect_by_path(T.cdepartmentid,'/') as visited,
|
|
|
|
|
sys_connect_by_path(T.deptshortname,'/') as path
|
|
|
|
|
FROM
|
|
|
|
|
department T
|
|
|
|
|
START with T.nlevel = #{nlevel}
|
|
|
|
|
AND T.cdepartmentid = #{deptId}
|
|
|
|
|
connect by prior t.cdepartmentid=t.parentdepartment
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getDeptAreaList" resultType="com.hisense.hiatmp.model.common.entity.Department">
|
|
|
|
|
select f.area_id as areaId,
|
|
|
|
|
trim(f.area_id) as areaCode,
|
|
|
|
|
f.area_name as areaName,
|
|
|
|
|
t.cdepartmentcode as deptCode,
|
|
|
|
|
f.area_type,
|
|
|
|
|
d.coordinate as coordinateCenter,
|
|
|
|
|
t.deptshortname as deptName,
|
|
|
|
|
t.cdepartmentid
|
|
|
|
|
from department t
|
|
|
|
|
left join area_department_relation r
|
|
|
|
|
on r.dept_id = t.cdepartmentid
|
|
|
|
|
left join face_area f on f.area_id = r.area_id
|
|
|
|
|
left join face_district_center d
|
|
|
|
|
on f.area_id = d.area_dept_id
|
|
|
|
|
where
|
|
|
|
|
t.departmentflag = '0'
|
|
|
|
|
<if test="paramIds != null and paramIds.size()>0">
|
|
|
|
|
and ( t.cdepartmentid in
|
|
|
|
|
<foreach collection="paramIds" item="paramId" index="index" open="(" close=")">
|
|
|
|
|
<if test="index != 0">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="index % 1000 == 999">) OR t.cdepartmentid IN (</when>
|
|
|
|
|
<otherwise>,</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
#{paramId,jdbcType=VARCHAR}
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getConfigByCode" resultType="com.hisense.hiatmp.model.cockpit.CkptCocConfig">
|
|
|
|
|
select ID,PARAM_CODE,PARAM_VALUE,BIG_TYPE,SUB_TYPE,PARAM_NAME
|
|
|
|
|
from CKPT_COC_CONFIG
|
|
|
|
|
where PARAM_CODE =#{paramCode}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getDeptByAreaId" resultType="java.lang.String">
|
|
|
|
|
select dept_id
|
|
|
|
|
from area_department_relation
|
|
|
|
|
where area_id = #{deptId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getXzqhAll" resultType="com.hisense.hiatmp.model.common.entity.XzqhRelation">
|
|
|
|
|
select *
|
|
|
|
|
from ckpt_dept_xzqh_subordinate x
|
|
|
|
|
where 1 = 1
|
|
|
|
|
<if test='level!=null'>
|
|
|
|
|
and x.nlevel<![CDATA[ <= ]]>#{level}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getMaxDepts" resultType="com.hisense.hiatmp.model.common.entity.Department">
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
DEPARTMENT t
|
|
|
|
|
WHERE
|
|
|
|
|
to_number(T.nlevel) =(
|
|
|
|
|
SELECT MIN
|
|
|
|
|
( COALESCE ( to_number( T.nlevel ), 99 ) )
|
|
|
|
|
FROM
|
|
|
|
|
DEPARTMENT T)
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getAllOperator" resultType="com.hisense.hiatmp.model.common.entity.Operator">
|
|
|
|
|
select *
|
|
|
|
|
from operator t
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|