<?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.glxp.mipsdl.thirddao.ctqyy.VYpzsPlanInfoMapper">
    <select id="selectGroupedWithPagination" resultType="com.glxp.mipsdl.entity.ctqyy.VYpzsPlanInfo">
        SELECT CGDBH
        FROM V_YPZS_PLAN_INFO
        <where>
            <if test="udiwmsThrOrderRequest.billNo != null and udiwmsThrOrderRequest.billNo != ''
            and udiwmsThrOrderRequest.databaseProductName == 'Oracle' ">
                and  ( CGDBH like '%' || #{udiwmsThrOrderRequest.billNo} || '%' )
            </if>

            <if test="udiwmsThrOrderRequest.keyWords != null and udiwmsThrOrderRequest.keyWords != ''
            and udiwmsThrOrderRequest.databaseProductName == 'Oracle' ">
                and (CGDBH like '%' || #{udiwmsThrOrderRequest.keyWords} || '%'
                        )
            </if>
            <if test="udiwmsThrOrderRequest.fromCorpName != null and udiwmsThrOrderRequest.fromCorpName != ''
            and udiwmsThrOrderRequest.databaseProductName == 'Oracle' ">
                and (SCQYMC like '%' || #{udiwmsThrOrderRequest.fromCorpName} || '%'
                        )
            </if>


            <if test="udiwmsThrOrderRequest.billNo != null and udiwmsThrOrderRequest.billNo != ''
            and udiwmsThrOrderRequest.databaseProductName == 'MySQL' ">
                and  ( CGDBH like  concat('%', #{udiwmsThrOrderRequest.billNo}, '%'))
            </if>

            <if test="udiwmsThrOrderRequest.keyWords != null and udiwmsThrOrderRequest.keyWords != ''
            and udiwmsThrOrderRequest.databaseProductName == 'MySQL' ">
                and (CGDBH like concat('%', #{udiwmsThrOrderRequest.keyWords}, '%'))
                        )
            </if>
            <if test="udiwmsThrOrderRequest.fromCorpName != null and udiwmsThrOrderRequest.fromCorpName != ''
            and udiwmsThrOrderRequest.databaseProductName == 'MySQL' ">
                and (SCQYMC like concat('%', #{udiwmsThrOrderRequest.keyWords}, '%'))
                        )
            </if>
        </where>
        GROUP BY CGDBH
        ORDER BY CGDBH
    </select>
</mapper>
