¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.vci.ubcs.code.dto.CodeButtonDTO; |
| | | import com.vci.ubcs.code.entity.CodeButton; |
| | | import com.vci.ubcs.code.mapper.CodeButtonMapper; |
| | | import com.vci.ubcs.code.service.ICodeButtonService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeButtonVO; |
| | | import com.vci.ubcs.code.wrapper.CodeButtonWrapper; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | 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.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± æ§å¶å¨ |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-03-29 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/codeButtonController") |
| | | @Api(value = "æ¨¡æ¿æ©å±æ± ", tags = "æ¨¡æ¿æ©å±æ± æ¥å£") |
| | | public class CodeButtonController extends BladeController { |
| | | |
| | | private final ICodeButtonService codeButtonService; |
| | | |
| | | CodeButtonMapper codeButtonMapper; |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± 详æ
|
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详æ
", notes = "ä¼ å
¥codebutton") |
| | | public R<CodeButtonVO> detail(CodeButton codebutton) { |
| | | CodeButton detail = codeButtonMapper.selectOne(Condition.getQueryWrapper(codebutton)); |
| | | return R.data(CodeButtonWrapper.build().entityVO(detail)); |
| | | } |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± å页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥codebutton") |
| | | public R<IPage<CodeButtonVO>> list(CodeButton codebutton, Query query) { |
| | | IPage<CodeButton> pages = codeButtonMapper.selectPage(Condition.getPage(query), Condition.getQueryWrapper(codebutton)); |
| | | return R.data(CodeButtonWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± èªå®ä¹å页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "å页", notes = "ä¼ å
¥codebutton") |
| | | public R<IPage<CodeButtonVO>> page(CodeButtonVO codebutton, Query query) { |
| | | IPage<CodeButtonVO> pages = codeButtonService.selectcodebuttonPage(Condition.getPage(query), codebutton); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± æ°å¢ |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "æ°å¢", notes = "ä¼ å
¥codebutton") |
| | | public R save(@Valid @RequestBody CodeButton codebutton) { |
| | | return R.status(SqlHelper.retBool(codeButtonMapper.insert(codebutton))); |
| | | } |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± ä¿®æ¹ |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "ä¿®æ¹", notes = "ä¼ å
¥codebutton") |
| | | public R update(@Valid @RequestBody CodeButton codebutton) { |
| | | return R.status(SqlHelper.retBool(codeButtonMapper.updateById(codebutton))); |
| | | } |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± æ°å¢æä¿®æ¹ |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "æ°å¢æä¿®æ¹", notes = "ä¼ å
¥codebutton") |
| | | public R submit(@Valid @RequestBody CodeButton codebutton) { |
| | | if(codebutton.getOid() != null){ |
| | | return R.status(SqlHelper.retBool(codeButtonMapper.updateById(codebutton))); |
| | | } |
| | | return R.status(SqlHelper.retBool(codeButtonMapper.insert(codebutton))); |
| | | } |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± å é¤ |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "é»è¾å é¤", notes = "ä¼ å
¥ids") |
| | | public R remove(@ApiParam(value = "主é®éå", required = true) @RequestParam String ids) { |
| | | // return codebuttonService.deleteCodeButton(ids); |
| | | return R.status(SqlHelper.retBool(codeButtonMapper.deleteBatchIds(Func.toStrList(ids)))); |
| | | } |
| | | |
| | | /** |
| | | * ä¸»æ°æ®ä¸çæé®æ©å±å表 |
| | | * @param baseQueryObject åºç¡æ¥è¯¢å¯¹è±¡ï¼å
嫿¥è¯¢æ¡ä»¶ï¼åé¡µï¼æåºç |
| | | * @return ä¸»æ°æ®ä¸çæé®æ©å±æ¾ç¤ºå¯¹è±¡å表 |
| | | */ |
| | | @GetMapping("/gridCodeButton") |
| | | public R<IPage<CodeButtonVO>> gridCodeButton(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return R.data(codeButtonService.gridCodeButton(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper())); |
| | | } |
| | | |
| | | /** |
| | | * å¢å ä¸»æ°æ®ä¸çæé®æ©å± |
| | | * @param codeButtonDTO ä¸»æ°æ®ä¸çæé®æ©å±æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æï¼success为true表示æåï¼msgæ¯å¤±è´¥çæç¤ºä¿¡æ¯ï¼objæ¯æ·»å 宿åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public R<CodeButtonVO> addSave(@RequestBody CodeButtonDTO codeButtonDTO){ |
| | | CodeButtonVO codeButtonVO = codeButtonService.addSave(codeButtonDTO); |
| | | return R.data(codeButtonVO); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ ä¸»æ°æ®ä¸çæé®æ©å± |
| | | * @param codeButtonDTO ä¸»æ°æ®ä¸çæé®æ©å±æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æï¼success为true表示æåï¼msgæ¯å¤±è´¥çæç¤ºä¿¡æ¯ï¼objæ¯æ·»å 宿åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public R<CodeButtonVO> editSave(@RequestBody CodeButtonDTO codeButtonDTO){ |
| | | CodeButtonVO codeButtonVO = codeButtonService.editSave(codeButtonDTO); |
| | | return R.data(codeButtonVO); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä¸»æ°æ®ä¸çæé®æ©å± |
| | | * @param codeButtonDTO ä¸»æ°æ®ä¸çæé®æ©å±æ°æ®ä¼ è¾å¯¹è±¡ï¼oidåtséè¦ä¼ è¾ |
| | | * @return å é¤ç»æåé¦ï¼ï¼successï¼æåï¼failï¼å¤±è´¥ |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public R delCodeButton( CodeButtonDTO codeButtonDTO) { |
| | | return codeButtonService.deleteCodeButton(codeButtonDTO); |
| | | } |
| | | |
| | | /** |
| | | * 主é®è·åä¸»æ°æ®ä¸çæé®æ©å± |
| | | * @param oid ä¸»é® |
| | | * @return ä¸»æ°æ®ä¸çæé®æ©å±æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public R<CodeButtonVO> getObjectByOid(String oid){ |
| | | CodeButtonVO codeButtonVO = codeButtonService.getObjectByOid(oid); |
| | | return R.data(codeButtonVO); |
| | | } |
| | | |
| | | /** |
| | | * 䏻鮿¹éè·åä¸»æ°æ®ä¸çæé®æ©å± |
| | | * @param oids 主é®ï¼å¤ä¸ªä»¥éå·åéï¼ä½æ¯åæ§è½å½±åï¼å»ºè®®ä¸æ¬¡æ¥è¯¢ä¸è¶
è¿10000个 |
| | | * @return ä¸»æ°æ®ä¸çæé®æ©å±æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @GetMapping("/listDataByOids") |
| | | public R<Collection<CodeButtonVO>> listCodeButtonByOids(String oids){ |
| | | return R.data(codeButtonService.listCodeButtonByOids(VciBaseUtil.str2List(oids))); |
| | | } |
| | | |
| | | /** |
| | | * åç
§ä¸»æ°æ®ä¸çæé®æ©å±å表 |
| | | * @param baseQueryObject åºç¡æ¥è¯¢å¯¹è±¡ï¼å
嫿¥è¯¢æ¡ä»¶ï¼åé¡µï¼æåºç |
| | | * @return ä¸»æ°æ®ä¸çæé®æ©å±æ¾ç¤ºå¯¹è±¡å表ï¼çæçå
容 |
| | | */ |
| | | @GetMapping("/refDataGrid") |
| | | public R<IPage<CodeButtonVO>> refDataGridCodeButton(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return R.data(codeButtonService.refDataGridCodeButton(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper())); |
| | | } |
| | | |
| | | /** |
| | | * å¯ç¨ |
| | | * @param oid æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return å¯ç¨ç»æåé¦ï¼ |
| | | */ |
| | | @PostMapping("/enableData") |
| | | public R enableOrgDuty(@ApiParam(value = "主é®éå", required = true) @RequestParam String oid) { |
| | | return codeButtonService.enableCodeButton(oid); |
| | | } |
| | | |
| | | /** |
| | | * åç¨ |
| | | * @param oid éè¦ä¼ è¾ |
| | | * @return åç¨ç»æåé¦ï¼ |
| | | */ |
| | | @PostMapping("/disableData") |
| | | public R disableOrgDuty(@ApiParam(value = "主é®éå", required = true) @RequestParam String oid) { |
| | | return codeButtonService.disableOrgDuty(oid); |
| | | } |
| | | |
| | | } |