Commit 308ecb23 authored by chenhao's avatar chenhao

添加批量刪除和模糊查詢的入參 陳浩

parent 5d50c8fb
......@@ -19,7 +19,7 @@ public interface IKeySiteService {
* @param id
* @return
*/
public boolean deleteById(Long id);
public boolean deleteById(List<Long> sequenceNbrList);
/**
* 保存
* @param model
......
......@@ -91,10 +91,10 @@ public class KeySiteController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "delete/{sequenceNbr}")
@DeleteMapping(value = "delete")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除重点部位", notes = "根据sequenceNbr删除重点部位")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(keySiteService.deleteById(sequenceNbr));
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,@RequestParam(value = "sequenceNbrList") List<Long> sequenceNbrList){
return ResponseHelper.buildResponse(keySiteService.deleteById(sequenceNbrList));
}
/**
......@@ -124,14 +124,14 @@ public class KeySiteController extends BaseController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/page")
@ApiOperation(httpMethod = "POST",value = "重点部位分页查询", notes = "重点部位分页查询")
@ApiOperation(httpMethod = "GET",value = "重点部位分页查询", notes = "重点部位分页查询")
public ResponseModel<IPage<KeySiteDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size,
@RequestBody KeySite keySite) {
(value = "size") int size,@RequestParam(required = false) String name,@RequestParam(required = false) Long buildingId,@RequestParam(required = false) String fireEnduranceRate,
@RequestParam(required = false) String useNature,@RequestParam(required = false) String fireFacilitiesInfo,@RequestParam(required = false) Long belongId) {
Page<KeySiteDto> page = new Page<KeySiteDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(keySiteServiceImpl.queryForKeySitePage(page,keySite));
return ResponseHelper.buildResponse(keySiteServiceImpl.getPageList(page,name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId));
}
/**
......
......@@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto;
......@@ -64,11 +65,10 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
/**
* 分页查询
*/
public IPage<KeySiteDto> queryForKeySitePage(Page<KeySiteDto> page, KeySite keySite) {
return keySiteMapper.getPageList(page, keySite.getName(), keySite.getBuildingId(),
keySite.getFireEnduranceRate(), keySite.getUseNature(), keySite.getFireFacilitiesInfo(),keySite.getBelongId());
public IPage<KeySiteDto> getPageList(Page<KeySiteDto> page, String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId){
return keySiteMapper.getPageList(page,name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId);
}
@Override
public List<Object> getBuildTree() {
ResponseModel<Object> response = equipFeignClient.getBuildingTree();
......@@ -107,18 +107,23 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
}
@Override
public boolean deleteById(Long id) {
KeySite keySite = keySiteMapper.selectById(id);
if (keySite == null) {
public boolean deleteById(List<Long> sequenceNbrList) {
if(ObjectUtils.isEmpty(sequenceNbrList)) {
return false;
}
try {
sequenceNbrList.stream().forEach(i->{
KeySite keySite = keySiteMapper.selectById(i);
if (keySite != null) {
keySite.setIsDelete(true);
int number = keySiteMapper.updateById(keySite);
if (number > 0) {
return true;
keySiteMapper.updateById(keySite);
}
});
} catch (Exception e) {
return false;
}
return true;
}
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -287,4 +292,6 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
list1.add(orgMenuDto);
return list1;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment