<?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="org.springblade.modules.guosen.pointsDetail.mapper.PointsDetailMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="pointsDetailResultMap" type="org.springblade.modules.guosen.pointsDetail.entity.PointsDetail">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="user_id" property="userId"/>
        <result column="points_value" property="pointsValue"/>
        <result column="type" property="type"/>
        <result column="relation_id" property="relationId"/>
    </resultMap>


    <select id="selectPointsDetailPage" resultType="org.springblade.modules.guosen.pointsDetail.vo.PointsDetailVO">
        select a.*,b.nick_name,b.avatar,b.phone
        from cyzh_points_detail as a
        left join cyzh_login_user as b on a.user_id=b.id
        where a.is_deleted = 0
        <if test="pointsDetail != null and pointsDetail != ''">
            <if test="pointsDetail.nickName != null and pointsDetail.nickName != ''">
                and b.nick_name like concat('%',#{pointsDetail.nickName},'%')
            </if>
            <if test="pointsDetail.phone !=null and pointsDetail.phone!=''">
                and b.phone like concat('%',#{pointsDetail.phone},'%')
            </if>
        </if>
    </select>

</mapper>
