<?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.hzs.member.detail.mapper.CuMemberAuthorityMapper">

    <!--查询修改注册权限列表-->
    <select id="selectCuMemberAuthorityList" parameterType="com.hzs.member.param.CuMemberAuthorityParam"
            resultType="com.hzs.member.param.CuMemberAuthorityParam">
        select a.PK_ID,
        a.PK_MEMBER,
        a.AUTHORITY_TYPE,
        a.OLD_VALUE,
        a.NEW_VALUE,
        a.DEL_FLAG,
        a.PK_COUNTRY,
        a.CREATION_TIME,
        a.MODIFIED_TIME,
        a.PK_CREATOR,
        a.PK_MODIFIED,
        b.MEMBER_CODE as memberCode,
        b.MEMBER_NAME as memberName,
        c.USER_NAME as creator,
        c.NICK_NAME as nickName
        from CU_MEMBER_AUTHORITY a
        INNER JOIN CU_MEMBER b on a.PK_MEMBER=b.PK_ID
        INNER JOIN SYS_USER c on a.PK_CREATOR=c.USER_ID
        where a.DEL_FLAG = 0
        <if test="memberCode != null and memberCode != ''">
            AND b.MEMBER_CODE like '%' || #{memberCode} || '%'
        </if>
        <if test="memberName != null and memberName != ''">
            AND b.USER_NAME like '%' || #{memberName} || '%'
        </if>
        <if test="creator != null and creator != ''">
            AND c.USER_NAME like '%' || #{creator} || '%'
        </if>
        <if test="nickName != null and nickName != ''">
            AND c.NICK_NAME like '%' || #{nickName} || '%'
        </if>

        <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
            and a.CREATION_TIME &gt;= to_date(#{params.beginTime}, 'yyyy-mm-dd')
        </if>
        <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
            and a.CREATION_TIME &lt;= to_date(#{params.endTime} || ' 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
        </if>
        order by a.CREATION_TIME desc
    </select>

</mapper>
