123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?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.mapper.UserinfoMapper">
- <sql id="Where_Clause">
- <where>
- <if test="id!=null and id!=0">and id= #{id}</if>
- <if test="name!=null and name!=''">and name=#{name}</if>
- <if test="upwd!=null and upwd!=''">and upwd=#{upwd}</if>
- <if test="tel!=null and tel!=''">and tel=#{tel}</if>
-
- </where>
- </sql>
- <select id="query" parameterType="java.util.Map"
- resultType="Userinfo">
- select * from userinfo
- <include refid="Where_Clause" />
- <if test="page">limit #{offset} ,#{pageSize}</if>
- </select>
- <select id="getCount" parameterType="java.util.Map"
- resultType="Int">
- select count(0) from userinfo
- <include refid="Where_Clause" />
- </select>
- <select id="queryUserinfoById" parameterType="int"
- resultType="Userinfo">
- select * from userinfo where id=${value}
- </select>
- <insert id="insertUserinfo" useGeneratedKeys="true" keyProperty="id"
- parameterType="Userinfo">
- insert into userinfo (name,tel,upwd,utype) values
- (#{name},#{tel},#{upwd},#{utype});
- </insert>
- <update id="updateUserinfo" parameterType="Userinfo">
- update userinfo set
- name=#{name},tel=#{tel},upwd=#{upwd},utype=#{utype} where
- id=#{id}
- </update>
- <delete id="deleteUserinfo" parameterType="int">
- delete from userinfo where id=${value}
- </delete>
- </mapper>
|