<?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.sundot.airport.ledger.mapper.ScoreDimensionMapper">

    <resultMap id="ScoreDimensionResult" type="com.sundot.airport.ledger.domain.ScoreDimension">
        <id     property="id"             column="id"/>
        <result property="name"           column="name"/>
        <result property="weight"         column="weight"/>
        <result property="baseScore"      column="base_score"/>
        <result property="sortOrder"      column="sort_order"/>
        <result property="status"         column="status"/>
        <result property="org"            column="org"/>
        <result property="dimRelationship" column="dim_relationship"/>
        <result property="remark"         column="remark"/>
        <result property="createBy"       column="create_by"/>
        <result property="createTime"     column="create_time"/>
        <result property="updateBy"       column="update_by"/>
        <result property="updateTime"     column="update_time"/>
    </resultMap>

    <sql id="selectVo">
        SELECT id, name, weight, base_score, sort_order, status, org,
               dim_relationship, remark,
               create_by, create_time, update_by, update_time
        FROM score_dimension
        WHERE del_flag = '0'
    </sql>

    <select id="selectList" parameterType="com.sundot.airport.ledger.domain.ScoreDimension"
            resultMap="ScoreDimensionResult">
        <include refid="selectVo"/>
        <if test="name != null and name != ''">AND name LIKE CONCAT('%', #{name}, '%')</if>
        <if test="status != null and status != ''">AND status = #{status}</if>
        <if test="org != null and org != ''">AND org = #{org}</if>
        <if test="dimRelationship != null and dimRelationship != ''">AND dim_relationship = #{dimRelationship}</if>
        ORDER BY sort_order ASC, id ASC
    </select>

</mapper>
