ShipmentContainerDetailAutoMapper.xml 12.3 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.shipment.shipmentContainerDetail.mapper.ShipmentContainerDetailAutoMapper">
  <select id="selectListEntityByLike" resultType="com.huaheng.pc.shipment.shipmentContainerDetail.domain.ShipmentContainerDetail">
   SELECT id, headerId, shipmentHeaderId, shipmentDetailId, materialCode, materialName, qty, inventoryId, created, createdBy  
   FROM shipment_container_detail
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="headerId != null"> 
        AND headerId = #{headerId}
    </if>
    <if test="shipmentHeaderId != null"> 
        AND shipmentHeaderId = #{shipmentHeaderId}
    </if>
    <if test="shipmentDetailId != null"> 
        AND shipmentDetailId = #{shipmentDetailId}
    </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="inventoryId != null"> 
        AND inventoryId = #{inventoryId}
    </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.shipment.shipmentContainerDetail.domain.ShipmentContainerDetail">
   SELECT id, headerId, shipmentHeaderId, shipmentDetailId, materialCode, materialName, qty, inventoryId, created, createdBy  
   FROM shipment_container_detail
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="headerId != null"> 
        AND headerId = #{headerId}
    </if>
    <if test="shipmentHeaderId != null"> 
        AND shipmentHeaderId = #{shipmentHeaderId}
    </if>
    <if test="shipmentDetailId != null"> 
        AND shipmentDetailId = #{shipmentDetailId}
    </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="inventoryId != null"> 
        AND inventoryId = #{inventoryId}
    </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 shipment_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.shipmentHeaderId != null"> 
        AND shipmentHeaderId = #{condition.shipmentHeaderId}
    </if>
    <if test="condition.shipmentDetailId != null"> 
        AND shipmentDetailId = #{condition.shipmentDetailId}
    </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.inventoryId != null"> 
        AND inventoryId = #{condition.inventoryId}
    </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.shipment.shipmentContainerDetail.domain.ShipmentContainerDetail">
      SELECT id, headerId, shipmentHeaderId, shipmentDetailId, materialCode, materialName, qty, inventoryId, created, createdBy  FROM shipment_container_detail WHERE id = #{id}
  </select>

  <select id="selectFirstEntity" resultType="com.huaheng.pc.shipment.shipmentContainerDetail.domain.ShipmentContainerDetail">
  SELECT id, headerId, shipmentHeaderId, shipmentDetailId, materialCode, materialName, qty, inventoryId, created, createdBy  
  FROM shipment_container_detail
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="headerId != null"> 
        AND headerId = #{headerId}
    </if>
    <if test="shipmentHeaderId != null"> 
        AND shipmentHeaderId = #{shipmentHeaderId}
    </if>
    <if test="shipmentDetailId != null"> 
        AND shipmentDetailId = #{shipmentDetailId}
    </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="inventoryId != null"> 
        AND inventoryId = #{inventoryId}
    </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 shipment_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.shipmentHeaderId != null"> 
        AND shipmentHeaderId = #{condition.shipmentHeaderId}
    </if>
    <if test="condition.shipmentDetailId != null"> 
        AND shipmentDetailId = #{condition.shipmentDetailId}
    </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.inventoryId != null"> 
        AND inventoryId = #{condition.inventoryId}
    </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.shipment.shipmentContainerDetail.domain.ShipmentContainerDetail" keyProperty="id" useGeneratedKeys="true" >
  INSERT INTO shipment_container_detail 
  <trim prefix="(" suffix=")" suffixOverrides=",">
    <if test="headerId != null"> 
        headerId, 
    </if>
    <if test="shipmentHeaderId != null"> 
        shipmentHeaderId, 
    </if>
    <if test="shipmentDetailId != null"> 
        shipmentDetailId, 
    </if>
    <if test="materialCode != null"> 
        materialCode, 
    </if>
    <if test="materialName != null"> 
        materialName, 
    </if>
    <if test="qty != null"> 
        qty, 
    </if>
    <if test="inventoryId != null"> 
        inventoryId, 
    </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="shipmentHeaderId != null"> 
        #{shipmentHeaderId, jdbcType=INTEGER}, 
    </if>
    <if test="shipmentDetailId != null"> 
        #{shipmentDetailId, 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="inventoryId != null"> 
        #{inventoryId, jdbcType=INTEGER}, 
    </if>
    <if test="created != null"> 
        #{created, jdbcType=TIMESTAMP}, 
    </if>
    <if test="createdBy != null"> 
        #{createdBy, jdbcType=VARCHAR}, 
    </if>
  </trim>
  </insert>

  <update id="updateByModel">
  UPDATE shipment_container_detail 
  <set>
    <if test="headerId != null"> 
        headerId = #{headerId, jdbcType=INTEGER}, 
    </if>
    <if test="shipmentHeaderId != null"> 
        shipmentHeaderId = #{shipmentHeaderId, jdbcType=INTEGER}, 
    </if>
    <if test="shipmentDetailId != null"> 
        shipmentDetailId = #{shipmentDetailId, 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="inventoryId != null"> 
        inventoryId = #{inventoryId, jdbcType=INTEGER}, 
    </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 shipment_container_detail 
  <set>
    <if test="record.headerId != null"> 
        headerId = #{record.headerId, jdbcType=INTEGER}, 
    </if>
    <if test="record.shipmentHeaderId != null"> 
        shipmentHeaderId = #{record.shipmentHeaderId, jdbcType=INTEGER}, 
    </if>
    <if test="record.shipmentDetailId != null"> 
        shipmentDetailId = #{record.shipmentDetailId, 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.inventoryId != null"> 
        inventoryId = #{record.inventoryId, jdbcType=INTEGER}, 
    </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.shipmentHeaderId != null"> 
        AND shipmentHeaderId = #{condition.shipmentHeaderId}
    </if>
    <if test="condition.shipmentDetailId != null"> 
        AND shipmentDetailId = #{condition.shipmentDetailId}
    </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.inventoryId != null"> 
        AND inventoryId = #{condition.inventoryId}
    </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 shipment_container_detail WHERE id = #{id, jdbcType=INTEGER} 
  </delete>

  <delete id="deleteByCondition"> 
  DELETE FROM shipment_container_detail 
  <where>
    <if test="id != null"> 
        AND id = #{id}
    </if>
    <if test="headerId != null"> 
        AND headerId = #{headerId}
    </if>
    <if test="shipmentHeaderId != null"> 
        AND shipmentHeaderId = #{shipmentHeaderId}
    </if>
    <if test="shipmentDetailId != null"> 
        AND shipmentDetailId = #{shipmentDetailId}
    </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="inventoryId != null"> 
        AND inventoryId = #{inventoryId}
    </if>
    <if test="created != null"> 
        AND created = #{created}
    </if>
    <if test="createdBy != null"> 
        AND createdBy = #{createdBy}
    </if>
  </where>
  </delete>

  </mapper>