<?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.zcxk.rmcp.core.dao.ProductMeasuringPointMapper">
  <resultMap id="BaseResultMap" type="com.zcxk.rmcp.core.entity.ProductMeasuringPoint">
    <!--@mbg.generated-->
    <!--@Table sc_product_measuring_point-->
    <id column="id" property="id" />
    <result column="product_id" property="productId" />
    <result column="measuring_code" property="measuringCode" />
    <result column="measuring_name" property="measuringName" />
    <result column="measuring_desc" property="measuringDesc" />
    <result column="measuring_unit" property="measuringUnit" />
    <result column="measuring_data_type" property="measuringDataType" />
    <result column="status" property="status" />
    <result column="create_date" property="createDate" />
    <result column="update_date" property="updateDate" />
    <result column="create_date" property="createDate" />
    <result column="update_date" property="updateDate" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, product_id, measuring_code, measuring_name, measuring_desc, measuring_unit, measuring_data_type, 
    `status`, create_date, update_date, create_by, update_by
  </sql>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.zcxk.rmcp.core.entity.ProductMeasuringPoint" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into sc_product_measuring_point
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="productId != null">
        product_id,
      </if>
      <if test="measuringCode != null">
        measuring_code,
      </if>
      <if test="measuringName != null">
        measuring_name,
      </if>
      <if test="measuringDesc != null">
        measuring_desc,
      </if>
      <if test="measuringUnit != null">
        measuring_unit,
      </if>
      <if test="measuringDataType != null">
        measuring_data_type,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="createDate != null">
        create_date,
      </if>
      <if test="updateDate != null">
        update_date,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="updateBy != null">
        update_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="productId != null">
        #{productId},
      </if>
      <if test="measuringCode != null">
        #{measuringCode},
      </if>
      <if test="measuringName != null">
        #{measuringName},
      </if>
      <if test="measuringDesc != null">
        #{measuringDesc},
      </if>
      <if test="measuringUnit != null">
        #{measuringUnit},
      </if>
      <if test="measuringDataType != null">
        #{measuringDataType},
      </if>
      <if test="status != null">
        #{status},
      </if>
      <if test="createDate != null">
        #{createDate},
      </if>
      <if test="updateDate != null">
        #{updateDate},
      </if>
      <if test="createBy != null">
        #{createBy},
      </if>
      <if test="updateBy != null">
        #{updateBy},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.zcxk.rmcp.core.entity.ProductMeasuringPoint">
    <!--@mbg.generated-->
    update sc_product_measuring_point
    <set>
      <if test="productId != null">
        product_id = #{productId},
      </if>
      <if test="measuringCode != null">
        measuring_code = #{measuringCode},
      </if>
      <if test="measuringName != null">
        measuring_name = #{measuringName},
      </if>
      <if test="measuringDesc != null">
        measuring_desc = #{measuringDesc},
      </if>
      <if test="measuringUnit != null">
        measuring_unit = #{measuringUnit},
      </if>
      <if test="measuringDataType != null">
        measuring_data_type = #{measuringDataType},
      </if>
      <if test="status != null">
        `status` = #{status},
      </if>
      <if test="createDate != null">
        create_date = #{createDate},
      </if>
      <if test="updateDate != null">
        update_date = #{updateDate},
      </if>
      <if test="createBy != null">
        create_by = #{createBy},
      </if>
      <if test="updateBy != null">
        update_by = #{updateBy},
      </if>
    </set>
    where id = #{id}
  </update>

    <select id="getList" resultType="com.zcxk.rmcp.api.vo.MeasuringPointVo">
      select <include refid="Base_Column_List"/> from rmcp_product_measuring_point where status = 1
      and product_id = #{productId}
    </select>
</mapper>