package com.ruzhoukj.sms.controller; import com.google.common.collect.Lists; import com.platform.controller.BaseController; import com.platform.model.resp.Result; import com.platform.page.TableDataInfo; import com.platform.utils.DozerUtils; import com.ruzhoukj.sms.common.Constant; import com.ruzhoukj.sms.entity.UserEntity; import com.ruzhoukj.sms.model.dto.ReportDataInfoDTO; import com.ruzhoukj.sms.model.vo.ReportDataInfoVO; import com.ruzhoukj.sms.service.DeptService; import com.ruzhoukj.sms.service.ReportDataInfoService; import com.ruzhoukj.sms.service.UserService; import io.swagger.annotations.Api; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; /** * @Author:zhuxiang * @Package:com.ruzhoukj.sms.controller * @Project:OA * @name:ReporDataInfoController * @Date:2025/2/20 17:05 * @Filename:ReporDataInfoController */ @Api(tags = "报表数据") @RestController @RequestMapping("/report/data") public class ReportDataInfoController extends BaseController { @Resource private UserService userService; @Resource private ReportDataInfoService reportDataInfoService; @PostMapping("/page") public TableDataInfo page(@RequestBody ReportDataInfoDTO reportDataInfoDTO){ UserEntity user = userService.getById(reportDataInfoDTO.getLoginUserId()); startPage(reportDataInfoDTO.getPageNum(),reportDataInfoDTO.getPageSize()); if(user.getUserRole().equals(Constant.ADMIN)){ return getDataTable(reportDataInfoService.queryList(reportDataInfoDTO)); } if(user.getUserRole().equals(Constant.D_ADMIN)){ reportDataInfoDTO.setDeptId(user.getDeptId()); return getDataTable(reportDataInfoService.queryList(reportDataInfoDTO)); } reportDataInfoDTO.setUserId(user.getId()); return getDataTable(reportDataInfoService.queryList(reportDataInfoDTO)); } @GetMapping("/{id}") public Result getInfo(@PathVariable String id){ return Result.data(DozerUtils.convertBean(reportDataInfoService.getById(id),ReportDataInfoVO.class)); } @PostMapping("/saveOrUpdate") public Result saveOrUpdate(@RequestBody ReportDataInfoDTO reportDataInfoDTO){ return toAjax(reportDataInfoService.saveOrUpdateReportData(reportDataInfoDTO)); } @GetMapping("/test") public void test(){ reportDataInfoService.test(); } }