<?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.transport.mapper.CreditScoreQuantificationMapper">

    <resultMap id="creditScoreQuantificationResultMap" type="org.springblade.transport.pojo.vo.CreditScoreQuantificationVO">
        <result column="id" property="id"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="create_user_name" property="createUserName"/>
        <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="remark" property="remark"/>
        <result column="standard_description" property="standardDescription"/>
    </resultMap>

    <select id="selectCreditScoreQuantificationPage" resultMap="creditScoreQuantificationResultMap">
        SELECT
            csq.id,
            csq.tenant_id,
            csq.create_user,
            csq.create_dept,
            csq.create_time,
            cu.real_name AS create_user_name,
            csq.update_user,
            csq.update_time,
            csq.status,
            csq.is_deleted,
            csq.name,
            csq.remark,
            csq.standard_description
        FROM
            blade_credit_score_quantification csq
            LEFT JOIN blade_user cu ON cu.id = csq.create_user
        WHERE
            csq.is_deleted = 0
        <if test="quantification.name != null and quantification.name != ''">
            <bind name="nameLike" value="'%' + quantification.name + '%'"/>
            AND csq.name LIKE #{nameLike}
        </if>
        <if test="quantification.status != null">
            AND csq.status = #{quantification.status}
        </if>
        <if test="quantification.createTimeStart != null and quantification.createTimeStart != ''">
            AND csq.create_time &gt;= #{quantification.createTimeStart}
        </if>
        <if test="quantification.createTimeEnd != null and quantification.createTimeEnd != ''">
            AND csq.create_time &lt;= #{quantification.createTimeEnd}
        </if>
        ORDER BY csq.create_time DESC
    </select>

</mapper>
