¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
| | | import com.vci.ubcs.code.entity.CodeButtonEntity; |
| | | import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus; |
| | | import com.vci.ubcs.code.mapper.CodeButtonMapper; |
| | | import com.vci.ubcs.code.service.ICodeButtonService; |
| | | import com.vci.ubcs.code.vo.CodeButtonVO; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * æ¨¡æ¿æ©å±æ± æå¡å®ç°ç±» |
| | | * |
| | | * @author yuxc |
| | | * @since 2023-03-29 |
| | | */ |
| | | @Service |
| | | public class CodeButtonServiceImpl implements ICodeButtonService { |
| | | |
| | | @Autowired |
| | | CodeButtonMapper codeButtonMapper; |
| | | |
| | | @Override |
| | | public IPage<CodeButtonVO> selectcodebuttonPage(IPage<CodeButtonVO> page, CodeButtonVO codebutton) { |
| | | return page.setRecords(codeButtonMapper.selectcodebuttonPage(page, codebutton)); |
| | | } |
| | | |
| | | @Override |
| | | public R enableCodeButton(String id) { |
| | | CodeButtonEntity codebutton = codeButtonMapper.selectById(id); |
| | | return changeLcStatus(codebutton,true); |
| | | } |
| | | /** |
| | | * åç¨ |
| | | * |
| | | * @param oid æ°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @Override |
| | | public R disableOrgDuty(String oid) { |
| | | CodeButtonEntity codebutton = codeButtonMapper.selectById(oid); |
| | | return changeLcStatus(codebutton,false); |
| | | } |
| | | |
| | | // @Override |
| | | // public R deleteCodeButton(String ids) { |
| | | //// VciBaseUtil.alertNotNull(codeButtonDTO,"ä¸»æ°æ®ä¸çæé®æ©å±æ°æ®å¯¹è±¡",codeButtonDTO.getOid(),"ä¸»æ°æ®ä¸çæé®æ©å±ç主é®"); |
| | | // if(StringUtils.isEmpty(ids)){ |
| | | // return R.fail("ä¼ å
¥éæ³æ°æ®ï¼"); |
| | | // } |
| | | // CodeButtonEntity codebutton = codeButtonMapper.selectById(ids); |
| | | // |
| | | // CodeButtonDO codeButtonDO = selectByOid(codeButtonDTO.getOid()); |
| | | // BaseResult baseResult = checkIsCanDeleteForDO(codeButtonDTO,codeButtonDO); |
| | | // if(baseResult.isSuccess()) { |
| | | // }else{ |
| | | // return baseResult; |
| | | // } |
| | | // //æ§è¡å é¤æä½ |
| | | // BatchCBO batchCBO = codeButtonMapper.deleteByPrimaryKey(codeButtonDO.getOid()); |
| | | // return (batchCBO!=null && batchCBO.getDeleteCbos() !=null &&batchCBO.getDeleteCbos().size() > 0)?BaseResult.successMsg(DELETE_SUCCESS):BaseResult.fail(DELETE_FAIL); |
| | | // } |
| | | |
| | | /** |
| | | * ä¿®æ¹çå½å¨æçç¶æï¼å¦åç¨åå¯ç¨ |
| | | * @param buttonDTO æ°æ®ä¼ è¾å¯¹è±¡ï¼å¿
é¡»è¦æoidåts |
| | | * @param disable æ¯å¦ä¸ºåç¨ |
| | | * @return æ§è¡çç»æ |
| | | */ |
| | | private R changeLcStatus(CodeButtonEntity buttonDTO, boolean disable){ |
| | | // VciBaseUtil.alertNotNull(buttonDTO,"æ°æ®å¯¹è±¡",buttonDTO.getOid(),"主é®"); |
| | | if(disable){ |
| | | buttonDTO.setLcstatus(FrameworkDataLCStatus.ENABLED.getValue()); |
| | | }else{ |
| | | buttonDTO.setLcstatus(FrameworkDataLCStatus.DISABLED.getValue()); |
| | | } |
| | | return SqlHelper.retBool(codeButtonMapper.updateById(buttonDTO))? |
| | | R.success(FrameworkDataLCStatus.ENABLED.getValue()):R.fail(FrameworkDataLCStatus.DISABLED.getValue()); |
| | | } |
| | | |
| | | // /** |
| | | // * æ ¡éªæ¯å¦å¯ä»¥å é¤ï¼å¦æåå¨ä¸çº§ï¼å¹¶ä¸ä¸çº§ææ°æ®å¼ç¨åä¸è½å é¤ |
| | | // * @param codeButtonDTO æ°æ®ä¼ è¾å¯¹è±¡ |
| | | // * @param codeButtonDO æ°æ®åºä¸çæ°æ®å¯¹è±¡ |
| | | // * @return success为true为å¯ä»¥å é¤ï¼falseè¡¨ç¤ºææ°æ®å¼ç¨ï¼obj为true表示æä¸çº§ |
| | | // */ |
| | | // private R checkIsCanDeleteForDO(CodeButtonEntity codeButtonDTO, CodeButtonVO codeButtonDO) { |
| | | // CodeButtonVO buttonDO = new CodeButtonVO(); |
| | | // BeanUtil.convert(codeButtonDTO,buttonDO); |
| | | // boService.checkTs(buttonDO); |
| | | // if(!checkIsLinked(codeButtonDO.getOid())) { |
| | | // return BaseResult.success(); |
| | | // }else{ |
| | | // return BaseResult.fail(DATA_LINKED_NOT_DELETE,new String[]{""}); |
| | | // } |
| | | // } |
| | | |
| | | } |