<?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.njzscloud.dispose.cst.project.mapper.ProjectMapper">

    <resultMap id="ProjectResultMap" type="com.njzscloud.dispose.cst.project.pojo.result.ProjectResult">
        <id column="id" property="id"/>
        <result column="project_name" property="projectName"/>
        <result column="contract_picture" property="contractPicture"/>
        <result column="trans_customer_id" property="transCustomerId"/>
        <result column="trans_org_id" property="transOrgId"/>
        <result column="fringe_customer_id" property="fringeCustomerId"/>
        <result column="fringe_org_id" property="fringeOrgId"/>
        <result column="province" property="province"/>
        <result column="city" property="city"/>
        <result column="area" property="area"/>
        <result column="town" property="town"/>
        <result column="province_name" property="provinceName"/>
        <result column="city_name" property="cityName"/>
        <result column="area_name" property="areaName"/>
        <result column="town_name" property="townName"/>
        <result column="address" property="address"/>
        <result column="lng" property="lng"/>
        <result column="lat" property="lat"/>
        <result column="contract_start_date" property="contractStartDate"/>
        <result column="contract_end_date" property="contractEndDate"/>
        <result column="creator_id" property="creatorId"/>
        <result column="modifier_id" property="modifierId"/>
        <result column="create_time" property="createTime"/>
        <result column="modify_time" property="modifyTime"/>
        <result column="deleted" property="deleted"/>
    </resultMap>

    <sql id="Base_Column_List">
        p.id, p.project_name, p.contract_picture, p.trans_customer_id, p.trans_org_id,
        p.fringe_customer_id, p.fringe_org_id, p.province, p.city, p.area, p.town,
        p.province_name, p.city_name, p.area_name, p.town_name, p.address, p.lng, p.lat,
        p.contract_start_date, p.contract_end_date, p.creator_id, p.modifier_id, p.create_time, p.modify_time, p.deleted
    </sql>

    <select id="getById" resultMap="ProjectResultMap">
        SELECT <include refid="Base_Column_List"/>
        FROM cst_project p
        WHERE p.id = #{id}
    </select>

    <!-- 分页查询，支持项目名称模糊查询 -->
    <select id="paging" resultMap="ProjectResultMap">
        SELECT <include refid="Base_Column_List"/>
        FROM cst_project p
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>

</mapper>
