<?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.zjt.mapper.priceMapper" >
  <resultMap id="BaseResultMap" type="com.zjt.entity.price" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="material_code" property="materialCode" jdbcType="VARCHAR" />
    <result column="material_name" property="materialName" jdbcType="VARCHAR" />
    <result column="category_code" property="categoryCode" jdbcType="VARCHAR" />
    <result column="brand_code" property="brandCode" jdbcType="VARCHAR" />
    <result column="material_group_code" property="materialGroupCode" jdbcType="VARCHAR" />
    <result column="batch" property="batch" jdbcType="VARCHAR" />
    <result column="store_code" property="storeCode" jdbcType="VARCHAR" />
    <result column="company_code" property="companyCode" jdbcType="VARCHAR" />
    <result column="purchase_price" property="purchasePrice" jdbcType="DECIMAL" />
    <result column="average_price" property="averagePrice" jdbcType="DECIMAL" />
    <result column="retail_price" property="retailPrice" jdbcType="DECIMAL" />
    <result column="wholesale_price" property="wholesalePrice" jdbcType="DECIMAL" />
    <result column="member_price" property="memberPrice" jdbcType="DECIMAL" />
    <result column="member_optician_price" property="memberOpticianPrice" jdbcType="DECIMAL" />
    <result column="creator" property="creator" jdbcType="BIGINT" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="updater" property="updater" jdbcType="BIGINT" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="status" property="status" jdbcType="TINYINT" />
    <result column="delete_flag" property="deleteFlag" jdbcType="TINYINT" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, material_code, material_name, category_code, brand_code, material_group_code, 
    batch, store_code, company_code, purchase_price, average_price, retail_price, wholesale_price, 
    member_price, member_optician_price, creator, create_time, updater, update_time, 
    status, delete_flag
  </sql>
  <select id="selectPrice" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />
    from `b_base_material_price` t
    where 1 = 1
    <if test="group != null and group != '' ">
      and t.`material_group_code`= #{group};
    </if>
  </select>
  <select id="selectCode" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />
    from `b_base_material_price` t
    WHERE
    <if test="code != null and code != '' ">
      and t.`material_code`= #{code};
    </if>
  </select>
</mapper>