ReceiptContainerDetailMapperAuto.xml 9.88 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.receipt.receiptContainerDetail.mapper.ReceiptContainerDetailMapperAuto">
  <select id="selectListEntityByLike" resultType="com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail">
   SELECT id, headerId, receiptDetailId, materialCode, materialName, qty, created, createdBy  
   FROM receipt_container_detail
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="headerId != null"> 
        AND headerId = #{headerId}
    </if>
    <if test="receiptDetailId != null"> 
        AND receiptDetailId = #{receiptDetailId}
    </if>
    <if test="materialCode != null"> 
        AND materialCode like #{materialCode}
    </if>
    <if test="materialName != null"> 
        AND materialName like #{materialName}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="created != null"> 
        AND created = #{created}
    </if>
    <if test="createdBy != null"> 
        AND createdBy like #{createdBy}
    </if>
  </where>
  </select>

  <select id="selectListEntityByEqual" resultType="com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail">
   SELECT id, headerId, receiptDetailId, materialCode, materialName, qty, created, createdBy  
   FROM receipt_container_detail
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="headerId != null"> 
        AND headerId = #{headerId}
    </if>
    <if test="receiptDetailId != null"> 
        AND receiptDetailId = #{receiptDetailId}
    </if>
    <if test="materialCode != null"> 
        AND materialCode = #{materialCode}
    </if>
    <if test="materialName != null"> 
        AND materialName = #{materialName}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="created != null"> 
        AND created = #{created}
    </if>
    <if test="createdBy != null"> 
        AND createdBy = #{createdBy}
    </if>
  </where>
  </select>

  <select id="selectListMapByEqual" resultType="java.util.HashMap">
      SELECT ${columns} FROM receipt_container_detail
  <where>
    <if test="condition.id != null"> 
        AND id = #{condition.id}
    </if>
    <if test="condition.headerId != null"> 
        AND headerId = #{condition.headerId}
    </if>
    <if test="condition.receiptDetailId != null"> 
        AND receiptDetailId = #{condition.receiptDetailId}
    </if>
    <if test="condition.materialCode != null"> 
        AND materialCode = #{condition.materialCode}
    </if>
    <if test="condition.materialName != null"> 
        AND materialName = #{condition.materialName}
    </if>
    <if test="condition.qty != null"> 
        AND qty = #{condition.qty}
    </if>
    <if test="condition.created != null"> 
        AND created = #{condition.created}
    </if>
    <if test="condition.createdBy != null"> 
        AND createdBy = #{condition.createdBy}
    </if>
  </where>
  </select>

  <select id="selectEntityById" resultType="com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail">
      SELECT id, headerId, receiptDetailId, materialCode, materialName, qty, created, createdBy  FROM receipt_container_detail WHERE id = #{id}
  </select>

  <select id="selectFirstEntity" resultType="com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail">
  SELECT id, headerId, receiptDetailId, materialCode, materialName, qty, created, createdBy  
  FROM receipt_container_detail
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="headerId != null"> 
        AND headerId = #{headerId}
    </if>
    <if test="receiptDetailId != null"> 
        AND receiptDetailId = #{receiptDetailId}
    </if>
    <if test="materialCode != null"> 
        AND materialCode = #{materialCode}
    </if>
    <if test="materialName != null"> 
        AND materialName = #{materialName}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="created != null"> 
        AND created = #{created}
    </if>
    <if test="createdBy != null"> 
        AND createdBy = #{createdBy}
    </if>
  </where>
   LIMIT 1 
  </select>

  <select id="selectFirstMap" resultType="java.util.HashMap">
      SELECT ${columns} FROM receipt_container_detail
  <where>
    <if test="condition.id != null"> 
        AND id = #{condition.id}
    </if>
    <if test="condition.headerId != null"> 
        AND headerId = #{condition.headerId}
    </if>
    <if test="condition.receiptDetailId != null"> 
        AND receiptDetailId = #{condition.receiptDetailId}
    </if>
    <if test="condition.materialCode != null"> 
        AND materialCode = #{condition.materialCode}
    </if>
    <if test="condition.materialName != null"> 
        AND materialName = #{condition.materialName}
    </if>
    <if test="condition.qty != null"> 
        AND qty = #{condition.qty}
    </if>
    <if test="condition.created != null"> 
        AND created = #{condition.created}
    </if>
    <if test="condition.createdBy != null"> 
        AND createdBy = #{condition.createdBy}
    </if>
  </where>
   LIMIT 1 
  </select>

  <insert id="insert" parameterType="com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail" keyProperty="id" useGeneratedKeys="true" >
  INSERT INTO receipt_container_detail 
  <trim prefix="(" suffix=")" suffixOverrides=",">
    <if test="headerId != null"> 
        headerId, 
    </if>
    <if test="receiptDetailId != null"> 
        receiptDetailId, 
    </if>
    <if test="materialCode != null"> 
        materialCode, 
    </if>
    <if test="materialName != null"> 
        materialName, 
    </if>
    <if test="qty != null"> 
        qty, 
    </if>
    <if test="created != null"> 
        created, 
    </if>
    <if test="createdBy != null"> 
        createdBy, 
    </if>
  </trim>
  <trim prefix=" values (" suffix=")" suffixOverrides=",">
    <if test="headerId != null"> 
        #{headerId, jdbcType=INTEGER}, 
    </if>
    <if test="receiptDetailId != null"> 
        #{receiptDetailId, jdbcType=INTEGER}, 
    </if>
    <if test="materialCode != null"> 
        #{materialCode, jdbcType=VARCHAR}, 
    </if>
    <if test="materialName != null"> 
        #{materialName, jdbcType=VARCHAR}, 
    </if>
    <if test="qty != null"> 
        #{qty, jdbcType=DECIMAL}, 
    </if>
    <if test="created != null"> 
        #{created, jdbcType=TIMESTAMP}, 
    </if>
    <if test="createdBy != null"> 
        #{createdBy, jdbcType=VARCHAR}, 
    </if>
  </trim>
  </insert>

  <update id="updateByModel">
  UPDATE receipt_container_detail 
  <set>
    <if test="headerId != null"> 
        headerId = #{headerId, jdbcType=INTEGER}, 
    </if>
    <if test="receiptDetailId != null"> 
        receiptDetailId = #{receiptDetailId, jdbcType=INTEGER}, 
    </if>
    <if test="materialCode != null"> 
        materialCode = #{materialCode, jdbcType=VARCHAR}, 
    </if>
    <if test="materialName != null"> 
        materialName = #{materialName, jdbcType=VARCHAR}, 
    </if>
    <if test="qty != null"> 
        qty = #{qty, jdbcType=DECIMAL}, 
    </if>
    <if test="created != null"> 
        created = #{created, jdbcType=TIMESTAMP}, 
    </if>
    <if test="createdBy != null"> 
        createdBy = #{createdBy, jdbcType=VARCHAR}, 
    </if>
  </set>
   WHERE id = #{id,jdbcType=INTEGER}
  </update>

  <update id="updateByCondition">
  UPDATE receipt_container_detail 
  <set>
    <if test="record.headerId != null"> 
        headerId = #{record.headerId, jdbcType=INTEGER}, 
    </if>
    <if test="record.receiptDetailId != null"> 
        receiptDetailId = #{record.receiptDetailId, jdbcType=INTEGER}, 
    </if>
    <if test="record.materialCode != null"> 
        materialCode = #{record.materialCode, jdbcType=VARCHAR}, 
    </if>
    <if test="record.materialName != null"> 
        materialName = #{record.materialName, jdbcType=VARCHAR}, 
    </if>
    <if test="record.qty != null"> 
        qty = #{record.qty, jdbcType=DECIMAL}, 
    </if>
    <if test="record.created != null"> 
        created = #{record.created, jdbcType=TIMESTAMP}, 
    </if>
    <if test="record.createdBy != null"> 
        createdBy = #{record.createdBy, 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.receiptDetailId != null"> 
        AND receiptDetailId = #{condition.receiptDetailId}
    </if>
    <if test="condition.materialCode != null"> 
        AND materialCode = #{condition.materialCode}
    </if>
    <if test="condition.materialName != null"> 
        AND materialName = #{condition.materialName}
    </if>
    <if test="condition.qty != null"> 
        AND qty = #{condition.qty}
    </if>
    <if test="condition.created != null"> 
        AND created = #{condition.created}
    </if>
    <if test="condition.createdBy != null"> 
        AND createdBy = #{condition.createdBy}
    </if>
  </where>
  </update>

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

  <delete id="deleteByCondition"> 
  DELETE FROM receipt_container_detail 
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="headerId != null"> 
        AND headerId = #{headerId}
    </if>
    <if test="receiptDetailId != null"> 
        AND receiptDetailId = #{receiptDetailId}
    </if>
    <if test="materialCode != null"> 
        AND materialCode = #{materialCode}
    </if>
    <if test="materialName != null"> 
        AND materialName = #{materialName}
    </if>
    <if test="qty != null"> 
        AND qty = #{qty}
    </if>
    <if test="created != null"> 
        AND created = #{created}
    </if>
    <if test="createdBy != null"> 
        AND createdBy = #{createdBy}
    </if>
  </where>
  </delete>

  </mapper>