mirror of
https://github.com/jeecgboot/jeecg-boot.git
synced 2025-09-07 20:57:45 +00:00
@@ -161,6 +161,11 @@
|
||||
<select id="getSysDepartList" resultType="org.jeecg.modules.system.vo.SysDepartExportVo">
|
||||
SELECT id,depart_name,parent_id,depart_name_en,depart_order,description,org_category,org_code,mobile,fax,address,memo FROM sys_depart
|
||||
WHERE
|
||||
1=1
|
||||
<if test="null != tenantId and 0 != tenantId">
|
||||
AND tenant_id = #{tenantId}
|
||||
</if>
|
||||
AND
|
||||
<choose>
|
||||
<when test="parentId != null and parentId != ''">
|
||||
parent_id = #{parentId}
|
||||
@@ -169,9 +174,6 @@
|
||||
parent_id IS NULL OR parent_id=''
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="null != tenantId and 0 != tenantId">
|
||||
AND tenant_id = #{tenantId}
|
||||
</if>
|
||||
ORDER BY depart_order DESC
|
||||
</select>
|
||||
</mapper>
|
@@ -127,41 +127,41 @@
|
||||
</if>
|
||||
${pidField} as parentId
|
||||
from ${table}
|
||||
<where>
|
||||
<!-- 父ID条件 -->
|
||||
<if test="query == null">
|
||||
where
|
||||
<!-- 父ID条件 -->
|
||||
<if test="query == null">
|
||||
<choose>
|
||||
<when test="pid != null and pid != ''">
|
||||
${pidField} = #{pid}
|
||||
</when>
|
||||
<otherwise>
|
||||
(${pidField} = '' OR ${pidField} IS NULL)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<!-- 查询条件组装 -->
|
||||
<if test="query!= null">
|
||||
1 = 1
|
||||
<foreach collection="query.entrySet()" item="value" index="key" >
|
||||
<choose>
|
||||
<when test="pid != null and pid != ''">
|
||||
${pidField} = #{pid}
|
||||
<when test="key == 'tenant_id'">
|
||||
and tenant_id = #{value}
|
||||
</when>
|
||||
<otherwise>
|
||||
(${pidField} = '' OR ${pidField} IS NULL)
|
||||
and ${key} LIKE #{value}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<!-- 查询条件组装 -->
|
||||
<if test="query!= null">
|
||||
<foreach collection="query.entrySet()" item="value" index="key" >
|
||||
<choose>
|
||||
<when test="key == 'tenant_id'">
|
||||
and tenant_id = #{value}
|
||||
</when>
|
||||
<otherwise>
|
||||
and ${key} LIKE #{value}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<!-- 【issues/3709】自定义树查询条件没有处理父ID,没有树状结构了 -->
|
||||
<choose>
|
||||
<when test="pid != null and pid != ''">
|
||||
and ${pidField} = #{pid}
|
||||
</when>
|
||||
<otherwise>
|
||||
and (${pidField} = '' OR ${pidField} IS NULL)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
</foreach>
|
||||
<!-- 【issues/3709】自定义树查询条件没有处理父ID,没有树状结构了 -->
|
||||
<choose>
|
||||
<when test="pid != null and pid != ''">
|
||||
and ${pidField} = #{pid}
|
||||
</when>
|
||||
<otherwise>
|
||||
and (${pidField} = '' OR ${pidField} IS NULL)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 分页查询字典表数据,支持text或code模糊查询匹配【已加入SQL注入check】 -->
|
||||
|
@@ -28,16 +28,15 @@
|
||||
,icon
|
||||
,is_leaf
|
||||
FROM sys_permission
|
||||
<where>
|
||||
<choose>
|
||||
<when test="parentId != null and parentId != ''">
|
||||
AND parent_id = #{parentId,jdbcType=VARCHAR}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND parent_id is null
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
WHERE 1=1
|
||||
<choose>
|
||||
<when test="parentId != null and parentId != ''">
|
||||
AND parent_id = #{parentId,jdbcType=VARCHAR}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND parent_id is null
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 获取登录用户拥有的权限 -->
|
||||
|
@@ -4,16 +4,15 @@
|
||||
|
||||
<select id="listAllSysRole" resultType="org.jeecg.modules.system.entity.SysRole">
|
||||
SELECT * from sys_role
|
||||
<where>
|
||||
<if test="role.roleName!='' and role.roleName!=null">
|
||||
<bind name="bindKeyword" value="'%'+role.roleName+'%'"/>
|
||||
AND role_name like #{bindKeyword}
|
||||
</if>
|
||||
<if test="role.roleCode!='' and role.roleCode!=null">
|
||||
<bind name="bindRoleCode" value="'%'+role.roleCode+'%'"/>
|
||||
AND role_code like #{bindRoleCode}
|
||||
</if>
|
||||
</where>
|
||||
WHERE 1=1
|
||||
<if test="role.roleName!='' and role.roleName!=null">
|
||||
<bind name="bindKeyword" value="'%'+role.roleName+'%'"/>
|
||||
AND role_name like #{bindKeyword}
|
||||
</if>
|
||||
<if test="role.roleCode!='' and role.roleCode!=null">
|
||||
<bind name="bindRoleCode" value="'%'+role.roleCode+'%'"/>
|
||||
AND role_code like #{bindRoleCode}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user