¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.omd.controller; |
| | | |
| | | import com.alibaba.nacos.api.exception.NacosException; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.vci.ubcs.omd.constant.OmdCacheConstant; |
| | | import com.vci.ubcs.omd.dto.BtmTypeDTO; |
| | | import com.vci.ubcs.omd.entity.BtmType; |
| | | import com.vci.ubcs.omd.repeater.DomainRepeater; |
| | | import com.vci.ubcs.omd.service.IBtmTypeService; |
| | | import com.vci.ubcs.omd.vo.BtmTypeVO; |
| | | import com.vci.ubcs.omd.wrapper.BtmTypeWrapper; |
| | | import io.swagger.annotations.*; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | 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.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Description: ä¸å¡ç±»åæ§å¶å¨ |
| | | * |
| | | * @author LiHang |
| | | * @date 2023/4/23 |
| | | */ |
| | | @NonDS |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/btm-type") |
| | | @Api(value = "ä¸å¡ç±»åæ§å¶å¨", tags = "ä¸å¡ç±»åæ§å¶å¨") |
| | | public class BtmTypeController extends BladeController { |
| | | |
| | | /** |
| | | * ä¸å¡ç±»åæå¡ |
| | | */ |
| | | private final IBtmTypeService btmTypeService; |
| | | |
| | | |
| | | /** |
| | | * æ¥ç详æ
|
| | | * |
| | | * @param oid ä¸»é® |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "æ¥ç详æ
", notes = "ä¼ å
¥ä¸»é®") |
| | | public R<BtmTypeVO> detail(String oid) { |
| | | return R.data(btmTypeService.getBtmTypeByOid(oid)); |
| | | } |
| | | |
| | | /** |
| | | * å表 |
| | | * |
| | | * @param condition æ¥è¯¢æ¡ä»¶ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "oid", value = "主é®", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "id", value = "ä¸å¡ç±»åè±æåç§°", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "name", value = "ä¸å¡ç±»å䏿åç§°", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "tableName", value = "ä¸å¡ç±»åæ°æ®åºè¡¨å", paramType = "query", dataType = "string"), |
| | | }) |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "æ¥è¯¢å表", notes = "ä¼ å
¥æ¥è¯¢") |
| | | public R<List<BtmTypeVO>> list(@ApiIgnore @RequestParam Map<String, Object> condition) { |
| | | return R.data(BtmTypeWrapper.build().listEntityVO(btmTypeService.list(Condition.getQueryWrapper(condition, BtmType.class).lambda().orderByAsc(BtmType::getId)))); |
| | | } |
| | | |
| | | /** |
| | | * å页å表 |
| | | * |
| | | * @param condition æ¥è¯¢æ¡ä»¶ |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "oid", value = "主é®", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "id", value = "ä¸å¡ç±»åè±æåç§°", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "name", value = "ä¸å¡ç±»å䏿åç§°", paramType = "query", dataType = "string"), |
| | | @ApiImplicitParam(name = "tableName", value = "ä¸å¡ç±»åæ°æ®åºè¡¨å", paramType = "query", dataType = "string"), |
| | | }) |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "æ¥è¯¢å表", notes = "ä¼ å
¥æ¥è¯¢") |
| | | public R<IPage<BtmTypeVO>> parentList(@ApiIgnore @RequestParam Map<String, Object> condition, Query query) { |
| | | IPage<BtmTypeVO> pageVO = new Page<>(); |
| | | IPage<BtmType> page = btmTypeService.page(Condition.getPage(query), Condition.getQueryWrapper(condition, BtmType.class).lambda().orderByAsc(BtmType::getId)); |
| | | BeanUtil.copy(page, pageVO); |
| | | pageVO.setRecords(BtmTypeWrapper.build().listEntityVO(page.getRecords())); |
| | | return R.data(pageVO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ°å¢æä¿®æ¹ |
| | | * |
| | | * @param dto å
æ°æ®é¡µé¢ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @PostMapping("/submit/{auto}") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "æ°å¢æä¿®æ¹", notes = "ä¼ å
¥ä¸å¡ç±»å对象") |
| | | public R submit(@Valid @RequestBody BtmTypeDTO dto,@PathVariable(value = "auto") boolean auto) { |
| | | CacheUtil.clear(OmdCacheConstant.BTM_CACHE); |
| | | return btmTypeService.submit(dto,auto); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ |
| | | * |
| | | * @param ids 主é®éå |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "å é¤", notes = "主é®éå") |
| | | public R remove(@ApiParam(value = "主é®éå", required = true) @RequestParam String ids) { |
| | | CacheUtil.clear(OmdCacheConstant.BTM_CACHE); |
| | | List<String> oidList = new ArrayList<>(); |
| | | if (ids.contains(",")) { |
| | | oidList.addAll(Func.toStrList(",", ids)); |
| | | } else { |
| | | oidList.add(ids); |
| | | } |
| | | return R.status(btmTypeService.removeBatchByIds(oidList)); |
| | | } |
| | | |
| | | /** |
| | | * è·åé¢åå¼ |
| | | */ |
| | | @GetMapping("/domain") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "è·åé¢åå¼") |
| | | public R<List<String>> getDomain(){ |
| | | try { |
| | | return R.data(DomainRepeater.getDomain()); |
| | | } catch (NacosException e) { |
| | | return R.fail(e.getErrMsg()); |
| | | } |
| | | } |
| | | } |