TSalaryEmployeeMapper.xml 12.6 KB
Newer Older
hongguangwu's avatar
hongguangwu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
<?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.yifu.salary.mapper.TSalaryEmployeeMapper">

  <resultMap id="tSalaryEmployeeMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee">
    <id property="id" column="ID"/>
    <result property="empName" column="EMP_NAME"/>
    <result property="empIdcard" column="EMP_IDCARD"/>
    <result property="unitId" column="UNIT_ID"/>
    <result property="unitName" column="UNIT_NAME"/>
    <result property="unitNo" column="UNIT_NO"/>
    <result property="deptId" column="DEPT_ID"/>
    <result property="deptName" column="DEPT_NAME"/>
    <result property="deptNo" column="DEPT_NO"/>
    <result property="createBy" column="CREATE_BY"/>
    <result property="createName" column="CREATE_NAME"/>
    <result property="createTime" column="CREATE_TIME"/>
    <result property="updateBy" column="UPDATE_BY"/>
    <result property="updateTime" column="UPDATE_TIME"/>
    <result property="bankName" column="BANK_NAME"/>
    <result property="bankSubName" column="BANK_SUB_NAME"/>
    <result property="bankNo" column="BANK_NO"/>
    <result property="invoiceTitle" column="INVOICE_TITLE"/>
    <result property="bankProvince" column="BANK_PROVINCE"/>
    <result property="bankCity" column="BANK_CITY"/>
    <result property="empPhone" column="EMP_PHONE"/>
    <result property="taxMonth" column="TAX_MONTH"/>
    <result property="fileStatus" column="FILE_STATUS"/>
  </resultMap>
fangxinjiang's avatar
fangxinjiang committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
	<resultMap id="salaryEmployeeExportMap" type="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeExportVo">
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitId" column="UNIT_ID"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="unitNo" column="UNIT_NO"/>
		<result property="deptId" column="DEPT_ID"/>
		<result property="deptName" column="DEPT_NAME"/>
		<result property="deptNo" column="DEPT_NO"/>
		<result property="bankName" column="BANK_NAME"/>
		<result property="bankSubName" column="BANK_SUB_NAME"/>
		<result property="bankNo" column="BANK_NO"/>
		<result property="invoiceTitle" column="INVOICE_TITLE"/>
		<result property="bankProvince" column="BANK_PROVINCE"/>
		<result property="bankCity" column="BANK_CITY"/>
		<result property="empPhone" column="EMP_PHONE"/>
		<result property="taxMonth" column="TAX_MONTH"/>
		<result property="fileStatus" column="FILE_STATUS"/>
	</resultMap>
fangxinjiang's avatar
fangxinjiang committed
70 71 72 73 74 75 76 77
	<resultMap id="salaryEmpRosterMap" type="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmpRosterVo">
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="bankName" column="BANK_NAME"/>
		<result property="bankSubName" column="BANK_SUB_NAME"/>
		<result property="bankNo" column="BANK_NO"/>
		<result property="bankProvince" column="BANK_PROVINCE"/>
		<result property="bankCity" column="BANK_CITY"/>
	</resultMap>
hongguangwu's avatar
hongguangwu committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    <sql id="Base_Column_List">
                a.ID,
                a.EMP_NAME,
                a.EMP_IDCARD,
                a.UNIT_ID,
                a.UNIT_NAME,
                a.UNIT_NO,
                a.DEPT_ID,
                a.DEPT_NAME,
                a.DEPT_NO,
                a.CREATE_BY,
                a.CREATE_NAME,
                a.CREATE_TIME,
                a.UPDATE_BY,
                a.UPDATE_TIME,
                a.BANK_NAME,
                a.BANK_SUB_NAME,
                a.BANK_NO,
                a.INVOICE_TITLE,
                a.BANK_PROVINCE,
                a.BANK_CITY,
                a.EMP_PHONE,
                a.TAX_MONTH,
                a.FILE_STATUS
    </sql>
    <sql id="tSalaryEmployee_where">
        <if test="tSalaryEmployee != null">
                    <if test="tSalaryEmployee.id != null and tSalaryEmployee.id.trim() != ''">
                        AND a.ID = #{tSalaryEmployee.id}
                    </if>
                    <if test="tSalaryEmployee.empName != null and tSalaryEmployee.empName.trim() != ''">
                        AND a.EMP_NAME = #{tSalaryEmployee.empName}
                    </if>
                    <if test="tSalaryEmployee.empIdcard != null and tSalaryEmployee.empIdcard.trim() != ''">
                        AND a.EMP_IDCARD = #{tSalaryEmployee.empIdcard}
                    </if>
                    <if test="tSalaryEmployee.unitId != null and tSalaryEmployee.unitId.trim() != ''">
                        AND a.UNIT_ID = #{tSalaryEmployee.unitId}
                    </if>
                    <if test="tSalaryEmployee.unitName != null and tSalaryEmployee.unitName.trim() != ''">
                        AND a.UNIT_NAME = #{tSalaryEmployee.unitName}
                    </if>
                    <if test="tSalaryEmployee.unitNo != null and tSalaryEmployee.unitNo.trim() != ''">
                        AND a.UNIT_NO = #{tSalaryEmployee.unitNo}
                    </if>
                    <if test="tSalaryEmployee.deptId != null and tSalaryEmployee.deptId.trim() != ''">
                        AND a.DEPT_ID = #{tSalaryEmployee.deptId}
                    </if>
                    <if test="tSalaryEmployee.deptName != null and tSalaryEmployee.deptName.trim() != ''">
