<?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.emr.dao.Zd_Cm3Mapper" >
  <resultMap id="BaseResultMap" type="com.emr.entity.Zd_Cm3" >
    <result column="code" property="code" jdbcType="VARCHAR" />
    <result column="name" property="name" jdbcType="NVARCHAR" />
    <result column="py_code" property="pyCode" jdbcType="VARCHAR" />
    <result column="oncard" property="oncard" jdbcType="DOUBLE" />
    <result column="d_code" property="dCode" jdbcType="VARCHAR" />
  </resultMap>
  <insert id="insert" parameterType="com.emr.entity.Zd_Cm3" >
    insert into zd_cm3 (code, name, py_code, 
      oncard, d_code)
    values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=NVARCHAR}, #{pyCode,jdbcType=VARCHAR}, 
      #{oncard,jdbcType=DOUBLE}, #{dCode,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.emr.entity.Zd_Cm3" >
    insert into zd_cm3
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="code != null" >
        code,
      </if>
      <if test="name != null" >
        name,
      </if>
      <if test="pyCode != null" >
        py_code,
      </if>
      <if test="oncard != null" >
        oncard,
      </if>
      <if test="dCode != null" >
        d_code,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="code != null" >
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        #{name,jdbcType=NVARCHAR},
      </if>
      <if test="pyCode != null" >
        #{pyCode,jdbcType=VARCHAR},
      </if>
      <if test="oncard != null" >
        #{oncard,jdbcType=DOUBLE},
      </if>
      <if test="dCode != null" >
        #{dCode,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <!--查询全部-->
  <select id="selectAll" resultMap="BaseResultMap">
      SELECT
          code,name
      FROM
          zd_cm3
      <where>
          <if test="code != null and code != ''">
                code LIKE '%${code}%'
          </if>
          <if test="name != null and name != ''">
              AND  name LIKE '%${name}%'
          </if>
      </where>
  </select>
</mapper>