<?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.base.mapper.CuMemberHonorWallMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.member.honor.CuMemberHonorWall">
        <id column="PK_ID" property="pkId" />
        <result column="PK_MEMBER" property="pkMember" />
        <result column="PK_HONOR_WALL" property="pkHonorWall" />
        <result column="SETTLE_MONTH" property="settleMonth" />
    </resultMap>
    <resultMap id="BaseResultExtMap" type="com.hzs.common.domain.member.ext.CuMemberHonorWallExt">
        <id column="PK_ID" property="pkId" />
        <result column="PK_MEMBER" property="pkMember" />
        <result column="PK_HONOR_WALL" property="pkHonorWall" />
        <result column="IMG" property="img" />
        <result column="TITLE" property="title" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        PK_ID, PK_MEMBER, PK_HONOR_WALL
    </sql>

    <select id="getByMemberHonorWall" resultMap="BaseResultExtMap">


        select hw.* from CU_HONOR_WALL hw where
        ( select count(mhw.pk_id) from CU_MEMBER_HONOR_WALL mhw where mhw.PK_HONOR_WALL = hw.PK_ID

        <if test="memberId != null">
            and mhw.PK_MEMBER = #{memberId}
        </if>
            ) > 0
    </select>

</mapper>
