<?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.unis.base.server.dao.TyHlyDao" >
  <resultMap id="BaseResultMap" type="com.unis.base.server.entity.TyHly" >
    <result column="id" property="id" jdbcType="VARCHAR" />
    <result column="qymc" property="qymc" jdbcType="VARCHAR" />
    <result column="qylx" property="qylx" jdbcType="VARCHAR" />
    <result column="qyxydm" property="qyxydm" jdbcType="VARCHAR" />
    <result column="lxr" property="lxr" jdbcType="VARCHAR" />
    <result column="lxfs" property="lxfs" jdbcType="VARCHAR" />
    <result column="zzbm" property="zzbm" jdbcType="VARCHAR" />
    <result column="cjsj" property="cjsj" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause" >
    <where >
      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    id, qymc, qylx, qyxydm, lxr, lxfs, zzbm, cjsj
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.unis.base.server.example.TyHlyExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from ty_hly
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.unis.base.server.example.TyHlyExample" >
    delete from ty_hly
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.unis.base.server.entity.TyHly" >
    insert into ty_hly (id, qymc, qylx, 
      qyxydm, lxr, lxfs, 
      zzbm, cjsj)
    values (#{id,jdbcType=VARCHAR}, #{qymc,jdbcType=VARCHAR}, #{qylx,jdbcType=VARCHAR}, 
      #{qyxydm,jdbcType=VARCHAR}, #{lxr,jdbcType=VARCHAR}, #{lxfs,jdbcType=VARCHAR}, 
      #{zzbm,jdbcType=VARCHAR}, #{cjsj,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.unis.base.server.entity.TyHly" >
    insert into ty_hly
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="qymc != null" >
        qymc,
      </if>
      <if test="qylx != null" >
        qylx,
      </if>
      <if test="qyxydm != null" >
        qyxydm,
      </if>
      <if test="lxr != null" >
        lxr,
      </if>
      <if test="lxfs != null" >
        lxfs,
      </if>
      <if test="zzbm != null" >
        zzbm,
      </if>
      <if test="cjsj != null" >
        cjsj,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="qymc != null" >
        #{qymc,jdbcType=VARCHAR},
      </if>
      <if test="qylx != null" >
        #{qylx,jdbcType=VARCHAR},
      </if>
      <if test="qyxydm != null" >
        #{qyxydm,jdbcType=VARCHAR},
      </if>
      <if test="lxr != null" >
        #{lxr,jdbcType=VARCHAR},
      </if>
      <if test="lxfs != null" >
        #{lxfs,jdbcType=VARCHAR},
      </if>
      <if test="zzbm != null" >
        #{zzbm,jdbcType=VARCHAR},
      </if>
      <if test="cjsj != null" >
        #{cjsj,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.unis.base.server.example.TyHlyExample" resultType="java.lang.Integer" >
    select count(1) from ty_hly
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update ty_hly
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.qymc != null" >
        qymc = #{record.qymc,jdbcType=VARCHAR},
      </if>
      <if test="record.qylx != null" >
        qylx = #{record.qylx,jdbcType=VARCHAR},
      </if>
      <if test="record.qyxydm != null" >
        qyxydm = #{record.qyxydm,jdbcType=VARCHAR},
      </if>
      <if test="record.lxr != null" >
        lxr = #{record.lxr,jdbcType=VARCHAR},
      </if>
      <if test="record.lxfs != null" >
        lxfs = #{record.lxfs,jdbcType=VARCHAR},
      </if>
      <if test="record.zzbm != null" >
        zzbm = #{record.zzbm,jdbcType=VARCHAR},
      </if>
      <if test="record.cjsj != null" >
        cjsj = #{record.cjsj,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update ty_hly
    set id = #{record.id,jdbcType=VARCHAR},
      qymc = #{record.qymc,jdbcType=VARCHAR},
      qylx = #{record.qylx,jdbcType=VARCHAR},
      qyxydm = #{record.qyxydm,jdbcType=VARCHAR},
      lxr = #{record.lxr,jdbcType=VARCHAR},
      lxfs = #{record.lxfs,jdbcType=VARCHAR},
      zzbm = #{record.zzbm,jdbcType=VARCHAR},
      cjsj = #{record.cjsj,jdbcType=TIMESTAMP}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  
  
  <resultMap id="BaseDcMap" type="com.unis.base.server.entity.TyHlyDr" >
    <result column="qymc" property="qymc" jdbcType="VARCHAR" />
    <result column="qylx" property="qylx" jdbcType="VARCHAR" />
    <result column="qyxydm" property="qyxydm" jdbcType="VARCHAR" />
    <result column="lxr" property="lxr" jdbcType="VARCHAR" />
    <result column="lxfs" property="lxfs" jdbcType="VARCHAR" />
    <result column="pp" property="pp" jdbcType="VARCHAR" />
    <result column="cpmc" property="cpmc" jdbcType="VARCHAR" />
  </resultMap>
  <select id="exportByEntityResult" parameterType="java.lang.String" resultMap="BaseDcMap">
  select 
    hly.qymc,hly.qylx,hly.qyxydm,hly.lxr,hly.lxfs,hlyz.pp,hlyz.cpmc 
  from base.ty_hlyz hlyz left join base.ty_hly hly on hlyz.zid = hly.id
  <if test="qymc != null and qymc !='' " >
    where hly.qymc LIKE CONCAT('%',#{qymc},'%' )
  </if>
   order by hly.qymc,hlyz.pp,hlyz.cpmc
  </select>
</mapper>