game-api/ff-admin/src/main/java/com/ff/common/controller/LangController.java

105 lines
3.2 KiB
Java
Raw Normal View History

2025-02-11 15:27:15 +08:00
package com.ff.common.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.annotation.Log;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.BusinessType;
import com.ff.common.domain.Lang;
import com.ff.common.service.ILangService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-10
*/
@RestController
@RequestMapping("/common/lang")
public class LangController extends BaseController
{
@Autowired
private ILangService langService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:list')")
@GetMapping("/list")
public TableDataInfo list(Lang lang)
{
startPage();
List<Lang> list = langService.selectLangList(lang);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:export')")
@Log(title = "系统语种管理 ", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Lang lang)
{
List<Lang> list = langService.selectLangList(lang);
ExcelUtil<Lang> util = new ExcelUtil<Lang>(Lang.class);
util.exportExcel(response, list, "系统语种管理 数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(langService.selectLangById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:add')")
@Log(title = "系统语种管理 ", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Lang lang)
{
return toAjax(langService.insertLang(lang));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:edit')")
@Log(title = "系统语种管理 ", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Lang lang)
{
return toAjax(langService.updateLang(lang));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:remove')")
@Log(title = "系统语种管理 ", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(langService.deleteLangByIds(ids));
}
}