jsp万能搜索

<div class="panel panel-default">
				<div class="panel-heading">查询条件</div>
				<div class="panel-body">
					<form id="formSearch" class="form-horizontal">
						<div class="form-group" style="margin-top:15px">
							<label class="control-label col-sm-2" for="txt_search_departmentname">领用物资编号:</label>
							<div class="col-sm-2">
								<input type="text" id="lynumbering" class="form-control"/>
							</div>
							<label class="control-label col-sm-2">领取时间</label>
							<div class="col-sm-2">
								<input class="form-control" name="startTime" type="date" id="startTime">
							</div>
							<div class="col-sm-2">
								<input class="form-control" name="endTime" type="date" id="endTime">
							</div>
							<div class="col-sm-1" style="text-align:left;">
								<button type="button" id="search" class="btn btn-primary">查询</button>
							</div>
						</div>
					</form>
				</div>
			</div>
$(function(){
$("#search").click(function(){
				var start=$("#startTime").val();
				var end=$("#endTime").val();
				if(start!="" && end!=""){
					if(start>end){
						alert("请选择正确的日期!");
					}
				}else{
					$('#lythTab').bootstrapTable("refresh");	
				} 
			});
			$("#lynumbering").keyup(function(){
				var a=$("#lynumbering").val();
				if(a.length>0){
					$('#lythTab').bootstrapTable("refresh");
				}
				if(a==""){
					$('#lythTab').bootstrapTable("refresh");
				}
			});
);
<?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.hngg.goods.mapper.Custome_ReceiveSalesMapper">
	<select id="selectReceiveSales" resultMap="ReceiveSales_Map" parameterType="com.hngg.goods.dto.TSreceiveRecipientsOfWarehouseDto">
		SELECT grow.Material_Recipients_Id,grow.RW_Number,mr.Material_Recipients_Number,grow.RW_Time FROM T_goods_Recipients_Of_Warehouse grow
		INNER JOIN T_goods_Material_Recipients mr
		ON mr.Material_Recipients_Id=grow.Material_Recipients_Id
		<where>
			<if test="tsdto.lynumbering!=null and tsdto.lynumbering!=''">
				mr.Material_Recipients_Number  LIKE '%${tsdto.lynumbering}%'
				or
				grow.RW_Number LIKE '%${tsdto.lynumbering}%'
			</if>
			 <if test="tsdto.startTime!=null ">
    		 	and  grow.RW_Time &gt;=#{tsdto.startTime}
  			</if>
  			<if test="tsdto.endTime!=null ">
    			and  grow.RW_Time &lt;=#{tsdto.endTime}
  			</if>
		</where>
	</select>
	<resultMap id="ReceiveSales_Map" type="com.hngg.goods.vo.ReceiveSalesVo">
		<id column="Material_Recipients_Id" property="recipientsId" jdbcType="INTEGER" />
		<result column="RW_Number" property="rwNumber"  jdbcType="VARCHAR"/>
		<result column="Material_Recipients_Number" property="materialRecipientsNumber" jdbcType="VARCHAR"/>
		<result column="RW_Time" property="rmtime"  jdbcType="DATE"/>
	</resultMap>
</mapper>

猜你喜欢

转载自blog.csdn.net/weixin_44315761/article/details/90311462