com.baomidou.mybatisplus.extension.service.impl.ServiceImpl Java Examples
The following examples show how to use
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServiceImplWrapper.java From springboot-plugin-framework-parent with Apache License 2.0 | 6 votes |
/** * 给ServiceImpl设置Mapper */ private void setMapper(){ Class<? extends ServiceImpl> aClass = serviceImpl.getClass(); Field[] fields = aClass.getDeclaredFields(); for (Field field : fields) { if(Objects.equals(field.getName(), "baseMapper") || (baseMapper != null && baseMapper.getClass() == field.getType())){ field.setAccessible(true); try { field.set(serviceImpl, baseMapper); } catch (IllegalAccessException e) { e.printStackTrace(); } } } }
Example #2
Source File: ServiceImplWrapper.java From springboot-plugin-framework-parent with Apache License 2.0 | 4 votes |
public ServiceImplWrapper(M baseMapper) { this.baseMapper = Objects.requireNonNull(baseMapper); this.serviceImpl = new ServiceImpl<M, T>(); setMapper(); }