| | |
| | | |
| | | 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.entity.CodeButton; |
| | | 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 com.vci.ubcs.code.vo.pagemodel.CodeButtonVO; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.web.util.BeanUtilForVCI; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 模板扩展池 服务实现类 |
| | |
| | | @Service |
| | | public class CodeButtonServiceImpl implements ICodeButtonService { |
| | | |
| | | @Autowired |
| | | @Resource |
| | | CodeButtonMapper codeButtonMapper; |
| | | |
| | | @Override |
| | |
| | | return page.setRecords(codeButtonMapper.selectcodebuttonPage(page, codebutton)); |
| | | } |
| | | |
| | | /** |
| | | * 主键批量获取主数据中的按钮扩展 |
| | | * @param oidCollections 主键集合,但是受性能影响,建议一次查询不超过10000个 |
| | | * @return 主数据中的按钮扩展显示对象 |
| | | * @throws VciBaseException 查询出现异常时会抛出 |
| | | */ |
| | | @Override |
| | | public Collection<CodeButtonVO> listCodeButtonByOids(Collection<String> oidCollections) throws VciBaseException { |
| | | VciBaseUtil.alertNotNull(oidCollections,"数据对象主键集合"); |
| | | List<CodeButton> codeButtonDOList = listCodeButtonDOByOidCollections(oidCollections); |
| | | return codeButtonDO2VOs(codeButtonDOList); |
| | | } |
| | | |
| | | /** |
| | | * 批量数据对象转换为显示对象 |
| | | * @param codeButtonDOs 数据对象列表 |
| | | * @return 显示对象 |
| | | * @throws VciBaseException 参数为空或者不存在的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public List<CodeButtonVO> codeButtonDO2VOs(Collection<CodeButton> codeButtonDOs) throws VciBaseException{ |
| | | List<CodeButtonVO> voList = new ArrayList<CodeButtonVO>(); |
| | | if(!CollectionUtils.isEmpty(codeButtonDOs)){ |
| | | for(CodeButton s: codeButtonDOs){ |
| | | CodeButtonVO vo = codeButtonDO2VO(s); |
| | | if(vo != null){ |
| | | voList.add(vo); |
| | | } |
| | | } |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * 数据对象转换为显示对象 |
| | | * @param codeButtonDO 数据对象 |
| | | * @return 显示对象 |
| | | * @throws VciBaseException 拷贝属性出错的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public CodeButtonVO codeButtonDO2VO(CodeButton codeButtonDO) throws VciBaseException{ |
| | | CodeButtonVO vo = new CodeButtonVO(); |
| | | if(codeButtonDO != null){ |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codeButtonDO,vo); |
| | | //如果有lcstatus的类的话 |
| | | vo.setLcStatusText(FrameworkDataLCStatus.getTextByValue(vo.getLcStatus())); |
| | | |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public List<CodeButton> selectByPrimaryKeyCollection(Collection<String> oids) { |
| | | VciBaseUtil.alertNotNull(oids,"主键集合"); |
| | | return codeButtonMapper.selectBatchIds(oids); |
| | | } |
| | | |
| | | /** |
| | | * 使用主键集合查询数据对象 |
| | | * @param oidCollections 主键的集合 |
| | | * @return 数据对象列表 |
| | | */ |
| | | private List<CodeButton> listCodeButtonDOByOidCollections(Collection<String> oidCollections){ |
| | | List<CodeButton> codeButtonDOList = new ArrayList<CodeButton>(); |
| | | if(!CollectionUtils.isEmpty(oidCollections)){ |
| | | Collection<Collection<String>> oidCollectionsList = VciBaseUtil.switchCollectionForOracleIn(oidCollections); |
| | | for(Collection<String> oids: oidCollectionsList){ |
| | | List<CodeButton> tempDOList = codeButtonMapper.selectBatchIds(oids); |
| | | if(!CollectionUtils.isEmpty(tempDOList)){ |
| | | codeButtonDOList.addAll(tempDOList); |
| | | } |
| | | } |
| | | } |
| | | return codeButtonDOList; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R enableCodeButton(String id) { |
| | | CodeButtonEntity codebutton = codeButtonMapper.selectById(id); |
| | | CodeButton codebutton = codeButtonMapper.selectById(id); |
| | | return changeLcStatus(codebutton,true); |
| | | } |
| | | |
| | | /** |
| | | * 停用 |
| | | * |
| | |
| | | */ |
| | | @Override |
| | | public R disableOrgDuty(String oid) { |
| | | CodeButtonEntity codebutton = codeButtonMapper.selectById(oid); |
| | | CodeButton codebutton = codeButtonMapper.selectById(oid); |
| | | return changeLcStatus(codebutton,false); |
| | | } |
| | | |
| | | // @Override |
| | | // @Override |
| | | // public R deleteCodeButton(String ids) { |
| | | //// VciBaseUtil.alertNotNull(codeButtonDTO,"主数据中的按钮扩展数据对象",codeButtonDTO.getOid(),"主数据中的按钮扩展的主键"); |
| | | // if(StringUtils.isEmpty(ids)){ |
| | |
| | | * @param disable 是否为停用 |
| | | * @return 执行的结果 |
| | | */ |
| | | private R changeLcStatus(CodeButtonEntity buttonDTO, boolean disable){ |
| | | private R changeLcStatus(CodeButton buttonDTO, boolean disable){ |
| | | // VciBaseUtil.alertNotNull(buttonDTO,"数据对象",buttonDTO.getOid(),"主键"); |
| | | if(disable){ |
| | | buttonDTO.setLcstatus(FrameworkDataLCStatus.ENABLED.getValue()); |
| | |
| | | R.success(FrameworkDataLCStatus.ENABLED.getValue()):R.fail(FrameworkDataLCStatus.DISABLED.getValue()); |
| | | } |
| | | |
| | | // /** |
| | | // /** |
| | | // * 校验是否可以删除,如果存在下级,并且下级有数据引用则不能删除 |
| | | // * @param codeButtonDTO 数据传输对象 |
| | | // * @param codeButtonDO 数据库中的数据对象 |