求指教!!!

来源:互联网 发布:淘宝汉服商家排名 编辑:程序博客网 时间:2024/04/28 21:34
 org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.apache.ibatis.session.SqlSessionFactory net.huadong.core.mybatis.dao.MyBatisDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [springmybatis.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\myeclipse\HD_HET_2.0\target\classes\net\huadong\system\luck\mapper\LuckMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 72; columnNumber: 25; 元素类型 "trim" 必须后跟属性规范 ">" 或 "/>"。
   配置文件:
       <?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="luck">
<resultMap type="net.huadong.system.luck.entity.Luck" id="luckMap">
<id column="id" property="id"/>
<result column="label" property="label"/>
<result column="value" property="value"/>
<result column="target" property="target"/>
<result column="description" property="description"/>
<result column="sort_id" property="sort_id"/>
<result column="disabled" property="disabled"/>
<result column="disabled_name" property="disabled_name"/>
</resultMap>

<!-- 查询 -->
<select id="select" resultMap="luckMap" parameterType="Map">
select d.*,
case when d.disabled='0' then '启用' 
when d.disabled='1' then '不启用' 
   end as disabled_name
from system_luck d
<where>
<if test="id !=null and id !='' ">
id=#{ id }
</if>
<if test="label !=null and label !='' ">
and label=#{ label }
</if>
<if test="value !=null">
and value like concat('%',#{ value },'%')
</if>
<if test="target !=null">
and target like concat('%',#{ target },'%')
</if>
<if test="description !=null">
and description=#{ description }
</if>
<if test="sort_id !=null">
and sort_id=#{ sort_id }
</if>
<if test="disabled !=null">
and disabled=#{ disabled }
</if>
</where>
</select>
<!-- 保存 -->
<insert id="insert" parameterType="net.huadong.system.luck.entity.Luck" useGeneratedKeys="true" keyProperty="id">
insert into system_luck
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id !=null">
id,
</if>
<if test="label !=null">
label,
</if>
<if test="value !=null">
value,
</if>
<if test="target !=null">
target,
</if>
<if test="description !=null">
description,
</if>
<if test="sort_id !=null">
sort_id,
</if>
<if test="disabled !=null">
disabled,
</if>
</trim>
<trim prefix="values ( "suffix=")" suffixOverrides=",">
<if test="id !=null">
#{id},
</if>
<if test="label !=null">
#{label},
</if>
<if test="value !=null">
#{value},
</if>
<if test="target !=null">
#{target},
</if>
<if test="description !=null">
#{description},
</if>
<if test="sort_id !=null">
#{sort_id},
</if>
<if test="disabled !=null">
#{disabled},
</if>
</trim>
</insert>
<!-- 修改 -->
<update id="update" parameterType="net.huadong.system.luck.entity.Luck">
update system_luck
<set>
<if test="id !=null and id !='' ">
id=#{ id },
</if>
<if test="label !=null and label !='' ">
label=#{ label },
</if>
<if test="value !=null">
value=#{ value },
</if>
<if test="target !=null">
target=#{ target },
</if>
<if test="description !=null">
description=#{ description },
</if>
<if test="sort_id !=null">
sort_id=#{ sort_id },
</if>
<if test="disabled !=null">
disabled=#{ disabled },
</if>
</set>
<where>
id=#{ id }
</where>
</update>

<!-- 删除 -->
<delete id="delete" parameterType="java.lang.Long">
delete from system_luck where id=#{id}
</delete>

<select id="selectByTarget" resultMap="luckMap" parameterType="java.lang.String">
select * from system_luck where target =#{target} and disabled=0
</select>
</mapper>
0 0
原创粉丝点击