1.1 需求分析 在商家后台,显示该商家的商品列表信息,如下图: 1.1 查询商家商品列表 1.1.1 后端代码 修改 pinyougou-shop-web 工程的 GoodsController.java 的 search 方法 [AppleScript] 纯文本查看 复制代码 @RequestMapping("/search")
public PageResult search(@RequestBody TbGoods goods, int page, int rows ){
//获取商家 ID String sellerId =
SecurityContextHolder.getContext().getAuthentication().getName();
//添加查询条件goods.setSellerId(sellerId);
return goodsService.findPage(goods, page, rows);
修改 pinyougou-sellergoods-service 工程 com.pinyougou.sellergoods.service.impl 的 findPage
方法,修改条件构建部分代码,将原来的模糊匹配修改为精确匹配
if(goods.getSellerId()!=null && goods.getSellerId().length()>0){
//criteria.andSellerIdLike("%"+goods.getSellerId()+"%"); criteria.andSellerIdEqualTo(goods.getSellerId());
} 1.1.1 前端代码 修改 goods.html. 引入 js [AppleScript] 纯文本查看 复制代码 <script type="text/javascript" src="../plugins/angularjs/angular.min.js"></script>
<!-- 分页组件开始 -->
<script src="../plugins/angularjs/pagination.js"></script>
<link rel="stylesheet" href="../plugins/angularjs/pagination.css">
<!-- 分页组件结束 -->
<script type="text/javascript" src="../js/base_pagination.js"></script>
<script type="text/javascript" src="../js/service/goodsService.js"></script> [AppleScript] 纯文本查看 复制代码 <script type="text/javascript" src="../js/service/itemCatService.js"></script>
<script type="text/javascript" src="../js/service/uploadService.js"></script>
<script type="text/javascript" src="../js/service/typeTemplateService.js"></script>
<script type="text/javascript" src="../js/controller/baseController.js"></script>
<script type="text/javascript" src="../js/controller/goodsController.js"></script> 添加指令 [AppleScript] 纯文本查看 复制代码 <tr ng-repeat="entity in list">
<td><input type="checkbox"></td>
<td>{{entity.id}}</td>
<td>{{entity.goodsName}}</td>
<td>{{entity.price}}</td>
<td>{{entity.category1Id}}</td>
<td>{{entity.category2Id}}</td>
<td>{{entity.category3Id}}</td>
<td>
{{entity.auditStatus}}
</td>
<td class="text-center">
<button type="button" class="btn bg-olive btn-xs">修改</button> [AppleScript] 纯文本查看 复制代码 </td>
</tr> 显示效果如下:
|