<?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.ContractTargetMapper">
  <resultMap id="BaseResultMap" type="cn.com.countrygarden.bi.main.model.excontract.ContractTarget">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="target_name" jdbcType="VARCHAR" property="targetName" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="evaluate_id" jdbcType="INTEGER" property="evaluateId" />
    <result column="parent_target_id" jdbcType="INTEGER" property="parentTargetId" />
    <result column="occur_num" jdbcType="INTEGER" property="occurNum" />
    <result column="deduct_score" jdbcType="DOUBLE" property="deductScore" />
    <result column="deduct_money" jdbcType="DECIMAL" property="deductMoney" />
    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
    <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
    <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
  </resultMap>

  <sql id="Base_Column_List">
    id, target_name, code, evaluate_id, parent_target_id, occur_num, deduct_score, deduct_money, 
    create_by, create_date, update_by, update_date,is_delete
  </sql>

  <select id="selectByEvaluateId" resultMap="BaseResultMap">
    SELECT <include refid="Base_Column_List"/> FROM contract_target WHERE evaluate_id = #{evaluateId} AND is_delete = 0
  </select>

  <select id="selectByParId" resultMap="BaseResultMap">
    SELECT <include refid="Base_Column_List"/> FROM contract_target WHERE parent_target_id = #{parId} AND is_delete = 0
  </select>

</mapper>