mybatis.mapper.t_idemfactor.xml Maven / Gradle / Ivy
<?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"> <!-- Automatic generated on 2023-08-09 22:56:36 by CrudCodeGenerator wirtten by Gerald Chen --> <mapper namespace="com.github.javaclub.base.mapper.IdemfactorDAO"> <resultMap type="com.github.javaclub.base.domain.IdemfactorDO" id="idemfactorMap"> <result property="id" column="id" /> <result property="identifier" column="identifier" /> <result property="bizType" column="biz_type" /> <result property="value" column="value" /> <result property="createdTime" column="created_time" /> <result property="modifiedTime" column="modified_time" /> </resultMap> <sql id="AllColumns"> id, identifier, biz_type, value, created_time, modified_time </sql> <sql id="InfoManageSet"> <set> <if test="identifier != null">identifier=#{identifier},</if> <if test="bizType != null">biz_type=#{bizType},</if> <if test="value != null">value=#{value},</if> </set> </sql> <sql id="Where_QueryCondition"> <where> <if test="id != null"> id = #{id} </if> <if test="identifier != null"> AND identifier = #{identifier} </if> <if test="bizType != null"> AND biz_type = #{bizType} </if> <if test="value != null"> AND value = #{value} </if> <if test="minId != null"> <![CDATA[ AND id >= #{minId} ]]> </if> <if test="maxId != null"> <![CDATA[ AND id <= #{maxId} ]]> </if> <if test="ids != null and ids.size() > 0"> AND id IN <foreach item="id" index="index" collection="ids" open="(" separator="," close=")"> #{id} </foreach> </if> <if test="gmtCreateRange != null and gmtCreateRange.start != null"> <![CDATA[ AND created_time >= #{gmtCreateRange.start} ]]> </if> <if test="gmtCreateRange != null and gmtCreateRange.end != null"> <![CDATA[ AND created_time <= #{gmtCreateRange.end} ]]> </if> <if test="gmtModifyRange != null and gmtModifyRange.start != null"> <![CDATA[ AND modified_time >= #{gmtModifyRange.start} ]]> </if> <if test="gmtModifyRange != null and gmtModifyRange.end != null"> <![CDATA[ AND modified_time <= #{gmtModifyRange.end} ]]> </if> </where> </sql> <sql id="OrderBy"> <choose> <when test="orderByList != null and orderByList.size() > 0"> <foreach item="orderby" index="index" collection="orderByList" open="" separator="," close=""> ${orderby.key} ${orderby.value} </foreach> </when> <otherwise> created_time DESC </otherwise> </choose> </sql> <select id="getById" resultMap="idemfactorMap"> SELECT <include refid="AllColumns" /> FROM t_idemfactor WHERE id = #{id} LIMIT 1 </select> <select id="uniqueQuery" resultMap="idemfactorMap"> SELECT <include refid="AllColumns" /> FROM t_idemfactor WHERE identifier = #{identifier} AND biz_type = #{bizType} AND value = #{value} LIMIT 1 </select> <select id="queryList" parameterType="com.github.javaclub.base.domain.query.IdemfactorQuery" resultMap="idemfactorMap"> SELECT <include refid="AllColumns" /> FROM t_idemfactor <if test="forceIndex != null"> FORCE INDEX(${forceIndex}) </if> <include refid="Where_QueryCondition" /> ORDER BY <include refid="OrderBy" /> LIMIT #{start}, #{limit} </select> <select id="count" parameterType="com.github.javaclub.base.domain.query.IdemfactorQuery" resultType="java.lang.Integer"> SELECT count(id) FROM t_idemfactor <if test="forceIndex != null"> FORCE INDEX(${forceIndex}) </if> <include refid="Where_QueryCondition" /> </select> <insert id="insert" parameterType="com.github.javaclub.base.domain.IdemfactorDO" useGeneratedKeys="true" keyProperty="id"> INSERT t_idemfactor <include refid="InfoManageSet" /> </insert> <insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id"> INSERT INTO t_idemfactor(identifier,biz_type,value,created_time,modified_time) VALUES <foreach collection="list" item="obj" index="index" separator=","> (#{obj.identifier},#{obj.bizType},#{obj.value},now(),now()) </foreach> </insert> <update id="update" parameterType="com.github.javaclub.base.domain.IdemfactorDO"> UPDATE t_idemfactor <include refid="InfoManageSet" /> WHERE id = #{id} <if test="version != null"> AND version=#{version} </if> </update> <delete id="deleteById"> DELETE FROM t_idemfactor WHERE id = #{id} </delete> </mapper>