FinanceInfoMapper.xml 8.57 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.financeInfo.mapper.FinanceInfoMapper">

    <resultMap type="FinanceInfo" id="FinanceInfoResult">
        <result property="id"    column="id"    />
        <result property="orgCode"    column="org_code"    />
        <result property="ename"    column="ename"    />
        <result property="year"    column="year"    />
        <result property="operRev"    column="operRev"    />
        <result property="operProfit"    column="operProfit"    />
        <result property="totProfit"    column="totProfit"    />
        <result property="netProfit"    column="netProfit"    />
        <result property="totLiab"    column="totLiab"    />
        <result property="totalEquity"    column="totalEquity"    />
        <result property="totAssets"    column="totAssets"    />
        <result property="source"    column="source"    />
        <result property="userId"    column="user_id"    />
        <result property="orgId"    column="org_id"    />
        <result property="cmId"    column="cm_id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectFinanceInfoVo">
        select id, org_code, ename, year, operRev, operProfit, totProfit, netProfit, totLiab, totalEquity, totAssets, source, user_id, org_id, cm_id, del_flag, create_time, create_by, update_time, update_by from finance_info
    </sql>

    <select id="selectFinanceInfoList" parameterType="FinanceInfo" resultMap="FinanceInfoResult">
        <include refid="selectFinanceInfoVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="orgCode != null  and orgCode != '' "> and org_code = #{orgCode}</if>
            <if test="ename != null  and ename != '' "> and ename = #{ename}</if>
            <if test="year != null "> and year = #{year}</if>
            <if test="operRev != null "> and operRev = #{operRev}</if>
            <if test="operProfit != null "> and operProfit = #{operProfit}</if>
            <if test="totProfit != null "> and totProfit = #{totProfit}</if>
            <if test="netProfit != null "> and netProfit = #{netProfit}</if>
            <if test="totLiab != null "> and totLiab = #{totLiab}</if>
            <if test="totalEquity != null "> and totalEquity = #{totalEquity}</if>
            <if test="totAssets != null "> and totAssets = #{totAssets}</if>
            <if test="source != null  and source != '' "> and source = #{source}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="orgId != null "> and org_id = #{orgId}</if>
            <if test="cmId != null "> and cm_id = #{cmId}</if>
            <if test="delFlag != null  and delFlag != '' "> and del_flag = #{delFlag}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="createBy != null  and createBy != '' "> and create_by = #{createBy}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="updateBy != null  and updateBy != '' "> and update_by = #{updateBy}</if>
        </where>
    </select>

    <select id="selectFinanceInfoById" parameterType="Long" resultMap="FinanceInfoResult">
        <include refid="selectFinanceInfoVo"/>
        where id = #{id}
    </select>
    
    <select id="getFinanceInfoSearchCount" parameterType="String" resultType="java.lang.Long">
        SELECT
            COUNT( DISTINCT org_code )
        FROM
            finance_info
        WHERE
            source = 1
          AND user_id= #{id}
    </select>
    
    <insert id="insertFinanceInfo" parameterType="FinanceInfo" useGeneratedKeys="true" keyProperty="id">
        insert into finance_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="orgCode != null  and orgCode != ''  ">org_code,</if>
            <if test="ename != null  and ename != ''  ">ename,</if>
            <if test="year != null  ">year,</if>
            <if test="operRev != null  ">operRev,</if>
            <if test="operProfit != null  ">operProfit,</if>
            <if test="totProfit != null  ">totProfit,</if>
            <if test="netProfit != null  ">netProfit,</if>
            <if test="totLiab != null  ">totLiab,</if>
            <if test="totalEquity != null  ">totalEquity,</if>
            <if test="totAssets != null  ">totAssets,</if>
            <if test="source != null  and source != ''  ">source,</if>
            <if test="userId != null  ">user_id,</if>
            <if test="orgId != null  ">org_id,</if>
            <if test="cmId != null  ">cm_id,</if>
            <if test="delFlag != null  and delFlag != ''  ">del_flag,</if>
            <if test="createTime != null  ">create_time,</if>
            <if test="createBy != null  and createBy != ''  ">create_by,</if>
            <if test="updateTime != null  ">update_time,</if>
            <if test="updateBy != null  and updateBy != ''  ">update_by,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="orgCode != null  and orgCode != ''  ">#{orgCode},</if>
            <if test="ename != null  and ename != ''  ">#{ename},</if>
            <if test="year != null  ">#{year},</if>
            <if test="operRev != null  ">#{operRev},</if>
            <if test="operProfit != null  ">#{operProfit},</if>
            <if test="totProfit != null  ">#{totProfit},</if>
            <if test="netProfit != null  ">#{netProfit},</if>
            <if test="totLiab != null  ">#{totLiab},</if>
            <if test="totalEquity != null  ">#{totalEquity},</if>
            <if test="totAssets != null  ">#{totAssets},</if>
            <if test="source != null  and source != ''  ">#{source},</if>
            <if test="userId != null  ">#{userId},</if>
            <if test="orgId != null  ">#{orgId},</if>
            <if test="cmId != null  ">#{cmId},</if>
            <if test="delFlag != null  and delFlag != ''  ">#{delFlag},</if>
            <if test="createTime != null  ">#{createTime},</if>
            <if test="createBy != null  and createBy != ''  ">#{createBy},</if>
            <if test="updateTime != null  ">#{updateTime},</if>
            <if test="updateBy != null  and updateBy != ''  ">#{updateBy},</if>
        </trim>
    </insert>

    <update id="updateFinanceInfo" parameterType="FinanceInfo">
        update finance_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="orgCode != null  and orgCode != ''  ">org_code = #{orgCode},</if>
            <if test="ename != null  and ename != ''  ">ename = #{ename},</if>
            <if test="year != null  ">year = #{year},</if>
            <if test="operRev != null  ">operRev = #{operRev},</if>
            <if test="operProfit != null  ">operProfit = #{operProfit},</if>
            <if test="totProfit != null  ">totProfit = #{totProfit},</if>
            <if test="netProfit != null  ">netProfit = #{netProfit},</if>
            <if test="totLiab != null  ">totLiab = #{totLiab},</if>
            <if test="totalEquity != null  ">totalEquity = #{totalEquity},</if>
            <if test="totAssets != null  ">totAssets = #{totAssets},</if>
            <if test="source != null  and source != ''  ">source = #{source},</if>
            <if test="userId != null  ">user_id = #{userId},</if>
            <if test="orgId != null  ">org_id = #{orgId},</if>
            <if test="cmId != null  ">cm_id = #{cmId},</if>
            <if test="delFlag != null  and delFlag != ''  ">del_flag = #{delFlag},</if>
            <if test="createTime != null  ">create_time = #{createTime},</if>
            <if test="createBy != null  and createBy != ''  ">create_by = #{createBy},</if>
            <if test="updateTime != null  ">update_time = #{updateTime},</if>
            <if test="updateBy != null  and updateBy != ''  ">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteFinanceInfoById" parameterType="Long">
        delete from finance_info where id = #{id}
    </delete>

    <delete id="deleteFinanceInfoByIds" parameterType="String">
        delete from finance_info where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>