<?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.backendsys.mapper.System.SysResourcePointsMapper">

    <sql id="includeResourcePoints">
        id,
        sign,
        resource_type,
        resource_tag,
        resource_name,
        COALESCE(resource_description, '') resource_description,
        COALESCE(resource_unit, '') resource_unit,
        resource_points,
        status
    </sql>

    <resultMap id="resultMapResourcePoints" type="java.util.LinkedHashMap">
        <id property="id" column="id" jdbcType="BIGINT" />
        <result property="sign" column="sign" javaType="java.lang.Integer"/>
        <result property="resource_type" column="resource_type" />
        <result property="resource_tag" column="resource_tag" />
        <result property="resource_name" column="resource_name" />
        <result property="resource_description" column="resource_description" />
        <result property="resource_unit" column="resource_unit" />
        <result property="resource_points" column="resource_points" javaType="java.lang.Float"/>
        <result property="status" column="status" javaType="java.lang.Integer"/>
    </resultMap>

    <!-- 查询 列表 -->
    <select id="queryResourcePointsList" resultMap="resultMapResourcePoints">
        SELECT <include refid="includeResourcePoints" />
        FROM sys_resource_points
        <where>
            <if test="resource_type != null and resource_type != ''">
                AND resource_type = #{resource_type}
            </if>
            <if test="resource_tag != null and resource_tag != ''">
                AND resource_tag = #{resource_tag}
            </if>
            <if test="status != null and status != ''">
                AND status = #{status}
            </if>
        </where>
    </select>

    <!-- 查询详情 -->
    <select id="queryResourcePointsDetail" resultType="com.backendsys.entity.System.SysResourcePointsDTO">
        SELECT <include refid="includeResourcePoints" />
        FROM sys_resource_points
        WHERE resource_type = #{resource_type} AND resource_tag = #{resource_tag}
    </select>


</mapper>