New file |
| | |
| | | package com.ycl.platform.controller; |
| | | |
| | | import annotation.Log; |
| | | import com.ycl.platform.domain.entity.DefaultTemplate; |
| | | import com.ycl.platform.service.IDefaultTemplateService; |
| | | import com.ycl.system.AjaxResult; |
| | | import com.ycl.system.controller.BaseController; |
| | | import com.ycl.system.page.TableDataInfo; |
| | | import com.ycl.utils.poi.ExcelUtil; |
| | | import enumeration.BusinessType; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 违约规则模板Controller |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-04-01 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/default/template") |
| | | public class DefaultTemplateController extends BaseController |
| | | { |
| | | @Autowired |
| | | private IDefaultTemplateService defaultTemplateService; |
| | | |
| | | /** |
| | | * 查询违约规则模板列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:template:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(DefaultTemplate defaultTemplate) |
| | | { |
| | | startPage(); |
| | | List<DefaultTemplate> list = defaultTemplateService.selectDefaultTemplateList(defaultTemplate); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导出违约规则模板列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:template:export')") |
| | | @Log(title = "违约规则模板", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, DefaultTemplate defaultTemplate) |
| | | { |
| | | List<DefaultTemplate> list = defaultTemplateService.selectDefaultTemplateList(defaultTemplate); |
| | | ExcelUtil<DefaultTemplate> util = new ExcelUtil<DefaultTemplate>(DefaultTemplate.class); |
| | | util.exportExcel(response, list, "违约规则模板数据"); |
| | | } |
| | | |
| | | /** |
| | | * 获取违约规则模板详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:template:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | return success(defaultTemplateService.selectDefaultTemplateById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 新增违约规则模板 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:template:add')") |
| | | @Log(title = "违约规则模板", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody DefaultTemplate defaultTemplate) |
| | | { |
| | | return toAjax(defaultTemplateService.insertDefaultTemplate(defaultTemplate)); |
| | | } |
| | | |
| | | /** |
| | | * 修改违约规则模板 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:template:edit')") |
| | | @Log(title = "违约规则模板", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody DefaultTemplate defaultTemplate) |
| | | { |
| | | return toAjax(defaultTemplateService.updateDefaultTemplate(defaultTemplate)); |
| | | } |
| | | |
| | | /** |
| | | * 删除违约规则模板 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('platform:template:remove')") |
| | | @Log(title = "违约规则模板", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | return toAjax(defaultTemplateService.deleteDefaultTemplateByIds(ids)); |
| | | } |
| | | } |