package cn.pluss.platform.controller.suggest;

import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.base.BaseModelController;
import cn.pluss.platform.controller.BaseController;
import cn.pluss.platform.controller.BaseNoModelController;
import cn.pluss.platform.device.MercOrderDetailService;
import cn.pluss.platform.entity.MercOrderDetail;
import cn.pluss.platform.entity.Suggest;
import cn.pluss.platform.suggest.SuggestService;
import cn.pluss.platform.util.StringUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("suggest")
public class SuggestController extends BaseModelController<SuggestService, Suggest> {

    /**
     * 引导页
     * @return
     */
    @GetMapping(value = "/index")
    public String index() {
        return "suggest/suggestList";
    }

    @Override
    public Result<Page<Suggest>> page(Page<Suggest> page, Suggest condition, OrderItem orderItem) {
        orderItem.setColumn("id").setAsc(false);
        return super.page(page, condition, orderItem);
    }

    @PostMapping("/markDeal")
    @ResponseBody
    public Result<Object> markDeal(Integer id) {
        Suggest entity = baseService.getById(id);
        entity.setStatus("1");
        baseService.updateById(entity);

        return ResultGenerator.genSuccessResult("操作成功", null);
    }
}


