src/conf/dao/VisitorDao.xml

(完整代码) 1KB

<?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.VisitorDao" >

    <!--分页查询-->
    <select id="getVisitorList" parameterType="Visitor" resultType="Visitor">
        select * from d_visitor
        <where>
            <if test="v_name!=null and v_name!='' ">
                and  v_name like  '%${v_name}%'
            </if>
            <if test="v_phone!=null and v_phone!=0">
                and  v_phone like  '%${v_phone}%'
            </if>
        </where>
        ORDER BY  v_id asc
        limit #{currentPage},#{pageSize}
    </select>

    <!--查询数据总数-->
    <select id="totalCount"  resultType="Integer">
        select count(v_id) from d_visitor
        <where>
            <if test="v_name!=null and v_name!='' ">
                and  v_name like  '%${v_name}%'
            </if>
            <if test="v_phone!=null and v_phone!=0">
                and  v_phone like  '%${v_phone}%'
            </if>
        </where>
    </select>

    <!--添加学生信息-->
    <insert id="addVisitor" parameterType="Visitor" keyProperty="v_id" useGeneratedKeys="true">
        insert into d_visitor (v_name,v_phone,v_dormitoryid,v_dormbuilding,create_time)
        values(#{v_name},#{v_phone},#{v_dormitoryid},#{v_dormbuilding},now())
    </insert>

    <select id="getAll" resultType="Visitor">
        select * from d_visitor;
    </select>

</mapper>

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

AI 解读 AI

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

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