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

    <resultMap id="feeItemResultMap" type="org.springblade.system.pojo.vo.FeeItemVO">
        <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="name" property="name"/>
        <result column="english_name" property="englishName"/>
    </resultMap>

    <select id="selectFeeItemPage" resultMap="feeItemResultMap">
        SELECT
            *
        FROM
            blade_fee_item
        WHERE
            is_deleted = 0
        <if test="feeItem.name != null and feeItem.name != ''">
            <bind name="nameLike" value="'%' + feeItem.name + '%'"/>
            AND name LIKE #{nameLike}
        </if>
        <if test="feeItem.englishName != null and feeItem.englishName != ''">
            <bind name="englishNameLike" value="'%' + feeItem.englishName + '%'"/>
            AND english_name LIKE #{englishNameLike}
        </if>
        <if test="feeItem.status != null">
            AND status = #{feeItem.status}
        </if>
        ORDER BY update_time DESC, create_time DESC
    </select>

</mapper>
