package com.bonus.sharedstation.app.controller;


import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.sharedstation.app.dto.CleaningServicesOrderDTO;
import com.bonus.sharedstation.app.entity.CleaningServicesOrder;
import com.bonus.sharedstation.app.service.CleaningServicesOrderService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * 便民服务信息表保洁(CleaningServicesOrder)表控制层
 *
 * @author makejava
 * @since 2024-12-10 17:01:59
 */
@RestController
@RequestMapping("information/cleaningServicesOrder")
public class CleaningServicesOrderController {
    /**
     * 服务对象
     */
    @Resource
    private CleaningServicesOrderService cleaningServicesOrderService;

    @ApiOperation("新增")
    @PostMapping("/insert")
    public AjaxResult insert(@RequestBody CleaningServicesOrder cleaningServicesOrder) {
        return AjaxResult.success(cleaningServicesOrderService.insertAndPay(cleaningServicesOrder));

    }

    @ApiOperation("修改")
    @PostMapping("/update")
    public AjaxResult update(@RequestBody CleaningServicesOrder cleaningServicesOrder) {
        //得到登录人
        cleaningServicesOrder.setUpdatedBy(SecurityUtils.getUsername());
        cleaningServicesOrder.setUpdatedTime(new Date());
        return AjaxResult.success(this.cleaningServicesOrderService.updateById(cleaningServicesOrder));
    }

    @ApiOperation("分页查询")
    @PostMapping("/getListApp")
    public AjaxResult getList(@RequestBody CleaningServicesOrderDTO dto) {
        return cleaningServicesOrderService.getListPageApp(dto);

    }


    @PostMapping(value = "selectById", produces = "application/json; charset=utf-8")
    @ApiOperation("查询详情")
    public AjaxResult selectInfoById(@RequestBody CleaningServicesOrder dto) {
        return cleaningServicesOrderService.selectInfoById(dto);
    }


    @ApiOperation("查询")
    @PostMapping("/getOrderListSeller")
    public AjaxResult getListWeb(@RequestBody CleaningServicesOrderDTO dto){
        return cleaningServicesOrderService.getListWeb(dto);
    }


}

