<?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.cku.dao.CkuGjdlMapper" >
  <resultMap id="BaseResultMap" type="com.cku.model.CkuGjdl" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="cku_zsid" property="ckuZsid" jdbcType="VARCHAR" />
    <result column="cku_dltype" property="ckuDltype" jdbcType="VARCHAR" />
    <result column="cku_dlid" property="ckuDlid" jdbcType="VARCHAR" />
    <result column="cku_qz" property="ckuQz" jdbcType="VARCHAR" />
    <result column="cku_userid" property="ckuUserid" jdbcType="VARCHAR" />
    <result column="cku_state" property="ckuState" jdbcType="INTEGER" />
    <result column="running_number" property="runningNumber" jdbcType="VARCHAR" />
    <result column="payout" property="payout" jdbcType="CHAR" />
    <result column="add_time" property="addTime" jdbcType="TIMESTAMP" />
    <result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
    <result column="del_tag" property="delTag" jdbcType="CHAR" />
    <result column="order_price" property="orderPrice" jdbcType="DECIMAL" />
    <result column="info_Confirm" property="infoConfirm" jdbcType="CHAR" />
    <result column="info_Confirm_time" property="infoConfirmTime" jdbcType="TIMESTAMP" />
    <result column="payout_time" property="payoutTime" jdbcType="TIMESTAMP" />
    <result column="operate" property="operate" jdbcType="CHAR" />
    <result column="operate_time" property="operateTime" jdbcType="TIMESTAMP" />
    <result column="pay_ckuid" property="payCkuid" jdbcType="CHAR" />
    <result column="cku_yjType" property="ckuYjtype" jdbcType="VARCHAR" />
    <result column="cku_address" property="ckuAddress" jdbcType="VARCHAR" />
    <result column="cku_yjPrice" property="ckuYjprice" jdbcType="VARCHAR" />
    <result column="dynum" property="dynum" jdbcType="CHAR" />
    <result column="cku_dytime" property="ckuDytime" jdbcType="TIMESTAMP" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com.cku.model.CkuGjdlWithBLOBs" extends="BaseResultMap" >
    <result column="info_Confirm_why" property="infoConfirmWhy" jdbcType="LONGVARCHAR" />
    <result column="remark" property="remark" jdbcType="LONGVARCHAR" />
    <result column="operater" property="operater" jdbcType="LONGVARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, cku_zsid, cku_dltype, cku_dlid, cku_qz, cku_userid, cku_state, running_number, 
    payout, add_time, edit_time, del_tag, order_price, info_Confirm, info_Confirm_time, 
    payout_time, operate, operate_time, pay_ckuid, cku_yjType, cku_address, cku_yjPrice, 
    dynum, cku_dytime
  </sql>
  <sql id="Blob_Column_List" >
    info_Confirm_why, remark, operater
  </sql>
  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from cku_gjdl
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from cku_gjdl
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.cku.model.CkuGjdlWithBLOBs" >
    insert into cku_gjdl (id, cku_zsid, cku_dltype, 
      cku_dlid, cku_qz, cku_userid, 
      cku_state, running_number, payout, 
      add_time, edit_time, del_tag, 
      order_price, info_Confirm, info_Confirm_time, 
      payout_time, operate, operate_time, 
      pay_ckuid, cku_yjType, cku_address, 
      cku_yjPrice, dynum, cku_dytime, 
      info_Confirm_why, remark, operater
      )
    values (#{id,jdbcType=INTEGER}, #{ckuZsid,jdbcType=VARCHAR}, #{ckuDltype,jdbcType=VARCHAR}, 
      #{ckuDlid,jdbcType=VARCHAR}, #{ckuQz,jdbcType=VARCHAR}, #{ckuUserid,jdbcType=VARCHAR}, 
      #{ckuState,jdbcType=INTEGER}, #{runningNumber,jdbcType=VARCHAR}, #{payout,jdbcType=CHAR}, 
      #{addTime,jdbcType=TIMESTAMP}, #{editTime,jdbcType=TIMESTAMP}, #{delTag,jdbcType=CHAR}, 
      #{orderPrice,jdbcType=DECIMAL}, #{infoConfirm,jdbcType=CHAR}, #{infoConfirmTime,jdbcType=TIMESTAMP}, 
      #{payoutTime,jdbcType=TIMESTAMP}, #{operate,jdbcType=CHAR}, #{operateTime,jdbcType=TIMESTAMP}, 
      #{payCkuid,jdbcType=CHAR}, #{ckuYjtype,jdbcType=VARCHAR}, #{ckuAddress,jdbcType=VARCHAR}, 
      #{ckuYjprice,jdbcType=VARCHAR}, #{dynum,jdbcType=CHAR}, #{ckuDytime,jdbcType=TIMESTAMP}, 
      #{infoConfirmWhy,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{operater,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.cku.model.CkuGjdlWithBLOBs" >
    insert into cku_gjdl
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="ckuZsid != null" >
        cku_zsid,
      </if>
      <if test="ckuDltype != null" >
        cku_dltype,
      </if>
      <if test="ckuDlid != null" >
        cku_dlid,
      </if>
      <if test="ckuQz != null" >
        cku_qz,
      </if>
      <if test="ckuUserid != null" >
        cku_userid,
      </if>
      <if test="ckuState != null" >
        cku_state,
      </if>
      <if test="runningNumber != null" >
        running_number,
      </if>
      <if test="payout != null" >
        payout,
      </if>
      <if test="addTime != null" >
        add_time,
      </if>
      <if test="editTime != null" >
        edit_time,
      </if>
      <if test="delTag != null" >
        del_tag,
      </if>
      <if test="orderPrice != null" >
        order_price,
      </if>
      <if test="infoConfirm != null" >
        info_Confirm,
      </if>
      <if test="infoConfirmTime != null" >
        info_Confirm_time,
      </if>
      <if test="payoutTime != null" >
        payout_time,
      </if>
      <if test="operate != null" >
        operate,
      </if>
      <if test="operateTime != null" >
        operate_time,
      </if>
      <if test="payCkuid != null" >
        pay_ckuid,
      </if>
      <if test="ckuYjtype != null" >
        cku_yjType,
      </if>
      <if test="ckuAddress != null" >
        cku_address,
      </if>
      <if test="ckuYjprice != null" >
        cku_yjPrice,
      </if>
      <if test="dynum != null" >
        dynum,
      </if>
      <if test="ckuDytime != null" >
        cku_dytime,
      </if>
      <if test="infoConfirmWhy != null" >
        info_Confirm_why,
      </if>
      <if test="remark != null" >
        remark,
      </if>
      <if test="operater != null" >
        operater,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="ckuZsid != null" >
        #{ckuZsid,jdbcType=VARCHAR},
      </if>
      <if test="ckuDltype != null" >
        #{ckuDltype,jdbcType=VARCHAR},
      </if>
      <if test="ckuDlid != null" >
        #{ckuDlid,jdbcType=VARCHAR},
      </if>
      <if test="ckuQz != null" >
        #{ckuQz,jdbcType=VARCHAR},
      </if>
      <if test="ckuUserid != null" >
        #{ckuUserid,jdbcType=VARCHAR},
      </if>
      <if test="ckuState != null" >
        #{ckuState,jdbcType=INTEGER},
      </if>
      <if test="runningNumber != null" >
        #{runningNumber,jdbcType=VARCHAR},
      </if>
      <if test="payout != null" >
        #{payout,jdbcType=CHAR},
      </if>
      <if test="addTime != null" >
        #{addTime,jdbcType=TIMESTAMP},
      </if>
      <if test="editTime != null" >
        #{editTime,jdbcType=TIMESTAMP},
      </if>
      <if test="delTag != null" >
        #{delTag,jdbcType=CHAR},
      </if>
      <if test="orderPrice != null" >
        #{orderPrice,jdbcType=DECIMAL},
      </if>
      <if test="infoConfirm != null" >
        #{infoConfirm,jdbcType=CHAR},
      </if>
      <if test="infoConfirmTime != null" >
        #{infoConfirmTime,jdbcType=TIMESTAMP},
      </if>
      <if test="payoutTime != null" >
        #{payoutTime,jdbcType=TIMESTAMP},
      </if>
      <if test="operate != null" >
        #{operate,jdbcType=CHAR},
      </if>
      <if test="operateTime != null" >
        #{operateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="payCkuid != null" >
        #{payCkuid,jdbcType=CHAR},
      </if>
      <if test="ckuYjtype != null" >
        #{ckuYjtype,jdbcType=VARCHAR},
      </if>
      <if test="ckuAddress != null" >
        #{ckuAddress,jdbcType=VARCHAR},
      </if>
      <if test="ckuYjprice != null" >
        #{ckuYjprice,jdbcType=VARCHAR},
      </if>
      <if test="dynum != null" >
        #{dynum,jdbcType=CHAR},
      </if>
      <if test="ckuDytime != null" >
        #{ckuDytime,jdbcType=TIMESTAMP},
      </if>
      <if test="infoConfirmWhy != null" >
        #{infoConfirmWhy,jdbcType=LONGVARCHAR},
      </if>
      <if test="remark != null" >
        #{remark,jdbcType=LONGVARCHAR},
      </if>
      <if test="operater != null" >
        #{operater,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.cku.model.CkuGjdlWithBLOBs" >
    update cku_gjdl
    <set >
      <if test="ckuZsid != null" >
        cku_zsid = #{ckuZsid,jdbcType=VARCHAR},
      </if>
      <if test="ckuDltype != null" >
        cku_dltype = #{ckuDltype,jdbcType=VARCHAR},
      </if>
      <if test="ckuDlid != null" >
        cku_dlid = #{ckuDlid,jdbcType=VARCHAR},
      </if>
      <if test="ckuQz != null" >
        cku_qz = #{ckuQz,jdbcType=VARCHAR},
      </if>
      <if test="ckuUserid != null" >
        cku_userid = #{ckuUserid,jdbcType=VARCHAR},
      </if>
      <if test="ckuState != null" >
        cku_state = #{ckuState,jdbcType=INTEGER},
      </if>
      <if test="runningNumber != null" >
        running_number = #{runningNumber,jdbcType=VARCHAR},
      </if>
      <if test="payout != null" >
        payout = #{payout,jdbcType=CHAR},
      </if>
      <if test="addTime != null" >
        add_time = #{addTime,jdbcType=TIMESTAMP},
      </if>
      <if test="editTime != null" >
        edit_time = #{editTime,jdbcType=TIMESTAMP},
      </if>
      <if test="delTag != null" >
        del_tag = #{delTag,jdbcType=CHAR},
      </if>
      <if test="orderPrice != null" >
        order_price = #{orderPrice,jdbcType=DECIMAL},
      </if>
      <if test="infoConfirm != null" >
        info_Confirm = #{infoConfirm,jdbcType=CHAR},
      </if>
      <if test="infoConfirmTime != null" >
        info_Confirm_time = #{infoConfirmTime,jdbcType=TIMESTAMP},
      </if>
      <if test="payoutTime != null" >
        payout_time = #{payoutTime,jdbcType=TIMESTAMP},
      </if>
      <if test="operate != null" >
        operate = #{operate,jdbcType=CHAR},
      </if>
      <if test="operateTime != null" >
        operate_time = #{operateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="payCkuid != null" >
        pay_ckuid = #{payCkuid,jdbcType=CHAR},
      </if>
      <if test="ckuYjtype != null" >
        cku_yjType = #{ckuYjtype,jdbcType=VARCHAR},
      </if>
      <if test="ckuAddress != null" >
        cku_address = #{ckuAddress,jdbcType=VARCHAR},
      </if>
      <if test="ckuYjprice != null" >
        cku_yjPrice = #{ckuYjprice,jdbcType=VARCHAR},
      </if>
      <if test="dynum != null" >
        dynum = #{dynum,jdbcType=CHAR},
      </if>
      <if test="ckuDytime != null" >
        cku_dytime = #{ckuDytime,jdbcType=TIMESTAMP},
      </if>
      <if test="infoConfirmWhy != null" >
        info_Confirm_why = #{infoConfirmWhy,jdbcType=LONGVARCHAR},
      </if>
      <if test="remark != null" >
        remark = #{remark,jdbcType=LONGVARCHAR},
      </if>
      <if test="operater != null" >
        operater = #{operater,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.cku.model.CkuGjdlWithBLOBs" >
    update cku_gjdl
    set cku_zsid = #{ckuZsid,jdbcType=VARCHAR},
      cku_dltype = #{ckuDltype,jdbcType=VARCHAR},
      cku_dlid = #{ckuDlid,jdbcType=VARCHAR},
      cku_qz = #{ckuQz,jdbcType=VARCHAR},
      cku_userid = #{ckuUserid,jdbcType=VARCHAR},
      cku_state = #{ckuState,jdbcType=INTEGER},
      running_number = #{runningNumber,jdbcType=VARCHAR},
      payout = #{payout,jdbcType=CHAR},
      add_time = #{addTime,jdbcType=TIMESTAMP},
      edit_time = #{editTime,jdbcType=TIMESTAMP},
      del_tag = #{delTag,jdbcType=CHAR},
      order_price = #{orderPrice,jdbcType=DECIMAL},
      info_Confirm = #{infoConfirm,jdbcType=CHAR},
      info_Confirm_time = #{infoConfirmTime,jdbcType=TIMESTAMP},
      payout_time = #{payoutTime,jdbcType=TIMESTAMP},
      operate = #{operate,jdbcType=CHAR},
      operate_time = #{operateTime,jdbcType=TIMESTAMP},
      pay_ckuid = #{payCkuid,jdbcType=CHAR},
      cku_yjType = #{ckuYjtype,jdbcType=VARCHAR},
      cku_address = #{ckuAddress,jdbcType=VARCHAR},
      cku_yjPrice = #{ckuYjprice,jdbcType=VARCHAR},
      dynum = #{dynum,jdbcType=CHAR},
      cku_dytime = #{ckuDytime,jdbcType=TIMESTAMP},
      info_Confirm_why = #{infoConfirmWhy,jdbcType=LONGVARCHAR},
      remark = #{remark,jdbcType=LONGVARCHAR},
      operater = #{operater,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.cku.model.CkuGjdl" >
    update cku_gjdl
    set cku_zsid = #{ckuZsid,jdbcType=VARCHAR},
      cku_dltype = #{ckuDltype,jdbcType=VARCHAR},
      cku_dlid = #{ckuDlid,jdbcType=VARCHAR},
      cku_qz = #{ckuQz,jdbcType=VARCHAR},
      cku_userid = #{ckuUserid,jdbcType=VARCHAR},
      cku_state = #{ckuState,jdbcType=INTEGER},
      running_number = #{runningNumber,jdbcType=VARCHAR},
      payout = #{payout,jdbcType=CHAR},
      add_time = #{addTime,jdbcType=TIMESTAMP},
      edit_time = #{editTime,jdbcType=TIMESTAMP},
      del_tag = #{delTag,jdbcType=CHAR},
      order_price = #{orderPrice,jdbcType=DECIMAL},
      info_Confirm = #{infoConfirm,jdbcType=CHAR},
      info_Confirm_time = #{infoConfirmTime,jdbcType=TIMESTAMP},
      payout_time = #{payoutTime,jdbcType=TIMESTAMP},
      operate = #{operate,jdbcType=CHAR},
      operate_time = #{operateTime,jdbcType=TIMESTAMP},
      pay_ckuid = #{payCkuid,jdbcType=CHAR},
      cku_yjType = #{ckuYjtype,jdbcType=VARCHAR},
      cku_address = #{ckuAddress,jdbcType=VARCHAR},
      cku_yjPrice = #{ckuYjprice,jdbcType=VARCHAR},
      dynum = #{dynum,jdbcType=CHAR},
      cku_dytime = #{ckuDytime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <!-- ******* -->
  <select id="getLoginType" resultMap="BaseResultMap">
SELECT
	id,
	cku_zsid,
	cku_dltype,
	cku_dlid,
	cku_qz,
	cku_userid,
	cku_state,
	running_number,
	(
		CASE payout
		WHEN '0' THEN
			'未缴费'
		WHEN '1' THEN
			'已缴费'
		WHEN '7' THEN
			'业务核对中'
		WHEN '8' THEN
			'已提交'
		WHEN '9' THEN
			'提交中'
END
	) as payout,
	add_time,
	edit_time,
	del_tag,
	order_price,
	(
		CASE info_Confirm
		WHEN '0' THEN
			'未审核'
		WHEN '1' THEN
			'通过'
		WHEN '2' THEN
			'未通过'
		WHEN '3' THEN
			'已注销'
		WHEN '4' THEN
			'FCI'
		END
	) AS info_Confirm,
	info_Confirm_time,
	payout_time,
	operate,
	operate_time,
	pay_ckuid,
	cku_yjType,
	cku_address,
	cku_yjPrice,
	dynum,
	cku_dytime,
	info_Confirm_why,
	remark,
	operater
FROM
	cku_gjdl
WHERE
	running_number =#{orderId}
  </select>
  
</mapper>