Commit 7dc44a65 authored by 董国亮's avatar 董国亮

在使用 MyBatis 时,出现 "Result Maps collection already contains value for...

在使用 MyBatis 时,出现 "Result Maps collection already contains value for BaseResultMap" 这个错误,通常是因为在 MyBatis 的映射文件中,有多个 Result Map 使用了相同的 id。每个 Result Map 的 id 必须是唯一的,否则会导致冲突。
parent b9a99677
...@@ -308,6 +308,97 @@ ...@@ -308,6 +308,97 @@
</executions> </executions>
</plugin> </plugin>
<!-- maven 打包方式-->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<!--<version>2.6</version>-->
<executions>
<!--将启动脚本复制到指定目录-->
<execution>
<id>copy-bin</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.parent.basedir}/assembly/${project.name}/bin</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/bin</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
<!--将配置文件复制到指定目录-->
<execution>
<id>copy-configs</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.parent.basedir}/assembly/${project.name}/resources
</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/bin/*</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<!--将依赖jar包复制到lib目录-->
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.parent.basedir}/assembly/${project.name}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!--指定生成jar包目录-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!--<classpathPrefix>lib/</classpathPrefix>-->
<classpathPrefix></classpathPrefix>
<mainClass> net.wanji.opt.SignalOptimizeApplication</mainClass>
</manifest>
<manifestEntries>
<Class-Path>../resources/</Class-Path>
</manifestEntries>
</archive>
<excludes>
<exclude>*.**</exclude>
<exclude>*/*.xml</exclude>
<!--<exclude>configs/**/**</exclude>-->
</excludes>
<outputDirectory>${project.parent.basedir}/assembly/${project.name}/lib</outputDirectory>
<classesDirectory>
</classesDirectory>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="net.wanji.opt.dao.mapper.trend.EventAlarmMapper"> <mapper namespace="net.wanji.opt.dao.mapper.trend.EventAlarmMapper">
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap type="net.wanji.opt.po.trend.EventAlarmPO" id="BaseResultMap"> <resultMap type="net.wanji.opt.po.trend.EventAlarmPO" id="EventAlarmBaseResultMap">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="eventId" column="event_id"/> <result property="eventId" column="event_id"/>
<result property="eventDesc" column="event_desc"/> <result property="eventDesc" column="event_desc"/>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<result property="gmtModified" column="gmt_modified"/> <result property="gmtModified" column="gmt_modified"/>
</resultMap> </resultMap>
<select id="selectByTodayTime" resultMap="BaseResultMap"> <select id="selectByTodayTime" resultMap="EventAlarmBaseResultMap" >
select select
id,event_id,event_desc,type,start_time,end_time,source,wkt,image_url,gmt_create,gmt_modified id,event_id,event_desc,type,start_time,end_time,source,wkt,image_url,gmt_create,gmt_modified
from t_event_data from t_event_data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment