package org.dromara.system.controller.system;

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

import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.system.domain.vo.SysIndustryVo;
import org.dromara.system.domain.bo.SysIndustryBo;
import org.dromara.system.service.ISysIndustryService;
import org.dromara.common.mybatis.core.page.TableDataInfo;

/**
 * 行业字典信息
 * 前端访问路由地址为:/system/industry
 *
 * @author LionLi
 * @date 2024-04-18
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/industry")
public class SysIndustryController extends BaseController {

    private final ISysIndustryService sysIndustryService;


    /***
     * 查询行业字典信息列表
     * @return
     */
    @GetMapping("/selList")
    @Log(title = "查询行业字典信息", businessType = BusinessType.OTHER)
    public R<List<Map>> selectIndustryList() {
        return R.ok(sysIndustryService.selectIndustryList());
    }
//
//    /**
//     * 查询行业字典信息列表
//     */
//    @SaCheckPermission("system:industry:list")
//    @GetMapping("/list")
//    public TableDataInfo<SysIndustryVo> list(SysIndustryBo bo, PageQuery pageQuery) {
//        return sysIndustryService.queryPageList(bo, pageQuery);
//    }
//
//    /**
//     * 导出行业字典信息列表
//     */
//    @SaCheckPermission("system:industry:export")
//    @Log(title = "行业字典信息", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(SysIndustryBo bo, HttpServletResponse response) {
//        List<SysIndustryVo> list = sysIndustryService.queryList(bo);
//        ExcelUtil.exportExcel(list, "行业字典信息", SysIndustryVo.class, response);
//    }
//
//    /**
//     * 获取行业字典信息详细信息
//     *
//     * @param id 主键
//     */
//    @SaCheckPermission("system:industry:query")
//    @GetMapping("/{id}")
//    public R<SysIndustryVo> getInfo(@NotNull(message = "主键不能为空")
//                                     @PathVariable Long id) {
//        return R.ok(sysIndustryService.queryById(id));
//    }
//
//    /**
//     * 新增行业字典信息
//     */
//    @SaCheckPermission("system:industry:add")
//    @Log(title = "行业字典信息", businessType = BusinessType.INSERT)
//    @RepeatSubmit()
//    @PostMapping()
//    public R<Void> add(@Validated(AddGroup.class) @RequestBody SysIndustryBo bo) {
//        return toAjax(sysIndustryService.insertByBo(bo));
//    }
//
//    /**
//     * 修改行业字典信息
//     */
//    @SaCheckPermission("system:industry:edit")
//    @Log(title = "行业字典信息", businessType = BusinessType.UPDATE)
//    @RepeatSubmit()
//    @PutMapping()
//    public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysIndustryBo bo) {
//        return toAjax(sysIndustryService.updateByBo(bo));
//    }
//
//    /**
//     * 删除行业字典信息
//     *
//     * @param ids 主键串
//     */
//    @SaCheckPermission("system:industry:remove")
//    @Log(title = "行业字典信息", businessType = BusinessType.DELETE)
//    @DeleteMapping("/{ids}")
//    public R<Void> remove(@NotEmpty(message = "主键不能为空")
//                          @PathVariable Long[] ids) {
//        return toAjax(sysIndustryService.deleteWithValidByIds(List.of(ids), true));
//    }
}
