<?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.system.config.mapper.BdAwardsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.system.config.BdAwards">
        <id column="PK_ID" property="pkId"/>
        <result column="DEL_FLAG" property="delFlag"/>
        <result column="PK_COUNTRY" property="pkCountry"/>
        <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="IMAGE" property="image"/>
        <result column="AWARDS_NAME" property="awardsName"/>
        <result column="PK_TRANSACTION" property="pkTransaction"/>
        <result column="AWARDS_VALUE" property="awardsValue"/>
        <result column="COMMUNITY_CHECK" property="communityCheck"/>
        <result column="ALGEBRA" property="algebra"/>
        <result column="PURCHASE_CHECK" property="purchaseCheck"/>
        <result column="SHARE_CHECK" property="shareCheck"/>
        <result column="GLOBAL_INTEGRAL" property="globalIntegral"/>
        <result column="CAR_AWARD_POINTS" property="carAwardPoints"/>
        <result column="ENABLE_STATE" property="enableState"/>
        <result column="TEXT_CONTENT" property="textContent"/>
        <result column="SYSTEM_TYPE" property="systemType"/>
    </resultMap>

    <!--   查询等级或奖衔是否被使用-->
    <select id="checkGradeAwards"
            parameterType="java.lang.Integer"
            resultType="java.lang.Integer">
        select count(1) from CU_MEMBER
        WHERE
        DEL_FLAG = 0 and (
        <if test="pkRegisterGrade != null ">
            PK_REGISTER_GRADE = #{pkRegisterGrade}
        </if>
        <if test="pkSettleGrade != null ">
            or PK_SETTLE_GRADE = #{pkSettleGrade}
        </if>
        <if test="pkAwards != null ">
            PK_AWARDS = #{pkAwards}
        </if>
        )
    </select>


</mapper>
