c930097a by chentao

隐藏系列

1 parent e83742f8
......@@ -98,4 +98,28 @@ public class BuildingBlockController extends BaseController {
public R<Void> remove(@PathVariable String id) throws ServerException {
return toAjax(service.remove(id));
}
@RepeatSubmit()
@PutMapping("/display/{id}")
public R<Void> display(@PathVariable String id) throws ServerException {
return toAjax(service.display(id));
}
@RepeatSubmit()
@PutMapping("/batch/display/{buildingBlockIds}")
public R<Void> batchDisplay(@PathVariable String[] buildingBlockIds) throws ServerException {
return toAjax(service.batchDisplay(buildingBlockIds));
}
@RepeatSubmit()
@PutMapping("/hide/{id}")
public R<Void> hide(@PathVariable String id) throws ServerException {
return toAjax(service.hide(id));
}
@RepeatSubmit()
@PutMapping("/batch/hide/{buildingBlockIds}")
public R<Void> batchHide(@PathVariable String[] buildingBlockIds) throws ServerException {
return toAjax(service.batchHide(buildingBlockIds));
}
}
......
......@@ -64,4 +64,9 @@ public class BuildingBlock extends BaseEntity {
*/
private Long sort;
/**
* 是否可见
*/
private boolean visible;
}
......
......@@ -44,4 +44,8 @@ public class BuildingBlockBo extends BaseBO {
* 排序
*/
private Long sort;
/**
* 是否可见
*/
private boolean visible;
}
......
......@@ -55,4 +55,13 @@ public class BuildingBlockVo {
* 套件信息
*/
List<EntiretyVo> entiretyList;
/**
* 是否可见
*/
private boolean visible;
/**
* 是否可见
*/
private String display;
}
......
......@@ -82,4 +82,39 @@ public interface IBuildingBlockService {
*/
BuildingBlockVo get(String id);
/**
* 隐藏
*
* @param id
* @return
* @throws ServerException
*/
boolean hide(String id) throws ServerException;
/**
* 批量隐藏
*
* @param buildingBlockIds
* @return
* @throws ServerException
*/
boolean batchHide(String[] buildingBlockIds) throws ServerException;
/**
* 显示
*
* @param id
* @return
* @throws ServerException
*/
boolean display(String id) throws ServerException;
/**
* 批量显示
*
* @param buildingBlockIds
* @return
* @throws ServerException
*/
boolean batchDisplay(String[] buildingBlockIds) throws ServerException;
}
......
......@@ -78,6 +78,12 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService {
vo.setOssUrl(ossUrlService.selectUrlByIds(vo.getOssId()));
}
vo.setEntiretyList(entiretyMap.get(vo.getId()));
if(vo.isVisible()){
vo.setDisplay("【已显示】");
}
else{
vo.setDisplay("【已隐藏】");
}
}
return TableDataInfo.build(page);
}
......@@ -104,12 +110,12 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService {
*/
@Override
public List<BuildingBlockVo> list() {
List<BuildingBlockVo> list = baseMapper.selectVoList(null);
List<BuildingBlockVo> list = baseMapper.selectVoList(Wrappers.<BuildingBlock>lambdaQuery().eq(BuildingBlock::isVisible, true));
for (BuildingBlockVo vo : list) {
if (StrUtil.isNotBlank(vo.getOssId())) {
vo.setOssUrl(ossUrlService.selectUrlByIds(vo.getOssId()));
}
List<EntiretyVo> entiretyVoList = entiretyMapper.selectVoList(Wrappers.<Entirety>lambdaQuery().eq(Entirety::getBuildingBlockId, vo.getId()));
List<EntiretyVo> entiretyVoList = entiretyMapper.selectVoList(Wrappers.<Entirety>lambdaQuery().eq(Entirety::getBuildingBlockId, vo.getId()).eq(Entirety::isVisible, true));
for(EntiretyVo entiretyVo:entiretyVoList){
if(StrUtil.isNotBlank(entiretyVo.getOssId())){
entiretyVo.setOssUrl(ossUrlService.selectUrlByIds(entiretyVo.getOssId()));
......@@ -220,4 +226,43 @@ public class BuildingBlockServiceImpl implements IBuildingBlockService {
}
}
}
@Override
public boolean display(String id) throws ServerException {
BuildingBlockVo entityVo = baseMapper.selectVoById(id);
entityVo.setVisible(true);
BuildingBlock entity = BeanUtil.toBean(entityVo, BuildingBlock.class);
return baseMapper.updateById(entity) > 0;
}
@Override
public boolean batchDisplay(String[] buildingBlockIds) throws ServerException {
for (String id : buildingBlockIds) {
BuildingBlockVo entityVo = baseMapper.selectVoById(id);
entityVo.setVisible(true);
BuildingBlock entity = BeanUtil.toBean(entityVo, BuildingBlock.class);
baseMapper.updateById(entity);
}
return true;
}
@Override
public boolean hide(String id) throws ServerException {
BuildingBlockVo entityVo = baseMapper.selectVoById(id);
entityVo.setVisible(false);
BuildingBlock entity = BeanUtil.toBean(entityVo, BuildingBlock.class);
return baseMapper.updateById(entity) > 0;
}
@Override
public boolean batchHide(String[] buildingBlockIds) throws ServerException {
for (String id : buildingBlockIds) {
BuildingBlockVo entityVo = baseMapper.selectVoById(id);
entityVo.setVisible(false);
BuildingBlock entity = BeanUtil.toBean(entityVo, BuildingBlock.class);
baseMapper.updateById(entity);
}
return true;
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!