huyuchen's avatar
huyuchen committed
127
                        AND a.DEPT_NAME like concat('%',#{tSalaryEmployee.deptName},'%')
hongguangwu's avatar
hongguangwu committed
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
                    </if>
                    <if test="tSalaryEmployee.deptNo != null and tSalaryEmployee.deptNo.trim() != ''">
                        AND a.DEPT_NO = #{tSalaryEmployee.deptNo}
                    </if>
                    <if test="tSalaryEmployee.createBy != null and tSalaryEmployee.createBy.trim() != ''">
                        AND a.CREATE_BY = #{tSalaryEmployee.createBy}
                    </if>
                    <if test="tSalaryEmployee.createName != null and tSalaryEmployee.createName.trim() != ''">
                        AND a.CREATE_NAME = #{tSalaryEmployee.createName}
                    </if>
                    <if test="tSalaryEmployee.createTime != null">
                        AND a.CREATE_TIME = #{tSalaryEmployee.createTime}
                    </if>
                    <if test="tSalaryEmployee.updateBy != null and tSalaryEmployee.updateBy.trim() != ''">
                        AND a.UPDATE_BY = #{tSalaryEmployee.updateBy}
                    </if>
                    <if test="tSalaryEmployee.updateTime != null">
                        AND a.UPDATE_TIME = #{tSalaryEmployee.updateTime}
                    </if>
                    <if test="tSalaryEmployee.bankName != null and tSalaryEmployee.bankName.trim() != ''">
                        AND a.BANK_NAME = #{tSalaryEmployee.bankName}
                    </if>
                    <if test="tSalaryEmployee.bankSubName != null and tSalaryEmployee.bankSubName.trim() != ''">
                        AND a.BANK_SUB_NAME = #{tSalaryEmployee.bankSubName}
                    </if>
                    <if test="tSalaryEmployee.bankNo != null and tSalaryEmployee.bankNo.trim() != ''">
                        AND a.BANK_NO = #{tSalaryEmployee.bankNo}
                    </if>
                    <if test="tSalaryEmployee.invoiceTitle != null and tSalaryEmployee.invoiceTitle.trim() != ''">
huyuchen's avatar
huyuchen committed
157
                        AND a.INVOICE_TITLE like concat('%',#{tSalaryEmployee.invoiceTitle},'%')
hongguangwu's avatar
hongguangwu committed
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
                    </if>
                    <if test="tSalaryEmployee.bankProvince != null">
                        AND a.BANK_PROVINCE = #{tSalaryEmployee.bankProvince}
                    </if>
                    <if test="tSalaryEmployee.bankCity != null">
                        AND a.BANK_CITY = #{tSalaryEmployee.bankCity}
                    </if>
                    <if test="tSalaryEmployee.empPhone != null and tSalaryEmployee.empPhone.trim() != ''">
                        AND a.EMP_PHONE = #{tSalaryEmployee.empPhone}
                    </if>
                    <if test="tSalaryEmployee.taxMonth != null and tSalaryEmployee.taxMonth.trim() != ''">
                        AND a.TAX_MONTH = #{tSalaryEmployee.taxMonth}
                    </if>
                    <if test="tSalaryEmployee.fileStatus != null">
                        AND a.FILE_STATUS = #{tSalaryEmployee.fileStatus}
                    </if>
        </if>
    </sql>
    <!--tSalaryEmployee简单分页查询-->
    <select id="getTSalaryEmployeePage" resultMap="tSalaryEmployeeMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_salary_employee a
        <where>
            1=1
            <include refid="tSalaryEmployee_where"/>
184 185 186
			<if test="tSalaryEmployee.authSql != null and tSalaryEmployee.authSql.trim() != ''">
				${tSalaryEmployee.authSql}
			</if>
fangxinjiang's avatar
fangxinjiang committed
187 188
			ORDER BY a.CREATE_TIME DESC
		</where>
hongguangwu's avatar
hongguangwu committed
189
    </select>
fangxinjiang's avatar
fangxinjiang committed
190 191 192

	<select id="noPageDiy" resultMap="salaryEmployeeExportMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeExportVo">
		SELECT
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
		a.ID,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_ID,
		a.UNIT_NAME,
		a.UNIT_NO,
		a.DEPT_ID,
		a.DEPT_NAME,
		a.DEPT_NO,
		a.CREATE_BY,
		a.CREATE_NAME,
		a.CREATE_TIME,
		a.UPDATE_BY,
		a.UPDATE_TIME,
		a.BANK_NAME,
		a.BANK_SUB_NAME,
		a.BANK_NO,
		a.INVOICE_TITLE,
		a1.area_name as "BANK_PROVINCE",
		a2.area_name as "BANK_CITY",
		a.EMP_PHONE,
		a.TAX_MONTH,
		case when a.FILE_STATUS = 0 then "在职"
		when a.FILE_STATUS = 1 then "离职"
		else null  end  as  "FILE_STATUS"
fangxinjiang's avatar
fangxinjiang committed
218
		FROM t_salary_employee a
219 220
		left join sys_area a1 on a1.id=a.BANK_PROVINCE
		left join sys_area a2 on a2.id=a.BANK_CITY
fangxinjiang's avatar
fangxinjiang committed
221 222 223
		<where>
			1=1
			<include refid="where_export"/>
224 225 226
			<if test="tSalaryEmployee.authSql != null and tSalaryEmployee.authSql.trim() != ''">
				${tSalaryEmployee.authSql}
			</if>
fangxinjiang's avatar
fangxinjiang committed
227 228 229 230 231 232 233 234
			ORDER BY a.CREATE_TIME DESC
		</where>
		<if test="tSalaryEmployee != null">
			<if test="tSalaryEmployee.limitStart != null">
				limit #{tSalaryEmployee.limitStart},#{tSalaryEmployee.limitEnd}
			</if>
		</if>
	</select>
hongguangwu's avatar
hongguangwu committed
235

fangxinjiang's avatar
fangxinjiang committed
236 237 238 239 240 241 242 243 244
	<sql id="where_export">
		<include refid="tSalaryEmployee_where"/>
		<if test="idList != null and idList.size>0">
			AND a.id in
			<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
				#{idStr}
			</foreach>
		</if>
	</sql>
hongguangwu's avatar
hongguangwu committed
245 246 247 248 249 250 251 252 253

	<!-- 按身份证查询全部人员 -->
	<select id="getListByIdCard" resultMap="tSalaryEmployeeMap" >
		<if test="idCardList != null and idCardList.size>0">
			SELECT
			<include refid="Base_Column_List"/>
			FROM t_salary_employee a
			where a.EMP_IDCARD in
			<foreach item="idStr" index="index" collection="idCardList" open="(" separator="," close=")">
hongguangwu's avatar
hongguangwu committed
254
				#{idStr}
hongguangwu's avatar
hongguangwu committed
255 256 257
			</foreach>
		</if>
	</select>
hongguangwu's avatar
hongguangwu committed
258 259 260 261 262 263 264 265 266

	<!-- 按身份证查询人员 -->
	<select id="getByEmpIdCard" resultMap="tSalaryEmployeeMap" >
		SELECT
			<include refid="Base_Column_List"/>
		FROM t_salary_employee a
		where a.EMP_IDCARD = #{empIdCard}
		ORDER BY a.BANK_CITY DESC LIMIT 1
	</select>
267 268 269 270 271 272 273 274 275 276 277

	<select id="selectByIdCard" resultType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem">
		SELECT
			a.ID,
			a.SALARY_ACCOUNT_ID,
			a.CN_NAME,
			a.JAVA_FIED_NAME,
			SUM(a.SALARY_MONEY)SALARY_MONEY,
			a.IS_TAX,
			a.TEXT_VALUE,
			b.EMP_IDCARD,
wangzb's avatar
wangzb committed
278 279
			b.SALARY_MONTH,
			b.DELETE_FLAG
280 281 282 283
		FROM `t_salary_account_item`  a LEFT JOIN t_salary_account b on a.SALARY_ACCOUNT_ID =b.ID
		WHERE  a.JAVA_FIED_NAME ='phoneSubsidy'
		  and b.EMP_IDCARD= #{empIdCard}
		  and b.SETTLEMENT_MONTH=#{nowMonth}
wangzb's avatar
wangzb committed
284
		   and b.DELETE_FLAG='0'
285
	</select>
fangxinjiang's avatar
fangxinjiang committed
286 287
	<!--  人员花名册薪资信息  -->
	<select id="getSalaryEmpRoster" resultMap="salaryEmpRosterMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmpRosterVo">
fangxinjiang's avatar
fangxinjiang committed
288
		select  a.EMP_IDCARD,BANK_NO,BANK_NAME,BANK_SUB_NAME,a.BANK_PROVINCE,a.BANK_CITY from t_salary_employee  a
fangxinjiang's avatar
fangxinjiang committed
289 290 291 292 293 294 295 296 297 298 299 300 301
		LEFT JOIN sys_area a1 on a.BANK_PROVINCE=a1.id
		LEFT JOIN sys_area a2 on a.BANK_CITY= a2.id
		<where>
			1=1
			<if test="idCards != null and idCards.size>0">
				AND a.EMP_IDCARD in
				<foreach item="idCard" index="index" collection="idCards" open="(" separator="," close=")">
					#{idCard}
				</foreach>
			</if>
		</where>

	</select>
hongguangwu's avatar
hongguangwu committed
302
</mapper>