<id column="value" property="value"/>报错

时间: 2023-07-21 16:11:03 浏览: 44
非常抱歉,我之前的回答有误。在使用动态SQL片段时,`<id>` 元素是不需要的,因为我们只是想获取一列数据而不是主键。请修改你的代码如下: ```xml <resultMap id="PinResultMap" type="java.lang.String"> <result column="value" property="value"/> </resultMap> <select id="getDistinctPin1" resultMap="PinResultMap" parameterType="com.example.pmp.pojo.dto.sense.senseDataDto"> <include refid="distinctQuery"> <property name="column" value="FAI_26_1_Value"/> </include> </select> <select id="getDistinctPin2" resultMap="PinResultMap" parameterType="com.example.pmp.pojo.dto.sense.senseDataDto"> <include refid="distinctQuery"> <property name="column" value="FAI_26_2_Value"/> </include> </select> <select id="getDistinctPin3" resultMap="PinResultMap" parameterType="com.example.pmp.pojo.dto.sense.senseDataDto"> <include refid="distinctQuery"> <property name="column" value="FAI_26_3_Value"/> </include> </select> ``` 这样,你就可以正确地将查询结果映射到 `String` 类型的属性 `value` 上,并且不需要 `<id>` 元素。再次对之前的错误表示抱歉,希望这次回答能够解决你的问题。如果还有其他问题,请随时提出。

相关推荐

使用<resultMap id="eqMapVo" type="EquipmentVo"> <result property="eqId" column="eq_id"/> <result property="companyId" column="company_id"/> <result property="itemName" column="item_name"/> <result property="eqName" column="eq_name"/> <result property="serialNumber" column="serial_number"/> <collection property="maps" javaType="Map"> <result column="mm" javaType="string" property="mm"/> <result column="yy" javaType="string" property="yy"/> <result column="week" javaType="string" property="week"/> <result column="dd" javaType="string" property="dd"/> <result column="hh" javaType="string" property="hh"/> <result column="minit" javaType="string" property="minit"/> <result column="eqName" javaType="string" property="eqName"/> <result column="itemName" javaType="string" property="itemName"/> <result column="rm" javaType="bigDecimal" property="rm"/> </collection> </resultMap>映射public class EquipmentVo extends RegionalEquipment { private List<EquipmentDataVo> equipmentDataVoList; private List<Map> maps; public List<Map> getMaps() { return maps; } public void setMaps(List<Map> maps) { this.maps = maps; } public List<EquipmentDataVo> getEquipmentDataVoList() { return equipmentDataVoList; } public void setEquipmentDataVoList(List<EquipmentDataVo> equipmentDataVoList) { this.equipmentDataVoList = equipmentDataVoList; } },抛出org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'maps' of 'class com.hapstar.regional.domain.vo.EquipmentVo' with value '{hh=2023-05-05 16, eqName=RM/7199, itemName=测试项目, rm=1.46}' Cause: java.lang.IllegalArgumentException: argument type mismatch异常,如何处理

<ItemsControl x:Class="HDSProject.Control.CustomFont" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:HDSProject.Control" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800" x:Name="itemCtrl" ItemsSource="{Binding Path=Title2, RelativeSource={RelativeSource Mode=Self}}" FontSize="20" Foreground="Teal" > <ItemsControl.ItemContainerStyle> <Style TargetType="ContentPresenter"> <Setter Property="VerticalAlignment" Value="Center" /> </Style> </ItemsControl.ItemContainerStyle> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel> <Border Margin="{Binding Path=CharacterSpacing, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CustomFont}}"> <TextBlock Text="{Binding}" /> </Border> <Rectangle Height="1" Fill="{Binding Foreground, ElementName=itemCtrl}" Margin="0,0,0,5"> <Rectangle.Style> <Style TargetType="Rectangle"> <Setter Property="Visibility" Value="Collapsed" /> <Style.Triggers> <DataTrigger Binding="{Binding ShowUnderline, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:CustomFont}}" Value="True"> <Setter Property="Visibility" Value="Visible" /> </DataTrigger> </Style.Triggers> </Style> </Rectangle.Style> </Rectangle> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl>给这个控件添加一个拖动边框改变大小的事件

