<?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.dromara.zjk.mapper.ZjkCreditMapper">

    <select id="queryPointList" resultType="org.dromara.zjk.domain.vo.CreditShowVO">
        SELECT
        CAST(ze.create_time AS DATETIME) AS inTime,
        ze.work_unit,
        ze.duty AS duty,
        ze.contact,
        ze.expert_name,
        zpu.expert_id,
        lv.credit_name AS creditLv,
        zpu.ID AS ID,
        RANK ( ) OVER ( ORDER BY credit_count DESC ) AS RANK,
        zpu.credit_count AS creditCount
        FROM
        zjk_credit_user zpu
        inner JOIN zjk_expert ze ON zpu.expert_id = ze.expert_id
        inner JOIN zjk_credit_lv lv ON zpu.lv_id = lv.ID
        <where>
            1=1
            <if test="bo.startTime !=null ">
               and  ze.approval_time >= #{bo.startTime}
            </if>
            <if test="bo.endTime !=null ">
                and  ze.approval_time &lt;= #{bo.endTime}
            </if>
            <if test="bo.expertName != null and bo.expertName != ''">
                and ze.expert_name like '%' || #{bo.expertName} || '%'
            </if>
            <if test="bo.workUnit != null and bo.workUnit != ''">
                and ze.work_unit like '%' || #{bo.workUnit} || '%'
            </if>
            <if test="bo.credtieGe != null and bo.crediteLe != null ">
                and zpu.credit_count >= #{bo.credtieGe}
                and zpu.credit_count &lt;= #{bo.crediteLe}
            </if>
        </where>
        ORDER BY credit_count DESC

    </select>

</mapper>
