| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.lf.server.entity.all.RedisCacheKey; |
| | | import com.lf.server.entity.ctrl.IdNameEntity; |
| | | import com.lf.server.entity.ctrl.TabEntity; |
| | |
| | | * 表名Map |
| | | */ |
| | | private static Map<String, String> tabMap = new HashMap<String, String>(3); |
| | | |
| | | /** |
| | | * 获取父Mapper |
| | | * |
| | | * @param name Mapper名 |
| | | * @return BaseMapper |
| | | */ |
| | | public BasicMapper getBasicMapper(String name) { |
| | | if (StringHelper.isEmpty(name)) { |
| | | return null; |
| | | } |
| | | |
| | | Object obj = ClassHelper.getBean(name.trim() + "Mapper"); |
| | | if (!(obj instanceof BasicMapper)) { |
| | | return null; |
| | | } |
| | | |
| | | return (BasicMapper) obj; |
| | | } |
| | | |
| | | /** |
| | | * 获取空间父Mapper |
| | | * |
| | | * @param name Mapper名 |
| | | * @return GeomBaseMapper |
| | | */ |
| | | public GeomBaseMapper getGeoBaseMapper(String name) { |
| | | if (StringHelper.isEmpty(name)) { |
| | | return null; |
| | | } |
| | | |
| | | Object obj = ClassHelper.getBean(name.trim() + "Mapper"); |
| | | if (!(obj instanceof GeomBaseMapper)) { |
| | | return null; |
| | | } |
| | | |
| | | return (GeomBaseMapper) obj; |
| | | } |
| | | |
| | | /** |
| | | * 添加过滤条件 |
| | |
| | | * @param basicMapper 空间基础Mapper |
| | | * @return SRID |
| | | */ |
| | | private Integer getSrid(GeomBaseMapper basicMapper) { |
| | | public Integer getSrid(GeomBaseMapper basicMapper) { |
| | | String tab = getTabName(basicMapper); |
| | | String key = RedisCacheKey.sridKey(tab); |
| | | |
| | |
| | | * @param basicMapper Mapper |
| | | * @return 表名 |
| | | */ |
| | | public String getTabName(BasicMapper basicMapper) { |
| | | public static String getTabName(BasicMapper basicMapper) { |
| | | String className = ClassHelper.getClassName(basicMapper); |
| | | if (tabMap.containsKey(className)) { |
| | | return tabMap.get(className); |
| | |
| | | * @param className Mapper类名 |
| | | * @return 表名 |
| | | */ |
| | | private String getTabName(String className) { |
| | | private static String getTabName(String className) { |
| | | Class clazz = ClassHelper.getEntityClass(className); |
| | | if (clazz == null) { |
| | | return null; |