Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3658143
  • 博文数量: 365
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2522
  • 用 户 组: 普通用户
  • 注册时间: 2019-10-28 13:40
文章分类

全部博文(365)

文章存档

2023年(8)

2022年(130)

2021年(155)

2020年(50)

2019年(22)

我的朋友

分类: Java

2022-11-09 13:52:51

/**

 * 订单

 * 后端接口

 * @author

 * @email

 * @date 2022-03-27 17:11:41

 */

@RestController

@RequestMapping("/orders")

public class OrdersController {

    @Autowired

    private OrdersService ordersService;

    /**

     * 后端列表

     */

    @RequestMapping("/page")

    public R page(@RequestParam Map params,OrdersEntity orders,

HttpServletRequest request){

     if(!request.getSession().getAttribute("role").toString().equals("管理员")) {

     orders.setUserid((Long)request.getSession().getAttribute("userId"));

     }

        EntityWrapper ew = new EntityWrapper();

PageUtils page = ordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));

 

        return R.ok().put("data", page);

    }

    /**

     * 前端列表

     */

    @RequestMapping("/list")

    public R list(@RequestParam Map params,OrdersEntity orders, HttpServletRequest request){

        EntityWrapper ew = new EntityWrapper();

PageUtils page = 外汇跟单gendan5.comordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));

        return R.ok().put("data", page);

    }

 /**

     * 查询

     */

    @RequestMapping("/query")

    public R query(OrdersEntity orders){

        EntityWrapper< OrdersEntity> ew = new EntityWrapper< OrdersEntity>();

  ew.allEq(MPUtil.allEQMapPre( orders, "orders"));

OrdersView ordersView =  ordersService.selectView(ew);

return R.ok("查询订单成功").put("data", ordersView);

    }

       /**

     * 前端详情

     */

    @RequestMapping("/detail/{id}")

    public R detail(@PathVariable("id") Long id){

        OrdersEntity orders = ordersService.selectById(id);

        return R.ok().put("data", orders);

    }

    /**

     * 前端保存

     */

    @RequestMapping("/add")

    public R add(@RequestBody OrdersEntity orders, HttpServletRequest request){

     orders.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());

     //ValidatorUtils.validateEntity(orders);

        ordersService.insert(orders);

        return R.ok();

    }

    /**

     * 修改

     */

    @RequestMapping("/update")

    public R update(@RequestBody OrdersEntity orders, HttpServletRequest request){

        //ValidatorUtils.validateEntity(orders);

        ordersService.updateById(orders);//全部更新

        return R.ok();

    }

    /**

     * 删除

     */

    @RequestMapping("/delete")

    public R delete(@RequestBody Long[] ids){

        ordersService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();

    }

}

阅读(1867) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~