mirror of https://github.com/jeecgboot/jeecg-boot
parent
c9b92decaf
commit
ee4ff35c90
|
@ -9,10 +9,7 @@
|
||||||
|
|
||||||
<!-- 根据权限sql查询数据集 20230904 内部写法,调用位置installAuthJdbc,暂不处理sql注入问题-->
|
<!-- 根据权限sql查询数据集 20230904 内部写法,调用位置installAuthJdbc,暂不处理sql注入问题-->
|
||||||
<select id="queryListWithPermission" parameterType="Object" resultType="org.jeecg.modules.demo.test.entity.JeecgDemo">
|
<select id="queryListWithPermission" parameterType="Object" resultType="org.jeecg.modules.demo.test.entity.JeecgDemo">
|
||||||
select * from demo
|
select * from demo where 1=1 ${permissionSql}
|
||||||
<where>
|
|
||||||
${permissionSql}
|
|
||||||
</where>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 查询所有符合前缀且有效字段 -->
|
<!-- 查询所有符合前缀且有效字段 -->
|
||||||
|
|
|
@ -161,6 +161,11 @@
|
||||||
<select id="getSysDepartList" resultType="org.jeecg.modules.system.vo.SysDepartExportVo">
|
<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
|
SELECT id,depart_name,parent_id,depart_name_en,depart_order,description,org_category,org_code,mobile,fax,address,memo FROM sys_depart
|
||||||
WHERE
|
WHERE
|
||||||
|
1=1
|
||||||
|
<if test="null != tenantId and 0 != tenantId">
|
||||||
|
AND tenant_id = #{tenantId}
|
||||||
|
</if>
|
||||||
|
AND
|
||||||
<choose>
|
<choose>
|
||||||
<when test="parentId != null and parentId != ''">
|
<when test="parentId != null and parentId != ''">
|
||||||
parent_id = #{parentId}
|
parent_id = #{parentId}
|
||||||
|
@ -169,9 +174,6 @@
|
||||||
parent_id IS NULL OR parent_id=''
|
parent_id IS NULL OR parent_id=''
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
<if test="null != tenantId and 0 != tenantId">
|
|
||||||
AND tenant_id = #{tenantId}
|
|
||||||
</if>
|
|
||||||
ORDER BY depart_order DESC
|
ORDER BY depart_order DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -127,41 +127,41 @@
|
||||||
</if>
|
</if>
|
||||||
${pidField} as parentId
|
${pidField} as parentId
|
||||||
from ${table}
|
from ${table}
|
||||||
<where>
|
where
|
||||||
<!-- 父ID条件 -->
|
<!-- 父ID条件 -->
|
||||||
<if test="query == null">
|
<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>
|
<choose>
|
||||||
<when test="pid != null and pid != ''">
|
<when test="key == 'tenant_id'">
|
||||||
${pidField} = #{pid}
|
and tenant_id = #{value}
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
(${pidField} = '' OR ${pidField} IS NULL)
|
and ${key} LIKE #{value}
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</foreach>
|
||||||
<!-- 查询条件组装 -->
|
<!-- 【issues/3709】自定义树查询条件没有处理父ID,没有树状结构了 -->
|
||||||
<if test="query!= null">
|
<choose>
|
||||||
<foreach collection="query.entrySet()" item="value" index="key" >
|
<when test="pid != null and pid != ''">
|
||||||
<choose>
|
and ${pidField} = #{pid}
|
||||||
<when test="key == 'tenant_id'">
|
</when>
|
||||||
and tenant_id = #{value}
|
<otherwise>
|
||||||
</when>
|
and (${pidField} = '' OR ${pidField} IS NULL)
|
||||||
<otherwise>
|
</otherwise>
|
||||||
and ${key} LIKE #{value}
|
</choose>
|
||||||
</otherwise>
|
</if>
|
||||||
</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>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 分页查询字典表数据,支持text或code模糊查询匹配【已加入SQL注入check】 -->
|
<!-- 分页查询字典表数据,支持text或code模糊查询匹配【已加入SQL注入check】 -->
|
||||||
|
|
|
@ -28,16 +28,15 @@
|
||||||
,icon
|
,icon
|
||||||
,is_leaf
|
,is_leaf
|
||||||
FROM sys_permission
|
FROM sys_permission
|
||||||
<where>
|
WHERE 1=1
|
||||||
<choose>
|
<choose>
|
||||||
<when test="parentId != null and parentId != ''">
|
<when test="parentId != null and parentId != ''">
|
||||||
AND parent_id = #{parentId,jdbcType=VARCHAR}
|
AND parent_id = #{parentId,jdbcType=VARCHAR}
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
AND parent_id is null
|
AND parent_id is null
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 获取登录用户拥有的权限 -->
|
<!-- 获取登录用户拥有的权限 -->
|
||||||
|
|
|
@ -4,16 +4,15 @@
|
||||||
|
|
||||||
<select id="listAllSysRole" resultType="org.jeecg.modules.system.entity.SysRole">
|
<select id="listAllSysRole" resultType="org.jeecg.modules.system.entity.SysRole">
|
||||||
SELECT * from sys_role
|
SELECT * from sys_role
|
||||||
<where>
|
WHERE 1=1
|
||||||
<if test="role.roleName!='' and role.roleName!=null">
|
<if test="role.roleName!='' and role.roleName!=null">
|
||||||
<bind name="bindKeyword" value="'%'+role.roleName+'%'"/>
|
<bind name="bindKeyword" value="'%'+role.roleName+'%'"/>
|
||||||
AND role_name like #{bindKeyword}
|
AND role_name like #{bindKeyword}
|
||||||
</if>
|
</if>
|
||||||
<if test="role.roleCode!='' and role.roleCode!=null">
|
<if test="role.roleCode!='' and role.roleCode!=null">
|
||||||
<bind name="bindRoleCode" value="'%'+role.roleCode+'%'"/>
|
<bind name="bindRoleCode" value="'%'+role.roleCode+'%'"/>
|
||||||
AND role_code like #{bindRoleCode}
|
AND role_code like #{bindRoleCode}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue