Browse Source

修正商品按时间搜索bug

master
xyiege 4 years ago
parent
commit
170b8c1e33
  1. 12
      src/main/java/cn/chjyj/szwh/controller/admin/AdminGoodsController.java
  2. 16
      src/main/resources/mapper/szwh/GoodsMapper.xml

12
src/main/java/cn/chjyj/szwh/controller/admin/AdminGoodsController.java

@ -97,12 +97,12 @@ public class AdminGoodsController extends BaseController {
qmap.put("gd.goods_name",goods); qmap.put("gd.goods_name",goods);
} }
// 创建时间 // 创建时间
// String createtime=request.getParameter("createtime"); String createtime=request.getString("createtime");
// if(StringUtils.isNotBlank("createtime")){ if(StringUtils.isNotBlank("createtime")){
// // 拆分 JSONArray jarr = JSONArray.parseArray(createtime);
// String[] aa= createtime.split(","); // 拆分
// qmap.put("createtime","between "+aa[0]+" and "+aa[1]); qmap.put("createtime"," g.createtime between '"+jarr.get(0)+" 00:00:00' and '"+jarr.get(1)+" 23:59:59'");
// } }
// 委托状态 // 委托状态
String entrust_status = request.getString("entrust_status"); String entrust_status = request.getString("entrust_status");
if(StringUtils.isNotBlank(entrust_status)){ if(StringUtils.isNotBlank(entrust_status)){

16
src/main/resources/mapper/szwh/GoodsMapper.xml

@ -40,12 +40,15 @@
FROM <include refid="tbName"/> FROM <include refid="tbName"/>
<where> <where>
<foreach collection="map" item="v" index="k" separator="and"> <foreach collection="map" item="v" index="k" separator="and">
<if test="v != null and v != '' and k!='id'"> <if test="v != null and v != '' and k!='id' and k!='createtime'">
${k} = #{v} ${k} = #{v}
</if> </if>
<if test="k=='id'"> <if test="k=='id'">
${k}>#{v} ${k}>#{v}
</if> </if>
<if test="k=='createtime'">
${v}
</if>
</foreach> </foreach>
</where> </where>
limit #{limit} limit #{limit}
@ -63,7 +66,7 @@
<if test="map!=null"> <if test="map!=null">
<foreach collection="map" item="v" index="k" separator="and"> <foreach collection="map" item="v" index="k" separator="and">
<if test="v != null and v != '' and k!='orderway' and k!='id' <if test="v != null and v != '' and k!='orderway' and k!='id'
and k!='gd.goods_name' and k!='g.entrust_name'"> and k!='gd.goods_name' and k!='g.entrust_name' and k!='createtime'">
${k} = #{v} ${k} = #{v}
</if> </if>
<if test="k=='gd.goods_name'"> <if test="k=='gd.goods_name'">
@ -73,6 +76,9 @@
<if test="k=='g.entrust_name'"> <if test="k=='g.entrust_name'">
g.username like concat('%',#{v},'%') g.username like concat('%',#{v},'%')
</if> </if>
<if test="k=='createtime'">
${v}
</if>
</foreach> </foreach>
</if> </if>
</where> </where>
@ -91,7 +97,8 @@
<where> <where>
<if test="map!=null"> <if test="map!=null">
<foreach collection="map" item="v" index="k" separator="and"> <foreach collection="map" item="v" index="k" separator="and">
<if test="v != null and v != '' and k!='orderway' and k!='id' and k!='gd.goods_name' and k!='g.entrust_name'"> <if test="v != null and v != '' and k!='orderway' and k!='id' and k!='gd.goods_name'
and k!='g.entrust_name' and k!='createtime'">
${k} = #{v} ${k} = #{v}
</if> </if>
<if test="k=='gd.goods_name'"> <if test="k=='gd.goods_name'">
@ -101,6 +108,9 @@
<if test="k=='g.entrust_name'"> <if test="k=='g.entrust_name'">
g.username like concat('%',#{v},'%') g.username like concat('%',#{v},'%')
</if> </if>
<if test="k=='createtime'">
${v}
</if>
</foreach> </foreach>
</if> </if>
</where> </where>

Loading…
Cancel
Save