当前位置: 首页> 文旅> 艺术 > 《web应用技术》第九次作业

《web应用技术》第九次作业

时间:2025/7/14 9:04:23来源:https://blog.csdn.net/ooiceoo12/article/details/139307388 浏览次数:0次

一、将前面的代码继续完善功能

1.采用XML映射文件的形式来映射sql语句;

<?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.itheima.mapper.EmpMapper">

    <select id="list" resultType="com.itheima.pojo.Emp">

        select * from emp where name like '%${name}%' and gender =#{gender} and

                        entrydate between #{begin} and #{end} order by update_time desc)

    </select>

</mapper>

2.采用动态sql语句的方式,实现条件查询的分页。

<select id="list" resultType="com.itheima.pojo.Emp">

        select *

        from emp

        <where>

              <if test="name!=null">

                  name like concat('%',#{name},'%')

              </if>

              <if test="gender!=null">

                  and gender =#{gender}

              </if>

              <if test="begin!=null and end!=null">

                  and entrydate between #{begin} and #{end}

              </if>

        </where>

        order by update_time desc)

    </select>

<update id="update2">

        update emp

        <set>

        <if test="username!=null">username=#{username},</if>

        <if test="name!=null">name=#{name},</if>

        <if test="gender!=null">gender=#{gender},</if>

        <if test="image!=null">image=#{image},</if>

        <if test="job!=null">job=#{job},</if>

        <if test="entrydate!=null">entrydate=#{entrydate},</if>

        <if test="depy_id!=null">dept_id=#{deptId},</if>

        <if test="update_time!=null">update_time=#{updateTime}</if>

                    where id=#{id}

        </set>

</update>

 <delete id="deleteByIds">

            delete from emp where id in

            <foreach collection="ids" item="id" separator="," open="(" close=")">

                #{id}

            </foreach>

    </delete>

二、学习git的使用。

1.每个小组将自己的项目上传到gitee,学会协作开发;

2.学会从gitee上拉取项目到本地;

复制地址点击克隆

关键字:《web应用技术》第九次作业

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: