<?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.member.mapper.MemberMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="member_infoResultMap" type="org.springblade.modules.member.entity.MemberEntity">
        <result column="id" property="id"/>
        <result column="reg_ip" property="regIp"/>
        <result column="register_time" property="registerTime"/>
        <result column="audit_status" property="auditStatus"/>
        <result column="area_code" property="areaCode"/>
        <result column="address" property="address"/>
        <result column="household_address" property="householdAddress"/>
        <result column="phone" property="phone"/>
        <result column="tel" property="tel"/>
        <result column="sex" property="sex"/>
        <result column="birthday" property="birthday"/>
        <result column="email" property="email"/>
        <result column="nick_name" property="nickName"/>
        <result column="real_name" property="realName"/>
        <result column="login_count" property="loginCount"/>
        <result column="avator" property="avator"/>
        <result column="qrcode" property="qrcode"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="sort" property="sort"/>
        <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"/>
    </resultMap>

    <select id="getBirMemByDate" resultMap="member_infoResultMap">
        SELECT *
        FROM gr_member_info
        WHERE DATE_FORMAT(birthday,"%m-%d") <![CDATA[ >= ]]> DATE_FORMAT(#{startDate},"%m-%d")
        And DATE_FORMAT(birthday,"%m-%d") <![CDATA[ <= ]]> DATE_FORMAT(#{endDate},"%m-%d")
        AND is_deleted = '0'
        ORDER BY Format(birthday,"mmdd")
    </select>

    <select id="getTotalAdvances" resultType="java.math.BigDecimal">
        select COALESCE(sum(advances), 0)
        from gr_member_info
        where is_deleted = '0'
    </select>

</mapper>
