whyyouhitme_ 2019-02-06 17:32 采纳率: 57.1%
浏览 998
已采纳

Could not find result map !按照百度说法把reaultMap改为resultType更是启动不了项目

以下是教材的sql语句,我跟教材唯独表名不一样。教材也是resultMap,所以不要再说把reaultMap改为resultType了

<?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.mmall.dao.SysDeptMapper" >
  <resultMap id="BaseResultMap" type="com.mmall.model.SysDept" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="parent_id" property="parentId" jdbcType="INTEGER" />
    <result column="level" property="level" jdbcType="VARCHAR" />
    <result column="seq" property="seq" jdbcType="INTEGER" />
    <result column="remark" property="remark" jdbcType="VARCHAR" />
    <result column="operator" property="operator" jdbcType="VARCHAR" />
    <result column="operate_time" property="operateTime" jdbcType="TIMESTAMP" />
    <result column="operate_ip" property="operateIp" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, name, parent_id, level, seq, remark, operator, operate_time, operate_ip
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from sys_dept
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from sys_dept
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.mmall.model.SysDept" >
    insert into sys_dept (id, name, parent_id, 
      level, seq, remark, 
      operator, operate_time, operate_ip
      )
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, 
      #{level,jdbcType=VARCHAR}, #{seq,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, 
      #{operator,jdbcType=VARCHAR}, #{operateTime,jdbcType=TIMESTAMP}, #{operateIp,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.mmall.model.SysDept" keyProperty="id" useGeneratedKeys="true">
    insert into sys_dept
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="name != null" >
        name,
      </if>
      <if test="parentId != null" >
        parent_id,
      </if>
      <if test="level != null" >
        level,
      </if>
      <if test="seq != null" >
        seq,
      </if>
      <if test="remark != null" >
        remark,
      </if>
      <if test="operator != null" >
        operator,
      </if>
      <if test="operateTime != null" >
        operate_time,
      </if>
      <if test="operateIp != null" >
        operate_ip,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null" >
        #{parentId,jdbcType=INTEGER},
      </if>
      <if test="level != null" >
        #{level,jdbcType=VARCHAR},
      </if>
      <if test="seq != null" >
        #{seq,jdbcType=INTEGER},
      </if>
      <if test="remark != null" >
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="operator != null" >
        #{operator,jdbcType=VARCHAR},
      </if>
      <if test="operateTime != null" >
        #{operateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="operateIp != null" >
        #{operateIp,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.mmall.model.SysDept" >
    update sys_dept
    <set >
      <if test="name != null" >
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null" >
        parent_id = #{parentId,jdbcType=INTEGER},
      </if>
      <if test="level != null" >
        level = #{level,jdbcType=VARCHAR},
      </if>
      <if test="seq != null" >
        seq = #{seq,jdbcType=INTEGER},
      </if>
      <if test="remark != null" >
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="operator != null" >
        operator = #{operator,jdbcType=VARCHAR},
      </if>
      <if test="operateTime != null" >
        operate_time = #{operateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="operateIp != null" >
        operate_ip = #{operateIp,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.mmall.model.SysDept" >
    update sys_dept
    set name = #{name,jdbcType=VARCHAR},
      parent_id = #{parentId,jdbcType=INTEGER},
      level = #{level,jdbcType=VARCHAR},
      seq = #{seq,jdbcType=INTEGER},
      remark = #{remark,jdbcType=VARCHAR},
      operator = #{operator,jdbcType=VARCHAR},
      operate_time = #{operateTime,jdbcType=TIMESTAMP},
      operate_ip = #{operateIp,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>

  <select id="getAllDept" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from sys_dept
  </select>

  <select id="getChildDeptListByLevel" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from sys_dept
    WHERE level like #{level} || '.%'
  </select>

  <update id="batchUpdateLevel" parameterType="map">
    <foreach collection="sysDeptList" item="sysDept" separator=";">
      UPDATE sys_dept
      SET level = #{dept.level}
      WHERE id = #{dept.id}
    </foreach>
  </update>

  <select id="countByNameAndParentId" parameterType="map" resultType="int">
    SELECT count(1)
    FROM sys_dept
    WHERE name = #{name}
    <if test="parentId != null">
      AND parent_id = #{parentId}
    </if>
    <if test="id != null">
      AND id != #{id}
    </if>
  </select>

  <select id="countByParentId" parameterType="int" resultType="int">
    SELECT count(1)
    FROM sys_dept
    WHERE parent_id = #{deptId}
  </select>
</mapper>
  • 写回答

1条回答 默认 最新

  • devmiao 2019-02-06 17:58
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