package com.fjhx.controller.tda;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.params.tda.TdaApplicationVo;
import com.fjhx.service.tda.TdaApplicationService;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;
import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-07-21
 */
@RestController
@RequestMapping("/tdaApplication")
public class TdaApplicationController {

    @Autowired
    private TdaApplicationService tdaApplicationService;

    @PostMapping("/page")
    public R page(@RequestBody Map<String, String> condition) {
        Page<Map<String, Object>> result = tdaApplicationService.getPage(condition);
        return R.success(result);
    }

    @PostMapping("/add")
    public R add(@RequestBody TdaApplicationVo tdaApplicationVo) {
        tdaApplicationService.add(tdaApplicationVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody TdaApplicationVo tdaApplicationVo) {
        tdaApplicationService.delete(tdaApplicationVo);
        return R.success();
    }

    @PostMapping("/list")
    public R list() {
        List<Map<String, Object>> list = tdaApplicationService.getList();
        return R.success(list);
    }

    @PostMapping("details")
    public R details(@RequestBody TdaApplicationVo tdaApplicationVo) {
        Map<String, Object> result = tdaApplicationService.details(tdaApplicationVo);
        return R.success(result);
    }


}

