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);
}
// 创建时间
// String createtime=request.getParameter("createtime");
// if(StringUtils.isNotBlank("createtime")){
// // 拆分
// String[] aa= createtime.split(",");
// qmap.put("createtime","between "+aa[0]+" and "+aa[1]);
// }
String createtime=request.getString("createtime");
if(StringUtils.isNotBlank("createtime")){
JSONArray jarr = JSONArray.parseArray(createtime);
// 拆分
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");
if(StringUtils.isNotBlank(entrust_status)){

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

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

Loading…
Cancel
Save