<?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.jeeplus.finance.projectRecords.mapper.EngineeringTreeMapper">

    <sql id="engineeringColumns">
        a.id AS "id",
		a.create_by AS "createBy.id",
		a.create_date AS "createDate",
		a.update_by AS "updateBy.id",
		a.update_date AS "updateDate",
		a.remarks AS "remarks",
		a.del_flag AS "delFlag",
		a.parent_id AS "parentId",
		a.engineering_name AS "engineeringName",
		a.parent_ids AS "parentIds",
		a.company_id AS "companyId",
		a.index_num AS "indexNum"
    </sql>

    <select id="findList" resultType="com.jeeplus.finance.projectRecords.domain.ProjectEngineeringInfo">
        SELECT
        <include refid="engineeringColumns"/>
        FROM project_engineering_info a
        <where>
            a.del_flag = 0
            <if test="engineeringName!=null and engineeringName != ''">
                and a.engineering_name like concat('%',#{engineeringName},'%')
            </if>
            <if test="parentIds!=null and parentIds != ''">
                and a.parent_ids like concat('%',#{parentIds},'%')
            </if>
            <if test="indexNum != null and indexNum!=0">
                and a.index_num = #{indexNum}
            </if>
        </where>
        ORDER BY a.index_num
    </select>
</mapper>