<?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.hotent.portal.persistence.dao.PortalBizSystemAuthDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hotent.portal.model.PortalBizSystemAuth">
    <result column="ID_" property="id" />
    <result column="SYS_CODE_" property="sysCode" />
    <result column="SYS_NAME_" property="sysName" />
    <result column="MANAGER_ID_" property="managerId" />
    <result column="MANAGER_NAME_" property="managerName" />
    <result column="CREATE_TIME_" property="createTime" />
    <result column="CREATE_BY_" property="createBy" />
    <result column="CREATE_ORG_ID_" property="createOrgId" />
    <result column="IS_DELE_" property="isDele" />
    <result column="UPDATE_TIME_" property="updateTime" />
    <result column="UPDATE_BY_" property="updateBy" />
    <result column="TENANT_ID_" property="tenantId" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        ID_, SYS_CODE_, SYS_NAME_, MANAGER_ID_, MANAGER_NAME_, CREATE_TIME_, CREATE_BY_, CREATE_ORG_ID_, IS_DELE_, UPDATE_TIME_, UPDATE_BY_, TENANT_ID_
    </sql>

	<select id="selectPage" resultMap="BaseResultMap">
		select 
			<include refid="Base_Column_List"/> 
		from
			portal_biz_system_auth
		${ew.customSqlSegment}
	</select>
	
	<select id="selectList" resultMap="BaseResultMap">
		select 
			<include refid="Base_Column_List"/> 
		from
			portal_biz_system_auth
		${ew.customSqlSegment}
	</select>
	
	<select id="selectById" resultMap="BaseResultMap">
		select 
			<include refid="Base_Column_List"/> 
		from
			portal_biz_system_auth
		where 
	</select>


    <select id="selectBizSystemAuth" resultType="com.hotent.portal.model.PortalBizSystemAuth">
		SELECT a.ID_,
			   a.SYS_CODE_,
			   a.SYS_NAME_,
			   a.MANAGER_ID_,
			   a.MANAGER_NAME_,
			   a.CREATE_TIME_,
			   a.CREATE_BY_,
			   a.CREATE_ORG_ID_,
			   a.IS_DELE_,
			   a.UPDATE_TIME_,
			   a.UPDATE_BY_,
			   a.TENANT_ID_ ,
			   a.ACCOUNT_
		FROM
			portal_biz_system_auth a
		WHERE(
			a.SYS_CODE_ = #{sysCode}
				AND a.IS_DELE_ = '0'
			    <if test="managerName!= null">
					AND (a.MANAGER_NAME_ LIKE '%${managerName}%'
					OR a.account_ LIKE '%${account}%')
				</if>
			    <if test="isAdmin == false">
					AND a.CREATE_BY_=#{curUserId}
				</if>
			)
	</select>
</mapper>
