| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.YwElectricalLog; |
| | | import com.doumee.service.business.YwElectricalLogService; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | /** |
| | | * 电器类操作日志 |
| | | * @author renkang |
| | | * @date 2026/04/03 |
| | | * 电器类操作日志Controller定义 |
| | | * @author doumee |
| | | * @date 2026-05-20 15:21:44 |
| | | */ |
| | | @Api(tags = "电器类操作日志") |
| | | @Api(tags = "yw_electrical_log接口") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX + "/business/ywElectricalLog") |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX +"/business/ywElectricalLog") |
| | | public class YwElectricalLogCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:ywelectricallog:create") |
| | | public ApiResponse create(@RequestBody YwElectricalLog ywElectricalLog, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ywElectricalLog.setLoginUserInfo(this.getLoginUser(token)); |
| | | ywElectricalLog.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(ywElectricalLogService.create(ywElectricalLog)); |
| | | } |
| | | |
| | |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:ywelectricallog:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | String[] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | ywElectricalLogService.deleteByIdInBatch(idList, this.getLoginUser(token)); |
| | | ywElectricalLogService.deleteByIdInBatch(this.getIdList(ids), this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | |
| | | @ApiOperation("分页查询") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:ywelectricallog:query") |
| | | public ApiResponse<PageData<YwElectricalLog>> findPage(@RequestBody PageWrap<YwElectricalLog> pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | public ApiResponse<PageData<YwElectricalLog>> findPage (@RequestBody PageWrap<YwElectricalLog> pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(ywElectricalLogService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywelectricallog:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<YwElectricalLog> pageWrap, HttpServletResponse response, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); |
| | | ExcelExporter.build(YwElectricalLog.class).export(ywElectricalLogService.findPage(pageWrap).getRecords(), "电器类操作日志", response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | |
| | | @CloudRequiredPermission("business:ywelectricallog:query") |
| | | public ApiResponse findById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(ywElectricalLogService.findById(id)); |
| | | } |
| | | |
| | | @ApiOperation("导出Excel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywelectricallog:exportExcel") |
| | | public void exportExcel(@RequestBody PageWrap<YwElectricalLog> pageWrap, HttpServletResponse response, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | pageWrap.getModel().setLoginUserInfo(this.getLoginUser(token)); |
| | | ExcelExporter.build(YwElectricalLog.class).export(ywElectricalLogService.findPage(pageWrap).getRecords(), "电器类操作日志", response); |
| | | } |
| | | } |