package com.chy.borrow.controller;


import com.chy.borrow.entity.TUnit;
import com.chy.borrow.exception.Result;
import com.chy.borrow.service.TUnitService;
import com.shanghaigeography.entity.ResultMsg;
import com.shanghaigeography.eum.ResultState;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import com.chy.borrow.controller.BaseController;
import org.springframework.web.bind.annotation.ResponseBody;

import java.awt.*;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 沈晔浩
 * @since 2022-03-28
 */
@Controller
@CrossOrigin
@RequestMapping("/tUnit")
public class TUnitController extends BaseController {

    @Autowired
    TUnitService tUnitService;


    @RequestMapping("/list")
    @ResponseBody
    public String list() {
//        List<TUnit> list = tUnitService.getList();
//        return list;
        List<TUnit> list = tUnitService.list();
        return new ResultMsg<>().setCode(ResultState.SUCCESS).setData(list).toJSON();
    }
}
