package com.fjhx.message.controller;

import com.fjhx.base.ListPageMap;
import com.fjhx.entity.message.UMessage;
import com.fjhx.entity.supplier.Supplier;
import com.fjhx.message.service.UMessageService;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 消息提醒 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-07-29
 */
@RestController
@RequestMapping("/uMessage")
public class UMessageController {

    @Autowired
    private UMessageService uMessageService;

    /**
     * 统计物料分类
     * @return
     */
    @PostMapping("/statisticsClassify")
    public R statisticsClassify(@RequestBody Map<String,Object> condition){
        List<Map<String,Object>> list = uMessageService.getClassMessage(condition);
        return R.success(list);
    }

    /**
     * 列表
     * @param condition
     * @return
     */
    @PostMapping("/list")
    public R list(@RequestBody Map<String, Object> condition){
        ListPageMap.getListPageMap(condition);
        List<UMessage> result = uMessageService.getList(condition);
        return R.success(result);
    }

    /**
     * 列表条数
     * @param condition
     * @return
     */
    @PostMapping("/list/count")
    public R listCount(@RequestBody Map<String, Object> condition){
        ListPageMap.getListPageMap(condition);
        Integer count = uMessageService.getListCount(condition);
        return R.success(count);
    }

}

