conf/dao/StudentDao.xml

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?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="dao.StudentDao" >

    <!--分页查询-->
    <select id="getStudentList" parameterType="Student" resultType="Student">
        select *from d_student
        <where>
            <if test="s_name!=null and s_name!='' ">
                and  s_name like  '%${s_name}%'
            </if>
            <if test="s_studentid!=null and s_studentid!=0">
                and  s_studentid like  '%${s_studentid}%'
            </if>
            <if test="s_classid!=null and s_classid!=0">
                and  s_classid like  '%${s_classid}%'
            </if>
            <if test="s_classname!=null and s_classname!='' ">
                and  s_classname like  '%${s_classname}%'
            </if>
        </where>
        ORDER BY  s_id asc
        limit #{currentPage},#{pageSize}
    </select>
    <!--查询数据总数-->
    <select id="totalCount"  resultType="Integer">
        select count(s_studentid) from d_student
        <where>
              <if test="s_name!=null and s_name!='' ">
                 and  s_name like  '%${s_name}%'
               </if>
              <if test="s_studentid!=null and s_studentid!=0">
                  and  s_studentid like  '%${s_studentid}%'
               </if>
              <if test="s_classid!=null and s_classid!=0">
                  and  s_classid like  '%${s_classid}%'
              </if>
              <if test="s_classname!=null and s_classname!='' ">
                and  s_classname like  '%${s_classname}%'
              </if>
          </where>
    </select>
    <!--通过id删除学生信息-->
    <delete id="deleteStudent" parameterType="Integer" >
        delete from d_student where s_id=#{s_id}
    </delete>
    <!--添加学生信息-->
    <insert id="addStudent" parameterType="Student" keyProperty="s_id" useGeneratedKeys="true">
        insert into d_student (s_studentid,s_name,s_sex,s_age,s_phone,s_classid,s_classname,s_dormitoryid)
        values(#{s_studentid},#{s_name},#{s_sex},#{s_age},#{s_phone},#{s_classid},#{s_classname},#{s_dormitoryid})
    </insert>


    <select id="findStudentById"  parameterType="Integer" resultType="Student" >
       select * from d_student where s_id=#{s_id}
    </select>
    <!--修改学生信息-->
    <update id="updateStudent" parameterType="Student">
        update d_student
后面还有 34 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。