|
|
|
@ -9,6 +9,7 @@ import cn.chjyj.szwh.service.GoodsDetailService; |
|
|
|
import cn.chjyj.szwh.service.GoodsService; |
|
|
|
import cn.chjyj.szwh.service.UserService; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
@ -33,14 +34,80 @@ public class AdminGoodsController extends BaseController { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@RequestMapping("/list") |
|
|
|
public JSONObject list(@RequestParam(name = "page",defaultValue = "1") String page){ |
|
|
|
public JSONObject list(HttpServletRequest request){ |
|
|
|
// 查询条件
|
|
|
|
Map qmap = new HashMap(); |
|
|
|
|
|
|
|
//分页
|
|
|
|
String page = request.getParameter("page"); |
|
|
|
if(StringUtils.isBlank(page)){ |
|
|
|
page="1"; |
|
|
|
} |
|
|
|
int ipage=Integer.parseInt(page); |
|
|
|
List<Goods> goodsList = goodsService.getGoodsList(ipage); |
|
|
|
// convert to json
|
|
|
|
JSONObject jsonObject= new JSONObject(); |
|
|
|
// 查询
|
|
|
|
String limit = request.getParameter("limit"); |
|
|
|
int ilimit=(StringUtils.isBlank(limit))?10:Integer.valueOf(limit); |
|
|
|
|
|
|
|
int start= ipage>1?(ipage-1)*ilimit:0; |
|
|
|
qmap.put("id",start); |
|
|
|
|
|
|
|
// 委托编码
|
|
|
|
String islicode=request.getParameter("islicode"); |
|
|
|
if(!StringUtils.isBlank(islicode)){ |
|
|
|
qmap.put("islicode",islicode); |
|
|
|
} |
|
|
|
// 商品名称
|
|
|
|
String gname=request.getParameter("goods_name"); |
|
|
|
if(!StringUtils.isBlank(gname)){ |
|
|
|
qmap.put("goods_name",gname); |
|
|
|
} |
|
|
|
//
|
|
|
|
String entrust_name =request.getParameter("entrust_name"); |
|
|
|
if(StringUtils.isNotBlank(entrust_name)){ |
|
|
|
qmap.put("entrust_name",entrust_name); |
|
|
|
} |
|
|
|
|
|
|
|
//
|
|
|
|
String goods_entrust = request.getParameter("goods_entrust"); |
|
|
|
if(StringUtils.isNotBlank(goods_entrust)){ |
|
|
|
qmap.put("goods_entrust",goods_entrust); |
|
|
|
} |
|
|
|
//
|
|
|
|
String goods_type= request.getParameter("goods_type"); |
|
|
|
if(StringUtils.isNotBlank(goods_type)){ |
|
|
|
qmap.put("goods_type",goods_type); |
|
|
|
} |
|
|
|
//
|
|
|
|
String data_type= request.getParameter("data_type"); |
|
|
|
if (StringUtils.isNotBlank(data_type)) { |
|
|
|
qmap.put("data_type",data_type); |
|
|
|
} |
|
|
|
// 创建时间
|
|
|
|
// String createtime=request.getParameter("createtime");
|
|
|
|
// if(StringUtils.isNotBlank("createtime")){
|
|
|
|
// // 拆分
|
|
|
|
// String[] aa= createtime.split(",");
|
|
|
|
// qmap.put("createtime","between "+aa[0]+" and "+aa[1]);
|
|
|
|
// }
|
|
|
|
// 委托状态
|
|
|
|
String entrust_status = request.getParameter("entrust_status"); |
|
|
|
if(StringUtils.isNotBlank(entrust_status)){ |
|
|
|
qmap.put("entrust_status",entrust_status); |
|
|
|
} |
|
|
|
// 交易
|
|
|
|
String transaction = request.getParameter("transaction"); |
|
|
|
if(StringUtils.isNotBlank(transaction)){ |
|
|
|
qmap.put("transaction",transaction); |
|
|
|
} |
|
|
|
// 查询返回的结果
|
|
|
|
Map retmap = goodsService.getGoodsByMap(qmap,ilimit); |
|
|
|
retmap.put("start",start); |
|
|
|
retmap.put("curr_page",page); |
|
|
|
retmap.put("per_page",limit); |
|
|
|
// 结果
|
|
|
|
jsonObject.put("code",200); |
|
|
|
jsonObject.put("msg","成功"); |
|
|
|
jsonObject.put("data",goodsList); |
|
|
|
jsonObject.put("data",retmap); |
|
|
|
return jsonObject; |
|
|
|
} |
|
|
|
|
|
|
|
|