| | |
| | | */ |
| | | package org.springblade.modules.label.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import lombok.AllArgsConstructor; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.common.node.TreeIntegerNode; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.label.entity.LabelEntity; |
| | | import org.springblade.modules.label.service.ILabelService; |
| | | import org.springblade.modules.label.vo.LabelVO; |
| | | import org.springblade.modules.label.wrapper.LabelWrapper; |
| | | import org.springblade.modules.label.service.ILabelService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 标签管理 控制器 |
| | |
| | | LabelEntity detail = labelService.getOne(Condition.getQueryWrapper(label)); |
| | | return R.data(LabelWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | /** |
| | | * 标签管理 分页 |
| | | */ |
| | |
| | | return R.data(LabelWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 标签管理 自定义分页 |
| | | */ |
| | |
| | | public R<IPage<LabelVO>> page(LabelVO label, Query query) { |
| | | IPage<LabelVO> pages = labelService.selectLabelPage(Condition.getPage(query), label); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 标签查询,按父id查询下级 |
| | | * @param label |
| | | * @return |
| | | */ |
| | | @GetMapping("/getLabelList") |
| | | public R getLabelList(LabelVO label) { |
| | | return R.data(labelService.getLabelList(label)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询人员标签(不包含人这一级) |
| | | * @param label |
| | | * @return |
| | | */ |
| | | @GetMapping("/getPersonLabelList") |
| | | public R getPersonLabelList(LabelVO label) { |
| | | return R.data(labelService.getPersonLabelList(label)); |
| | | } |
| | | |
| | | /** |
| | | * 标签管理 分页 |
| | | */ |
| | | @GetMapping("/tree") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "树形接口", notes = "传入label") |
| | | public R<List<TreeIntegerNode>> tree(LabelVO label) { |
| | | List<TreeIntegerNode> pages = labelService.tree(label); |
| | | return R.data( pages); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入label") |
| | | public R submit(@Valid @RequestBody LabelEntity label) { |
| | | label.setCreateUser(AuthUtil.getUserId()); |
| | | return R.status(labelService.saveOrUpdate(label)); |
| | | } |
| | | |