From 59b9376070522038963d10dc48f32a2770d99426 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 16 七月 2025 10:30:00 +0800 Subject: [PATCH] 添加模块,解决服务启动报错 --- se-collect/src/main/resources/mapper/all/PermsMapper.xml | 8 se-collect/src/main/java/com/terra/collect/extend/CustomizedSqlInjector.java | 27 ++ se-discover/src/main/resources/mybatis.xml | 4 se-system/src/main/resources/mybatis.xml | 4 se-collect/src/main/java/com/terra/collect/config/MybatisPlusConfig.java | 52 +++++ se-collect/src/main/java/com/terra/collect/extend/UpdateBatchMethod.java | 86 ++++++++ se-collect/src/main/java/com/terra/collect/entity/all/StaticData.java | 272 +++++++++++++++++++++++++++ se-collect/src/main/java/com/terra/collect/mapper/all/PermsMapper.java | 12 + se-collect/src/main/java/com/terra/collect/extend/InsertBatchMethod.java | 76 +++++++ se-publish/src/main/resources/mybatis.xml | 4 pom.xml | 3 se-collect/src/main/resources/mybatis.xml | 4 12 files changed, 536 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 94e8fa0..3ad71d4 100644 --- a/pom.xml +++ b/pom.xml @@ -166,6 +166,9 @@ <module>se-common</module> <module>se-gateway</module> <module>se-system</module> + <module>se-collect</module> + <module>se-discover</module> + <module>se-publish</module> </modules> <packaging>pom</packaging> diff --git a/se-collect/src/main/java/com/terra/collect/config/MybatisPlusConfig.java b/se-collect/src/main/java/com/terra/collect/config/MybatisPlusConfig.java new file mode 100644 index 0000000..c658724 --- /dev/null +++ b/se-collect/src/main/java/com/terra/collect/config/MybatisPlusConfig.java @@ -0,0 +1,52 @@ +package com.terra.collect.config; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer; +import com.baomidou.mybatisplus.core.MybatisConfiguration; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import com.terra.collect.extend.CustomizedSqlInjector; +import org.apache.ibatis.type.JdbcType; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * Mybatis-Plus鍒嗛〉閰嶇疆 + * @author WWW + */ +@EnableTransactionManagement +@Configuration +@MapperScan("com.terra.system.mapper") +public class MybatisPlusConfig { + /** + * 鏂扮殑鍒嗛〉鎻掍欢,涓�缂撳拰浜岀紦閬靛惊mybatis鐨勮鍒�,闇�瑕佽缃� + * MybatisConfiguration#useDeprecatedExecutor = false + * 閬垮厤缂撳瓨鍑虹幇闂(璇ュ睘鎬т細鍦ㄦ棫鎻掍欢绉婚櫎鍚庝竴鍚岀Щ闄�) + */ + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL)); + return interceptor; + } + + @Bean + public ConfigurationCustomizer configurationCustomizer() { + return new ConfigurationCustomizer() { + @Override + public void customize(MybatisConfiguration configuration) { + configuration.setCacheEnabled(true); + configuration.setMapUnderscoreToCamelCase(true); + configuration.setCallSettersOnNulls(true); + configuration.setJdbcTypeForNull(JdbcType.NULL); + } + }; + } + + @Bean + public CustomizedSqlInjector customizedSqlInjector() { + return new CustomizedSqlInjector(); + } +} diff --git a/se-collect/src/main/java/com/terra/collect/entity/all/StaticData.java b/se-collect/src/main/java/com/terra/collect/entity/all/StaticData.java new file mode 100644 index 0000000..d112f34 --- /dev/null +++ b/se-collect/src/main/java/com/terra/collect/entity/all/StaticData.java @@ -0,0 +1,272 @@ +package com.terra.collect.entity.all; + +import com.alibaba.fastjson.JSON; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 闈欐�佹暟鎹被 + * @author WWW + */ +public class StaticData { + /** + * 鏉冮檺鎺掗櫎璺緞锛�/proxy锛岃姹傚叏閮ㄥ皬鍐� + */ + public static String[] EXCLUDE_PATH = new String[]{"/sign/", "/perms/", "/fmeit/", "/crds/", "/floatserver/", "/wmts/select", "/onemap/", "/swagger", "/error"}; + + public final static int I1 = 1; + + public final static int I2 = 2; + + public final static int FOUR = 4; + + public final static int I5 = 5; + + public final static int NINE = 9; + + public final static int I10 = 10; + + public final static int SIXTEEN = 16; + + public final static int TWO_HUNDRED = 200; + + public final static int I100000 = 100000; + + public final static int I1000000 = 1000000; + + public static final double D90 = 90.0; + + public static final double D100 = 100.0; + + public static final double D1024 = 1024.0; + + public static final double D1050 = 1050.0; + + public static final int I12 = 12; + + public static final int I23 = 23; + + public static final int I24 = 24; + + public static final int I31 = 31; + + public static final int I50 = 50; + + public static final int I60 = 60; + + public static final int I90 = 90; + + public static final int I90_NEG = -90; + + public final static int I100 = 100; + + public final static int I120 = 120; + + public static final int I180 = 180; + + public static final int I180_NEG = -180; + + public static final int I1000 = 1000; + + public static final int I2050 = 2050; + + public static final int I4326 = 4326; + + public static final int I4490 = 4490; + + public final static String S1 = "1"; + + public final static String EQ = "="; + + public final static String POINT = "."; + + public final static String COMMA = ","; + + public final static String TILDE = "~"; + + public final static String SINGLE_QUOTES = "'"; + + public final static String BBOREHOLE = "bborehole"; + + public final static String SLASH = "/"; + + public final static String IN = "in"; + + public final static String DWG = "dwg"; + + public final static String ZIP = ".zip"; + + public final static String XLS = ".xls"; + + public final static String XLSX = ".xlsx"; + + public final static String MDB = ".mdb"; + + public final static String KML = ".kml"; + + public final static String SHP = ".shp"; + + public final static String NGDB = "gdb"; + + public final static String GDB = ".gdb"; + + public final static String JPG = ".jpg"; + + public final static String IMG = ".img"; + + public final static String MPT = ".mpt"; + + public final static String D3DML = ".3dml"; + + public final static String TIF = ".tif"; + + public final static String TIFF = ".tiff"; + + public final static String LAS = ".las"; + + public final static String OSGB = ".osgb"; + + public static String ADMIN = "admin"; + + public final static String SYS_META = "sysmeta"; + + public final static String VERSION = "1.0.0"; + + public final static String TOKEN_KEY = "token"; + + public final static String TOKEN_COOKIE_KEY = "token"; + + public final static String TEXT_ENCODER = "UTF-8"; + + public final static String CHECK_MAIN = "checkMain"; + + public final static String OBJECT = "java.lang.Object"; + + public final static String DRUID_COOKIE_KEY = "JSESSIONID"; + + public final static String YES = "YES"; + + public final static String NO = "NO"; + + public final static String ROUTE = "绾胯矾"; + + public final static String CROSSING = "绌胯法瓒�"; + + public final static String LINESTRING = "LINESTRING"; + + public final static String MULTILINESTRING = "MULTILINESTRING"; + + public final static String POLYGON = "POLYGON"; + + public final static String MULTIPOLYGON = "MULTIPOLYGON"; + + public final static String MULTICURVE = "MULTICURVE"; + + public final static String COMPOUNDCURVE = "COMPOUNDCURVE"; + + public final static String CGCS2000 = "CGCS2000"; + + public static final String NO_FILE = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NOT_FOUND, "鏂囦欢鎵句笉鍒�")); + + /** + * 16杩涘埗 + */ + public static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + + /** + * 鏍呮牸鏁版嵁鎵╁睍鍚� + */ + public final static List<String> RASTER_EXT = new ArrayList<>(Arrays.asList(".img", ".tif", ".tiff", ".jpg", ".jp2")); + + /** + * 瀵嗙爜姝e垯琛ㄨ揪寮� + */ + public final static String PWD_REG = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![a-z0-9]+$)(?![a-z\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![0-9\\W!@#$%^&*`~()\\-_+=,.?;<>]+$)[a-zA-Z0-9\\W!@#$%^&*`~()\\-_+=,.?;<>]{12,20}$"; + + /** + * MPT鏂囦欢鎵╁睍鍚� + */ + public final static List<String> MPT_EXT = new ArrayList<>(Arrays.asList(".midx", ".strmi", ".ei.midx", ".ei.mpt", ".ei.strmi")); + + /** + * JPG鏂囦欢鎵╁睍鍚� + */ + public final static List<String> JPG_EXT = new ArrayList<>(Arrays.asList(".jpg.aux.xml", ".jpg.ovr", ".jpg.xml", ".jgw", ".prj")); + + /** + * JP2鏂囦欢鎵╁睍鍚� + */ + public final static List<String> JP2_EXT = new ArrayList<>(Arrays.asList(".jp2.aux.xml", ".jp2.ovr", ".jp2.xml", ".jgw", ".prj", ".jp2.html", ".jp2.txt")); + + /** + * IMG鏂囦欢鎵╁睍鍚� + */ + public final static List<String> IMG_EXT = new ArrayList<>(Arrays.asList(".rrd", ".img.aux.xml", ".hdr", ".img.enp", ".img.xml")); + + /** + * TIF鏂囦欢鎵╁睍鍚� + */ + public final static List<String> TIF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".aux", ".tif.ovr", ".tif.aux.xml", ".tif.xml")); + + /** + * TIFF鏂囦欢鎵╁睍鍚� + */ + public final static List<String> TIFF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".aux", ".tiff.ovr", ".tiff.aux.xml", ".tiff.xml")); + + /** + * SHP鏂囦欢鎵╁睍鍚� + */ + public final static List<String> SHP_EXT = new ArrayList<>(Arrays.asList(".shx", ".dbf", ".prj", ".cpg")); + + /** + * Mapper鎺掗櫎鎵╁睍鍚� + */ + public final static List<String> MAPPER_EXCLUDE_EXT = new ArrayList<>(Arrays.asList(".jpg.aux.xml", ".jpg.xml", ".jp2.aux.xml", ".jp2.xml", ".jp2.html", ".jp2.txt", ".img.aux.xml", ".img.xml", ".tif.aux.xml", ".tif.xml", ".tiff.aux.xml", ".tiff.xml", ".shp.xml", ".ecw.xml", "ecw.aux.xml")); + + /** + * 鎵�鏈夋枃浠舵墿灞曞悕 + */ + public final static List<String> ALL_EXTENSION = new ArrayList<>(Arrays.asList(".txt", ".xml", ".pdf", ".xls", ".xlsx", ".doc", ".docx", ".ppt", ".pptx", ".shp", ".gdb", ".mdb", ".dwg", ".las", ".laz", ".cpt", ".mpt", ".ei.mpt", ".fly", ".efb", ".g3d", ".fbx", ".obj", ".3dm", ".3dml", ".osgb", ".rvt", ".ifc", ".jpg", ".jp2", ".png", ".img", ".tif", ".tiff", ".dem", ".bmp", ".gif", ".rmvb", ".rm", ".mp3", ".mp4", ".avi", ".wma", ".wmv", ".7z", ".rar", ".zip", ".lz", ".kml")); + + /** + * 鎻掑叆鎺掗櫎瀛楁 + */ + public final static List<String> INSERT_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("gid", "objectid", "updateuser", "updatetime", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); + + /** + * 鏇存柊鎺掗櫎瀛楁 + */ + public final static List<String> UPDATE_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("objectid", "createuser", "createtime", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); + + /** + * 璇诲彇鎺掗櫎瀛楁 + */ + public final static List<String> READ_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("gid", "eventid", "parentid", "objectid", "dirid", "depid", "verid", "createtime", "createuser", "updateuser", "updatetime", "shape_leng", "shape_area", "serialversionuid", "dirname", "depname", "vername", "createname", "updatename")); + + /** + * MDB鎺掗櫎瀛楁 + */ + public final static List<String> MDB_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("Shape", "SHAPE_LENG", "Shape_Length", "Shape_Area", "OBJECTID_1")); + + /** + * 鏍囩粯Shp鎺掗櫎瀛楁 + */ + public final static List<String> MARK_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("wkt", "geom", "objectid", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); + + /** + * GDB鎺掗櫎瀛楁 + */ + public final static List<String> GDB_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("geom", "objectid", "shape_leng", "shape_area", "serialVersionUID", "dirName", "depName", "verName", "createName", "updateName")); + + /** + * 绠$嚎鍒嗘瀽琛ㄥ悕闆嗗悎 + */ + public final static List<String> PIPE_ANALYSIS_TABS = new ArrayList<>(Arrays.asList("bd.dlg_25w_hydl", "bd.dlg_25w_lrdl", "bd.dlg_25w_lrrl", "bd.dlg_25w_hyda")); + + /** + * 绠$嚎鎺掗櫎瀛楁 + */ + public final static List<String> PIPE_EXCLUDE_FIELDS = new ArrayList<>(Arrays.asList("serialVersionUID", "tabs", "pwd", "gid", "wkt")); +} diff --git a/se-collect/src/main/java/com/terra/collect/extend/CustomizedSqlInjector.java b/se-collect/src/main/java/com/terra/collect/extend/CustomizedSqlInjector.java new file mode 100644 index 0000000..b552cb7 --- /dev/null +++ b/se-collect/src/main/java/com/terra/collect/extend/CustomizedSqlInjector.java @@ -0,0 +1,27 @@ +package com.terra.collect.extend; + +import com.baomidou.mybatisplus.core.injector.AbstractMethod; +import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; +import com.baomidou.mybatisplus.core.metadata.TableInfo; +import com.terra.collect.extend.UpdateBatchMethod; + +import java.util.List; + +/** + * 鑷畾涔夋柟娉昐QL娉ㄥ叆鍣� + * @author WWW + */ +public class CustomizedSqlInjector extends DefaultSqlInjector { + /** + * 濡傛灉鍙渶澧炲姞鏂规硶锛屼繚鐣檓ybatis plus鑷甫鏂规硶锛� + * 鍙互鍏堣幏鍙杝uper.getMethodList()锛屽啀娣诲姞add + */ + @Override + public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) { + List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo); + methodList.add(new InsertBatchMethod()); + methodList.add(new UpdateBatchMethod()); + + return methodList; + } +} diff --git a/se-collect/src/main/java/com/terra/collect/extend/InsertBatchMethod.java b/se-collect/src/main/java/com/terra/collect/extend/InsertBatchMethod.java new file mode 100644 index 0000000..94d5873 --- /dev/null +++ b/se-collect/src/main/java/com/terra/collect/extend/InsertBatchMethod.java @@ -0,0 +1,76 @@ +package com.terra.collect.extend; + +import com.baomidou.mybatisplus.core.injector.AbstractMethod; +import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; +import com.baomidou.mybatisplus.core.metadata.TableInfo; +import com.terra.collect.entity.all.StaticData; +import org.apache.ibatis.executor.keygen.NoKeyGenerator; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.SqlSource; + +/** + * 鎵归噺鎻掑叆鏂规硶 + * @author WWW + */ +@SuppressWarnings("ALL") +public class InsertBatchMethod extends AbstractMethod { + /** + * insert into user(id, name, age) values (1, "a", 17), (2, "b", 18); + * <script> + * insert into user(id, name, age) values + * <foreach collection="list" item="item" index="index" open="(" separator="),(" close=")"> + * #{item.id}, #{item.name}, #{item.age} + * </foreach> + * </script> + */ + @Override + public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) { + final String sql = "<script>insert into %s %s values %s</script>"; + final String fieldSql = prepareFieldSql(tableInfo); + final String valueSql = prepareValuesSql(tableInfo); + final String sqlResult = String.format(sql, tableInfo.getTableName(), fieldSql, valueSql); + + SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass); + + // 绗笁涓弬鏁板繀椤诲拰RootMapper鐨勮嚜瀹氫箟鏂规硶鍚嶄竴鑷� + return this.addInsertMappedStatement(mapperClass, modelClass, "insertBatch", sqlSource, new NoKeyGenerator(), null, null); + } + + private String prepareFieldSql(TableInfo tableInfo) { + StringBuilder fieldSql = new StringBuilder(); + // fieldSql.append(tableInfo.getKeyColumn()).append(",") + // tableInfo.getFieldList().forEach(x -> fieldSql.append(x.getColumn()).append(",")) + for (TableFieldInfo f : tableInfo.getFieldList()) { + if (StaticData.INSERT_EXCLUDE_FIELDS.contains(f.getProperty())) { + continue; + } + + fieldSql.append(f.getColumn()).append(","); + } + + fieldSql.delete(fieldSql.length() - 1, fieldSql.length()); + fieldSql.insert(0, "("); + fieldSql.append(")"); + + return fieldSql.toString(); + } + + private String prepareValuesSql(TableInfo tableInfo) { + final StringBuilder valueSql = new StringBuilder(); + valueSql.append("<foreach collection=\"list\" item=\"item\" index=\"index\" open=\"(\" separator=\"),(\" close=\")\">"); + // valueSql.append("#{item.").append(tableInfo.getKeyProperty()).append("},") + // tableInfo.getFieldList().forEach(x -> valueSql.append("#{item.").append(x.getProperty()).append("},")) + for (TableFieldInfo f : tableInfo.getFieldList()) { + if (StaticData.INSERT_EXCLUDE_FIELDS.contains(f.getProperty())) { + continue; + } + + valueSql.append("geom".equals(f.getProperty()) ? "${item." : "#{item.").append(f.getProperty()).append("},"); + } + + valueSql.delete(valueSql.length() - 1, valueSql.length()); + valueSql.append("</foreach>"); + + return valueSql.toString(); + } +} diff --git a/se-collect/src/main/java/com/terra/collect/extend/UpdateBatchMethod.java b/se-collect/src/main/java/com/terra/collect/extend/UpdateBatchMethod.java new file mode 100644 index 0000000..f698ed1 --- /dev/null +++ b/se-collect/src/main/java/com/terra/collect/extend/UpdateBatchMethod.java @@ -0,0 +1,86 @@ +package com.terra.collect.extend; + +import com.baomidou.mybatisplus.core.injector.AbstractMethod; +import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; +import com.baomidou.mybatisplus.core.metadata.TableInfo; +import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils; +import com.terra.collect.entity.all.StaticData; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.mapping.SqlSource; + +/** + * 鎵归噺鏇存柊鏂规硶 + * @author WWW + */ +@SuppressWarnings("ALL") +public class UpdateBatchMethod extends AbstractMethod { + /** + * update user set name = "a", age = 17 where id = 1; + * update user set name = "b", age = 18 where id = 2; + * <script> + * <foreach collection="list" item="item" separator=";"> + * update user + * <set> + * <if test="item.name != null and item.name != ''"> + * name = #{item.name,jdbcType=VARCHAR}, + * </if> + * <if test="item.age != null"> + * age = #{item.age,jdbcType=INTEGER}, + * </if> + * </set> + * where id = #{item.id,jdbcType=INTEGER} + * </foreach> + * </script> + */ + @Override + public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) { + String sql = "<script>\n<foreach collection=\"list\" item=\"item\" separator=\";\">\nupdate %s %s where %s=#{%s} %s\n</foreach>\n</script>"; + String additional = tableInfo.isWithVersion() ? tableInfo.getVersionFieldInfo().getVersionOli("item", "item.") : "" + tableInfo.getLogicDeleteSql(true, true); + //String setSql = sqlSet(tableInfo.isWithLogicDelete(), false, tableInfo, false, "item", "item."); + String setSql = getSqlSet(tableInfo.isWithLogicDelete(), false, tableInfo, false, "item", "item."); + String sqlResult = String.format(sql, tableInfo.getTableName(), setSql, tableInfo.getKeyColumn(), "item." + tableInfo.getKeyProperty(), additional); + + // update %s %s where %s=#{%s} %s + // update tab set a=#{a} where gid=1 + + SqlSource sqlSource = languageDriver.createSqlSource(configuration, sqlResult, modelClass); + + // 绗笁涓弬鏁板繀椤诲拰RootMapper鐨勮嚜瀹氫箟鏂规硶鍚嶄竴鑷� + return this.addUpdateMappedStatement(mapperClass, modelClass, "updateBatch", sqlSource); + } + + private String getSqlSet(boolean logic, boolean ew, TableInfo table, boolean judgeAliasNull, final String alias, final String prefix) { + // String sqlScript = table.getAllSqlSet(logic, prefix); + String sqlScript = getSqlSet(table); + if (judgeAliasNull) { + sqlScript = SqlScriptUtils.convertIf(sqlScript, String.format("%s != null", alias), true); + } + if (ew) { + sqlScript = sqlScript + "\n"; + sqlScript = sqlScript + this.convertIfEwParam("ew.sqlSet", false); + } + + sqlScript = SqlScriptUtils.convertSet(sqlScript); + + return sqlScript; + } + + private String getSqlSet(TableInfo tableInfo) { + StringBuilder sb = new StringBuilder(); + for (TableFieldInfo f : tableInfo.getFieldList()) { + if (StaticData.UPDATE_EXCLUDE_FIELDS.contains(f.getProperty())) { + continue; + } + + if ("geom".equals(f.getProperty())) { + sb.append("<if test=\"item['geom'] != null\">geom=${item.geom},</if>\n"); + continue; + } + + sb.append(String.format("<if test=\"item['%s'] != null\">%s=#{item.%s},</if>\n", f.getProperty(), f.getColumn(), f.getProperty())); + } + sb.deleteCharAt(sb.length() - 1); + + return sb.toString(); + } +} diff --git a/se-collect/src/main/java/com/terra/collect/mapper/all/PermsMapper.java b/se-collect/src/main/java/com/terra/collect/mapper/all/PermsMapper.java new file mode 100644 index 0000000..9bb3735 --- /dev/null +++ b/se-collect/src/main/java/com/terra/collect/mapper/all/PermsMapper.java @@ -0,0 +1,12 @@ +package com.terra.collect.mapper.all; + +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Mapper +@Repository +public interface PermsMapper { + public List<Integer> selectRoles(String uid); +} diff --git a/se-collect/src/main/resources/mapper/all/PermsMapper.xml b/se-collect/src/main/resources/mapper/all/PermsMapper.xml new file mode 100644 index 0000000..5136884 --- /dev/null +++ b/se-collect/src/main/resources/mapper/all/PermsMapper.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.terra.collect.mapper.all.PermsMapper"> + <select id="selectRoles" resultType="java.lang.Integer"> + select is_admin from lf.sys_role a inner join lf.sys_role_user b on a.id = b.roleid + inner join lf.sys_user c on b.userid = c.id where c.uid = #{uid} + </select> +</mapper> \ No newline at end of file diff --git a/se-collect/src/main/resources/mybatis.xml b/se-collect/src/main/resources/mybatis.xml index 86d68f2..34ce323 100644 --- a/se-collect/src/main/resources/mybatis.xml +++ b/se-collect/src/main/resources/mybatis.xml @@ -35,8 +35,4 @@ <!--鈥岀被鍨嬪埆鍚嶉厤缃�--> <package name="com.terra.collect.entity"/> </typeAliases> - <mappers> - <!--Mapper鏂囦欢浣嶇疆閰嶇疆--> - <mapper resource="mapper/**/*.xml" /> - </mappers> </configuration> \ No newline at end of file diff --git a/se-discover/src/main/resources/mybatis.xml b/se-discover/src/main/resources/mybatis.xml index 86d68f2..34ce323 100644 --- a/se-discover/src/main/resources/mybatis.xml +++ b/se-discover/src/main/resources/mybatis.xml @@ -35,8 +35,4 @@ <!--鈥岀被鍨嬪埆鍚嶉厤缃�--> <package name="com.terra.collect.entity"/> </typeAliases> - <mappers> - <!--Mapper鏂囦欢浣嶇疆閰嶇疆--> - <mapper resource="mapper/**/*.xml" /> - </mappers> </configuration> \ No newline at end of file diff --git a/se-publish/src/main/resources/mybatis.xml b/se-publish/src/main/resources/mybatis.xml index 86d68f2..34ce323 100644 --- a/se-publish/src/main/resources/mybatis.xml +++ b/se-publish/src/main/resources/mybatis.xml @@ -35,8 +35,4 @@ <!--鈥岀被鍨嬪埆鍚嶉厤缃�--> <package name="com.terra.collect.entity"/> </typeAliases> - <mappers> - <!--Mapper鏂囦欢浣嶇疆閰嶇疆--> - <mapper resource="mapper/**/*.xml" /> - </mappers> </configuration> \ No newline at end of file diff --git a/se-system/src/main/resources/mybatis.xml b/se-system/src/main/resources/mybatis.xml index 86d68f2..34ce323 100644 --- a/se-system/src/main/resources/mybatis.xml +++ b/se-system/src/main/resources/mybatis.xml @@ -35,8 +35,4 @@ <!--鈥岀被鍨嬪埆鍚嶉厤缃�--> <package name="com.terra.collect.entity"/> </typeAliases> - <mappers> - <!--Mapper鏂囦欢浣嶇疆閰嶇疆--> - <mapper resource="mapper/**/*.xml" /> - </mappers> </configuration> \ No newline at end of file -- Gitblit v1.9.3