mybatis.account.AccountDcRecordMapper.xml Maven / Gradle / Ivy
The newest version!
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mappers.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.higgschain.trust.slave.dao.mysql.account.AccountDcRecordDao"> <!-- Result Map --> <resultMap id="baseResultMap" type="com.higgschain.trust.slave.dao.po.account.AccountDcRecordPO"> <result column="id" property="id"/> <result column="biz_flow_no" property="bizFlowNo"/> <result column="account_no" property="accountNo"/> <result column="dc_flag" property="dcFlag"/> <result column="amount" property="amount"/> <result column="create_time" property="createTime"/> </resultMap> <!-- account_dc_record table all fields --> <sql id="baseColumnList"> id,biz_flow_no,account_no,dc_flag,amount,create_time </sql> <!-- 查询条件 --> <sql id="baseWhereClause"> where 1=1 <trim suffixOverrides=","> <if test="id != null"> and id=#{id} </if> <if test="bizFlowNo != null and bizFlowNo != ''"> and biz_flow_no=#{bizFlowNo} </if> <if test="accountNo != null and accountNo != ''"> and account_no=#{accountNo} </if> <if test="dcFlag != null and dcFlag != ''"> and dc_flag=#{dcFlag} </if> <if test="amount != null"> and amount=#{amount} </if> <if test="createTime != null"> and create_time=#{createTime} </if> </trim> </sql> <!-- 插入记录 --> <insert id="add" parameterType="Object"> insert into account_dc_record(id,biz_flow_no,account_no,dc_flag,amount,create_time) values(#{id},#{bizFlowNo},#{accountNo},#{dcFlag},#{amount},now(3)) </insert> <!-- 删除记录 --> <delete id="delete" parameterType="Object"> delete from account_dc_record where id=#{id} </delete> <!-- 根据id查询 --> <select id="queryById" resultMap="baseResultMap" parameterType="Object"> select <include refid="baseColumnList"/> from account_dc_record where id=#{id} </select> <!-- 列表总数 --> <select id="queryByCount" resultType="java.lang.Integer" parameterType="Object"> select count(1) from account_dc_record <include refid="baseWhereClause"/> </select> <!-- 查询列表 --> <select id="queryByList" resultMap="baseResultMap" parameterType="Object"> select <include refid="baseColumnList"/> from account_dc_record <include refid="baseWhereClause"/> </select> <!-- 以上为工具自动生成 --> <!--batch insert--> <insert id ="batchInsert" parameterType="java.util.List" > insert into account_dc_record(id,biz_flow_no,account_no,dc_flag,amount,create_time) values <foreach collection ="list" item="item" index= "index" separator =","> (#{item.id},#{item.bizFlowNo},#{item.accountNo},#{item.dcFlag},#{item.amount},now(3)) </foreach> </insert> </mapper>