<?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.huatek.busi.mapper.CalculateBasicDataMapper">

    <sql id="Base_Column_List">
        id,
        main_file_name AS mainFileName,
        value_one AS valueOne,
        value_two AS valueTwo,
        value_three AS valueThree,
        value_four AS valueFour,
        value_five AS valueFive,
        `status`,
        flag,
        child_file_name AS childFileName,
        sort,
        create_time AS createTime
    </sql>

    <select id="findList" parameterType="com.huatek.busi.vo.CalculateBasicDataVo" resultType="com.huatek.busi.dto.CalculateBasicDataDto">
        SELECT
            <include refid="Base_Column_List"/>
        FROM
            x_calculate_basic_data
        WHERE
            main_file_name = #{mainFileName}
        <if test="status != null and status != ''">
            AND `status` = #{status}
        </if>
        <if test="flag != null and flag != ''">
            AND flag = #{flag}
        </if>
        <if test="childFileName != null and childFileName != ''">
            AND child_file_name = #{childFileName}
        </if>
    </select>

    <select id="getTestc" resultType="java.lang.String">
        SELECT
            GROUP_CONCAT(value_two ORDER BY sort) valueTwo
        FROM
            x_calculate_basic_data
        WHERE
            main_file_name = #{mainFileName}
        AND `status` = -1
        AND flag = #{label}
        AND child_file_name = #{childFileName};
    </select>

    <select id="getCalculateBasicData" resultType="com.huatek.busi.dto.CalculateBasicDataDto">
        SELECT
            GROUP_CONCAT(value_one ORDER BY sort) valueOne,
            GROUP_CONCAT(value_two ORDER BY sort) valueTwo,
            GROUP_CONCAT(value_three ORDER BY sort) valueThree,
            GROUP_CONCAT(value_four ORDER BY sort) valueFour,
            GROUP_CONCAT(value_five ORDER BY sort) valueFive
        FROM
            x_calculate_basic_data
        WHERE
            main_file_name = #{mainFileName}
        AND `status` = #{a}
        AND flag = #{label}
        AND child_file_name = #{childFileName};
    </select>
</mapper>