ÎļþÃû´Ó Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/DictBizOmdController.java ÐÞ¸Ä |
| | |
| | | package com.vci.ubcs.omd.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.vci.ubcs.omd.entity.DictBizM; |
| | | import com.vci.ubcs.omd.service.IDictBizService; |
| | | import com.vci.ubcs.omd.vo.DictBizMVO; |
| | | import com.vci.ubcs.omd.wrapper.DictBizWrapper; |
| | | import com.vci.ubcs.common.constant.CommonConstant; |
| | | import com.vci.ubcs.omd.entity.Dict; |
| | | import com.vci.ubcs.omd.service.IDictService; |
| | | import com.vci.ubcs.omd.vo.DictVO; |
| | | import com.vci.ubcs.omd.wrapper.DictWrapper; |
| | | import io.swagger.annotations.*; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | |
| | | @NonDS |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/dict-biz") |
| | | @Api(value = "ä¸å¡åå
¸", tags = "ä¸å¡åå
¸") |
| | | public class DictBizOmdController extends BladeController { |
| | | @RequestMapping("/dict") |
| | | @Api(value = "æä¸¾å®ä¹", tags = "æä¸¾å®ä¹") |
| | | public class DictController extends BladeController { |
| | | |
| | | private final IDictBizService dictService; |
| | | private final IDictService dictService; |
| | | |
| | | /** |
| | | * 详æ
|
| | |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详æ
", notes = "ä¼ å
¥dict") |
| | | public R<DictBizMVO> detail(DictBizM dict) { |
| | | DictBizM detail = dictService.getOne(Condition.getQueryWrapper(dict)); |
| | | return R.data(DictBizWrapper.build().entityVO(detail)); |
| | | public R<DictVO> detail(Dict dict) { |
| | | Dict detail = dictService.getOne(Condition.getQueryWrapper(dict)); |
| | | return R.data(DictWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "code", value = "åå
¸ç¼å·", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "dictValue", value = "åå
¸åç§°", paramType = "query", dataType = "string") |
| | | @ApiImplicitParam(name = "code", value = "æä¸¾ç¼å·", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "dictValue", value = "æä¸¾åç§°", paramType = "query", dataType = "string") |
| | | }) |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "å表", notes = "ä¼ å
¥dict") |
| | | public R<List<DictBizMVO>> list(@ApiIgnore @RequestParam Map<String, Object> dict) { |
| | | List<DictBizM> list = dictService.list(Condition.getQueryWrapper(dict, DictBizM.class).lambda().orderByAsc(DictBizM::getSort)); |
| | | return R.data(DictBizWrapper.build().listNodeVO(list)); |
| | | public R<List<DictVO>> list(@ApiIgnore @RequestParam Map<String, Object> dict) { |
| | | List<Dict> list = dictService.list(Condition.getQueryWrapper(dict, Dict.class).lambda().orderByAsc(Dict::getSort)); |
| | | return R.data(DictWrapper.build().listNodeVO(list)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/parent-list") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "code", value = "åå
¸ç¼å·", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "dictValue", value = "åå
¸åç§°", paramType = "query", dataType = "string") |
| | | @ApiImplicitParam(name = "code", value = "æä¸¾ç¼å·", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "dictValue", value = "æä¸¾åç§°", paramType = "query", dataType = "string") |
| | | }) |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "å表", notes = "ä¼ å
¥dict") |
| | | public R<IPage<DictBizMVO>> parentList(@ApiIgnore @RequestParam Map<String, Object> dict, Query query) { |
| | | public R<IPage<DictVO>> parentList(@ApiIgnore @RequestParam Map<String, Object> dict, Query query) { |
| | | return R.data(dictService.parentList(dict, query)); |
| | | } |
| | | |
| | |
| | | }) |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "å表", notes = "ä¼ å
¥dict") |
| | | public R<List<DictBizMVO>> childList(@ApiIgnore @RequestParam Map<String, Object> dict, @RequestParam(required = false, defaultValue = "-1") Long parentId) { |
| | | public R<List<DictVO>> childList(@ApiIgnore @RequestParam Map<String, Object> dict, @RequestParam(required = false, defaultValue = "-1") Long parentId) { |
| | | return R.data(dictService.childList(dict, parentId)); |
| | | } |
| | | |
| | |
| | | @GetMapping("/tree") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "æ å½¢ç»æ", notes = "æ å½¢ç»æ") |
| | | public R<List<DictBizMVO>> tree() { |
| | | List<DictBizMVO> tree = dictService.tree(); |
| | | public R<List<DictVO>> tree() { |
| | | List<DictVO> tree = dictService.tree(); |
| | | return R.data(tree); |
| | | } |
| | | |
| | |
| | | @GetMapping("/parent-tree") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "æ å½¢ç»æ", notes = "æ å½¢ç»æ") |
| | | public R<List<DictBizMVO>> parentTree() { |
| | | List<DictBizMVO> tree = dictService.parentTree(); |
| | | public R<List<DictVO>> parentTree() { |
| | | List<DictVO> tree = dictService.parentTree(); |
| | | return R.data(tree); |
| | | } |
| | | |
| | |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "æ°å¢æä¿®æ¹", notes = "ä¼ å
¥dict") |
| | | public R submit(@Valid @RequestBody DictBizM dict) { |
| | | public R submit(@Valid @RequestBody Dict dict) { |
| | | CacheUtil.clear(DICT_CACHE); |
| | | return R.status(dictService.submit(dict)); |
| | | } |
| | |
| | | @GetMapping("/dictionary") |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "è·ååå
¸", notes = "è·ååå
¸") |
| | | public R<List<DictBizM>> dictionary(String code) { |
| | | List<DictBizM> tree = dictService.getList(code); |
| | | public R<List<Dict>> dictionary(String code) { |
| | | List<Dict> tree = dictService.getList(code); |
| | | return R.data(tree); |
| | | } |
| | | |
| | |
| | | @GetMapping("/dictionary-tree") |
| | | @ApiOperationSupport(order = 9) |
| | | @ApiOperation(value = "è·ååå
¸æ ", notes = "è·ååå
¸æ ") |
| | | public R<List<DictBizMVO>> dictionaryTree(String code) { |
| | | List<DictBizM> tree = dictService.getList(code); |
| | | return R.data(DictBizWrapper.build().listNodeVO(tree)); |
| | | public R<List<DictVO>> dictionaryTree(String code) { |
| | | List<Dict> tree = dictService.getList(code); |
| | | return R.data(DictWrapper.build().listNodeVO(tree)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/check") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "æ°å¢æä¿®æ¹", notes = "ä¼ å
¥dict") |
| | | public R checkOrInsert(@Valid @RequestBody DictBizM dict) { |
| | | public R checkOrInsert(@Valid @RequestBody Dict dict) { |
| | | CacheUtil.clear(DICT_CACHE); |
| | | return dictService.checkOrInsert(dict); |
| | | } |
| | | |
| | | /** |
| | | * åå
¸é®å¼å表 |
| | | */ |
| | | @GetMapping("/select") |
| | | @ApiOperationSupport(order = 10) |
| | | @ApiOperation(value = "åå
¸é®å¼å表", notes = "åå
¸é®å¼å表") |
| | | public R<List<Dict>> select() { |
| | | List<Dict> list = dictService.list(Wrappers.<Dict>query().lambda().eq(Dict::getParentId, CommonConstant.TOP_PARENT_ID)); |
| | | list.forEach(dict -> dict.setDictValue(dict.getCode() + StringPool.COLON + StringPool.SPACE + dict.getDictValue())); |
| | | return R.data(list); |
| | | } |
| | | |
| | | } |