Commit 426f040d authored by huyuchen's avatar huyuchen

明细接口改造

parent 65c9d9db
<?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.yifu.cloud.plus.v1.permission.mapper.SysMenuMapper">
<resultMap id="sysMenuMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu">
<id property="id" column="ID"/>
<result property="menuName" column="MENU_NAME"/>
<result property="menuNameParent" column="MENU_NAME_PARENT"/>
<result property="menuParentId" column="MENU_PARENT_ID"/>
<result property="modelId" column="MODEL_ID"/>
<result property="viewId" column="VIEW_ID"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
<result property="deleteStatus" column="DELETE_STATUS"/>
<result property="incomeId" column="INCOME_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="contractId" column="CONTRACT_ID"/>
<result property="bussinessId" column="BUSSINESS_ID"/>
<result property="quotationId" column="QUOTATION_ID"/>
<result property="domainId" column="DOMAIN_ID"/>
<result property="buId" column="BU_ID"/>
<result property="lineId" column="LINE_ID"/>
<result property="deptId" column="DEPT_ID"/>
<result property="twoLevelId" column="TWO_LEVEL_ID"/>
<result property="createBy" column="CREATE_BY"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="isOpen" column="IS_OPEN"/>
<result property="tableName" column="TABLE_NAME"/>
<result property="queryFields" column="QUERY_FIELDS"/>
<result property="taxId" column="TAX_ID"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.MENU_NAME,
a.MODEL_ID,
a.MENU_NAME_PARENT,
a.MENU_PARENT_ID,
a.PERMISSION_TYPE,
a.PERMISSION_STATUS,
a.DELETE_STATUS,
a.INCOME_ID,
a.CUSTOMER_ID,
a.CONTRACT_ID,
a.BUSSINESS_ID,
a.QUOTATION_ID,
a.DOMAIN_ID,
a.BU_ID,
a.LINE_ID,
a.DEPT_ID,
a.IS_OPEN,
a.TWO_LEVEL_ID,
a.VIEW_ID,
a.CREATE_TIME,
a.TABLE_NAME,
a.QUERY_FIELDS,
a.TAX_ID
</sql>
<sql id="sysMenu_where">
<if test="sysMenu != null">
<if test="sysMenu.menuName != null and sysMenu.menuName.trim() != ''">
AND a.MENU_NAME like concat('%',#{sysMenu.menuName},'%')
</if>
<if test="sysMenu.menuNameParent != null and sysMenu.menuNameParent.trim() != ''">
AND a.MENU_NAME_PARENT = #{sysMenu.menuNameParent}
</if>
<if test="sysMenu.menuParentId != null and sysMenu.menuParentId.trim() != ''">
AND a.MENU_PARENT_ID = #{sysMenu.menuParentId}
</if>
<if test="sysMenu.permissionStatus != null and sysMenu.permissionStatus.trim() != ''">
AND a.PERMISSION_STATUS = #{sysMenu.permissionStatus}
</if>
</if>
</sql>
<!--sysMenu简单分页查询-->
<select id="getSysMenuPage" resultMap="sysMenuMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_menu a
<where>
a.DELETE_STATUS = '1'
<include refid="sysMenu_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<select id="selectMenuId" resultType="java.lang.Long">
SELECT
count(1)
FROM modeling_app_model a
WHERE a.fd_id = #{modelId}
</select>
<select id="selectViewId" resultType="java.lang.Long">
SELECT
count(1)
FROM modeling_app_collection_view a
WHERE a.fd_model_id = #{modelId} and a.fd_id = #{viewId}
</select>
<select id="selectColumnList" resultType="java.lang.String">
SELECT
a.fd_column
FROM sys_xform_db_column a
LEFT JOIN sys_xform_db_table b on a.fd_main_id = b.fd_id
WHERE b.fd_model_id = #{modelId}
</select>
<!--根据modelId获取菜单-->
<select id="getSysMenuByModelId" resultMap="sysMenuMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_menu a
where a.DELETE_STATUS = '1' and a.PERMISSION_STATUS='0' and a.MODEL_ID = #{modelId}
limit 1
</select>
<!-- 获取税务主体列表-->
<select id="getSysTaxVoPage" resultType="com.yifu.cloud.plus.v1.yifu.permission.vo.SysTaxVo">
select fd_id AS id,a.fd_3afab4c6755286 AS name
from ekp_7e091e5e36848fb97451 a
where a.fd_3afab4c6755286 is not null
<if test="vo != null">
<if test="vo.name != null and vo.name.trim() != ''">
AND a.fd_3afab4c6755286 like concat('%',#{vo.name},'%')
</if>
</if>
GROUP BY a.fd_3afab4c6755286 ORDER BY a.fd_3afab4c6755286 desc
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysRoleInfoMapper">
<resultMap id="sysRoleInfoMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleInfo">
<id property="fdId" column="fd_id"/>
<result property="roleName" column="role_name"/>
<result property="remark" column="remark"/>
<result property="status" column="status"/>
<result property="deleteFlag" column="delete_flag"/>
<result property="dataAuth" column="data_auth"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
a.role_name,
a.remark,
a.status,
a.delete_flag,
a.data_auth,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
</sql>
<sql id="sysRoleInfo_where">
<if test="sysRoleInfo != null">
<if test="sysRoleInfo.fdId != null and sysRoleInfo.fdId.trim() != ''">
AND a.fd_id = #{sysRoleInfo.fdId}
</if>
<if test="sysRoleInfo.roleName != null and sysRoleInfo.roleName.trim() != ''">
AND a.role_name like concat('%',#{sysRoleInfo.roleName},'%')
</if>
<if test="sysRoleInfo.remark != null and sysRoleInfo.remark.trim() != ''">
AND a.remark = #{sysRoleInfo.remark}
</if>
<if test="sysRoleInfo.status != null">
AND a.status = #{sysRoleInfo.status}
</if>
<if test="sysRoleInfo.deleteFlag != null">
AND a.delete_flag = #{sysRoleInfo.deleteFlag}
</if>
<if test="sysRoleInfo.dataAuth != null and sysRoleInfo.dataAuth.trim() != ''">
AND a.data_auth = #{sysRoleInfo.dataAuth}
</if>
<if test="sysRoleInfo.createBy != null and sysRoleInfo.createBy.trim() != ''">
AND a.CREATE_BY = #{sysRoleInfo.createBy}
</if>
<if test="sysRoleInfo.createName != null and sysRoleInfo.createName.trim() != ''">
AND a.CREATE_NAME = #{sysRoleInfo.createName}
</if>
<if test="sysRoleInfo.createTime != null">
AND a.CREATE_TIME = #{sysRoleInfo.createTime}
</if>
<if test="sysRoleInfo.createTimeStart != null">
AND a.CREATE_TIME <![CDATA[ >= ]]> #{sysRoleInfo.createTimeStart}
</if>
<if test="sysRoleInfo.createTimeEnd != null">
AND a.CREATE_TIME <![CDATA[ <= ]]> #{sysRoleInfo.createTimeEnd}
</if>
<if test="sysRoleInfo.updateBy != null and sysRoleInfo.updateBy.trim() != ''">
AND a.UPDATE_BY = #{sysRoleInfo.updateBy}
</if>
<if test="sysRoleInfo.updateTime != null">
AND a.UPDATE_TIME = #{sysRoleInfo.updateTime}
</if>
</if>
</sql>
<!--sysRoleInfo简单分页查询-->
<select id="getSysRoleInfoPage" resultMap="sysRoleInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_role_info a
<where>
a.delete_flag = 0
<include refid="sysRoleInfo_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<!-- 根据用户Id获取所有的角色的权限-->
<select id="getAllRoleDataAuthByUserId" resultType="java.lang.String">
SELECT
a.data_auth
FROM sys_role_info a
left join sys_user_role_res r on r.role_id = a.fd_id
where a.delete_flag = 0 and r.user_id = #{userId}
</select>
<!-- 根据角色Id获取所有的角色的权限-->
<select id="getRoleDataAuthByRoleId" resultType="java.lang.String">
SELECT
a.data_auth
FROM sys_role_info a
where a.delete_flag = 0 and a.fd_id in
<foreach item="idStr" index="index" collection="roleIdList" open="(" separator="," close=")">
#{idStr}
</foreach>
</select>
<!-- 查找名称是否存在-->
<select id="checkExistenceRole" resultType="java.lang.Integer">
SELECT
count(1)
FROM sys_role_info a
where a.delete_flag = 0 and a.role_name = #{roleName}
<if test="roleId != null and roleId.trim() != ''">
AND a.fd_id != #{roleId}
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysRoleMenuResMapper">
<resultMap id="sysRoleMenuResMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes">
<id property="fdId" column="fd_id"/>
<result property="roleId" column="role_id"/>
<result property="menuId" column="menu_id"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
a.role_id,
a.menu_id
</sql>
<sql id="sysRoleMenuRes_where">
<if test="sysRoleMenuRes != null">
<if test="sysRoleMenuRes.fdId != null and sysRoleMenuRes.fdId.trim() != ''">
AND a.fd_id = #{sysRoleMenuRes.fdId}
</if>
<if test="sysRoleMenuRes.roleId != null and sysRoleMenuRes.roleId.trim() != ''">
AND a.role_id = #{sysRoleMenuRes.roleId}
</if>
<if test="sysRoleMenuRes.menuId != null and sysRoleMenuRes.menuId.trim() != ''">
AND a.menu_id = #{sysRoleMenuRes.menuId}
</if>
</if>
</sql>
<!--sysRoleMenuRes简单分页查询-->
<select id="getSysRoleMenuResPage" resultMap="sysRoleMenuResMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_role_menu_res a
<where>
1=1
<include refid="sysRoleMenuRes_where"/>
</where>
</select>
<!-- 根据角色删除关联表 -->
<delete id="deleteByRoleId">
delete from sys_role_menu_res where role_id = #{roleId}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysUserInfoMapper">
<resultMap id="sysUserInfoMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo">
<id property="fdId" column="fd_id"/>
<result property="fdName" column="fd_name"/>
<result property="fdLoginName" column="fd_login_name"/>
<result property="fdLdapDn" column="fd_ldap_dn"/>
<result property="fdDeptName" column="fd_dept_name"/>
<result property="fdMobileNo" column="fd_mobile_no"/>
<result property="fdEmail" column="fd_email"/>
<result property="status" column="status"/>
<result property="roleNames" column="role_names"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
a.fd_name,
a.fd_login_name,
a.fd_ldap_dn,
a.fd_dept_name,
a.fd_mobile_no,
a.fd_email,
a.status,
GROUP_CONCAT(r.role_name ORDER BY r.create_time asc) as role_names,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
</sql>
<sql id="sysUserInfo_where">
<if test="sysUserInfo != null">
<if test="sysUserInfo.fdId != null and sysUserInfo.fdId.trim() != ''">
AND a.fd_id = #{sysUserInfo.fdId}
</if>
<if test="sysUserInfo.fdName != null and sysUserInfo.fdName.trim() != ''">
AND a.fd_name like concat('%',#{sysUserInfo.fdName},'%')
</if>
<if test="sysUserInfo.fdLoginName != null and sysUserInfo.fdLoginName.trim() != ''">
AND a.fd_login_name = #{sysUserInfo.fdLoginName}
</if>
<if test="sysUserInfo.fdLdapDn != null and sysUserInfo.fdLdapDn.trim() != ''">
AND a.fd_ldap_dn = #{sysUserInfo.fdLdapDn}
</if>
<if test="sysUserInfo.fdDeptName != null and sysUserInfo.fdDeptName.trim() != ''">
AND a.fd_dept_name like concat('%',#{sysUserInfo.fdDeptName},'%')
</if>
<if test="sysUserInfo.fdMobileNo != null and sysUserInfo.fdMobileNo.trim() != ''">
AND a.fd_mobile_no = #{sysUserInfo.fdMobileNo}
</if>
<if test="sysUserInfo.fdEmail != null and sysUserInfo.fdEmail.trim() != ''">
AND a.fd_email = #{sysUserInfo.fdEmail}
</if>
<if test="sysUserInfo.status != null">
AND a.status = #{sysUserInfo.status}
</if>
<if test="sysUserInfo.createBy != null and sysUserInfo.createBy.trim() != ''">
AND a.CREATE_BY = #{sysUserInfo.createBy}
</if>
<if test="sysUserInfo.createName != null and sysUserInfo.createName.trim() != ''">
AND a.CREATE_NAME = #{sysUserInfo.createName}
</if>
<if test="sysUserInfo.createTime != null">
AND a.CREATE_TIME = #{sysUserInfo.createTime}
</if>
<if test="sysUserInfo.updateBy != null and sysUserInfo.updateBy.trim() != ''">
AND a.UPDATE_BY = #{sysUserInfo.updateBy}
</if>
<if test="sysUserInfo.updateTime != null">
AND a.UPDATE_TIME = #{sysUserInfo.updateTime}
</if>
</if>
</sql>
<!--sysUserInfo简单分页查询-->
<select id="getSysUserInfoPage" resultMap="sysUserInfoMap">
SELECT
a.fd_id,
a.fd_name,
a.fd_login_name,
a.fd_ldap_dn,
a.fd_dept_name,
a.fd_mobile_no,
a.fd_email,
a.status,
a.role_names,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
from (
SELECT
<include refid="Base_Column_List"/>
FROM sys_user_info a
LEFT JOIN sys_user_role_res res on a.fd_id=res.user_id
LEFT JOIN sys_role_info r on res.role_id=r.fd_id and r.delete_flag = 0 and r.status = 0
<where>
1=1
<include refid="sysUserInfo_where"/>
</where>
GROUP BY a.fd_id
) a
<if test="sysUserInfo != null">
<if test="sysUserInfo.roleNames != null and sysUserInfo.roleNames.trim() != ''">
where a.role_names like concat('%',#{sysUserInfo.roleNames},'%')
</if>
</if>
order by a.CREATE_TIME desc
</select>
<!--list-->
<select id="getEkpUser" resultMap="sysUserInfoMap">
select e.fd_id,e.fd_name,p.fd_login_name,e.fd_ldap_dn
,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) AS fd_dept_name
,p.fd_mobile_no,p.fd_email
from sys_org_element e JOIN sys_org_person p on e.fd_id=p.fd_id
where e.fd_is_available = '1'
</select>
<!--list-->
<select id="getResAndRoleNameUserId" resultType="com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes">
SELECT
a.fd_id as fdId
,a.user_id as userId
,a.role_id as roleId
,r.role_name as roleName
FROM sys_user_role_res a
LEFT JOIN sys_role_info r on a.role_id=r.fd_id and r.delete_flag = 0 and r.status = 0
where a.user_id=#{userId}
</select>
<!--给EKP用的,获取列表是否全量的权限-->
<!--#全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)-->
<select id="getAuthByUserIdAndModelId" resultType="java.lang.Integer">
select
case
when a.data_auth is null then 0
when a.data_auth like "%0%" then 1
when a.data_auth like "%a%" and a.CUSTOMER_ID is not null then 1
when a.data_auth like "%b%" and a.BUSSINESS_ID is not null then 1
when a.data_auth like "%c%" and a.QUOTATION_ID is not null then 1
when a.data_auth like "%d%" and a.CONTRACT_ID is not null then 1
when a.data_auth like "%e%" and a.DOMAIN_ID is not null then 1
when a.data_auth like "%f%" and a.BU_ID is not null then 1
when a.data_auth like "%g%" and a.LINE_ID is not null then 1
when a.data_auth like "%h%" and a.INCOME_ID is not null then 1
else 2 end
from (
SELECT
GROUP_CONCAT(DISTINCT a.data_auth) as data_auth
,b.INCOME_ID
,b.CUSTOMER_ID
,b.CONTRACT_ID
,b.BUSSINESS_ID
,b.QUOTATION_ID
,b.DOMAIN_ID
,b.BU_ID
,b.LINE_ID
FROM
sys_menu b
join sys_role_menu_res m on b.id=m.menu_id
join sys_role_info a on m.role_id = a.fd_id
join sys_user_role_res r on r.role_id = a.fd_id
where a.delete_flag = 0 and a.status = 0 and b.DELETE_STATUS='1' and b.PERMISSION_STATUS='0'
and r.user_id = #{userId} and b.MODEL_ID=#{modelId}
) a
</select>
<select id="getUserByCodeOrLoginName" resultMap="sysUserInfoMap">
SELECT
a.fd_id,
a.fd_name,
a.fd_login_name,
a.fd_dept_name
FROM sys_user_info a
<where>
1=1 and a.status = 0
<if test="code != null and code != ''">
AND (a.fd_login_name like concat('%',#{code},'%') or a.fd_name like concat('%',#{code},'%'))
</if>
</where>
order by a.CREATE_TIME desc
</select>
</mapper>
<?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.yifu.cloud.plus.v1.permission.mapper.SysUserPermissionMapper">
<resultMap id="sysUserPermissionMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission">
<id property="id" column="ID"/>
<result property="empName" column="EMP_NAME"/>
<result property="empLoginName" column="EMP_LOGIN_NAME"/>
<result property="empDept" column="EMP_DEPT"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="name" column="NAME"/>
<result property="code" column="CODE"/>
<result property="isContains" column="IS_CONTAINS"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
<result property="deleteFlag" column="DELETE_FLAG"/>
<result property="createBy" column="CREATE_BY"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="sourceType" column="SOURCE_TYPE"/>
</resultMap>
<resultMap id="sysUserPermissionExportMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionExportVo">
<result property="empName" column="EMP_NAME"/>
<result property="empLoginName" column="EMP_LOGIN_NAME"/>
<result property="empDept" column="EMP_DEPT"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="name" column="NAME"/>
<result property="code" column="CODE"/>
<result property="isContains" column="IS_CONTAINS"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
</resultMap>
<resultMap id="nameAndCodeMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo">
<result property="name" column="name"/>
<result property="code" column="code"/>
<result property="domainId" column="domainId"/>
</resultMap>
<resultMap id="dictMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo">
<result property="id" column="id"/>
<result property="name" column="name"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.EMP_NAME,
a.EMP_LOGIN_NAME,
b.fd_dept_name as EMP_DEPT,
a.PERMISSION_TYPE,
a.NAME,
a.CODE,
a.IS_CONTAINS,
a.PERMISSION_STATUS,
a.DELETE_FLAG,
a.CREATE_TIME
</sql>
<sql id="sysUserPermission_where">
<if test="sysUserPermission != null">
<if test="sysUserPermission.idList != null">
AND a.id in
<foreach item="idStr" index="index" collection="sysUserPermission.idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
<if test="sysUserPermission.idList == null">
<if test="sysUserPermission.empName != null and sysUserPermission.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{sysUserPermission.empName},'%')
</if>
<if test="sysUserPermission.empLoginName != null and sysUserPermission.empLoginName.trim() != ''">
AND a.EMP_LOGIN_NAME = #{sysUserPermission.empLoginName}
</if>
<if test="sysUserPermission.empDept != null and sysUserPermission.empDept.trim() != ''">
AND b.fd_dept_name like concat('%',#{sysUserPermission.empDept},'%')
</if>
<if test="sysUserPermission.permissionType != null and sysUserPermission.permissionType.trim() != ''">
AND a.PERMISSION_TYPE = #{sysUserPermission.permissionType}
</if>
<if test="sysUserPermission.name != null and sysUserPermission.name.trim() != ''">
AND a.NAME like concat('%',#{sysUserPermission.name},'%')
</if>
<if test="sysUserPermission.code != null and sysUserPermission.code.trim() != ''">
AND a.CODE = #{sysUserPermission.code}
</if>
<if test="sysUserPermission.permissionStatus != null and sysUserPermission.permissionStatus.trim() != ''">
AND a.PERMISSION_STATUS = #{sysUserPermission.permissionStatus}
</if>
</if>
</if>
</sql>
<!--sysUserPermission简单分页查询-->
<select id="getSysUserPermissionPage" resultMap="sysUserPermissionMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_user_permission a left join sys_user_info b on a.user_id = b.fd_id
<where>
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<select id="userSelectCount" resultType="java.lang.Long">
SELECT
count(1)
FROM sys_user_permission a left join sys_user_info b on a.user_id = b.fd_id
<where>
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
</select>
<select id="userSelectList" resultMap="sysUserPermissionExportMap">
SELECT
a.EMP_NAME,
a.EMP_LOGIN_NAME,
b.fd_dept_name as EMP_DEPT,
c.name AS PERMISSION_TYPE,
a.NAME,
a.CODE,
CASE WHEN a.IS_CONTAINS=0 THEN "是"
WHEN a.IS_CONTAINS =1 THEN "否"
ELSE a.IS_CONTAINS END as IS_CONTAINS,
CASE WHEN a.PERMISSION_STATUS=0 THEN "启用"
WHEN a.PERMISSION_STATUS =1 THEN "禁用"
ELSE a.PERMISSION_STATUS END as PERMISSION_STATUS
FROM sys_user_permission a
LEFT JOIN permission_type c on a.PERMISSION_TYPE = c.id
LEFT JOIN sys_user_info b on a.user_id = b.fd_id
<where>
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
limit #{sysUserPermission.limitStart},#{sysUserPermission.limitEnd}
</select>
<select id="selectUnitVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3a9d1d4d438bfc code,a.fd_3a9d1d4caeeeb8 name
from ekp_05b7485fd444f95a6177 a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3a9d1d4d438bfc like concat('%',#{name},'%') or a.fd_3a9d1d4caeeeb8 like concat('%',#{name},'%'))
</if>
</select>
<select id="selectContractVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3ade33763baa0e code,a.fd_3ade334bac0016 name
from ekp_0103c453b2848c3bb31c a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3ade33763baa0e like concat('%',#{name},'%') or a.fd_3ade334bac0016 like concat('%',#{name},'%'))
</if>
</select>
<select id="selectSettleVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3a37fe508071fe code,a.fd_3a2b38c61ef9aa name
from ekp_24a8e6a7fc143bb8c48a a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3a37fe508071fe like concat('%',#{name},'%') or a.fd_3a2b38c61ef9aa like concat('%',#{name},'%'))
</if>
</select>
<select id="selectContractSimpleVO" resultMap="nameAndCodeMap">
SELECT
a.NAME,
a.CODE
from sys_user_permission a
where a.EMP_LOGIN_NAME = #{loginName} and a.PERMISSION_TYPE = #{type} and a.PERMISSION_STATUS = '0'
<if test="name != null and name.trim() != ''">
AND (a.NAME like concat('%',#{name},'%') or a.CODE like concat('%',#{name},'%'))
</if>
</select>
<select id="selectBusinessVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3b107f1084fd96 code,a.fd_3b04b95268f19c name
from ekp_2f8e08660c542d8a169f a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3b107f1084fd96 like concat('%',#{name},'%') or a.fd_3b04b95268f19c like concat('%',#{name},'%'))
</if>
</select>
<select id="selectQuotationVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3b04b9dc64a9f4 code,a.fd_3b04b9d8688cfa name
from ekp_fd1449d265845e087bf2 a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3b04b9dc64a9f4 like concat('%',#{name},'%') or a.fd_3b04b9d8688cfa like concat('%',#{name},'%'))
</if>
</select>
<select id="selectDeptVO" resultMap="nameAndCodeMap">
SELECT
a.fd_no code,a.fd_name name,a.fd_id domainId
from sys_org_element a
where a.fd_is_available = '1' and a.fd_org_type = 2
<if test="name != null and name.trim() != ''">
AND (a.fd_no like concat('%',#{name},'%') or a.fd_name like concat('%',#{name},'%'))
</if>
</select>
<select id="selectTwoGsVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3b1235d8f35c6c name
from ekp_793f0c590104b7ebd460 a
where 1 = 1
<if test="name != null and name.trim() != ''">
AND a.fd_3b1235d8f35c6c like concat('%',#{name},'%')
</if>
</select>
<!-- 查找税务主体分页 -->
<select id="selectTaxVO" resultMap="nameAndCodeMap">
select a.fd_3afab4c6755286 AS name
from ekp_7e091e5e36848fb97451 a
where a.fd_3afab4c6755286 is not null
<if test="name != null and name.trim() != ''">
AND a.fd_3afab4c6755286 like concat('%',#{name},'%')
</if>
GROUP BY a.fd_3afab4c6755286 ORDER BY a.fd_3afab4c6755286 desc
</select>
<!--根据部门编码查询id-->
<select id="selectSettleByCode" resultType="java.lang.String">
SELECT
a.fd_id
from sys_org_element a
where a.fd_is_available = '1' and a.fd_org_type = 2 and a.fd_no = #{code}
limit 1
</select>
<select id="selectDictByType" resultMap="dictMap">
SELECT
a.dict_id as id,a.name
from permission_type a
where a.dict_type = #{type}
</select>
<select id="selectDictByTypeOne" resultMap="dictMap">
SELECT
a.dict_id as id,a.name
from permission_type a
where a.dict_type = #{type} and a.user_id = #{userId}
</select>
<!--针对BU归属和条线类型时的存在判断-->
<select id="selectDictByName" resultType="java.lang.Integer">
SELECT
count(1)
from permission_type a
where a.dict_type = #{type} and a.name = #{name}
</select>
<!--判断对应维度的名称或者编码是否存在-->
<select id="selectUnitCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_05b7485fd444f95a6177 a
where a.fd_3a9d1d4d438bfc = #{name}
</select>
<select id="selectContractCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_0103c453b2848c3bb31c a
where a.fd_3ade33763baa0e = #{name}
</select>
<select id="selectSettleCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_24a8e6a7fc143bb8c48a a
where a.fd_3a37fe508071fe = #{name}
</select>
<select id="selectBusinessCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_2f8e08660c542d8a169f a
where a.fd_3b107f1084fd96 = #{name}
</select>
<select id="selectQuotationCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_fd1449d265845e087bf2 a
where a.fd_3b04b9dc64a9f4 = #{name}
</select>
<select id="selectDeptCount" resultType="java.lang.Integer">
SELECT
count(1)
from sys_org_element a
where a.fd_is_available = '1' and fd_org_type = 2 and a.fd_no = #{name}
</select>
<select id="selectTwoGsCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_793f0c590104b7ebd460 a
where a.fd_3b1235d8f35c6c = #{name}
</select>
<select id="selectTaxCount" resultType="java.lang.Integer">
SELECT
count(1)
from ekp_7e091e5e36848fb97451 a
where a.fd_3afab4c6755286 = #{name}
</select>
<!-- 查找当前用户的所有权限 -->
<select id="getUserPermissionByUserId" resultMap="sysUserPermissionMap">
select
p.PERMISSION_TYPE,p.NAME,p.CODE,ifnull(p.IS_CONTAINS,'1') IS_CONTAINS
from
sys_user_permission p
where p.DELETE_FLAG='1' and p.PERMISSION_STATUS='0'
and p.USER_ID = #{userId}
ORDER BY p.PERMISSION_TYPE
</select>
<!-- 查找权限,用来新建 - 客户 -->
<select id="getUserPermissionByAutoCreateKH" resultMap="sysUserPermissionMap">
select
e.fd_name EMP_NAME ,p.fd_login_name EMP_LOGIN_NAME ,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'1' PERMISSION_TYPE ,d.fd_3a9d1d4caeeeb8 NAME ,d.fd_3a9d1d4d438bfc CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS ,'0' PERMISSION_STATUS ,'1' DELETE_FLAG ,e.fd_id USER_ID ,d.fd_id DOMAIN_ID
from ekp_fa3e25a1b6c472683e96 d
LEFT JOIN ekp_c472683e96_8b4d79b2c8 f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.fd_3b118b5e5d1024
JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId} GROUP BY e.fd_id
</select>
<!-- 查找权限,用来新建 - 商机 -->
<select id="getUserPermissionByAutoCreateSJ" resultMap="sysUserPermissionMap">
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'2' PERMISSION_TYPE,d.fd_3b04b95268f19c NAME,d.fd_3b107f1084fd96 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_24385b8cc934eb8a9231 d
LEFT JOIN ekp_34eb8a9231_8c4fb81d42 f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.fd_3b0e8c7f169ed2
JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId} GROUP BY e.fd_id
</select>
<!-- 查找权限,用来新建 - 报价单 -->
<select id="getUserPermissionByAutoCreateBJD" resultMap="sysUserPermissionMap">
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'3' PERMISSION_TYPE,d.fd_3b04b9d8688cfa NAME,d.fd_3b04b9dc64a9f4 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_fd06fd1251d4bac8cc91 d
LEFT JOIN ekp_d4bac8cc91_8aad2804b4 f1 on f1.fd_parent_id = d.fd_id
LEFT JOIN ekporg_18308def06b6c534b70e f on f.fd_parent_id = f1.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.sys_org_person_id JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId} GROUP BY e.fd_id
</select>
<!-- 查找权限,用来新建 - 合同 -->
<select id="getUserPermissionByAutoCreateHT" resultMap="sysUserPermissionMap">
select a.EMP_NAME,a.EMP_LOGIN_NAME,a.EMP_DEPT,a.PERMISSION_TYPE,a.NAME,a.CODE,a.SOURCE_TYPE,a.IS_CONTAINS,a.PERMISSION_STATUS,a.DELETE_FLAG,a.USER_ID,a.DOMAIN_ID
from (
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'4' PERMISSION_TYPE,d.fd_3ad97ed761c75c NAME,d.fd_3ade319226ed52 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_4834ce2ea964f1a8cfdb d
LEFT JOIN ekporg_183823dc7ae199aa37e9 f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.sys_org_person_id JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
union ALL
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'4' PERMISSION_TYPE,d.fd_3ad97ed761c75c NAME,d.fd_3ade319226ed52 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_4834ce2ea964f1a8cfdb d
LEFT JOIN sys_org_element e on e.fd_id = d.fd_3ade318b64b54c
JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
) a GROUP BY a.USER_ID
</select>
<!-- 查找权限,用来新建 - 项目 -->
<select id="getUserPermissionByAutoCreateXM" resultMap="sysUserPermissionMap">
select a.EMP_NAME,a.EMP_LOGIN_NAME,a.EMP_DEPT,a.PERMISSION_TYPE,a.NAME,a.CODE,a.SOURCE_TYPE,a.IS_CONTAINS,a.PERMISSION_STATUS,a.DELETE_FLAG,a.USER_ID,a.DOMAIN_ID
from (
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'5' PERMISSION_TYPE,d.fd_3a829ae9bab760 NAME,d.fd_3a829aea0b84a4 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_fb3b8d0c8f148639b8e2 d
LEFT JOIN ekporg_1832fea7d722404c1e92 f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.sys_org_person_id JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
union ALL
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'5' PERMISSION_TYPE,d.fd_3a829ae9bab760 NAME,d.fd_3a829aea0b84a4 CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_fb3b8d0c8f148639b8e2 d
LEFT JOIN sys_org_element e on e.fd_id = d.fd_3ae55447e30d62
JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
) a GROUP BY a.USER_ID
</select>
<!-- 查找权限,用来新建 - 合同变更 -->
<select id="getUserPermissionByAutoCreateHTBG" resultMap="sysUserPermissionMap">
select a.EMP_NAME,a.EMP_LOGIN_NAME,a.EMP_DEPT,a.PERMISSION_TYPE,a.NAME,a.CODE,a.SOURCE_TYPE,a.IS_CONTAINS,a.PERMISSION_STATUS,a.DELETE_FLAG,a.USER_ID,a.DOMAIN_ID
from (
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'4' PERMISSION_TYPE,d.fd_3b8797876dc13c_text NAME,d.fd_3b879793d37afe CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_224c54af6ae4418ae0a2 d
LEFT JOIN ekporg_186a02b160aa59dd70f4 f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.sys_org_person_id JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
union all
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'4' PERMISSION_TYPE,d.fd_3b8797876dc13c_text NAME,d.fd_3b879793d37afe CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_224c54af6ae4418ae0a2 d
left join ekp_0103c453b2848c3bb31c h on d.fd_3b879793d37afe=h.fd_3ade33763baa0e
LEFT JOIN sys_org_element e on e.fd_id = h.fd_3ade318b64b54c JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
) a
GROUP BY a.USER_ID
</select>
<!-- 查找权限,用来新建 - 项目变更 -->
<select id="getUserPermissionByAutoCreateXMBG" resultMap="sysUserPermissionMap">
select a.EMP_NAME,a.EMP_LOGIN_NAME,a.EMP_DEPT,a.PERMISSION_TYPE,a.NAME,a.CODE,a.SOURCE_TYPE,a.IS_CONTAINS,a.PERMISSION_STATUS,a.DELETE_FLAG,a.USER_ID,a.DOMAIN_ID
from (
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'5' PERMISSION_TYPE,d.fd_3b8797876dc13c_text NAME,d.fd_3b879793d37afe CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_d701e3e72794ff390ca8 d
LEFT JOIN ekporg_18622320f73771d520db f on f.fd_parent_id = d.fd_id
LEFT JOIN sys_org_element e on e.fd_id = f.sys_org_person_id JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
union all
select
e.fd_name EMP_NAME,p.fd_login_name EMP_LOGIN_NAME,SUBSTRING_INDEX(SUBSTRING_INDEX(e.fd_ldap_dn,',ou', 2),',ou=', -1) EMP_DEPT
,'5' PERMISSION_TYPE,d.fd_3b8797876dc13c_text NAME,d.fd_3b879793d37afe CODE,0 SOURCE_TYPE
,'1' IS_CONTAINS,'0' PERMISSION_STATUS,'1' DELETE_FLAG,e.fd_id USER_ID,d.fd_id DOMAIN_ID
from ekp_d701e3e72794ff390ca8 d
LEFT JOIN ekp_24a8e6a7fc143bb8c48a f on f.fd_3a37fe508071fe = d.fd_3b879793d37afe
LEFT JOIN sys_org_element e on e.fd_id = f.fd_3b212a2d7a65c6 JOIN sys_org_person p on e.fd_id=p.fd_id
where d.fd_id = #{fdId}
) a GROUP BY a.USER_ID
</select>
<!-- 查找fdId对应的code -->
<select id="selectCodeByFdId" resultType="java.lang.String">
select d.fd_3a9d1d4d438bfc CODE from ekp_fa3e25a1b6c472683e96 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b107f1084fd96 CODE from ekp_24385b8cc934eb8a9231 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b04b9dc64a9f4 CODE from ekp_fd06fd1251d4bac8cc91 d where d.fd_id = #{fdId}
union ALL
select d.fd_3ade319226ed52 CODE from ekp_4834ce2ea964f1a8cfdb d where d.fd_id = #{fdId}
union ALL
select d.fd_3a829aea0b84a4 CODE from ekp_fb3b8d0c8f148639b8e2 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b879793d37afe CODE from ekp_d701e3e72794ff390ca8 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b879793d37afe CODE from ekp_224c54af6ae4418ae0a2 d where d.fd_id = #{fdId}
limit 1
</select>
<!-- 删除EKP新建的 -->
<delete id="deleteUserPermissionByIdAndType">
delete from sys_user_permission p
where SOURCE_TYPE = 0 and CODE = #{code} and PERMISSION_TYPE = #{permissionType}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.permission.mapper.SysUserRoleResMapper">
<resultMap id="sysUserRoleResMap" type="com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes">
<id property="fdId" column="fd_id"/>
<result property="userId" column="user_id"/>
<result property="roleId" column="role_id"/>
</resultMap>
<sql id="Base_Column_List">
a.fd_id,
a.user_id,
a.role_id
</sql>
<sql id="sysUserRoleRes_where">
<if test="sysUserRoleRes != null">
<if test="sysUserRoleRes.fdId != null and sysUserRoleRes.fdId.trim() != ''">
AND a.fd_id = #{sysUserRoleRes.fdId}
</if>
<if test="sysUserRoleRes.userId != null and sysUserRoleRes.userId.trim() != ''">
AND a.user_id = #{sysUserRoleRes.userId}
</if>
<if test="sysUserRoleRes.roleId != null and sysUserRoleRes.roleId.trim() != ''">
AND a.role_id = #{sysUserRoleRes.roleId}
</if>
</if>
</sql>
<!--sysUserRoleRes简单分页查询-->
<select id="getSysUserRoleResPage" resultMap="sysUserRoleResMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_user_role_res a
<where>
1=1
<include refid="sysUserRoleRes_where"/>
</where>
</select>
<!--sysUserRoleRes简单分页查询-->
<select id="getSysUserByRoleId" resultType="java.lang.String">
SELECT
DISTINCT u.fd_name
FROM sys_user_role_res a
join sys_user_info u on a.user_id=u.fd_id
where a.role_id = #{roleId}
</select>
<!-- 根据账号删除关联表 -->
<delete id="deleteByUserId">
delete from sys_user_role_res where user_id = #{userId}
</delete>
<!-- 根据角色删除关联表 -->
<delete id="deleteByRoleId">
delete from sys_user_role_res where role_id = #{roleId}
</delete>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment