<?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.personal.mapper.CuPersonalServiceMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.member.personal.CuPersonalService">
        <id column="PK_ID" property="pkId" />
    <result column="PK_CREATOR" property="pkCreator" />
    <result column="CREATION_TIME" property="creationTime" />
    <result column="PK_MODIFIED" property="pkModified" />
    <result column="MODIFIED_TIME" property="modifiedTime" />
    <result column="DEL_FLAG" property="delFlag" />
    <result column="PK_COUNTRY" property="pkCountry" />
        <result column="TYPE" property="type" />
        <result column="STATUS" property="status" />
        <result column="MEMBER_CODE" property="memberCode" />
        <result column="CONTENT" property="content" />
        <result column="REJECT_INFO" property="rejectInfo" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        PK_CREATOR,
        CREATION_TIME,
        PK_MODIFIED,
        MODIFIED_TIME,
        DEL_FLAG,
        PK_COUNTRY,
        PK_ID, TYPE, STATUS, MEMBER_CODE, CONTENT, REJECT_INFO
    </sql>

    <select id="selectByList" resultType="com.hzs.member.personal.vo.PersonalServiceVo">
      select
        ps.PK_ID pkId,
             ps.MEMBER_CODE memberCode,
             ps.TYPE type ,
             ps.STATUS status ,
             ps.CONTENT content,
             ps.REJECT_INFO rejectInfo,
             ps.PK_COUNTRY pkCountry,
             ps.PK_CREATOR pkCreator,
             ps.CREATION_TIME creationTime,
             cm.MEMBER_NAME memberName from CU_PERSONAL_SERVICE ps
      left join CU_MEMBER cm on cm.MEMBER_CODE = ps.MEMBER_CODE
      where  ps.DEL_FLAG = 0
        <if test="memberCode != null and memberCode != ''">
            and ps.MEMBER_CODE = #{memberCode}
        </if>
        <if test="pkCountry != null">
            and ps.PK_COUNTRY = #{pkCountry}
        </if>
        <if test="type != null">
            and ps.type = #{type}
        </if>
        <if test="status != null">
            and ps.status = #{status}
        </if>
        <if test="startCreateDate != null">
            and ps.CREATION_TIME &gt;= #{startCreateDate}
        </if>
        <if test="endCreateDate != null">
            and ps.CREATION_TIME &lt;= #{endCreateDate}
        </if>
    </select>

</mapper>
