¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill åºéª (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.code.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
| | | import com.vci.ubcs.code.entity.CodeSynonymEntity; |
| | | import com.vci.ubcs.code.mapper.CodeSynonymMapper; |
| | | import com.vci.ubcs.code.service.ICodeSynonymService; |
| | | import com.vci.ubcs.code.vo.CodeSynonymVO; |
| | | import com.vci.ubcs.code.wrapper.CodeSynonymWrapper; |
| | | 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.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | |
| | | /** |
| | | * è¿ä¹è¯ç»´æ¤ æ§å¶å¨ |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-04-04 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/codeSynonym") |
| | | @Api(value = "è¿ä¹è¯ç»´æ¤", tags = "è¿ä¹è¯ç»´æ¤æ¥å£") |
| | | public class CodeSynonymController extends BladeController { |
| | | |
| | | private final ICodeSynonymService codeSynonymService; |
| | | |
| | | CodeSynonymMapper codeSynonymMapper; |
| | | |
| | | /** |
| | | * è¿ä¹è¯ç»´æ¤ 详æ
|
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详æ
", notes = "codeSynonym") |
| | | public R<CodeSynonymVO> detail(CodeSynonymEntity codeSynonym) { |
| | | CodeSynonymEntity detail = codeSynonymMapper.selectOne(Condition.getQueryWrapper(codeSynonym)); |
| | | return R.data(CodeSynonymWrapper.build().entityVO(detail)); |
| | | } |
| | | /** |
| | | * è¿ä¹è¯ç»´æ¤ å页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥codeSynonym") |
| | | public R<IPage<CodeSynonymVO>> list(CodeSynonymEntity codeSynonym, Query query) { |
| | | IPage<CodeSynonymEntity> pages = codeSynonymMapper.selectPage(Condition.getPage(query), Condition.getQueryWrapper(codeSynonym)); |
| | | return R.data(CodeSynonymWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * è¿ä¹è¯ç»´æ¤ èªå®ä¹å页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥codeSynonym") |
| | | public R<IPage<CodeSynonymVO>> page(CodeSynonymVO codeSynonym, Query query) { |
| | | IPage<CodeSynonymVO> pages = codeSynonymService.selectPlCodeSynonymPage(Condition.getPage(query), codeSynonym); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * è¿ä¹è¯ç»´æ¤ æ°å¢ |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "æ°å¢", notes = "ä¼ å
¥codeSynonym") |
| | | public R save(@Valid @RequestBody CodeSynonymEntity codeSynonym) { |
| | | return R.status(SqlHelper.retBool(codeSynonymMapper.insert(codeSynonym))); |
| | | } |
| | | |
| | | /** |
| | | * è¿ä¹è¯ç»´æ¤ ä¿®æ¹ |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "ä¿®æ¹", notes = "ä¼ å
¥codeSynonym") |
| | | public R update(@Valid @RequestBody CodeSynonymEntity codeSynonym) { |
| | | return R.status(SqlHelper.retBool(codeSynonymMapper.updateById(codeSynonym))); |
| | | } |
| | | |
| | | /** |
| | | * è¿ä¹è¯ç»´æ¤ æ°å¢æä¿®æ¹ |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "æ°å¢æä¿®æ¹", notes = "ä¼ å
¥codeSynonym") |
| | | public R submit(@Valid @RequestBody CodeSynonymEntity codeSynonym) { |
| | | if(codeSynonym.getOid() != null){ |
| | | return R.status(SqlHelper.retBool(codeSynonymMapper.updateById(codeSynonym))); |
| | | } |
| | | return R.status(SqlHelper.retBool(codeSynonymMapper.insert(codeSynonym))); |
| | | // return R.status(plCodeSynonymService.saveOrUpdate(plCodeSynonym)); |
| | | } |
| | | |
| | | /** |
| | | * è¿ä¹è¯ç»´æ¤ å é¤ |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "é»è¾å é¤", notes = "ä¼ å
¥oids") |
| | | public R remove(@ApiParam(value = "主é®éå", required = true) @RequestParam String oids) { |
| | | return R.status(SqlHelper.retBool(codeSynonymMapper.deleteBatchIds(Func.toLongList(oids)))); |
| | | } |
| | | |
| | | |
| | | } |