<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.yifu.cloud.plus.v1.ekp.mapper.EkpSalaryInfoMapper">

  <resultMap id="ekpSalaryInfoMap" type="com.yifu.cloud.plus.v1.ekp.entity.EkpSalaryInfo">
    <id property="fd_id" column="fd_id"/>
    <result property="fd_3adfedf98ccba2" column="fd_3adfedf98ccba2"/>
    <result property="fd_3adfedf9d2bf1c" column="fd_3adfedf9d2bf1c"/>
    <result property="fd_3adfedfa4410aa" column="fd_3adfedfa4410aa"/>
    <result property="fd_3adfedfacd65d6" column="fd_3adfedfacd65d6"/>
    <result property="fd_3adfedfb174068" column="fd_3adfedfb174068"/>
    <result property="fd_3adfedfb5a68a2" column="fd_3adfedfb5a68a2"/>
    <result property="fd_3adfedfb8f76d4" column="fd_3adfedfb8f76d4"/>
    <result property="fd_3adfedfbd23ab8" column="fd_3adfedfbd23ab8"/>
    <result property="fd_3adfedfcb17f1e" column="fd_3adfedfcb17f1e"/>
    <result property="fd_3adfedfc453cc4" column="fd_3adfedfc453cc4"/>
    <result property="fd_3adfee063acff0" column="fd_3adfee063acff0"/>
    <result property="fd_3adfee0690737c" column="fd_3adfee0690737c"/>
    <result property="fd_3adfee01668666" column="fd_3adfee01668666"/>
    <result property="fd_3adfedfed8bb28" column="fd_3adfedfed8bb28"/>
    <result property="fd_3adfedff3a7430" column="fd_3adfedff3a7430"/>
    <result property="fd_3adfee0009d070" column="fd_3adfee0009d070"/>
    <result property="fd_3adfee01dea2fa" column="fd_3adfee01dea2fa"/>
    <result property="fd_3adfee12cb8840" column="fd_3adfee12cb8840"/>
    <result property="fd_3adfee1374ed7a" column="fd_3adfee1374ed7a"/>
    <result property="fd_3adfee1e2b2f78" column="fd_3adfee1e2b2f78"/>
    <result property="fd_3adfee1e88723e" column="fd_3adfee1e88723e"/>
    <result property="fd_3adfee1ee24680" column="fd_3adfee1ee24680"/>
    <result property="fd_3adfee1f32fa24" column="fd_3adfee1f32fa24"/>
    <result property="fd_3adfee1f901c46" column="fd_3adfee1f901c46"/>
    <result property="fd_3adfee1ff1ca6a" column="fd_3adfee1ff1ca6a"/>
    <result property="fd_3adfee203f86b2" column="fd_3adfee203f86b2"/>
    <result property="fd_3adfee20fe5ba4" column="fd_3adfee20fe5ba4"/>
    <result property="fd_3adfee21802434" column="fd_3adfee21802434"/>
    <result property="fd_3adfee4ba5ad36" column="fd_3adfee4ba5ad36"/>
    <result property="fd_3adfee4c0c59ee" column="fd_3adfee4c0c59ee"/>
    <result property="fd_3adfee5dd14866" column="fd_3adfee5dd14866"/>
    <result property="fd_3adfee5e3d1638" column="fd_3adfee5e3d1638"/>
    <result property="fd_3adfeeb34ea0ea" column="fd_3adfeeb34ea0ea"/>
    <result property="fd_3adfeededfb5a6" column="fd_3adfeededfb5a6"/>
    <result property="fd_3adfeed3a20598" column="fd_3adfeed3a20598"/>
    <result property="fd_3adfeec6db8766" column="fd_3adfeec6db8766"/>
    <result property="fd_3adfeef8ef38fc" column="fd_3adfeef8ef38fc"/>
    <result property="fd_3adfeedd08222c" column="fd_3adfeedd08222c"/>
    <result property="fd_3adfeec730ec44" column="fd_3adfeec730ec44"/>
    <result property="fd_3adfeef9440ab2" column="fd_3adfeef9440ab2"/>
    <result property="fd_3adfeedd5f3cb2" column="fd_3adfeedd5f3cb2"/>
    <result property="fd_3adfeec782070a" column="fd_3adfeec782070a"/>
    <result property="fd_3adfeef9b9fb3e" column="fd_3adfeef9b9fb3e"/>
    <result property="fd_3adfeeddacf6d4" column="fd_3adfeeddacf6d4"/>
    <result property="fd_3adfeec7ccdd1c" column="fd_3adfeec7ccdd1c"/>
    <result property="fd_3adfeefa1eba32" column="fd_3adfeefa1eba32"/>
    <result property="fd_3adfeede08d430" column="fd_3adfeede08d430"/>
    <result property="fd_3aea309696d32e" column="fd_3aea309696d32e"/>
    <result property="fd_3aea30866d0c30" column="fd_3aea30866d0c30"/>
    <result property="fd_3aeadf182ef6a2" column="fd_3aeadf182ef6a2"/>
    <result property="fd_3aeadf1992544c" column="fd_3aeadf1992544c"/>
    <result property="fd_3aeadf17522642" column="fd_3aeadf17522642"/>
    <result property="fd_3aeadf191c62a0" column="fd_3aeadf191c62a0"/>
    <result property="fd_3aeadede4cea84" column="fd_3aeadede4cea84"/>
    <result property="fd_3aeadee1cf1266" column="fd_3aeadee1cf1266"/>
    <result property="fd_3aeadf1892fdb2" column="fd_3aeadf1892fdb2"/>
    <result property="fd_3aeadf17b7d03a" column="fd_3aeadf17b7d03a"/>
    <result property="fd_3af9d5874f8166" column="fd_3af9d5874f8166"/>
    <result property="fd_3afaa69ad4d16a" column="fd_3afaa69ad4d16a"/>
    <result property="fd_3afab16f356672" column="fd_3afab16f356672"/>
    <result property="fd_3b10afe8c70742" column="fd_3b10afe8c70742"/>
    <result property="fd_3b13b1b91f5b34" column="fd_3b13b1b91f5b34"/>
    <result property="fd_3b13b1d1ff9678" column="fd_3b13b1d1ff9678"/>
    <result property="fd_3b16cecc2bbd16" column="fd_3b16cecc2bbd16"/>
    <result property="fd_3b16cecd47a856" column="fd_3b16cecd47a856"/>
    <result property="fd_3b16e418905f52" column="fd_3b16e418905f52"/>
    <result property="fd_3b16e418905f52_text" column="fd_3b16e418905f52_text"/>
    <result property="fd_3b178f3e24cc32" column="fd_3b178f3e24cc32"/>
    <result property="fd_3b3beee3ec7e12" column="fd_3b3beee3ec7e12"/>
    <result property="fd_3b73c214e52982" column="fd_3b73c214e52982"/>
    <result property="fd_3b84d6a6c7b8f0" column="fd_3b84d6a6c7b8f0"/>
    <result property="fd_3b9893328ffb46" column="fd_3b9893328ffb46"/>
    <result property="fd_3bbc0711464020" column="fd_3bbc0711464020"/>
    <result property="fd_3bcd2e63600446" column="fd_3bcd2e63600446"/>
    <result property="fd_3bcd2e64868de6" column="fd_3bcd2e64868de6"/>
    <result property="fd_3bcd2e6259fdbe" column="fd_3bcd2e6259fdbe"/>
    <result property="fd_3bcd2f1a073260" column="fd_3bcd2f1a073260"/>
    <result property="fd_3bcd2f180f2a8c" column="fd_3bcd2f180f2a8c"/>
    <result property="fd_3bcd3102f612ea" column="fd_3bcd3102f612ea"/>
    <result property="fd_3bcd2ef618ee54" column="fd_3bcd2ef618ee54"/>
    <result property="fd_3bcd3119a295be" column="fd_3bcd3119a295be"/>
    <result property="fd_3bcdeed22ec8dc" column="fd_3bcdeed22ec8dc"/>
    <result property="fd_3bcd34a8c296c8" column="fd_3bcd34a8c296c8"/>
    <result property="fd_3bcd2ef8728fe0" column="fd_3bcd2ef8728fe0"/>
    <result property="fd_3bcd2f18fd1840" column="fd_3bcd2f18fd1840"/>
    <result property="fd_3bcd3100f45ca2" column="fd_3bcd3100f45ca2"/>
    <result property="fd_3bcd2ef727ac6a" column="fd_3bcd2ef727ac6a"/>
    <result property="fd_3bcd3101d95dd8" column="fd_3bcd3101d95dd8"/>
    <result property="fd_3bcd311a72d000" column="fd_3bcd311a72d000"/>
    <result property="fd_3bee2056eeb800" column="fd_3bee2056eeb800"/>
    <result property="fd_3c3e5ff65115a2" column="fd_3c3e5ff65115a2"/>
  </resultMap>

	<!--查询项目信息-->
	<select id="getAllEkpDeptInfo" resultType="com.yifu.cloud.plus.v1.ekp.vo.EkpDeptInfoVo">
		SELECT
			a.fd_id as fdId,
			a.fd_3b1480cd9dcb60 as settleType,
			a.fd_3b15f64dd59a28 as isBpo,
			a.fd_3b13b28d4123ee as socialType,
			a.fd_3a2b38c61ef9aa as deptName,
			a.fd_3a37fe508071fe as deptNo
		from ekp_24a8e6a7fc143bb8c48a a
		group by fd_3a37fe508071fe
	</select>

	<!--查询工资明细信息-->
	<select id="getCostSumInfo" resultType="com.yifu.cloud.plus.v1.ekp.vo.EkpSocialSumInfoVo">
		SELECT
			round(sum(ifnull(fd_3af9f2883941b4,0)),2) as ygSum,
			round(sum(ifnull(fd_3af9f285ee1e38,0)),2) as ygPersonSum,
			round(sum(ifnull(fd_3af9f3059e5b9c,0)),2) as sjSum,
			round(sum(ifnull(fd_3adfeb4e8064a8,0)),2) as ygDwSum,
			round(sum(ifnull(fd_3af9f2e9208e4e,0)),2) as sjDwSum,
			round(sum(ifnull(fd_3af9f303037214,0)),2) as sjPersonSum,
			round(sum(ifnull(fd_3adfeb7b624f06,0)),2) as ys,
			round(sum(ifnull(fd_3b35a57aee1428,0)),2) as personYs,
			round(sum(ifnull(fd_3b35a57b6e9d0a,0)),2) as dwYs,
			round(sum(ifnull(fd_3adfeb7bd97464,0)),2) as yzc,
			round(sum(ifnull(fd_3b35a5b03100c4,0)),2) as personYzc,
			round(sum(ifnull(fd_3b35a5b0b04d54,0)),2) as dwYzc
		from ekp_social_info
		where fd_3adfe8c7e4cf7a = #{card} and fd_3adfe8cb96c41e = #{month}
	</select>

	<!--根据项目编码和申请人查询款项认领明细-->
	<select id="getClaimInfoByDeptNo" resultType="com.yifu.cloud.plus.v1.ekp.vo.ClaimRebackInfotVO">
		select
		    fd_3afb4c634ebd08 claimNo,
			fd_3afb4689209aa2 deptNo,
			fd_3afb468b23b0e2 deptName,
			fd_3afb46ab98d9a8 claimMoney,
			fd_3afb46ac507904 cancelMoney,
			ifnull(fd_3afb46d05d19ec,0) surMoney,
			fd_3b5f41db9fb154 claimTime
		from
			ekp_94b6cd1535e4b34865c8
		where
		fd_3afb4689209aa2 = #{deptNo}
		<if test="flag != null and flag == 3">
			and fd_3afb46d05d19ec > 0
		</if>
		<if test="flag != null and (flag == 1 or flag == 3)">
			and fd_3b2a70e26f520a = '1817fbe83899f5f34c1ee9b463bbf9c1'
		</if>
		order by fd_3b5f41db9fb154 asc
		<if test="flag != null">
		limit 1
		</if>
	</select>

	<!--根据项目编码和申请人查询款项认领明细-->
	<select id="getClaimBigInfoByDeptNoAndUser" resultType="com.yifu.cloud.plus.v1.ekp.vo.ClaimRebackInfotVO">
		select
			fd_3afb4c634ebd08 claimNo,
			fd_3afb4689209aa2 deptNo,
			fd_3afb468b23b0e2 deptName,
			fd_3afb46ab98d9a8 claimMoney,
			fd_3afb46ac507904 cancelMoney,
			ifnull(fd_3afb46d05d19ec,0) surMoney,
			fd_3b5f41db9fb154 claimTime
		from
			ekp_94b6cd1535e4b34865c8
		where
		   fd_3afb4689209aa2 = #{deptNo}
		   and fd_3afb46d05d19ec > 0
		   and fd_3b2a70e26f520a != '1817fbe83899f5f34c1ee9b463bbf9c1'
		   order by fd_3b5f41db9fb154 asc
	</select>

</mapper>