TTTTTHY 2018-12-18 16:27 采纳率: 33.3%
浏览 980

请问如何在前台实现模糊查询

需要在前台加一个单选框,默认不勾选为精准查找,用=,勾选为模糊查询,用like,请问如何在前台实现

<input id="isAmbiguous" style="width: 16px;height: 16px" name="xxxxxFilter.isAmbiguous"  type="checkbox" onchange="xxxxx方法()"/><font color="red" size="4px" font-weight="bold" >模糊查询</font>

我的sql是否需要改

<![CDATA[ 
        select distinct 
            cust.cust_uuid,
            cust.cust_phone,
            cust.cust_name,
            cust.gender,
            car.license_plate,
            car.vin,
            sa1.name as owerd_Sa,
            cust.last_time,
            cust.is_active,
            hr1.br_name as cust_Record_Br_Name,
            hr1.br_code as cust_Record_Br_Code,
            hr2.br_code as car_Record_Br_Name,
            hr2.br_name as car_Record_Br_Code,
            hr3.br_name as owerd_Br_Name,
            hr3.br_code as owerd_Br_Code,
            sa.name as last_Sa,
            hr4.br_name as last_Br
                from 
            cust_cust_info cust
            left join hr_branches hr1 on cust.record_br_uuid = hr1.br_uuid 
            left join sys_account sa1 on cust.owed_sa_uuid = sa1.account_id
            left join hr_branches hr3 on cust.owed_br_uuid = hr3.br_uuid
            ,
            cust_car_info car 
            left join hr_branches hr2 on car.record_br_uuid =hr2.br_uuid 
            left join sys_account sa on car.last_sa_uuid = sa.account_id
            left join hr_branches hr4 on car.last_serv_br_uuid = hr4.br_uuid
            where cust.is_active ='Y' and car.is_active='Y'
            and cust.cust_uuid =car.cust_uuid       
    ]]>
                <isNotNull prepend="AND" property="licensePlate">
                    CAR.LICENSE_PLATE like '%'||#licensePlate#||'%'                 
                </isNotNull>
                    <isNotNull prepend="AND" property="custPhone">
                    CUST.CUST_PHONE like '%'||#custPhone#||'%'                      
                </isNotNull>
                <isNotNull prepend="AND" property="custName">
                    CUST.CUST_NAME like '%'||#custName#||'%'                    
                </isNotNull>
                <isNotNull prepend="AND" property="vin">
                    car.vin like '%'||#vin#||'%'                    
                </isNotNull>
                <isNotNull prepend="AND" property="searchField">
                    (
                        CUST.cust_phone like '%' || #searchField# || '%' 
                        or (CUST.CUST_NAME_PY like #searchField#   or lower(CUST.CUST_NAME) like #searchField# ) 
                        or CUST.license_plate like '%' || #searchField# || '%'
                        or car.vin like '%' || #searchField# || '%'
                    )                       
                </isNotNull>

  • 写回答

3条回答 默认 最新

  • o(╯□╰)o ! 2018-12-18 08:42
    关注

    checkbox的值传到后台,sql判断值是true还是false,true就用like

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料