| | |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "查询列表", notes = "传入查询") |
| | | public R<List<AttributeVO>> list(@ApiIgnore @RequestParam Map<String, Object> condition) { |
| | | return R.data(AttributeWrapper.build().listEntityVO(attributeService.list(Condition.getQueryWrapper(condition, Attribute.class).lambda().orderByAsc(Attribute::getKey)))); |
| | | return R.data(AttributeWrapper.build().listEntityVO(attributeService.list(Condition.getQueryWrapper(condition, Attribute.class).lambda().orderByAsc(Attribute::getId)))); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "查询列表", notes = "传入查询") |
| | | public R<IPage<AttributeVO>> pageList(@ApiIgnore @RequestParam Map<String, Object> condition, Query query) { |
| | | IPage<AttributeVO> pageVO = new Page<>(); |
| | | IPage<Attribute> page = attributeService.page(Condition.getPage(query), Condition.getQueryWrapper(condition, Attribute.class).lambda().orderByAsc(Attribute::getKey)); |
| | | IPage<Attribute> page = attributeService.page(Condition.getPage(query), Condition.getQueryWrapper(condition, Attribute.class).lambda().orderByAsc(Attribute::getId)); |
| | | BeanUtil.copy(page,pageVO); |
| | | pageVO.setRecords( AttributeWrapper.build().listEntityVO(page.getRecords())); |
| | | return R.data(pageVO); |
| | |
| | | if (StringUtil.isNotBlank(notInStr)){ |
| | | List<String> notInList = Func.toStrList(",", notInStr); |
| | | if (!CollectionUtils.isEmpty(notInList)){ |
| | | wrapper = wrapper.notIn(Attribute::getKey,notInList); |
| | | wrapper = wrapper.notIn(Attribute::getId,notInList); |
| | | } |
| | | } |
| | | if (StringUtil.isNotBlank(key)){ |
| | | wrapper = wrapper.like(Attribute::getKey,key); |
| | | wrapper = wrapper.like(Attribute::getId,key); |
| | | } |
| | | IPage<Attribute> page = attributeService.page(Condition.getPage(query),wrapper.orderByAsc(Attribute::getKey)); |
| | | IPage<Attribute> page = attributeService.page(Condition.getPage(query),wrapper.orderByAsc(Attribute::getId)); |
| | | IPage<AttributeVO> pageVO = new Page<>(); |
| | | BeanUtil.copy(page,pageVO); |
| | | pageVO.setRecords(AttributeWrapper.build().listEntityVO(page.getRecords())); |
| | |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "新增或修改", notes = "传入元数据对象") |
| | | public R submit(@Valid @RequestBody AttributeDTO dto) { |
| | | public R submit(@RequestBody AttributeDTO dto) { |
| | | CacheUtil.clear(OmdCacheConstant.ATTR_CACHE); |
| | | return R.status(attributeService.submit(dto)); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 查看应用范围 |
| | | * @param id 主键 |
| | | * @param oid 主键 |
| | | * @return 查询结果 |
| | | */ |
| | | @GetMapping("/applyRange") |
| | | @GetMapping("/apply-range") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "查看应用范围",notes = "传入主键") |
| | | public R applyRange(Long id){ |
| | | return R.data(attributeService.applyRange(id)); |
| | | public R applyRange(String oid){ |
| | | return R.data(attributeService.applyRange(oid)); |
| | | } |
| | | } |