package com.ruoyi.web.controller.pub;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.Assetlog;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.domain.TGoods;
import com.ruoyi.system.domain.vo.AssetVo;
import com.ruoyi.system.service.AssetlogService;
import com.ruoyi.system.service.DepartmentService;
import com.ruoyi.system.service.VAssetlogService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

import static com.ruoyi.common.core.domain.AjaxResult.success;

/**
 * @Description: 资产
 * @author: elis
 * @date: 2024.05.27
 */
@Anonymous
@RestController
@RequestMapping("/system/dept")
public class AssetController extends BaseController {

    @Resource
    private DepartmentService departmentService;

    @Resource
    private AssetlogService assetlogService;

    @GetMapping("/getDepartments")
    public AjaxResult getDepartments(String departmentName){
        return success(departmentService.getDepartments(departmentName));
    }
    @GetMapping("/getAsset")
    public AjaxResult getAsset(Integer id){
        return success(assetlogService.queryById(id));
    }
    @GetMapping("/assetList")
    public TableDataInfo list(AssetVo assetVo){
        startPage();
        List<Assetlog> list = assetlogService.list(assetVo);
        return getDataTable(list);
    }

    @GetMapping("/getAssetType")
    public AjaxResult getAssetType(){
        return success(assetlogService.getAssetType());
    }

}
