问题描述
- SSM框架整合的<mapper>问题
-
The content of element type "mapper" must match "(cache-ref|cache|resultMap*|parameterMap*|sql*|
insert*|update*|delete*|select*)+".
该怎么解决?
解决方案
sql语句出错了,把mybatis中的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.blue.mapper.UserMapper">
<resultMap type="User" id="userMap">
<id property="id" column="ID"/>
<result property="username" column="USERNAME"/>
<result property="password" column="PASSWORD"/>
<collection property="roleList" column="ID"
select="com.blue.mapper.UserRoleMapper.getRoleByUserId"/>
</resultMap>
resultType="userMap">
SELECT
*
FROM users
where
username=#{username}
AND password=#{password}
解决方案三:
<?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.blue.mapper.UserMapper">
<resultMap type="User" id="userMap">
<id property="id" column="ID"/>
<result property="username" column="USERNAME"/>
<result property="password" column="PASSWORD"/>
<collection property="roleList" column="ID"
select="com.blue.mapper.UserRoleMapper.getRoleByUserId"/>
</resultMap>
resultType="userMap">
SELECT
*
FROM users
where
username=#{username}
AND password=#{password}
时间: 2024-10-26 05:47:07