mybatis.dataIdentity.DataIdentityMapper.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.dataIdentity.DataIdentityDao"> <!-- Result Map --> <resultMap id="baseResultMap" type="com.higgschain.trust.slave.dao.po.DataIdentityPO"> <result column="id" property="id"/> <result column="identity" property="identity"/> <result column="chain_owner" property="chainOwner"/> <result column="data_owner" property="dataOwner"/> <result column="create_time" property="createTime"/> </resultMap> <!-- data_identity table all fields --> <sql id="baseColumnList"> identity,chain_owner,data_owner,create_time </sql> <!-- 查询条件 --> <sql id="baseWhereClause"> where 1=1 <trim suffixOverrides=","> <if test="identity != null and identity != ''"> and `identity`=#{identity} </if> <if test="chainOwner != null and chainOwner != ''"> and chain_owner=#{chainOwner} </if> <if test="dataOwner != null and dataOwner != ''"> and data_owner=#{dataOwner} </if> <if test="createTime != null"> and create_time=#{createTime} </if> </trim> </sql> <!-- 插入记录 --> <insert id="add" parameterType="com.higgschain.trust.slave.dao.po.DataIdentityPO"> insert into data_identity(`identity`,chain_owner,data_owner,create_time) values(#{identity},#{chainOwner},#{dataOwner},now(3)) </insert> <!-- 列表总数 --> <select id="queryByCount" resultType="java.lang.Integer" parameterType="com.higgschain.trust.slave.dao.po.DataIdentityPO"> select count(1) from data_identity <include refid="baseWhereClause"/> </select> <!-- 查询列表 --> <select id="queryByList" resultMap="baseResultMap" parameterType="com.higgschain.trust.slave.dao.po.DataIdentityPO"> select <include refid="baseColumnList"/> from data_identity <include refid="baseWhereClause"/> </select> <!-- 以上为工具自动生成 --> <!--queryByIdentity--> <select id="queryByIdentity" resultMap="baseResultMap" parameterType="java.lang.String"> select <include refid="baseColumnList"/> from data_identity where `identity`=#{identity} </select> <!-- batch insert --> <insert id="batchInsert" parameterType="java.util.List"> INSERT INTO data_identity(`identity`,chain_owner,data_owner,create_time) VALUES <foreach collection="list" item="item" index="index" separator=","> (#{item.identity},#{item.chainOwner},#{item.dataOwner},now(3)) </foreach> </insert> </mapper>