| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param dto 基础数据分类传输对象 |
| | | * @return R<Void> |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param dto 基础数据分类更新传输对象 |
| | | * @return R<Void> |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param id id |
| | | * @return R<Void> |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("删除") |
| | | public R<Void> delete(@RequestParam(value = "id") Integer id){ |
| | | public R<Void> delete(@RequestParam(value = "id") Long id) { |
| | | try { |
| | | tbBasicDataCategoryService.removeById(id); |
| | | } catch (Exception e) { |
| | |
| | | |
| | | /** |
| | | * 根据id获取详情 |
| | | * |
| | | * @param id id |
| | | * @return R<BasicDataCategoryVO> |
| | | */ |
| | | @GetMapping("/get-details") |
| | | @ApiOperation("根据id获取详情") |
| | | public R<BasicDataCategoryVO> getDetails(@RequestParam(value = "id") Integer id){ |
| | | public R<BasicDataCategoryVO> getDetails(@RequestParam(value = "id") Long id) { |
| | | try { |
| | | TbBasicDataCategory basicDataCategory = tbBasicDataCategoryService.getById(id); |
| | | BasicDataCategoryVO vo = BeanUtils.copyBean(basicDataCategory, BasicDataCategoryVO.class); |
| | | BasicDataCategoryVO vo = BeanUtils.copyBean(basicDataCategory, |
| | | BasicDataCategoryVO.class); |
| | | return R.ok(vo); |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | |
| | | |
| | | /** |
| | | * 隐藏显示操作 |
| | | * |
| | | * @param dto 显示隐藏操作数据传输对象 |
| | | * @return R<Void> |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 分页条件查询 |
| | | * |
| | | * @param query 基础数据分类条件查询对象 |
| | | * @return R<PageDTO<BasicDataCategoryVO>> |
| | | * @return R<PageDTO < BasicDataCategoryVO>> |
| | | */ |
| | | @PostMapping("/page") |
| | | @ApiOperation("分页条件查询") |
| | | public R<PageDTO<BasicDataCategoryVO>> page(@Validated @RequestBody BasicDataCategoryQuery query) { |
| | | public R<PageDTO<BasicDataCategoryVO>> page( |
| | | @Validated @RequestBody BasicDataCategoryQuery query) { |
| | | try { |
| | | return R.ok(tbBasicDataCategoryService.queryPage(query)); |
| | | } catch (Exception e) { |