All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mapper.TemplateMapper.xml Maven / Gradle / Ivy

There is a newer version: 1.2
Show newest version
<?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.mocai.merchant.mapper.TemplateMapper">
  <resultMap id="BaseResultMap" type="com.mocai.merchant.model.Template">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="parameters" jdbcType="VARCHAR" property="parameters" />
    <result column="content" jdbcType="VARCHAR" property="content" />
  </resultMap>
  <sql id="Base_Column_List">
    id, name, parameters, content
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from template
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from template
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.mocai.merchant.model.Template">
    insert into template (id, name, parameters, 
      content)
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{parameters,jdbcType=VARCHAR}, 
      #{content,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.mocai.merchant.model.Template">
    insert into template
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="parameters != null">
        parameters,
      </if>
      <if test="content != null">
        content,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="parameters != null">
        #{parameters,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.mocai.merchant.model.Template">
    update template
    <set>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="parameters != null">
        parameters = #{parameters,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        content = #{content,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.mocai.merchant.model.Template">
    update template
    set name = #{name,jdbcType=VARCHAR},
      parameters = #{parameters,jdbcType=VARCHAR},
      content = #{content,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectAll" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from template
  </select>
  <select id="selectByRecord" parameterType="com.mocai.merchant.model.Template" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from template
    <where>
      <if test="name != null">
        name like "%"#{name,jdbcType=VARCHAR}"%" 
      </if>
      <if test="parameters != null">
        and parameters like "%"#{parameters,jdbcType=VARCHAR}"%" 
      </if>
      <if test="content != null">
        and content like "%"#{content,jdbcType=VARCHAR}"%" 
      </if>
    </where>
  </select>
  <select id="count" resultType="java.lang.Long">
    select count(*) 
    from template
  </select>
  <insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
    insert into template (id, name, parameters, content) values
    <foreach collection="list" item="list" separator=",">
      (#{item.id, jdbcType=INTEGER}, #{item.name, jdbcType=VARCHAR}, #{item.parameters, jdbcType=VARCHAR}, #{item.content, jdbcType=VARCHAR})
    </foreach>
  </insert>
  <update id="batchUpdate">
    <foreach close="" collection="list" item="item" open="" separator=";">
      update template
      <set>
        <if test="item.name != null">
          name = #{item.name, jdbcType=VARCHAR}
        </if>
        <if test="item.parameters != null">
          parameters = #{item.parameters, jdbcType=VARCHAR}
        </if>
        <if test="item.content != null">
          content = #{item.content, jdbcType=VARCHAR}
        </if>
      </set>
      where id = #{item.id, jdbcType=INTEGER}
    </foreach>
  </update>
  <delete id="batchDelete">
    delete from template where id in 
    <foreach close=")" collection="list" item="item" open="(" separator=",">
      #{item}
    </foreach>
  </delete>

	<!--CUSTOM_CODE_START-->

	<!--CUSTOM_CODE_END-->
</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy