<?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="cn.com.countrygarden.bi.main.dao.excontract.ContractRecordMapper">
  <resultMap id="BaseResultMap" type="cn.com.countrygarden.bi.main.model.excontract.ContractRecord">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="organ_name" jdbcType="VARCHAR" property="organName" />
    <result column="organ_code" jdbcType="VARCHAR" property="organCode" />
    <result column="commname" jdbcType="VARCHAR" property="commname" />
    <result column="commid" jdbcType="VARCHAR" property="commid" />
    <result column="group_name" jdbcType="VARCHAR" property="groupName" />
    <result column="group_code" jdbcType="VARCHAR" property="groupCode" />
    <result column="contract_name" jdbcType="VARCHAR" property="contractName" />
    <result column="contract_code" jdbcType="VARCHAR" property="contractCode" />
    <result column="supplier_name" jdbcType="VARCHAR" property="supplierName" />
    <result column="supplier_code" jdbcType="VARCHAR" property="supplierCode" />
    <result column="ex_code" jdbcType="VARCHAR" property="exCode" />
    <result column="ex_content" jdbcType="VARCHAR" property="exContent" />
    <result column="other_score" jdbcType="DOUBLE" property="otherScore" />
    <result column="other_money" jdbcType="DECIMAL" property="otherMoney" />
    <result column="other_describe" jdbcType="VARCHAR" property="otherDescribe" />
    <result column="reward_money" jdbcType="DECIMAL" property="rewardMoney" />
    <result column="reward_score" jdbcType="DOUBLE" property="rewardScore" />
    <result column="reward_describe" jdbcType="VARCHAR" property="rewardDescribe" />
    <result column="total_score" jdbcType="DOUBLE" property="totalScore" />
    <result column="total_grade" jdbcType="DOUBLE" property="totalGrade" />
    <result column="break_money" jdbcType="DECIMAL" property="breakMoney" />
    <result column="month_contract_money" jdbcType="DECIMAL" property="monthContractMoney" />
    <result column="actual_contract_money" jdbcType="DECIMAL" property="actualContractMoney" />
    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
    <result column="create_date" jdbcType="DATE" property="createDate" />
    <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
    <result column="update_date" jdbcType="DATE" property="updateDate" />
    <result column="year" jdbcType="VARCHAR" property="year" />
    <result column="month" jdbcType="VARCHAR" property="month" />
    <result column="total_money" jdbcType="DECIMAL" property="totalMoney" />
    <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
  </resultMap>

    <resultMap id="EnvironmentResultMap" type="cn.com.countrygarden.bi.main.model.excontract.dto.EnvironmentalClean">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="organ_name" jdbcType="VARCHAR" property="organName" />
        <result column="organ_code" jdbcType="VARCHAR" property="organCode" />
        <result column="commname" jdbcType="VARCHAR" property="commname" />
        <result column="commid" jdbcType="VARCHAR" property="commid" />
        <result column="group_name" jdbcType="VARCHAR" property="groupName" />
        <result column="group_code" jdbcType="VARCHAR" property="groupCode" />
        <result column="contract_name" jdbcType="VARCHAR" property="contractName" />
        <result column="contract_code" jdbcType="VARCHAR" property="contractCode" />
        <result column="supplier_name" jdbcType="VARCHAR" property="supplierName" />
        <result column="supplier_code" jdbcType="VARCHAR" property="supplierCode" />
        <result column="ex_code" jdbcType="VARCHAR" property="exCode" />
        <result column="ex_content" jdbcType="VARCHAR" property="exContent" />
        <result column="other_score" jdbcType="DOUBLE" property="otherScore" />
        <result column="other_money" jdbcType="DECIMAL" property="otherMoney" />
        <result column="other_describe" jdbcType="VARCHAR" property="otherDescribe" />
        <result column="reward_money" jdbcType="DECIMAL" property="rewardMoney" />
        <result column="reward_score" jdbcType="DOUBLE" property="rewardScore" />
        <result column="reward_describe" jdbcType="VARCHAR" property="rewardDescribe" />
        <result column="total_score" jdbcType="DOUBLE" property="totalScore" />
        <result column="total_grade" jdbcType="DOUBLE" property="totalGrade" />
        <result column="break_money" jdbcType="DECIMAL" property="breakMoney" />
        <result column="month_contract_money" jdbcType="DECIMAL" property="monthContractMoney" />
        <result column="actual_contract_money" jdbcType="DECIMAL" property="actualContractMoney" />
        <result column="create_by" jdbcType="VARCHAR" property="createBy" />
        <result column="create_date" jdbcType="DATE" property="createDate" />
        <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
        <result column="update_date" jdbcType="DATE" property="updateDate" />
        <result column="year" jdbcType="VARCHAR" property="year" />
        <result column="month" jdbcType="VARCHAR" property="month" />
        <result column="total_money" jdbcType="DECIMAL" property="totalMoney" />
        <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
    </resultMap>

    <resultMap id="GarbageResultMap" type="cn.com.countrygarden.bi.main.model.excontract.dto.GarbageCleaning">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="organ_name" jdbcType="VARCHAR" property="organName" />
        <result column="organ_code" jdbcType="VARCHAR" property="organCode" />
        <result column="commname" jdbcType="VARCHAR" property="commname" />
        <result column="commid" jdbcType="VARCHAR" property="commid" />
        <result column="group_name" jdbcType="VARCHAR" property="groupName" />
        <result column="group_code" jdbcType="VARCHAR" property="groupCode" />
        <result column="contract_name" jdbcType="VARCHAR" property="contractName" />
        <result column="contract_code" jdbcType="VARCHAR" property="contractCode" />
        <result column="supplier_name" jdbcType="VARCHAR" property="supplierName" />
        <result column="supplier_code" jdbcType="VARCHAR" property="supplierCode" />
        <result column="ex_code" jdbcType="VARCHAR" property="exCode" />
        <result column="ex_content" jdbcType="VARCHAR" property="exContent" />
        <result column="other_score" jdbcType="DOUBLE" property="otherScore" />
        <result column="other_money" jdbcType="DECIMAL" property="otherMoney" />
        <result column="other_describe" jdbcType="VARCHAR" property="otherDescribe" />
        <result column="reward_money" jdbcType="DECIMAL" property="rewardMoney" />
        <result column="reward_score" jdbcType="DOUBLE" property="rewardScore" />
        <result column="reward_describe" jdbcType="VARCHAR" property="rewardDescribe" />
        <result column="total_score" jdbcType="DOUBLE" property="totalScore" />
        <result column="total_grade" jdbcType="DOUBLE" property="totalGrade" />
        <result column="break_money" jdbcType="DECIMAL" property="breakMoney" />
        <result column="month_contract_money" jdbcType="DECIMAL" property="monthContractMoney" />
        <result column="actual_contract_money" jdbcType="DECIMAL" property="actualContractMoney" />
        <result column="create_by" jdbcType="VARCHAR" property="createBy" />
        <result column="create_date" jdbcType="DATE" property="createDate" />
        <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
        <result column="update_date" jdbcType="DATE" property="updateDate" />
        <result column="year" jdbcType="VARCHAR" property="year" />
        <result column="month" jdbcType="VARCHAR" property="month" />
        <result column="total_money" jdbcType="DECIMAL" property="totalMoney" />
        <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
    </resultMap>

    <resultMap id="GreenResultMap" type="cn.com.countrygarden.bi.main.model.excontract.dto.GreeningMaintenance">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="organ_name" jdbcType="VARCHAR" property="organName" />
        <result column="organ_code" jdbcType="VARCHAR" property="organCode" />
        <result column="commname" jdbcType="VARCHAR" property="commname" />
        <result column="commid" jdbcType="VARCHAR" property="commid" />
        <result column="group_name" jdbcType="VARCHAR" property="groupName" />
        <result column="group_code" jdbcType="VARCHAR" property="groupCode" />
        <result column="contract_name" jdbcType="VARCHAR" property="contractName" />
        <result column="contract_code" jdbcType="VARCHAR" property="contractCode" />
        <result column="supplier_name" jdbcType="VARCHAR" property="supplierName" />
        <result column="supplier_code" jdbcType="VARCHAR" property="supplierCode" />
        <result column="ex_code" jdbcType="VARCHAR" property="exCode" />
        <result column="ex_content" jdbcType="VARCHAR" property="exContent" />
        <result column="other_score" jdbcType="DOUBLE" property="otherScore" />
        <result column="other_money" jdbcType="DECIMAL" property="otherMoney" />
        <result column="other_describe" jdbcType="VARCHAR" property="otherDescribe" />
        <result column="reward_money" jdbcType="DECIMAL" property="rewardMoney" />
        <result column="reward_score" jdbcType="DOUBLE" property="rewardScore" />
        <result column="reward_describe" jdbcType="VARCHAR" property="rewardDescribe" />
        <result column="total_score" jdbcType="DOUBLE" property="totalScore" />
        <result column="total_grade" jdbcType="DOUBLE" property="totalGrade" />
        <result column="break_money" jdbcType="DECIMAL" property="breakMoney" />
        <result column="month_contract_money" jdbcType="DECIMAL" property="monthContractMoney" />
        <result column="actual_contract_money" jdbcType="DECIMAL" property="actualContractMoney" />
        <result column="create_by" jdbcType="VARCHAR" property="createBy" />
        <result column="create_date" jdbcType="DATE" property="createDate" />
        <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
        <result column="update_date" jdbcType="DATE" property="updateDate" />
        <result column="year" jdbcType="VARCHAR" property="year" />
        <result column="month" jdbcType="VARCHAR" property="month" />
        <result column="total_money" jdbcType="DECIMAL" property="totalMoney" />
        <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
    </resultMap>
  
  <sql id="Base_Column_List">
    id, organ_name, organ_code, commname, commid, group_name, group_code, contract_name, 
    contract_code, supplier_name, supplier_code, ex_code,ex_content, other_score,other_money, other_describe,
    reward_money, reward_score, reward_describe, total_score, total_grade, break_money,
    month_contract_money, actual_contract_money, create_by, create_date,
    update_by, update_date, year, month,total_money,is_delete
  </sql>

    <select id="selectEnviroByPrimaryKey" resultMap="EnvironmentResultMap">
        SELECT <include refid="Base_Column_List"/> FROM contract_record WHERE id = #{id} AND is_delete = 0
    </select>

    <select id="selectGarbageByPrimaryKey" resultMap="GarbageResultMap">
        SELECT <include refid="Base_Column_List"/> FROM contract_record WHERE id = #{id} AND is_delete = 0
    </select>

    <select id="selectGreenByPrimaryKey" resultMap="GreenResultMap">
        SELECT <include refid="Base_Column_List"/> FROM contract_record WHERE id = #{id} AND is_delete = 0
    </select>

</mapper>