会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132413个问题
JAVA 全系列/第二阶段:JAVA 基础深化和提高/容器(旧) 18436楼

老师,有个路径访问的问题,一直出错,不知道如何解决,为了能让您更好地理解我的意思,内容可能会多,望老师能看完。


问题:我的项目出现了路径访问的错误,就是不能更好处理请求转发与重定向产生的资源路径访问问题。

首先,我知道的是,请求转发是需要在请求头中添加信息需要带会给客户端的时候是用它;重定向更好是在使用表单时使用。


那么现在,我的项目就是:基于请求转发时,没操作功能时可以正常的返回主页面,但是一旦操作了一个功能后页面就会报404错误;但是若是基于重定向的话,就不会出现这个问题,不管是执行完后,还是没执行功能前都可以返回上一层。


详情如下:就以添加用户为例:


image.png


image.png




image.png




image.png



但是,这一切,若是在重定向上,就完全没有问题.。


image.png

image.png



但是这样一来,却违背了我想将数据显示在同样的页面上的,要是使用重定向,将需要显示的数据放在另一个页面上,不太方便,就像很多图书管理系统,数据就显示到了当前的页面上。



所有的servlet代码:

package com.example.servlet.UserManager;

import com.example.exception.NotSearchUserResultException;
import com.example.pojo.Users;
import com.example.service.ServiceImpl.ServiceUserManagerClass;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.List;

@WebServlet("/userManager.do")
public class UserManagerServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        /**
         * 我在这里面就对其用户管理进行全部操作
         */
        String flag = req.getParameter("flag");

        if ("addUser".equals(flag)) {
            /**
             * 执行添加用户函数
             */
            try {

                Users users = this.getUsersMessage(req);
                ServiceUserManagerClass serviceUserManagerClass = new ServiceUserManagerClass();
                serviceUserManagerClass.addUsers(users);
                List<Users> list = serviceUserManagerClass.allUsers();
                req.setAttribute("listAllUsers",list);
                req.setAttribute("addUserMessageSuccess","用户信息已经添加成功!");
                req.getRequestDispatcher("userManagerJsp/addUser.jsp").forward(req,resp);
                
              //resp.sendRedirect("userManagerJsp/addUser.jsp");

                /**
                 * 老师以上就是我刚才举得例子:
                 * 是基于请求转发的
                 */


            } catch (Exception e) {
                e.printStackTrace();
                resp.sendRedirect("error.jsp");
            }

        } else if ("deleteUser".equals(flag)) {
            /**
             * 执行删除用户函数
             */
            try {

                String userName = req.getParameter("userName");

                ServiceUserManagerClass serviceUserManagerClass = new ServiceUserManagerClass();
                serviceUserManagerClass.deleteUser(userName);
                List<Users> list = serviceUserManagerClass.allUsers();
                req.setAttribute("listAllUsers",list);
                req.setAttribute("deleteUserMessageSuccess","用户信息已经删除成功!");
                req.getRequestDispatcher("userManagerJsp/deleteUser.jsp").forward(req,resp);

            } catch (Exception e) {
                e.printStackTrace();
                resp.sendRedirect("error.jsp");
            }


        } else if ("updateUser".equals(flag)) {
            /**
             * 执行更新用户函数
             */
            try {

                /**
                 * 是从表单里面提取的新的数据,但是我还需要旧的,咋办???
                 */
                Users newUser = this.getUsersMessage(req);
                String oldUserID = req.getParameter("oldUserID");

                ServiceUserManagerClass serviceUserManagerClass = new ServiceUserManagerClass();
                serviceUserManagerClass.updateUsers(oldUserID, newUser);

                List<Users> list = serviceUserManagerClass.allUsers();
                req.setAttribute("listAllUsers",list);
                req.setAttribute("deleteUserMessageSuccess","用户信息已经修改成功!");
                req.getRequestDispatcher("userManagerJsp/userUpdate.jsp").forward(req,resp);

            } catch (Exception e) {
                e.printStackTrace();
                resp.sendRedirect("error.jsp");
            }

        } else if ("searchUser".equals(flag)){
            /**
             * 执行查找用户函数
             */
            try {
                String userName = req.getParameter("userName");
                ServiceUserManagerClass serviceUserManagerClass = new ServiceUserManagerClass();
                Users usersTemp = serviceUserManagerClass.searchUsers(userName);
                List<Users> list = serviceUserManagerClass.allUsers();
                if (usersTemp != null) {

                    req.setAttribute("userIdMsg",usersTemp.getUserID());
                    req.setAttribute("userNameMsg",usersTemp.getUserName());
                    req.setAttribute("userEmailMsg",usersTemp.getUserEmial());
                    req.setAttribute("listAllUsers",list);
                    req.setAttribute("searchUserResultMsgSuccess","成功查询结果信息");
                    req.getRequestDispatcher("userManagerJsp/findUser.jsp").forward(req,resp);

                } else {
                    throw new NotSearchUserResultException("查询结果信息不存在,请重新输入...");
                }
            } catch (NotSearchUserResultException e) {
                e.printStackTrace();
                req.setAttribute("searchUserResultMsg",e.getMessage());
                req.getRequestDispatcher("userManagerJsp/findUser.jsp").forward(req,resp);
            }
        }
    }

    /**
     * 获取来自前端的用户的数据
     */
    private Users getUsersMessage(HttpServletRequest req) {
        Users users = new Users();

        String userID = req.getParameter("userName");
        String userPwd = req.getParameter("userPwd");
        String userEmail = req.getParameter("userEmail");
        users.setUserID(userID);
        users.setUserName(userPwd);
        users.setUserEmial(userEmail);

        return users;
    }
}


