IndustryStandardMapper.xml 6.33 KB
<?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.lhcredit.project.business.reportTable.mapper.IndustryMapper">

    <resultMap type="com.lhcredit.project.business.reportMake.industry.IndustryStandard" id="IndustryStandardMap">
        <result column="id" property="id"/>
        <result column="industry_name" property="industryName"/>
        <result column="industry_size" property="industrySize"/>

        <result column="name" property="name"/>

        <result column="good_value" property="goodValue"/>

        <result column="a_good_value" property="aGoodValue"/>

        <result column="mean_value" property="meanValue"/>

        <result column="low_value" property="lowValue"/>

        <result column="difference_value" property="differenceValue"/>
        <result column="year" property="year"/>
    </resultMap>
    <resultMap type="com.lhcredit.project.business.reportMake.industry.IndustryRelation" id="IndustryRelationMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="originalName" column="original_name" jdbcType="VARCHAR"/>
        <result property="contrastName" column="contrast_name" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="selectIndustryStandardVo">
        select id, industry_name, industry_size, `name`, good_value, a_good_value, mean_value, low_value, difference_value ,`year` from industry_standard_2022
    </sql>
    <sql id="selectIndustryRelationVo">
        select id, original_name, contrast_name,year from industry_relation_2022
    </sql>
    <!--通过实体作为筛选条件查询-->
    <select id="industryStandardAueryAll"    parameterType="com.lhcredit.project.business.reportMake.industry.IndustryStandard"   resultMap="IndustryStandardMap">
        <include refid="selectIndustryStandardVo"/>
        <where>
            <if test="id != null">
                and id = #{id}
            </if>
            <if test="null!=industryNameList and industryNameList.size()!=0">
                and industry_name in
                <foreach collection="industryNameList" item="item" index="index" open="(" separator="," close=")">
                    #{item.contrastName}
                </foreach>
            </if>
            <if test="industrySize != null and industrySize != ''">
                and industry_size = #{industrySize}
            </if>
            <if test="name != null and name != ''">
                and name = #{name}
            </if>
            <if test="goodValue != null">
                and good_value = #{goodValue}
            </if>
            <if test="aGoodValue != null">
                and a_good_value = #{aGoodValue}
            </if>
            <if test="meanValue != null">
                and mean_value = #{meanValue}
            </if>
            <if test="lowValue != null">
                and low_value = #{lowValue}
            </if>
            <if test="differenceValue != null">
                and difference_value = #{differenceValue}
            </if>
            <if test="year != null">
                and year = #{year}
            </if>
            <if test="years != null">
                and year in
                <foreach item="id" collection="list" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
            <if test="remark != null and remark != ''">
                and YEAR=(SELECT YEAR FROM industry_standard_2022 ORDER BY YEAR DESC LIMIT 1)
            </if>
        </where>
    </select>

    <select id="industryStandardAueryAll2"    parameterType="com.lhcredit.project.business.reportMake.industry.IndustryStandard"   resultMap="IndustryStandardMap">
        <include refid="selectIndustryStandardVo"/>
        where
             name in("营业总收入增长率(%)","净资产收益率(%)","总资产周转率(次)","资产负债率(%)")
        <if test="null!=industryNameList and industryNameList.size()!=0">
            and industry_name in
            <foreach collection="industryNameList" item="item" index="index" open="(" separator="," close=")">
                #{item.contrastName}
            </foreach>
        </if>
        <if test="industrySize != null and industrySize != ''">
            and industry_size = #{industrySize}
        </if>
        <if test="name != null and name != ''">
            and name = #{name}
        </if>
        <if test="year != null and year != ''">
            and year = #{year}
        </if>
    </select>


    <!--通过实体作为筛选条件查询-->
    <select id="industryRelationByAll"    parameterType="com.lhcredit.project.business.reportMake.industry.IndustryRelation"   resultMap="IndustryRelationMap">
        <include refid="selectIndustryRelationVo"/>
        <where>

             contrast_name IS NOT  NULL and contrast_name!=""
            <if test="id != null">
                and id = #{id}
            </if>
            <if test="originalName != null and originalName != ''">
                and original_name = #{originalName}
            </if>
            <if test="contrastName != null and contrastName != ''">
                and contrast_name = #{contrastName}
            </if>
            <if test="remark != null and remark != ''">
                and YEAR=(SELECT YEAR FROM industry_relation_2022 ORDER BY YEAR DESC LIMIT 1)
            </if>
            <if test="years != null and years != ''">
               and  year in ${years}
            </if>
        </where>
    </select>

    <!--通过实体作为筛选条件查询-->
    <select id="industryRelationByNew"    parameterType="com.lhcredit.project.business.reportMake.industry.IndustryRelation"   resultMap="IndustryRelationMap">
        <include refid="selectIndustryRelationVo"/>
        <where>

             contrast_name IS NOT  NULL and contrast_name!=""
            <if test="id != null">
                and id = #{id}
            </if>
            <if test="originalName != null and originalName != ''">
                and original_name = #{originalName}
            </if>
            <if test="contrastName != null and contrastName != ''">
                and contrast_name = #{contrastName}
            </if>
            <if test="years != null and years != ''">
                and  year in ${years}
            </if>
    </where>
    </select>



</mapper>