| | |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.sxkj.fw.fwDevicePerShare.dto.FwDevicePerShareDTO; |
| | | import org.sxkj.fw.fwDevicePerShare.entity.FwDevicePerShareEntity; |
| | | import org.sxkj.fw.fwDevicePerShare.vo.FwDevicePerShareVO; |
| | | import org.sxkj.fw.fwDevicePerShare.excel.FwDevicePerShareExcel; |
| | |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 设备权限分享表 分页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入fwDevicePerShare") |
| | | public R<IPage<FwDevicePerShareVO>> list(@ApiIgnore @RequestParam Map<String, Object> fwDevicePerShare, Query query) { |
| | | IPage<FwDevicePerShareEntity> pages = fwDevicePerShareService.page(Condition.getPage(query), Condition.getQueryWrapper(fwDevicePerShare, FwDevicePerShareEntity.class)); |
| | | return R.data(FwDevicePerShareWrapper.build().pageVO(pages)); |
| | | } |
| | | // @GetMapping("/list") |
| | | // @ApiOperationSupport(order = 2) |
| | | // @ApiOperation(value = "分页", notes = "传入fwDevicePerShare") |
| | | // public R<IPage<FwDevicePerShareVO>> list(@ApiIgnore @RequestParam Map<String, Object> fwDevicePerShare, Query query) { |
| | | // IPage<FwDevicePerShareEntity> pages = fwDevicePerShareService.page(Condition.getPage(query), Condition.getQueryWrapper(fwDevicePerShare, FwDevicePerShareEntity.class)); |
| | | // return R.data(FwDevicePerShareWrapper.build().pageVO(pages)); |
| | | // } |
| | | |
| | | /** |
| | | * 设备权限分享表 自定义分页 |
| | |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入fwDevicePerShare") |
| | | public R save(@Valid @RequestBody FwDevicePerShareEntity fwDevicePerShare) { |
| | | return R.status(fwDevicePerShareService.save(fwDevicePerShare)); |
| | | public R save(@Valid @RequestBody FwDevicePerShareDTO fwDevicePerShare) { |
| | | FwDevicePerShareEntity fwDevicePerShareEntity = Objects.requireNonNull(BeanUtil.copy(fwDevicePerShare, FwDevicePerShareEntity.class)); |
| | | return R.status(fwDevicePerShareService.save(fwDevicePerShareEntity)); |
| | | } |
| | | |
| | | /** |
| | | * 设备权限分享表 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入fwDevicePerShare") |
| | | public R update(@Valid @RequestBody FwDevicePerShareEntity fwDevicePerShare) { |
| | | return R.status(fwDevicePerShareService.updateById(fwDevicePerShare)); |
| | | } |
| | | // @PostMapping("/update") |
| | | // @ApiOperationSupport(order = 5) |
| | | // @ApiOperation(value = "修改", notes = "传入fwDevicePerShare") |
| | | // public R update(@Valid @RequestBody FwDevicePerShareEntity fwDevicePerShare) { |
| | | // return R.status(fwDevicePerShareService.updateById(fwDevicePerShare)); |
| | | // } |
| | | |
| | | /** |
| | | * 设备权限分享表 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入fwDevicePerShare") |
| | | public R submit(@Valid @RequestBody FwDevicePerShareEntity fwDevicePerShare) { |
| | | return R.status(fwDevicePerShareService.saveOrUpdate(fwDevicePerShare)); |
| | | } |
| | | // @PostMapping("/submit") |
| | | // @ApiOperationSupport(order = 6) |
| | | // @ApiOperation(value = "新增或修改", notes = "传入fwDevicePerShare") |
| | | // public R submit(@Valid @RequestBody FwDevicePerShareEntity fwDevicePerShare) { |
| | | // return R.status(fwDevicePerShareService.saveOrUpdate(fwDevicePerShare)); |
| | | // } |
| | | |
| | | /** |
| | | * 设备权限分享表 删除 |
| | |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | return R.status(fwDevicePerShareService.deleteLogic(Func.toLongList(ids))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出数据 |
| | | */ |
| | | @GetMapping("/export-fwDevicePerShare") |
| | | @ApiOperationSupport(order = 9) |
| | | @ApiOperation(value = "导出数据", notes = "传入fwDevicePerShare") |
| | | public void exportFwDevicePerShare(@ApiIgnore @RequestParam Map<String, Object> fwDevicePerShare, BladeUser bladeUser, HttpServletResponse response) { |
| | | QueryWrapper<FwDevicePerShareEntity> queryWrapper = Condition.getQueryWrapper(fwDevicePerShare, FwDevicePerShareEntity.class); |
| | | //if (!AuthUtil.isAdministrator()) { |
| | | // queryWrapper.lambda().eq(FwDevicePerShare::getTenantId, bladeUser.getTenantId()); |
| | | //} |
| | | queryWrapper.lambda().eq(FwDevicePerShareEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); |
| | | List<FwDevicePerShareExcel> list = fwDevicePerShareService.exportFwDevicePerShare(queryWrapper); |
| | | ExcelUtil.export(response, "设备权限分享表数据" + DateUtil.time(), "设备权限分享表数据表", list, FwDevicePerShareExcel.class); |
| | | } |
| | | |
| | | } |