1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?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.persagy.account.mapper.SaasProductPageMapper">
-
- <resultMap id="BaseResultMap" type="com.persagy.account.pojo.dto.SaasProductPage">
- <result column="ID" property="id" jdbcType="VARCHAR" />
- <result column="PRODUCT_ID" property="productId" jdbcType="VARCHAR" />
- <result column="PARENT_ID" property="parentId" jdbcType="VARCHAR" />
- <result column="PAGE_NAME" property="pageName" jdbcType="VARCHAR" />
- <result column="PAGE_ICON" property="pageIcon" jdbcType="VARCHAR" />
- <result column="PAGE_URL" property="pageUrl" jdbcType="VARCHAR" />
- <result column="PAGE_ANGLE" property="pageAngle" jdbcType="VARCHAR" />
- <result column="PAGE_FLOOR" property="pageFloor" jdbcType="VARCHAR" />
- <result column="PAGE_LEVEL" property="pageLevel" jdbcType="INTEGER" />
- <result column="CREATE_TIME" property="createTime" jdbcType="DATE" />
- <result column="UPDATE_TIME" property="updateTime" jdbcType="DATE" />
- <result column="UPDATE_USER" property="updateUser" jdbcType="VARCHAR" />
- <result column="REMARK" property="remark" jdbcType="VARCHAR" />
- </resultMap>
-
- <sql id="Base_Sql_Column">
- ID, PRODUCT_ID, PARENT_ID, PAGE_NAME, PAGE_ICON, PAGE_URL, PAGE_ANGLE, PAGE_FLOOR, PAGE_LEVEL, CREATE_TIME, UPDATE_TIME, UPDATE_USER, REMARK
- </sql>
-
- <select id="queryGroupProductPages" resultMap="BaseResultMap">
- SELECT M.* FROM (SELECT ID FROM saas_group_product
- <where>
- <if test="groupCode != null and groupCode.trim().length() != 0">AND GROUP_CODE = #{groupCode}</if>
- <if test="productId != null and productId.trim().length() != 0">AND PRODUCT_ID = #{productId}</if>
- </where>) M JOIN saas_group_product_detail N ON M.ID = N.CONTRACT_ID
- JOIN (SELECT <include refid="Base_Sql_Column"></include> FROM saas_product_page
- <where>
- <if test="productId != null and productId.trim().length() != 0">AND PRODUCT_ID = #{productId}</if>
- <choose>
- <when test="angle != null and angle == '1'">AND PAGE_ANGLE IN ('0', '1')</when>
- <when test="angle != null and angle == '2'">AND PAGE_ANGLE IN ('0', '2')</when>
- </choose>
- </where>) P ON P.ID = N.PAGE_ID
- </select>
- <select id="queryProjectProductPages" resultMap="BaseResultMap">
- SELECT M.* FROM (SELECT ID FROM saas_project_product
- <where>
- <if test="groupCode != null and groupCode.trim().length() != 0">AND GROUP_CODE = #{groupCode}</if>
- <if test="projectId != null and projectId.trim().length() != 0">AND PROJECT_ID = #{projectId}</if>
- <if test="productId != null and productId.trim().length() != 0">AND PRODUCT_ID = #{productId}</if>
- </where>) M JOIN saas_group_product_detail N ON M.CONTRACT_ID = N.CONTRACT_ID
- JOIN (SELECT <include refid="Base_Sql_Column"></include> FROM saas_product_page
- <where>
- <if test="productId != null and productId.trim().length() != 0">AND PRODUCT_ID = #{productId}</if>
- <choose>
- <when test="angle != null and angle == '1'">AND PAGE_ANGLE IN ('0', '1')</when>
- <when test="angle != null and angle == '2'">AND PAGE_ANGLE IN ('0', '2')</when>
- </choose>
- </where>) P ON P.ID = N.PAGE_ID
- </select>
- <select id="queryAccountProductPages" resultMap="BaseResultMap">
- SELECT * FROM (SELECT <include refid="Base_Sql_Column"></include> FROM saas_product_page
- <where>
- <if test="productId != null and productId.trim().length() != 0">AND PRODUCT_ID = #{productId}</if>
- <if test="parentId != null and parentId.trim().length() != 0">AND PARENT_ID = #{parentId}</if>
- <choose>
- <when test="angle != null and angle == '1'">AND PAGE_ANGLE IN ('0', '1')</when>
- <when test="angle != null and angle == '2'">AND PAGE_ANGLE IN ('0', '2')</when>
- </choose>
- </where>) M
- <!-- JOIN 内容为权限过滤数据 -->
- JOIN (SELECT DISTINCT Q.PAGE_ID FROM (SELECT ROLE_ID FROM saas_account_role
- <where>
- <if test="accountId != null and accountId.trim().length() != 0">AND ACCOUNT_ID = #{accountId}</if>
- </where>) P
- JOIN (SELECT ROLE_ID, PAGE_ID FROM saas_role_menu
- <where>
- <if test="menuId != null and menuId.trim().length() != 0">AND MENU_ID = #{menuId}</if>
- </where>) Q ON P.ROLE_ID = Q.ROLE_ID) N ON M.ID = N.PAGE_ID
- </select>
-
- </mapper>
|