猫妈狗爸伴宠师小程序后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

104 lines
3.3 KiB

package com.ruoyi.catdog.controller;
import java.io.IOException;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.catdog.domain.License;
import com.ruoyi.catdog.service.ILicenseService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 执照Controller
*
* @author ruoyi
* @date 2025-03-02
*/
@RestController
@RequestMapping("/catdog/license")
public class LicenseController extends BaseController
{
@Autowired
private ILicenseService licenseService;
/**
* 查询执照列表
*/
@PreAuthorize("@ss.hasPermi('catdog:license:list')")
@GetMapping("/list")
public TableDataInfo list(License license)
{
startPage();
List<License> list = licenseService.selectLicenseList(license);
return getDataTable(list);
}
/**
* 导出执照列表
*/
@PreAuthorize("@ss.hasPermi('catdog:license:export')")
@Log(title = "执照", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, License license) throws IOException {
List<License> list = licenseService.selectLicenseList(license);
ExcelUtil<License> util = new ExcelUtil<License>(License.class);
util.exportExcel(response, list, "执照数据");
}
/**
* 获取执照详细信息
*/
@PreAuthorize("@ss.hasPermi('catdog:license:query')")
@GetMapping(value = "/{licenseId}")
public AjaxResult getInfo(@PathVariable("licenseId") Long licenseId)
{
return success(licenseService.selectLicenseByLicenseId(licenseId));
}
/**
* 新增执照
*/
@PreAuthorize("@ss.hasPermi('catdog:license:add')")
@Log(title = "执照", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody License license)
{
return toAjax(licenseService.insertLicense(license));
}
/**
* 修改执照
*/
@PreAuthorize("@ss.hasPermi('catdog:license:edit')")
@Log(title = "执照", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody License license)
{
return toAjax(licenseService.updateLicense(license));
}
/**
* 删除执照
*/
@PreAuthorize("@ss.hasPermi('catdog:license:remove')")
@Log(title = "执照", businessType = BusinessType.DELETE)
@DeleteMapping("/{licenseIds}")
public AjaxResult remove(@PathVariable Long[] licenseIds)
{
return toAjax(licenseService.deleteLicenseByLicenseIds(licenseIds));
}
}