| | |
| | | import com.ruoyi.lavorissue.mapper.LavorIssueMapper; |
| | | import com.ruoyi.lavorissue.pojo.LaborIssue; |
| | | import com.ruoyi.lavorissue.service.LavorIssueService; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | @PostMapping("/add") |
| | | @Log(title = "劳保发放-添加", businessType = BusinessType.INSERT) |
| | | @ApiOperation("劳保发放-添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody LaborIssue laborIssue){ |
| | | boolean save = laborIssueService.save(laborIssue); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | |
| | | @PostMapping("/update") |
| | | @Log(title = "劳保发放-修改", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("劳保发放-修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody LaborIssue laborIssue){ |
| | | boolean update = laborIssueService.updateById(laborIssue); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "劳保发放-删除", businessType = BusinessType.DELETE) |
| | | @ApiOperation("劳保发放-删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | boolean delete = laborIssueService.removeBatchByIds(ids); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | |
| | | Long tenantId = SecurityUtils.getLoginUser().getTenantId(); |
| | | ExcelUtil<LaborIssue> util = new ExcelUtil<LaborIssue>(LaborIssue.class); |
| | | List<LaborIssue> list = lavorIssueMapper.list(); |
| | | SysDept sysDept = sysDeptMapper.selectDeptById(tenantId); |
| | | if(sysDept == null){ |
| | | throw new RuntimeException("部门不存在!"); |
| | | } |
| | | list.forEach(item -> { |
| | | item.setDeptName(sysDeptMapper.selectDeptById(tenantId).getDeptName()); |
| | | item.setDeptName(sysDept.getDeptName()); |
| | | }); |
| | | util.exportExcel(response, list , "劳保台账"); |
| | | } |