<?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.de.debook.mapper.CategoryMapper"> <resultMap id="BaseResultMap" type="com.de.debook.entity.Category"> <id column="id" jdbcType="INTEGER" property="id"/> <result column="name" jdbcType="VARCHAR" property="name"/> </resultMap> <resultMap id="StatisticsResultMap" type="com.de.debook.entity.Statistics"> <result column="name" jdbcType="VARCHAR" property="name"/> <result column="value" jdbcType="VARCHAR" property="value"/> </resultMap> <sql id="Base_Column_List"> id, name </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from category where id = #{id,jdbcType=INTEGER} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> delete from category where id = #{id,jdbcType=INTEGER} </delete> <insert id="insert" parameterType="com.de.debook.entity.Category"> insert into category (id, name) values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}) </insert> <insert id="insertSelective" parameterType="com.de.debook.entity.Category"> insert into category <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null"> id, </if> <if test="name != null"> name, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=INTEGER}, </if> <if test="name != null"> #{name,jdbcType=VARCHAR}, </if> </trim> </insert> <update id="updateByPrimaryKeySelective" parameterType="com.de.debook.entity.Category"> update category <set> <if test="name != null"> name = #{name,jdbcType=VARCHAR}, </if> </set> where id = #{id,jdbcType=INTEGER} </update> <update id="updateByPrimaryKey" parameterType="com.de.debook.entity.Category"> update category set name = #{name,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} </update> <select id="selectAll" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from category order by id asc </select> <select id="selectStatistics" resultMap="StatisticsResultMap"> SELECT t1.name as name, COUNT(*) as value FROM category t1, debook t2 WHERE t1.id = t2.category_id GROUP BY t1.id order by t1.id asc </select> </mapper>

<?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.phonemarket.mapper.BannerMapper"> <resultMap type="Banner" id="BaseResultMap"> <id property="bannerId" column="banner_id" /> <result property="bannerName" column="banner_name" /> <result property="bannerUrl" column="banner_url" /> <result property="bannerImg" column="banner_img" /> <result property="bannerState" column="banner_state" /> </resultMap> <insert id="addBanner" parameterType="Banner"> insert into banner(banner_name,banner_url,banner_img) values(#{bannerName},#{bannerUrl},#{bannerImg}) </insert> <update id="deleteBanner" parameterType="java.lang.Integer"> update banner set banner_state=-1 where banner_id=#{id} </update> <update id="changeBannerState" parameterType="java.lang.Integer"> update banner set banner_state=#{0} where banner_id=#{1} </update> <update id="updateBanner" parameterType="Banner"> update banner <set> <if test="bannerName!=null"> banner_name=#{bannerName}, </if> <if test="bannerUrl!=null"> banner_url=#{bannerUrl}, </if> <if test="bannerImg!=null"> banner_img=#{bannerImg} </if> </set> where banner_id=#{bannerId} </update> <select id="findBannerById" parameterType="java.lang.Integer" resultMap="BaseResultMap"> select * from banner where banner_id=#{id} </select> <select id="findAllBanner" resultMap="BaseResultMap"> select * from banner where banner_state > 0 </select> <select id="findAllBannerByLikeName" parameterType="java.lang.String" resultMap="BaseResultMap"> select * from banner where banner_state > 0 and banner_name like '%${value}%' </select> <select id="findAllShowBanner" resultMap="BaseResultMap"> select * from banner where banner_state=1 </select> </mapper>

最新推荐

recommend-type

pre_o_1csdn63m9a1bs0e1rr51niuu33e.a

pre_o_1csdn63m9a1bs0e1rr51niuu33e.a
recommend-type

matlab建立计算力学课程的笔记和文件.zip

matlab建立计算力学课程的笔记和文件.zip
recommend-type

FT-Prog-v3.12.38.643-FTD USB 工作模式设定及eprom读写

FT_Prog_v3.12.38.643--FTD USB 工作模式设定及eprom读写
recommend-type

matlab基于RRT和人工势场法混合算法的路径规划.zip

matlab基于RRT和人工势场法混合算法的路径规划.zip
recommend-type

matlab基于matlab的两步定位软件定义接收机的开源GNSS直接位置估计插件模块.zip

matlab基于matlab的两步定位软件定义接收机的开源GNSS直接位置估计插件模块.zip
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

2. 通过python绘制y=e-xsin(2πx)图像

可以使用matplotlib库来绘制这个函数的图像。以下是一段示例代码: ```python import numpy as np import matplotlib.pyplot as plt def func(x): return np.exp(-x) * np.sin(2 * np.pi * x) x = np.linspace(0, 5, 500) y = func(x) plt.plot(x, y) plt.xlabel('x') plt.ylabel('y') plt.title('y = e^{-x} sin(2πx)') plt.show() ``` 运行这段
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。