1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?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="bank.dao.AccountDao">
- <sql id="selectAccountsWhere">
- <where>
- <if test="no!=null">
- no like "%${no}%"
- </if>
- <if test="name!=null">
- and name like "%${name}%"
- </if>
- </where>
- </sql>
- <select id="selectAccounts" parameterType="bank.model.Account" resultType="bank.model.Account">
- select * from account
- <include refid="selectAccountsWhere"/>
- </select>
-
- <insert id="insertAccount" parameterType="bank.model.Account">
- insert into account (no,name,balance) values (#{no},#{name},#{balance})
- </insert>
-
- <select id="getAccountByNo" parameterType="java.lang.String" resultType="bank.model.Account">
- select*from account where no=#{no}
- </select>
-
- <select id="getAccountByid" parameterType="java.lang.Integer" resultType="bank.model.Account">
- select * from account where id=#{id}
- </select>
-
- <update id="updateAccount" parameterType="bank.model.Account">
- update account set no=#{no},name=#{name},balance=#{balance} where id=#{id}
- </update>
-
- <delete id="deleteAccountById" parameterType="java.lang.Integer">
- delete from account where id=#{id}
- </delete>
- </mapper>
|