123456789101112131415161718192021222324252627282930313233343536 |
- <?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.fuzamei.mapperInterface.AccountInfoInterface">
- <select id="getAllAccount" resultType="com.fuzamei.entity.AccountInfo">
- select * from account_info;
- </select>
- <insert id="insertAccountInfo" parameterType="java.util.List">
- insert into account_info(account_id,account_name,account_type)values
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.account_id},
- #{item.account_name},
- #{item.account_type})
- </foreach>
- </insert>
- <select id="getAccountInfoByUser" parameterType="java.lang.String" resultType="com.fuzamei.entity.AccountInfo">
- select account_id,account_name from account_info where account_id in(
- select account_id from user_account where user_id = #{userId}
- );
- </select>
- <update id="updateBatchAccountById">
- update
- account_info
- set
- <foreach collection="cloumn" item = "cloumnItem" index = "cloumnIndex" separator=",">
- ${cloumnItem} =
- <foreach collection="parameter.keys" item="item" index="index" open="case account_id" close="end" separator=" ">
- when ${item} then #{parameter.[${item}].[${cloumnItem}]}
- </foreach>
- </foreach>
- where
- account_id in
- <foreach collection="parameter.keys" item="key" open="(" close=")" separator=",">
- #{key}
- </foreach>
- </update>
- </mapper>
|