老师,如果需要项目的话,我全部上传。

JAVA 全系列/第五阶段:JavaWeb开发/Web实战案例 18437楼


Error parsing Mapper XML. The XML location is 'com/bjsxt/mapper/UsersMapper.xml'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.bjsxt.mapper.UsersMapper.BaseResultMap


使用这个插件 org.mybatis.generator 生成的xml文件,里面有多个id,相同

是什么回事

<?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.bjsxt.mapper.UsersMapper">
  <resultMap id="BaseResultMap" type="com.bjsxt.pojo.Users">
    <result column="USER" jdbcType="CHAR" property="user" />
    <result column="CURRENT_CONNECTIONS" jdbcType="BIGINT" property="currentConnections" />
    <result column="TOTAL_CONNECTIONS" jdbcType="BIGINT" property="totalConnections" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    USER, CURRENT_CONNECTIONS, TOTAL_CONNECTIONS
  </sql>
  <select id="selectByExample" parameterType="com.bjsxt.pojo.UsersExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.bjsxt.pojo.UsersExample">
    delete from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.bjsxt.pojo.Users">
    insert into users (USER, CURRENT_CONNECTIONS, TOTAL_CONNECTIONS
      )
    values (#{user,jdbcType=CHAR}, #{currentConnections,jdbcType=BIGINT}, #{totalConnections,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.bjsxt.pojo.Users">
    insert into users
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="user != null">
        USER,
      </if>
      <if test="currentConnections != null">
        CURRENT_CONNECTIONS,
      </if>
      <if test="totalConnections != null">
        TOTAL_CONNECTIONS,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="user != null">
        #{user,jdbcType=CHAR},
      </if>
      <if test="currentConnections != null">
        #{currentConnections,jdbcType=BIGINT},
      </if>
      <if test="totalConnections != null">
        #{totalConnections,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.bjsxt.pojo.UsersExample" resultType="java.lang.Long">
    select count(*) from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update users
    <set>
      <if test="record.user != null">
        USER = #{record.user,jdbcType=CHAR},
      </if>
      <if test="record.currentConnections != null">
        CURRENT_CONNECTIONS = #{record.currentConnections,jdbcType=BIGINT},
      </if>
      <if test="record.totalConnections != null">
        TOTAL_CONNECTIONS = #{record.totalConnections,jdbcType=BIGINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update users
    set USER = #{record.user,jdbcType=CHAR},
      CURRENT_CONNECTIONS = #{record.currentConnections,jdbcType=BIGINT},
      TOTAL_CONNECTIONS = #{record.totalConnections,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <resultMap id="BaseResultMap" type="com.bjsxt.pojo.Users">
    <result column="username" jdbcType="VARCHAR" property="username" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="salting" jdbcType="VARCHAR" property="salting" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    username, password, salting
  </sql>
  <select id="selectByExample" parameterType="com.bjsxt.pojo.UsersExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.bjsxt.pojo.UsersExample">
    delete from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.bjsxt.pojo.Users">
    insert into users (username, password, salting
      )
    values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{salting,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.bjsxt.pojo.Users">
    insert into users
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="username != null">
        username,
      </if>
      <if test="password != null">
        password,
      </if>
      <if test="salting != null">
        salting,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="username != null">
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="salting != null">
        #{salting,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.bjsxt.pojo.UsersExample" resultType="java.lang.Long">
    select count(*) from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update users
    <set>
      <if test="record.username != null">
        username = #{record.username,jdbcType=VARCHAR},
      </if>
      <if test="record.password != null">
        password = #{record.password,jdbcType=VARCHAR},
      </if>
      <if test="record.salting != null">
        salting = #{record.salting,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update users
    set username = #{record.username,jdbcType=VARCHAR},
      password = #{record.password,jdbcType=VARCHAR},
      salting = #{record.salting,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <resultMap id="BaseResultMap" type="com.bjsxt.pojo.Users">
    <id column="userid" jdbcType="INTEGER" property="userid" />
    <result column="username" jdbcType="VARCHAR" property="username" />
    <result column="userage" jdbcType="INTEGER" property="userage" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    userid, username, userage
  </sql>
  <select id="selectByExample" parameterType="com.bjsxt.pojo.UsersExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from users
    where userid = #{userid,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from users
    where userid = #{userid,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.bjsxt.pojo.UsersExample">
    delete from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.bjsxt.pojo.Users">
    insert into users (userid, username, userage
      )
    values (#{userid,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{userage,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.bjsxt.pojo.Users">
    insert into users
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userid != null">
        userid,
      </if>
      <if test="username != null">
        username,
      </if>
      <if test="userage != null">
        userage,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userid != null">
        #{userid,jdbcType=INTEGER},
      </if>
      <if test="username != null">
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="userage != null">
        #{userage,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.bjsxt.pojo.UsersExample" resultType="java.lang.Long">
    select count(*) from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update users
    <set>
      <if test="record.userid != null">
        userid = #{record.userid,jdbcType=INTEGER},
      </if>
      <if test="record.username != null">
        username = #{record.username,jdbcType=VARCHAR},
      </if>
      <if test="record.userage != null">
        userage = #{record.userage,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update users
    set userid = #{record.userid,jdbcType=INTEGER},
      username = #{record.username,jdbcType=VARCHAR},
      userage = #{record.userage,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.bjsxt.pojo.Users">
    update users
    <set>
      <if test="username != null">
        username = #{username,jdbcType=VARCHAR},
      </if>
      <if test="userage != null">
        userage = #{userage,jdbcType=INTEGER},
      </if>
    </set>
    where userid = #{userid,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjsxt.pojo.Users">
    update users
    set username = #{username,jdbcType=VARCHAR},
      userage = #{userage,jdbcType=INTEGER}
    where userid = #{userid,jdbcType=INTEGER}
  </update>
  <resultMap id="BaseResultMap" type="com.bjsxt.pojo.Users">
    <result column="username" jdbcType="VARCHAR" property="username" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="salting" jdbcType="VARCHAR" property="salting" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    username, password, salting
  </sql>
  <select id="selectByExample" parameterType="com.bjsxt.pojo.UsersExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.bjsxt.pojo.UsersExample">
    delete from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.bjsxt.pojo.Users">
    insert into users (username, password, salting
      )
    values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{salting,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.bjsxt.pojo.Users">
    insert into users
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="username != null">
        username,
      </if>
      <if test="password != null">
        password,
      </if>
      <if test="salting != null">
        salting,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="username != null">
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="salting != null">
        #{salting,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.bjsxt.pojo.UsersExample" resultType="java.lang.Long">
    select count(*) from users
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update users
    <set>
      <if test="record.username != null">
        username = #{record.username,jdbcType=VARCHAR},
      </if>
      <if test="record.password != null">
        password = #{record.password,jdbcType=VARCHAR},
      </if>
      <if test="record.salting != null">
        salting = #{record.salting,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update users
    set username = #{record.username,jdbcType=VARCHAR},
      password = #{record.password,jdbcType=VARCHAR},
      salting = #{record.salting,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
</mapper>


插件配置

<build>
    <plugins>
        <!-- generator  -->
        <plugin>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>mybatis-generator-maven-plugin</artifactId>
            <dependencies>
                <!-- 插件中引入依赖,只会去本地仓库中查找 -->
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>8.0.22</version>
                </dependency>
            </dependencies>
            <configuration>
                <configurationFile>
                    ${project.basedir}/src/main/resources/generatorConfig.xml
                </configurationFile>
                <verbose>true</verbose>
                <overwrite>true</overwrite>
            </configuration>
        </plugin>
    </plugins>
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>false</filtering>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>false</filtering>
        </resource>
    </resources>
</build>

解决方法是,将相同的id删除,我就是想问一下,这个插件为什么会出现这种情况


JAVA 全系列/第八阶段:Linux入门到实战/Maven 18438楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/智能电话本项目实战 18441楼
JAVA 全系列/第十一阶段:分布式RPC调用和分布式文件存储/FastDFS 18442楼
JAVA 全系列/第六阶段:项目管理与SSM框架/Mybatis 18443楼

老师我这为啥运行不了

"""新增功能:
   优化:按下方向键,坦克一直移动
   松开方向键,坦克停止
"""
#导入prcharm模块
import pygame,time
SCREEN_WIDTH=700    #设置宽度
SCREEN_HEIGHT=500   #设置高度
BG_COLOR=pygame.Color(0,0,0) #设置窗口颜色,0,0,0代表黑色
TEXT_COLOR=pygame.Color(255,0,0)  #设置字体颜色,255,0,0代表红色

#主类
class MainGame():
    window=None
    my_tank=None
    def __init__(self):
        pass
    #开始游戏
    def startGame(self):
        #加载主窗口
        #初始化窗口
        pygame.display.init()
        #设置窗口的大小及显示
        MainGame.window=pygame.display.set_mode([SCREEN_WIDTH,SCREEN_HEIGHT])
        #初始化我方坦克
        MainGame.my_tank=Tank(350,250)
        #设置窗口标题
        pygame.display.set_caption("坦克大战1.03")
        while True:
            #使用坦克移动的速度慢一点
            time.sleep(0.02)
            #给窗口设置填充色
            MainGame.window.fill(BG_COLOR)
            #获取事件
            self.getEvent()
            #绘制文字
            MainGame.window.blit(self.getTextSuface("敌方坦克剩余数量%d"%6),(10,10))
            #调用坦克显示的方法
            MainGame.my_tank.displayTank()
            #调用移动方法
            #如果坦克的开关是开启才可以移动
            if not MainGame.my_tank.stop:
                 MainGame.my_tank.move()
            pygame.display.update()

    #结束游戏
    def endGame(self):
        print("谢谢使用,欢迎再次使用")
        exit()
    #左上角文字的绘制
    def getTextSuface(self,text):
        #初始化文字模块
        pygame.font.init()
        #查看所有的字体名称
        #print(pygame.font.get_fonts())
        #获取字体Font对象
        font=pygame.font.SysFont("kaiti",18)
        #绘制文字信息
        textSurface=font.render(text,True,TEXT_COLOR)
        return textSurface
    #获取事件
    def getEvent(self):
        #获取所有的事件
        eventList=pygame.event.get()
        #遍历事件
        for event in eventList:
            #判断按下的键是关闭还是键盘按下
            #如果按的是退出,关闭窗口
            if event.type==pygame.QUIT:
                self.endGame()
            #如果是键盘的按下
            if event.type==pygame.KEYDOWN:

            #松开方向键,坦克停止移动,修改坦克的开关状态
            if event.type==pygame.KEYUP:
                #判断松开的键是上,下,左,右时候才停止坦克的移动
                if event.key==pygame.K_UP or event.key==pygame.K_DOWN or event.key == pygame.K_LEFT or event.key==pygame.K_RIGHT:
                    MainGame.my_tank.stop=True
                # 修改坦克的开关状态
                MainGame.my_tank.stop = False
            if event.type == pygame.KEYUP:
                MainGame.my_tank.stop=True
                #判断按下的是上,下,左,右
                if event.key==pygame.K_LEFT:
                    #切换方向
                    MainGame.my_tank.dirction="L"
                    #修改坦克的开关状态
                    MainGame.my_tank.stop=False
                    #MainGame.my_tank.move()
                    print("按下左键,坦克向左移动")
                elif event.key==pygame.K_RIGHT:
                    #切换方向
                    MainGame.my_tank.dirction = "R"
                    # 修改坦克的开关状态
                    MainGame.my_tank.stop = False
                    #MainGame.my_tank.move()
                    print("按下右键,坦克向右移动")
                elif event.key==pygame.K_UP:
                    #切换方向
                    MainGame.my_tank.dirction = "U"
                    # 修改坦克的开关状态
                    MainGame.my_tank.stop = False
                    #MainGame.my_tank.move()
                    print("按下上键,坦克向上移动")
                elif event.key == pygame.K_DOWN:
                    #切换方向
                    MainGame.my_tank.dirction = "D"
                    # 修改坦克的开关状态
                    MainGame.my_tank.stop = False
                    #MainGame.my_tank.move()
                    print("按下下键,坦克向下移动")
                elif event.key == pygame.K_SPACE:
                    print("发射子弹")

#坦克类
class Tank():
    #添加距离左边left 距离上边top
    def __init__(self,left,top):
        #保存加载的照片
        self.images={
            "U":pygame.image.load("img/p1tankU.gif"),
            "D":pygame.image.load("img/p1tankD.gif"),
            "L":pygame.image.load("img/p1tankL.gif"),
            "R":pygame.image.load("img/p1tankR.gif"),
        }
        #方向
        self.dirction="R"
        #根据当前图片的方向获取图片 surface
        self.image=self.images[self.dirction]
        #根据图片获取区域
        self.rect=self.image.get_rect()
        #设置区域的left 和top
        self.rect.left=left
        self.rect.top=top
        #速度 决定移动的快慢
        self.speed=5
        #坦克移动的开关
        self.stop=True



    #移动
    def move(self):
        #判断坦克的方向进行移动
        if self.dirction=="L":
            if self.rect.left>0:
                self.rect.left -= self.speed
        elif self.dirction == "U":
            if self.rect.top>0:
                self.rect.top -= self.speed
        elif self.dirction == "D":
            if self.rect.top+self.rect.height<SCREEN_HEIGHT:
                self.rect.top += self.speed

        elif self.dirction == "R":
            if self.rect.left+self.rect.height<SCREEN_WIDTH:
                self.rect.left += self.speed
    #射击
    def shot(self):
        pass
    #展示坦克方法
    def displayTank(self):
        #获取展示的对象
        self.image=self.images[self.dirction]
        #调用blit方法展示
        MainGame.window.blit(self.image,self.rect)
#我方坦克
class MyTank(Tank):
    def __init__(self):
        pass
#敌方坦克
class EnemyTank(Tank):
    def __init__(self):
        pass

#子弹类
class Bullet():
    def __init__(self):
        pass
    #移动
    def move(self):
        pass
    #展示子弹的方法:
    def displayBullet(self):
        pass

class Wall():
    def __init__(self):
        pass
    #展示墙壁的方法
    def displayWall(self):
        pass
class Explode():
    def __init__(self):
        pass
    #展示爆炸效果的方法
    def displayExplode(self):
        pass
class Music():
    def __init__(self):
        pass
    #播放音乐
    def play(self):
        pass

if __name__=="__main__":
    MainGame().startGame()
    #MainGame().getTextSuface()


Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 18445楼

"""新增功能:
   优化我方坦克移动
"""
#导入prcharm模块
import pygame
SCREEN_WIDTH=700    #设置宽度
SCREEN_HEIGHT=500   #设置高度
BG_COLOR=pygame.Color(0,0,0) #设置窗口颜色,0,0,0代表黑色
TEXT_COLOR=pygame.Color(255,0,0)  #设置字体颜色,255,0,0代表红色

#主类
class MainGame():
    window=None
    my_tank=None
    def __init__(self):
        pass
    #开始游戏
    def startGame(self):
        #加载主窗口
        #初始化窗口
        pygame.display.init()
        #设置窗口的大小及显示
        MainGame.window=pygame.display.set_mode([SCREEN_WIDTH,SCREEN_HEIGHT])
        #初始化我方坦克
        MainGame.my_tank=Tank(350,250)
        #设置窗口标题
        pygame.display.set_caption("坦克大战1.03")
        while True:
            #给窗口设置填充色
            MainGame.window.fill(BG_COLOR)
            #获取事件
            self.getEvent()
            #绘制文字
            MainGame.window.blit(self.getTextSuface("敌方坦克剩余数量%d"%6),(10,10))
            #调用坦克显示的方法
            MainGame.my_tank.displayTank()
            pygame.display.update()

    #结束游戏
    def endGame(self):
        print("谢谢使用,欢迎再次使用")
        exit()
    #左上角文字的绘制
    def getTextSuface(self,text):
        #初始化文字模块
        pygame.font.init()
        #查看所有的字体名称
        #print(pygame.font.get_fonts())
        #获取字体Font对象
        font=pygame.font.SysFont("kaiti",18)
        #绘制文字信息
        textSurface=font.render(text,True,TEXT_COLOR)
        return textSurface
    #获取事件
    def getEvent(self):
        #获取所有的事件
        eventList=pygame.event.get()
        #遍历事件
        for event in eventList:
            #判断按下的键是关闭还是键盘按下
            #如果按的是退出,关闭窗口
            if event.type==pygame.QUIT:
                self.endGame()
            #如果是键盘的按下
            if event.type==pygame.KEYDOWN:
                #判断按下的是上,下,左,右
                if event.key==pygame.K_LEFT:
                    #切换方向
                    MainGame.my_tank.dirction="L"
                    MainGame.my_tank.move()
                    print("按下左键,坦克向左移动")
                elif event.key==pygame.K_RIGHT:
                    #切换方向
                    MainGame.my_tank.dirction = "R"
                    MainGame.my_tank.move()
                    print("按下右键,坦克向右移动")
                elif event.key==pygame.K_UP:
                    #切换方向
                    MainGame.my_tank.dirction = "U"
                    MainGame.my_tank.move()
                    print("按下上键,坦克向上移动")
                elif event.key == pygame.K_DOWN:
                    #切换方向
                    MainGame.my_tank.dirction = "D"
                    MainGame.my_tank.move()
                    print("按下下键,坦克向下移动")

#坦克类
class Tank():
    #添加距离左边left 距离上边top
    def __init__(self,left,top):
        #保存加载的照片
        self.images={
            "U":pygame.image.load("img/p1tankU.gif"),
            "D":pygame.image.load("img/p1tankD.gif"),
            "L":pygame.image.load("img/p1tankL.gif"),
            "R":pygame.image.load("img/p1tankR.gif"),
        }
        #方向
        self.dirction="R"
        #根据当前图片的方向获取图片 surface
        self.image=self.images[self.dirction]
        #根据图片获取区域
        self.rect=self.image.get_rect()
        #设置区域的left 和top
        self.rect.left=left
        self.rect.top=top
        #速度 决定移动的快慢
        self.speed=10



    #移动
    def move(self):
        #判断坦克的方向进行移动
        if self.dirction=="L":
            if self.rect.left>0:
                self.rect.left -= self.speed
        elif self.dirction == "U":
            if self.rect.top>0:
                self.rect.top -= self.speed
        elif self.dirction == "D":
            if self.rect.top+self.rect.height<SCREEN_HEIGHT:
                self.rect.top += self.speed

        elif self.dirction == "R":
            if self.rect.left+self.rect.height<SCREEN_WIDTH:
                self.rect.left += self.speed
    #射击
    def shot(self):
        pass
    #展示坦克方法
    def displayTank(self):
        #获取展示的对象
        self.image=self.images[self.dirction]
        #调用blit方法展示
        MainGame.window.blit(self.image,self.rect)
#我方坦克
class MyTank(Tank):
    def __init__(self):
        pass
#敌方坦克
class EnemyTank(Tank):
    def __init__(self):
        pass

#子弹类
class Bullet():
    def __init__(self):
        pass
    #移动
    def move(self):
        pass
    #展示子弹的方法:
    def displayBullet(self):
        pass

class Wall():
    def __init__(self):
        pass
    #展示墙壁的方法
    def displayWall(self):
        pass
class Explode():
    def __init__(self):
        pass
    #展示爆炸效果的方法
    def displayExplode(self):
        pass
class Music():
    def __init__(self):
        pass
    #播放音乐
    def play(self):
        pass

if __name__=="__main__":
    MainGame().startGame()
    #MainGame().getTextSuface()

老师如何摁着下键让坦克一直移动呀,而不是摁一下移动一下

Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 18446楼
JAVA 全系列/第八阶段:Linux入门到实战/Git 18448楼

老师我这跟老师一样的代码 却总是报

assosiationdemo.zip

错 ,麻烦老师帮我看下

"C:\Program Files\Java\jdk-11.0.10\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\lib\idea_rt.jar=60584:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\l1812\IdeaProjects\assosiationdemo\out\production\associationdemo;D:\BaiduNetdiskDownload\MyBatis\lib\asm-7.1.jar;D:\BaiduNetdiskDownload\MyBatis\lib\cglib-3.3.0.jar;D:\BaiduNetdiskDownload\MyBatis\lib\ognl-3.2.14.jar;D:\BaiduNetdiskDownload\MyBatis\lib\log4j-1.2.17.jar;D:\BaiduNetdiskDownload\MyBatis\lib\mybatis-3.5.5.jar;D:\BaiduNetdiskDownload\MyBatis\lib\jsqlparser-3.1.jar;D:\BaiduNetdiskDownload\MyBatis\lib\log4j-api-2.13.3.jar;D:\BaiduNetdiskDownload\MyBatis\lib\slf4j-api-1.7.30.jar;D:\BaiduNetdiskDownload\MyBatis\lib\log4j-core-2.13.3.jar;D:\BaiduNetdiskDownload\MyBatis\lib\pagehelper-5.1.11.jar;D:\BaiduNetdiskDownload\MyBatis\lib\commons-logging-1.2.jar;D:\BaiduNetdiskDownload\MyBatis\lib\javassist-3.27.0-GA.jar;D:\BaiduNetdiskDownload\MyBatis\lib\slf4j-log4j12-1.7.30.jar;D:\BaiduNetdiskDownload\MyBatis\lib\mysql-connector-java-5.1.48.jar com.bjsxt.test.SelectUsersAndOrdersTest
<2021-08-05 18:10:18,013> DEBUG (LogFactory.java:105) [main] (org.apache.ibatis.logging.LogFactory) - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
<2021-08-05 18:10:18,031> DEBUG (VFS.java:116) [main] (org.apache.ibatis.io.VFS) - Class not found: org.jboss.vfs.VFS
<2021-08-05 18:10:18,038> DEBUG (JBoss6VFS.java:149) [main] (org.apache.ibatis.io.JBoss6VFS) - JBoss 6 VFS API is not available in this environment.
<2021-08-05 18:10:18,040> DEBUG (VFS.java:116) [main] (org.apache.ibatis.io.VFS) - Class not found: org.jboss.vfs.VirtualFile
<2021-08-05 18:10:18,041> DEBUG (VFS.java:64) [main] (org.apache.ibatis.io.VFS) - VFS implementation org.apache.ibatis.io.JBoss6VFS is not valid in this environment.
<2021-08-05 18:10:18,043> DEBUG (VFS.java:74) [main] (org.apache.ibatis.io.VFS) - Using VFS adapter org.apache.ibatis.io.DefaultVFS
<2021-08-05 18:10:18,044> DEBUG (DefaultVFS.java:220) [main] (org.apache.ibatis.io.DefaultVFS) - Find JAR URL: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/pojo
<2021-08-05 18:10:18,045> DEBUG (DefaultVFS.java:247) [main] (org.apache.ibatis.io.DefaultVFS) - Not a JAR: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/pojo
<2021-08-05 18:10:18,224> DEBUG (DefaultVFS.java:100) [main] (org.apache.ibatis.io.DefaultVFS) - Reader entry: Order.class
<2021-08-05 18:10:18,233> DEBUG (DefaultVFS.java:100) [main] (org.apache.ibatis.io.DefaultVFS) - Reader entry: Roles.class
<2021-08-05 18:10:18,237> DEBUG (DefaultVFS.java:100) [main] (org.apache.ibatis.io.DefaultVFS) - Reader entry: Users.class
<2021-08-05 18:10:18,238> DEBUG (DefaultVFS.java:111) [main] (org.apache.ibatis.io.DefaultVFS) - Listing file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/pojo
<2021-08-05 18:10:18,239> DEBUG (DefaultVFS.java:220) [main] (org.apache.ibatis.io.DefaultVFS) - Find JAR URL: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/pojo/Order.class
<2021-08-05 18:10:18,239> DEBUG (DefaultVFS.java:247) [main] (org.apache.ibatis.io.DefaultVFS) - Not a JAR: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/pojo/Order.class
<2021-08-05 18:10:18,241> DEBUG (DefaultVFS.java:100) [main] (org.apache.ibatis.io.DefaultVFS) - Reader entry: ����   7 5
<2021-08-05 18:10:18,245> DEBUG (DefaultVFS.java:220) [main] (org.apache.ibatis.io.DefaultVFS) - Find JAR URL: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/pojo/Roles.class
<2021-08-05 18:10:18,251> DEBUG (DefaultVFS.java:247) [main] (org.apache.ibatis.io.DefaultVFS) - Not a JAR: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/pojo/Roles.class
<2021-08-05 18:10:18,253> DEBUG (DefaultVFS.java:100) [main] (org.apache.ibatis.io.DefaultVFS) - Reader entry: ����   7 4
<2021-08-05 18:10:18,256> DEBUG (DefaultVFS.java:220) [main] (org.apache.ibatis.io.DefaultVFS) - Find JAR URL: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/pojo/Users.class
<2021-08-05 18:10:18,256> DEBUG (DefaultVFS.java:247) [main] (org.apache.ibatis.io.DefaultVFS) - Not a JAR: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/pojo/Users.class
<2021-08-05 18:10:18,258> DEBUG (DefaultVFS.java:100) [main] (org.apache.ibatis.io.DefaultVFS) - Reader entry: ����   7 N
<2021-08-05 18:10:18,261> DEBUG (ResolverUtil.java:288) [main] (org.apache.ibatis.io.ResolverUtil) - Checking to see if class com.bjsxt.pojo.Order matches criteria [is assignable to Object]
<2021-08-05 18:10:18,270> DEBUG (ResolverUtil.java:288) [main] (org.apache.ibatis.io.ResolverUtil) - Checking to see if class com.bjsxt.pojo.Roles matches criteria [is assignable to Object]
<2021-08-05 18:10:18,273> DEBUG (ResolverUtil.java:288) [main] (org.apache.ibatis.io.ResolverUtil) - Checking to see if class com.bjsxt.pojo.Users matches criteria [is assignable to Object]
<2021-08-05 18:10:18,370> DEBUG (PooledDataSource.java:363) [main] (org.apache.ibatis.datasource.pooled.PooledDataSource) - PooledDataSource forcefully closed/removed all connections.
<2021-08-05 18:10:18,371> DEBUG (PooledDataSource.java:363) [main] (org.apache.ibatis.datasource.pooled.PooledDataSource) - PooledDataSource forcefully closed/removed all connections.
<2021-08-05 18:10:18,371> DEBUG (PooledDataSource.java:363) [main] (org.apache.ibatis.datasource.pooled.PooledDataSource) - PooledDataSource forcefully closed/removed all connections.
<2021-08-05 18:10:18,371> DEBUG (PooledDataSource.java:363) [main] (org.apache.ibatis.datasource.pooled.PooledDataSource) - PooledDataSource forcefully closed/removed all connections.
<2021-08-05 18:10:18,378> DEBUG (DefaultVFS.java:220) [main] (org.apache.ibatis.io.DefaultVFS) - Find JAR URL: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/mapper
<2021-08-05 18:10:18,378> DEBUG (DefaultVFS.java:247) [main] (org.apache.ibatis.io.DefaultVFS) - Not a JAR: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/mapper
<2021-08-05 18:10:18,380> DEBUG (DefaultVFS.java:100) [main] (org.apache.ibatis.io.DefaultVFS) - Reader entry: UsersMapper
<2021-08-05 18:10:18,381> DEBUG (DefaultVFS.java:100) [main] (org.apache.ibatis.io.DefaultVFS) - Reader entry: UsersMapper.class
<2021-08-05 18:10:18,383> DEBUG (DefaultVFS.java:111) [main] (org.apache.ibatis.io.DefaultVFS) - Listing file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/mapper
<2021-08-05 18:10:18,384> DEBUG (DefaultVFS.java:220) [main] (org.apache.ibatis.io.DefaultVFS) - Find JAR URL: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/mapper/UsersMapper
<2021-08-05 18:10:18,384> DEBUG (DefaultVFS.java:247) [main] (org.apache.ibatis.io.DefaultVFS) - Not a JAR: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/mapper/UsersMapper
<2021-08-05 18:10:18,386> DEBUG (DefaultVFS.java:100) [main] (org.apache.ibatis.io.DefaultVFS) - Reader entry: <?xml  version="1.0" encoding="UTF-8"?>
<2021-08-05 18:10:18,387> DEBUG (DefaultVFS.java:220) [main] (org.apache.ibatis.io.DefaultVFS) - Find JAR URL: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/mapper/UsersMapper.class
<2021-08-05 18:10:18,388> DEBUG (DefaultVFS.java:247) [main] (org.apache.ibatis.io.DefaultVFS) - Not a JAR: file:/C:/Users/l1812/IdeaProjects/assosiationdemo/out/production/associationdemo/com/bjsxt/mapper/UsersMapper.class
<2021-08-05 18:10:18,389> DEBUG (DefaultVFS.java:100) [main] (org.apache.ibatis.io.DefaultVFS) - Reader entry: ����   7 
<2021-08-05 18:10:18,391> DEBUG (ResolverUtil.java:288) [main] (org.apache.ibatis.io.ResolverUtil) - Checking to see if class com.bjsxt.mapper.UsersMapper matches criteria [is assignable to Object]
Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.bjsxt.mapper.UsersMapper.selectUsersAndOrders
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:235)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:53)
	at org.apache.ibatis.binding.MapperProxy.lambda$cachedInvoker$0(MapperProxy.java:115)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
	at org.apache.ibatis.binding.MapperProxy.cachedInvoker(MapperProxy.java:102)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
	at com.sun.proxy.$Proxy6.selectUsersAndOrders(Unknown Source)
	at com.bjsxt.test.SelectUsersAndOrdersTest.main(SelectUsersAndOrdersTest.java:16)

Process finished with exit code 1




JAVA 全系列/第六阶段:项目管理与SSM框架/Mybatis 18449楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637