优化
This commit is contained in:
@ -1,14 +1,21 @@
|
||||
package com.ruoyi.web.controller.common;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
|
||||
import com.ruoyi.bgt.domain.dto.BgtGetAnnexDTO;
|
||||
import com.ruoyi.bgt.domain.dto.BgtGetWgzAnnexDTO;
|
||||
import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.domain.Annex;
|
||||
import com.ruoyi.common.domain.dto.AnnexListDTO;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.exception.BaseException;
|
||||
import com.ruoyi.common.service.IAnnexService;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
@ -16,13 +23,14 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.BGT;
|
||||
import static com.ruoyi.common.constant.Constants.WGZ;
|
||||
|
||||
/**
|
||||
@ -75,17 +83,16 @@ public class AnnexController extends BaseController {
|
||||
// return AjaxResult.success(iAnnexService.queryById(id));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 新增附件
|
||||
// */
|
||||
// @ApiOperation("新增附件")
|
||||
// @PreAuthorize("@ss.hasPermi('common:annex:add')")
|
||||
// @Log(title = "附件", businessType = BusinessType.INSERT)
|
||||
// @RepeatSubmit
|
||||
// @PostMapping()
|
||||
// public AjaxResult<Void> add(@Validated @RequestBody Annex bo) {
|
||||
// return toAjax(iAnnexService.insert(bo) ? 1 : 0);
|
||||
// }
|
||||
/**
|
||||
* 新增附件
|
||||
*/
|
||||
@ApiOperation("新增附件")
|
||||
@Log(title = "附件", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Boolean> add(@Validated @RequestBody AnnexListDTO bo) {
|
||||
return AjaxResult.success(iAnnexService.saveBatch(bo.getList()));
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 修改附件
|
||||
@ -99,17 +106,16 @@ public class AnnexController extends BaseController {
|
||||
// return toAjax(iAnnexService.update(bo) ? 1 : 0);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 删除附件
|
||||
// */
|
||||
// @ApiOperation("删除附件")
|
||||
// @PreAuthorize("@ss.hasPermi('common:annex:remove')")
|
||||
// @Log(title = "附件" , businessType = BusinessType.DELETE)
|
||||
// @DeleteMapping("/{ids}")
|
||||
// public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
// @PathVariable String[] ids) {
|
||||
// return toAjax(iAnnexService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||
// }
|
||||
/**
|
||||
* 删除附件
|
||||
*/
|
||||
@ApiOperation("删除附件")
|
||||
@Log(title = "附件" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Boolean> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable String[] ids) {
|
||||
return AjaxResult.success(iAnnexService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("包工头获取务工者附件")
|
||||
@ -133,4 +139,15 @@ public class AnnexController extends BaseController {
|
||||
Page<Annex> result = iAnnexService.page(PageUtils.buildPage(), wrapper);
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@ApiOperation("获取包工头附件")
|
||||
@GetMapping("/getBgtAnnex")
|
||||
public AjaxResult<List<Annex>> getBgtAnnex(BgtGetAnnexDTO dto) {
|
||||
LambdaQueryWrapper<Annex> wrapper = Wrappers.<Annex>lambdaQuery()
|
||||
.eq(Annex::getUserId, dto.getUserId())
|
||||
.eq(Annex::getUserType, BGT)
|
||||
.eq(StrUtil.isNotBlank(dto.getAnnexType()),Annex::getAnnexType, dto.getAnnexType());
|
||||
return AjaxResult.success(iAnnexService.list(wrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user