TSalaryEmployeeMapper.xml 11.1 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>
hongguangwu's avatar
hongguangwu committed
70 71 72 73 74 75 76 77 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
    <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
119
                        AND a.DEPT_NAME like concat('%',#{tSalaryEmployee.deptName},'%')
hongguangwu's avatar
hongguangwu committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
                    </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
149
                        AND a.INVOICE_TITLE like concat('%',#{tSalaryEmployee.invoiceTitle},'%')
hongguangwu's avatar
hongguangwu committed
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
                    </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"/>
176 177 178
			<if test="tSalaryEmployee.authSql != null and tSalaryEmployee.authSql.trim() != ''">
				${tSalaryEmployee.authSql}
			</if>
fangxinjiang's avatar
fangxinjiang committed
179 180
			ORDER BY a.CREATE_TIME DESC
		</where>
hongguangwu's avatar
hongguangwu committed
181
    </select>
fangxinjiang's avatar
fangxinjiang committed
182 183 184

	<select id="noPageDiy" resultMap="salaryEmployeeExportMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmployeeExportVo">
		SELECT
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
		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
210
		FROM t_salary_employee a
211 212
		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
213 214 215
		<where>
			1=1
			<include refid="where_export"/>
216 217 218
			<if test="tSalaryEmployee.authSql != null and tSalaryEmployee.authSql.trim() != ''">
				${tSalaryEmployee.authSql}
			</if>
fangxinjiang's avatar
fangxinjiang committed
219 220 221 222 223 224 225 226
			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
227

fangxinjiang's avatar
fangxinjiang committed
228 229 230 231 232 233 234 235 236
	<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
237 238 239 240 241 242 243 244 245

	<!-- 按身份证查询全部人员 -->
	<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
246
				#{idStr}
hongguangwu's avatar
hongguangwu committed
247 248 249
			</foreach>
		</if>
	</select>
hongguangwu's avatar
hongguangwu committed
250 251 252 253 254 255 256 257 258

	<!-- 按身份证查询人员 -->
	<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>
hongguangwu's avatar
hongguangwu committed
259
</mapper>