IdentificationMapperAuto.xml 9.21 KB
<?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.huaheng.pc.config.zone.mapper.IdentificationMapperAuto">
  <select id="selectListEntityByLike" resultType="com.huaheng.pc.config.zone.domain.Identification">
   SELECT ID, HeaderId, itemId, UserDeft1, UserDeft2, UserDeft3, UserDeft4  
   FROM identification
  <where>
    <if test="ID != null "> 
        AND ID = #{ID}
    </if>
    <if test="HeaderId != null and HeaderId != ''"> 
        <bind name="HeaderIdPattern" value="'%' + HeaderId + '%'" />
        AND HeaderId like #{HeaderIdPattern}
    </if>
    <if test="itemId != null and itemId != ''"> 
        <bind name="itemIdPattern" value="'%' + itemId + '%'" />
        AND itemId like #{itemIdPattern}
    </if>
    <if test="UserDeft1 != null and UserDeft1 != ''"> 
        <bind name="UserDeft1Pattern" value="'%' + UserDeft1 + '%'" />
        AND UserDeft1 like #{UserDeft1Pattern}
    </if>
    <if test="UserDeft2 != null and UserDeft2 != ''"> 
        <bind name="UserDeft2Pattern" value="'%' + UserDeft2 + '%'" />
        AND UserDeft2 like #{UserDeft2Pattern}
    </if>
    <if test="UserDeft3 != null and UserDeft3 != ''"> 
        <bind name="UserDeft3Pattern" value="'%' + UserDeft3 + '%'" />
        AND UserDeft3 like #{UserDeft3Pattern}
    </if>
    <if test="UserDeft4 != null and UserDeft4 != ''"> 
        <bind name="UserDeft4Pattern" value="'%' + UserDeft4 + '%'" />
        AND UserDeft4 like #{UserDeft4Pattern}
    </if>
  </where>
  </select>

  <select id="selectListEntityByEqual" resultType="com.huaheng.pc.config.zone.domain.Identification">
   SELECT ID, HeaderId, itemId, UserDeft1, UserDeft2, UserDeft3, UserDeft4  
   FROM identification
  <where>
    <if test="ID != null"> 
        AND ID = #{ID}
    </if>
    <if test="HeaderId != null"> 
        AND HeaderId = #{HeaderId}
    </if>
    <if test="itemId != null"> 
        AND itemId = #{itemId}
    </if>
    <if test="UserDeft1 != null"> 
        AND UserDeft1 = #{UserDeft1}
    </if>
    <if test="UserDeft2 != null"> 
        AND UserDeft2 = #{UserDeft2}
    </if>
    <if test="UserDeft3 != null"> 
        AND UserDeft3 = #{UserDeft3}
    </if>
    <if test="UserDeft4 != null"> 
        AND UserDeft4 = #{UserDeft4}
    </if>
  </where>
  </select>

  <select id="selectListMapByEqual" resultType="java.util.HashMap">
      SELECT ${columns} FROM identification
  <where>
    <if test="condition.ID != null"> 
        AND ID = #{condition.ID}
    </if>
    <if test="condition.HeaderId != null"> 
        AND HeaderId = #{condition.HeaderId}
    </if>
    <if test="condition.itemId != null"> 
        AND itemId = #{condition.itemId}
    </if>
    <if test="condition.UserDeft1 != null"> 
        AND UserDeft1 = #{condition.UserDeft1}
    </if>
    <if test="condition.UserDeft2 != null"> 
        AND UserDeft2 = #{condition.UserDeft2}
    </if>
    <if test="condition.UserDeft3 != null"> 
        AND UserDeft3 = #{condition.UserDeft3}
    </if>
    <if test="condition.UserDeft4 != null"> 
        AND UserDeft4 = #{condition.UserDeft4}
    </if>
  </where>
  </select>

  <select id="selectEntityById" resultType="com.huaheng.pc.config.zone.domain.Identification">
      SELECT ID, HeaderId, itemId, UserDeft1, UserDeft2, UserDeft3, UserDeft4  FROM identification WHERE id = #{id}
  </select>

  <select id="selectFirstEntity" resultType="com.huaheng.pc.config.zone.domain.Identification">
  SELECT ID, HeaderId, itemId, UserDeft1, UserDeft2, UserDeft3, UserDeft4  
  FROM identification
  <where>
    <if test="ID != null"> 
        AND ID = #{ID}
    </if>
    <if test="HeaderId != null"> 
        AND HeaderId = #{HeaderId}
    </if>
    <if test="itemId != null"> 
        AND itemId = #{itemId}
    </if>
    <if test="UserDeft1 != null"> 
        AND UserDeft1 = #{UserDeft1}
    </if>
    <if test="UserDeft2 != null"> 
        AND UserDeft2 = #{UserDeft2}
    </if>
    <if test="UserDeft3 != null"> 
        AND UserDeft3 = #{UserDeft3}
    </if>
    <if test="UserDeft4 != null"> 
        AND UserDeft4 = #{UserDeft4}
    </if>
  </where>
   LIMIT 1 
  </select>

  <select id="selectFirstMap" resultType="java.util.HashMap">
      SELECT ${columns} FROM identification
  <where>
    <if test="condition.ID != null"> 
        AND ID = #{condition.ID}
    </if>
    <if test="condition.HeaderId != null"> 
        AND HeaderId = #{condition.HeaderId}
    </if>
    <if test="condition.itemId != null"> 
        AND itemId = #{condition.itemId}
    </if>
    <if test="condition.UserDeft1 != null"> 
        AND UserDeft1 = #{condition.UserDeft1}
    </if>
    <if test="condition.UserDeft2 != null"> 
        AND UserDeft2 = #{condition.UserDeft2}
    </if>
    <if test="condition.UserDeft3 != null"> 
        AND UserDeft3 = #{condition.UserDeft3}
    </if>
    <if test="condition.UserDeft4 != null"> 
        AND UserDeft4 = #{condition.UserDeft4}
    </if>
  </where>
   LIMIT 1 
  </select>

  <insert id="insert" parameterType="com.huaheng.pc.config.zone.domain.Identification" keyProperty="id" useGeneratedKeys="true" >
  INSERT INTO identification 
  <trim prefix="(" suffix=")" suffixOverrides=",">
    <if test="ID != null"> 
        ID, 
    </if>
    <if test="HeaderId != null"> 
        HeaderId, 
    </if>
    <if test="itemId != null"> 
        itemId, 
    </if>
    <if test="UserDeft1 != null"> 
        UserDeft1, 
    </if>
    <if test="UserDeft2 != null"> 
        UserDeft2, 
    </if>
    <if test="UserDeft3 != null"> 
        UserDeft3, 
    </if>
    <if test="UserDeft4 != null"> 
        UserDeft4, 
    </if>
  </trim>
  <trim prefix=" values (" suffix=")" suffixOverrides=",">
    <if test="ID != null"> 
        #{ID, jdbcType=INTEGER}, 
    </if>
    <if test="HeaderId != null"> 
        #{HeaderId, jdbcType=VARCHAR}, 
    </if>
    <if test="itemId != null"> 
        #{itemId, jdbcType=VARCHAR}, 
    </if>
    <if test="UserDeft1 != null"> 
        #{UserDeft1, jdbcType=VARCHAR}, 
    </if>
    <if test="UserDeft2 != null"> 
        #{UserDeft2, jdbcType=VARCHAR}, 
    </if>
    <if test="UserDeft3 != null"> 
        #{UserDeft3, jdbcType=VARCHAR}, 
    </if>
    <if test="UserDeft4 != null"> 
        #{UserDeft4, jdbcType=VARCHAR}, 
    </if>
  </trim>
  </insert>

  <update id="updateByModel">
  UPDATE identification 
  <set>
    <if test="ID != null"> 
        ID = #{ID, jdbcType=INTEGER}, 
    </if>
    <if test="HeaderId != null"> 
        HeaderId = #{HeaderId, jdbcType=VARCHAR}, 
    </if>
    <if test="itemId != null"> 
        itemId = #{itemId, jdbcType=VARCHAR}, 
    </if>
    <if test="UserDeft1 != null"> 
        UserDeft1 = #{UserDeft1, jdbcType=VARCHAR}, 
    </if>
    <if test="UserDeft2 != null"> 
        UserDeft2 = #{UserDeft2, jdbcType=VARCHAR}, 
    </if>
    <if test="UserDeft3 != null"> 
        UserDeft3 = #{UserDeft3, jdbcType=VARCHAR}, 
    </if>
    <if test="UserDeft4 != null"> 
        UserDeft4 = #{UserDeft4, jdbcType=VARCHAR}, 
    </if>
  </set>
   WHERE id = #{id,jdbcType=INTEGER}
  </update>

  <update id="updateByCondition">
  UPDATE identification 
  <set>
    <if test="record.ID != null"> 
        ID = #{record.ID, jdbcType=INTEGER}, 
    </if>
    <if test="record.HeaderId != null"> 
        HeaderId = #{record.HeaderId, jdbcType=VARCHAR}, 
    </if>
    <if test="record.itemId != null"> 
        itemId = #{record.itemId, jdbcType=VARCHAR}, 
    </if>
    <if test="record.UserDeft1 != null"> 
        UserDeft1 = #{record.UserDeft1, jdbcType=VARCHAR}, 
    </if>
    <if test="record.UserDeft2 != null"> 
        UserDeft2 = #{record.UserDeft2, jdbcType=VARCHAR}, 
    </if>
    <if test="record.UserDeft3 != null"> 
        UserDeft3 = #{record.UserDeft3, jdbcType=VARCHAR}, 
    </if>
    <if test="record.UserDeft4 != null"> 
        UserDeft4 = #{record.UserDeft4, jdbcType=VARCHAR}, 
    </if>
  </set>
  <where>
    <if test="condition.ID != null"> 
        AND ID = #{condition.ID}
    </if>
    <if test="condition.HeaderId != null"> 
        AND HeaderId = #{condition.HeaderId}
    </if>
    <if test="condition.itemId != null"> 
        AND itemId = #{condition.itemId}
    </if>
    <if test="condition.UserDeft1 != null"> 
        AND UserDeft1 = #{condition.UserDeft1}
    </if>
    <if test="condition.UserDeft2 != null"> 
        AND UserDeft2 = #{condition.UserDeft2}
    </if>
    <if test="condition.UserDeft3 != null"> 
        AND UserDeft3 = #{condition.UserDeft3}
    </if>
    <if test="condition.UserDeft4 != null"> 
        AND UserDeft4 = #{condition.UserDeft4}
    </if>
  </where>
  </update>

  <delete id="deleteById"> 
  DELETE FROM identification WHERE id = #{id, jdbcType=INTEGER} 
  </delete>

  <delete id="deleteByCondition"> 
  DELETE FROM identification 
  <where>
    <if test="ID != null"> 
        AND ID = #{ID}
    </if>
    <if test="HeaderId != null"> 
        AND HeaderId = #{HeaderId}
    </if>
    <if test="itemId != null"> 
        AND itemId = #{itemId}
    </if>
    <if test="UserDeft1 != null"> 
        AND UserDeft1 = #{UserDeft1}
    </if>
    <if test="UserDeft2 != null"> 
        AND UserDeft2 = #{UserDeft2}
    </if>
    <if test="UserDeft3 != null"> 
        AND UserDeft3 = #{UserDeft3}
    </if>
    <if test="UserDeft4 != null"> 
        AND UserDeft4 = #{UserDeft4}
    </if>
  </where>
  </delete>

  </mapper>