847 lines
31 KiB
XML
847 lines
31 KiB
XML
<?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.engine.salary.mapper.archive.SalaryArchiveMapper">
|
|
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
<result column="id" property="id"/>
|
|
<result column="employee_id" property="employeeId"/>
|
|
<result column="create_time" property="createTime"/>
|
|
<result column="update_time" property="updateTime"/>
|
|
<result column="creator" property="creator"/>
|
|
<result column="delete_type" property="deleteType"/>
|
|
<result column="tenant_key" property="tenantKey"/>
|
|
<result column="tax_agent_id" property="taxAgentId"/>
|
|
<result column="pay_start_date" property="payStartDate"/>
|
|
<result column="pay_end_date" property="payEndDate"/>
|
|
<result column="run_status" property="runStatus"/>
|
|
<result column="employee_type" property="employeeType"/>
|
|
</resultMap>
|
|
|
|
<!-- 表字段 -->
|
|
<sql id="baseColumns">
|
|
t
|
|
.
|
|
id
|
|
, t.employee_id
|
|
, t.create_time
|
|
, t.update_time
|
|
, t.creator
|
|
, t.delete_type
|
|
, t.tenant_key
|
|
, t.tax_agent_id
|
|
, t.pay_start_date
|
|
, t.pay_end_date
|
|
, t.run_status
|
|
, t.employee_type
|
|
</sql>
|
|
|
|
<!-- 查询全部 -->
|
|
<select id="listAll" resultMap="BaseResultMap">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_salary_archive t
|
|
WHERE delete_type = 0
|
|
</select>
|
|
|
|
<update id="update" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
employee_id=#{employeeId},
|
|
create_time=#{createTime},
|
|
update_time=#{updateTime},
|
|
creator=#{creator},
|
|
delete_type=#{deleteType},
|
|
tenant_key=#{tenantKey},
|
|
tax_agent_id=#{taxAgentId},
|
|
pay_start_date=#{payStartDate},
|
|
pay_end_date=#{payEndDate},
|
|
run_status=#{runStatus},
|
|
employee_type=#{employeeType},
|
|
</set>
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<!-- 根据主键获取单条记录 -->
|
|
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_salary_archive t
|
|
WHERE id = #{id} AND delete_type = 0
|
|
</select>
|
|
|
|
<!-- 根据主键删除记录 -->
|
|
<delete id="delete" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
SET delete_type=1
|
|
WHERE id = #{id}
|
|
AND delete_type = 0
|
|
</delete>
|
|
|
|
|
|
<sql id="salaryArchiveColumn">
|
|
t
|
|
.
|
|
id
|
|
, t.employee_id
|
|
, t.create_time
|
|
, t.update_time
|
|
, t.creator
|
|
, t.delete_type
|
|
, t.tenant_key
|
|
, t.tax_agent_id
|
|
, t.pay_start_date
|
|
, t.pay_end_date
|
|
, t.run_status
|
|
, t.employee_type
|
|
, e.mobile
|
|
, e.workcode
|
|
, e.lastname as username
|
|
, e.status AS employeeStatus
|
|
, e.companystartdate as companystartdate
|
|
, e.enddate as dismissdate
|
|
, e.status AS employeeStatus
|
|
,e.certificatenum as idNo
|
|
, d.departmentname AS departmentName
|
|
, c.subcompanyname AS subcompanyName
|
|
</sql>
|
|
|
|
|
|
<!-- 薪资档案列表 -->
|
|
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO">
|
|
SELECT
|
|
<include refid="salaryArchiveColumn"/>
|
|
FROM
|
|
hrsa_salary_archive t
|
|
LEFT JOIN hrmresource e ON e.id = t.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
WHERE t.delete_type = 0
|
|
and t.employee_type is null
|
|
and e.status not in (7)
|
|
and (e.accounttype is null or e.accounttype = 0)
|
|
<if test="param.ids != null and param.ids.size()>0">
|
|
AND t.id IN
|
|
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 个税扣缴义务人 -->
|
|
<if test="param.taxAgentId != null">
|
|
AND t.tax_agent_id = #{param.taxAgentId}
|
|
</if>
|
|
<!-- 姓名 -->
|
|
<if test="param.username != null and param.username != ''">
|
|
AND e.lastname like CONCAT('%',#{param.username},'%')
|
|
</if>
|
|
<if test="param.workcode != null and param.workcode != ''">
|
|
AND e.workcode like CONCAT('%',#{param.workcode},'%')
|
|
</if>
|
|
<!-- 分部 -->
|
|
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
|
|
AND c.id IN
|
|
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
|
|
#{subcompanyId}
|
|
</foreach>
|
|
</if>
|
|
<!-- 部门 -->
|
|
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
|
AND d.id IN
|
|
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 岗位 -->
|
|
<if test="param.positionIds != null and param.positionIds.size()>0">
|
|
AND e.jobtitle IN
|
|
<foreach collection="param.positionIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 状态 -->
|
|
<if test="param.userstatus != null and param.userstatus != ''">
|
|
AND e.status = #{param.userstatus}
|
|
</if>
|
|
<if test="param.statuses != null and param.statuses.size()>0">
|
|
AND e.status IN
|
|
<foreach collection="param.statuses" open="(" item="userstatus" separator="," close=")">
|
|
#{userstatus}
|
|
</foreach>
|
|
</if>
|
|
<!-- 入职日期 -->
|
|
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
|
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
|
</if>
|
|
<!-- 人事状态 -->
|
|
<if test="param.personnelStatuss != null and param.personnelStatuss.size()>0">
|
|
AND e.status IN
|
|
<foreach collection="param.personnelStatuss" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 档案状态 -->
|
|
<if test="param.runStatusList != null and param.runStatusList.size()>0">
|
|
AND t.run_status IN
|
|
<foreach collection="param.runStatusList" open="(" item="runStatus" separator="," close=")">
|
|
#{runStatus}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.payStartDateStartDate != null and param.payStartDateStartDate != null">
|
|
AND pay_start_date <![CDATA[ >= ]]> #{param.payStartDateStartDate}
|
|
</if>
|
|
<if test="param.payStartDateEndDate != null and param.payStartDateEndDate != null">
|
|
AND pay_start_date <![CDATA[ <= ]]> #{param.payStartDateEndDate}
|
|
</if>
|
|
<if test="param.payEndDateStartDate != null and param.payEndDateStartDate != null">
|
|
AND pay_end_date <![CDATA[ >= ]]> #{param.payEndDateStartDate}
|
|
</if>
|
|
<if test="param.payEndDateEndDate != null and param.payEndDateEndDate != null">
|
|
AND pay_end_date <![CDATA[ <= ]]> #{param.payEndDateEndDate}
|
|
</if>
|
|
<!-- 排序 -->
|
|
<if test="param.orderRule != null">
|
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
|
</if>
|
|
</select>
|
|
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO" databaseId="oracle">
|
|
SELECT
|
|
|
|
<include refid="salaryArchiveColumn"/>
|
|
|
|
FROM
|
|
hrsa_salary_archive t
|
|
LEFT JOIN hrmresource e ON e.id = t.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
WHERE t.delete_type = 0
|
|
and t.employee_type is null
|
|
and e.status not in (7)
|
|
and (e.accounttype is null or e.accounttype = 0)
|
|
<if test="param.ids != null and param.ids.size()>0">
|
|
AND t.id IN
|
|
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 个税扣缴义务人 -->
|
|
<if test="param.taxAgentId != null">
|
|
AND t.tax_agent_id = #{param.taxAgentId}
|
|
</if>
|
|
<if test="param.username != null and param.username != ''">
|
|
AND e.lastname like '%'||#{param.username}||'%'
|
|
</if>
|
|
<if test="param.workcode != null and param.workcode != ''">
|
|
AND e.workcode like '%'||#{param.workcode}||'%'
|
|
</if>
|
|
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
|
|
AND c.id IN
|
|
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
|
|
#{subcompanyId}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
|
AND d.id IN
|
|
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="param.positionIds != null and param.positionIds.size()>0">
|
|
AND e.jobtitle IN
|
|
<foreach collection="param.positionIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="param.userstatus != null and param.userstatus != ''">
|
|
AND e.status = #{param.userstatus}
|
|
</if>
|
|
<if test="param.statuses != null and param.statuses.size()>0">
|
|
AND e.status IN
|
|
<foreach collection="param.statuses" open="(" item="userstatus" separator="," close=")">
|
|
#{userstatus}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
|
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
|
</if>
|
|
<!-- 人事状态 -->
|
|
<if test="param.personnelStatuss != null and param.personnelStatuss.size()>0">
|
|
AND e.status IN
|
|
<foreach collection="param.personnelStatuss" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 档案状态 -->
|
|
<if test="param.runStatusList != null and param.runStatusList.size()>0">
|
|
AND t.run_status IN
|
|
<foreach collection="param.runStatusList" open="(" item="runStatus" separator="," close=")">
|
|
#{runStatus}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.payStartDateStartDate != null and param.payStartDateStartDate != null">
|
|
AND pay_start_date <![CDATA[ >= ]]> #{param.payStartDateStartDate}
|
|
</if>
|
|
<if test="param.payStartDateEndDate != null and param.payStartDateEndDate != null">
|
|
AND pay_start_date <![CDATA[ <= ]]> #{param.payStartDateEndDate}
|
|
</if>
|
|
<if test="param.payEndDateStartDate != null and param.payEndDateStartDate != null">
|
|
AND pay_end_date <![CDATA[ >= ]]> #{param.payEndDateStartDate}
|
|
</if>
|
|
<if test="param.payEndDateEndDate != null and param.payEndDateEndDate != null">
|
|
AND pay_end_date <![CDATA[ <= ]]> #{param.payEndDateEndDate}
|
|
</if>
|
|
<!-- 排序 -->
|
|
<if test="param.orderRule != null">
|
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
|
</if>
|
|
</select>
|
|
<select id="list" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO"
|
|
databaseId="sqlserver">
|
|
SELECT
|
|
|
|
<include refid="salaryArchiveColumn"/>
|
|
|
|
FROM
|
|
hrsa_salary_archive t
|
|
LEFT JOIN hrmresource e ON e.id = t.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
WHERE t.delete_type = 0
|
|
and t.employee_type is null
|
|
and e.status not in (7)
|
|
and (e.accounttype is null or e.accounttype = 0)
|
|
<if test="param.ids != null and param.ids.size()>0">
|
|
AND t.id IN
|
|
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 个税扣缴义务人 -->
|
|
<if test="param.taxAgentId != null">
|
|
AND t.tax_agent_id = #{param.taxAgentId}
|
|
</if>
|
|
<if test="param.username != null and param.username != ''">
|
|
AND e.lastname like '%'+#{param.username}+'%'
|
|
</if>
|
|
<if test="param.workcode != null and param.workcode != ''">
|
|
AND e.workcode like '%'+#{param.workcode}+'%'
|
|
</if>
|
|
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
|
|
AND c.id IN
|
|
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
|
|
#{subcompanyId}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
|
AND d.id IN
|
|
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="param.positionIds != null and param.positionIds.size()>0">
|
|
AND e.jobtitle IN
|
|
<foreach collection="param.positionIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="param.userstatus != null and param.userstatus != ''">
|
|
AND e.status = #{param.userstatus}
|
|
</if>
|
|
<if test="param.statuses != null and param.statuses.size()>0">
|
|
AND e.status IN
|
|
<foreach collection="param.statuses" open="(" item="userstatus" separator="," close=")">
|
|
#{userstatus}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
|
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
|
</if>
|
|
<!-- 人事状态 -->
|
|
<if test="param.personnelStatuss != null and param.personnelStatuss.size()>0">
|
|
AND e.status IN
|
|
<foreach collection="param.personnelStatuss" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 档案状态 -->
|
|
<if test="param.runStatusList != null and param.runStatusList.size()>0">
|
|
AND t.run_status IN
|
|
<foreach collection="param.runStatusList" open="(" item="runStatus" separator="," close=")">
|
|
#{runStatus}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.payStartDateStartDate != null and param.payStartDateStartDate != null">
|
|
AND pay_start_date <![CDATA[ >= ]]> #{param.payStartDateStartDate}
|
|
</if>
|
|
<if test="param.payStartDateEndDate != null and param.payStartDateEndDate != null">
|
|
AND pay_start_date <![CDATA[ <= ]]> #{param.payStartDateEndDate}
|
|
</if>
|
|
<if test="param.payEndDateStartDate != null and param.payEndDateStartDate != null">
|
|
AND pay_end_date <![CDATA[ >= ]]> #{param.payEndDateStartDate}
|
|
</if>
|
|
<if test="param.payEndDateEndDate != null and param.payEndDateEndDate != null">
|
|
AND pay_end_date <![CDATA[ <= ]]> #{param.payEndDateEndDate}
|
|
</if>
|
|
<!-- 排序 -->
|
|
<if test="param.orderRule != null">
|
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 薪资档案列表 -->
|
|
<select id="listExtSalaryArchive" resultType="com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO">
|
|
SELECT
|
|
t
|
|
.
|
|
id
|
|
, t.employee_id
|
|
, t.create_time
|
|
, t.update_time
|
|
, t.creator
|
|
, t.delete_type
|
|
, t.tenant_key
|
|
, t.tax_agent_id
|
|
, t.pay_start_date
|
|
, t.pay_end_date
|
|
, t.run_status
|
|
, t.employee_type
|
|
, e.mobile
|
|
, e.workcode
|
|
, e.username
|
|
, e.status AS employeeStatus
|
|
, e.companystartdate as companystartdate
|
|
, e.status AS employeeStatus
|
|
, e.department_name as departmentName
|
|
, e.subcompany_name AS subcompanyName
|
|
FROM
|
|
hrsa_salary_archive t
|
|
LEFT JOIN hrsa_external_employee e ON e.id = t.employee_id
|
|
WHERE t.delete_type = 0
|
|
and t.employee_type is not null
|
|
<if test="param.ids != null and param.ids.size()>0">
|
|
AND t.id IN
|
|
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 个税扣缴义务人 -->
|
|
<if test="param.taxAgentId != null">
|
|
AND t.tax_agent_id = #{param.taxAgentId}
|
|
</if>
|
|
<!-- 姓名 -->
|
|
<if test="param.username != null and param.username != ''">
|
|
AND e.username like CONCAT('%',#{param.username},'%')
|
|
</if>
|
|
<!-- 分部 -->
|
|
<if test="param.subcompanyIds != null and param.subcompanyIds.size()>0">
|
|
AND e.subcompany_id IN
|
|
<foreach collection="param.subcompanyIds" open="(" item="subcompanyId" separator="," close=")">
|
|
#{subcompanyId}
|
|
</foreach>
|
|
</if>
|
|
<!-- 部门 -->
|
|
<if test="param.departmentIds != null and param.departmentIds.size()>0">
|
|
AND e.department_id IN
|
|
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 岗位 -->
|
|
<if test="param.positionIds != null and param.positionIds.size()>0">
|
|
AND e.jobtitle_id IN
|
|
<foreach collection="param.positionIds" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 状态 -->
|
|
<if test="param.userstatus != null and param.userstatus != ''">
|
|
AND e.status = #{param.userstatus}
|
|
</if>
|
|
<!-- 入职日期 -->
|
|
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
|
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
|
</if>
|
|
<!-- 人事状态 -->
|
|
<if test="param.personnelStatuss != null and param.personnelStatuss.size()>0">
|
|
AND e.status IN
|
|
<foreach collection="param.personnelStatuss" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 档案状态 -->
|
|
<!-- <if test="param.runStatusList != null and param.runStatusList.size()>0">-->
|
|
<!-- AND t.run_status IN-->
|
|
<!-- <foreach collection="param.runStatusList" open="(" item="runStatus" separator="," close=")">-->
|
|
<!-- #{runStatus}-->
|
|
<!-- </foreach>-->
|
|
<!-- </if>-->
|
|
</select>
|
|
|
|
<insert id="batchInsert">
|
|
INSERT INTO hrsa_salary_archive (
|
|
id,
|
|
employee_id,
|
|
create_time,
|
|
update_time,
|
|
creator,
|
|
tenant_key,
|
|
tax_agent_id,
|
|
pay_start_date,
|
|
pay_end_date,
|
|
run_status,
|
|
employee_type
|
|
)
|
|
VALUES
|
|
<foreach collection="collection" item="item" separator=",">
|
|
(
|
|
#{item.id},
|
|
#{item.employeeId},
|
|
#{item.createTime},
|
|
#{item.updateTime},
|
|
#{item.creator},
|
|
#{item.tenantKey},
|
|
#{item.taxAgentId},
|
|
#{item.payStartDate},
|
|
#{item.payEndDate},
|
|
#{item.runStatus},
|
|
#{item.employeeType}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchInsert" databaseId="oracle">
|
|
INSERT INTO hrsa_salary_archive (
|
|
id,
|
|
employee_id,
|
|
create_time,
|
|
update_time,
|
|
creator,
|
|
tenant_key,
|
|
tax_agent_id,
|
|
pay_start_date,
|
|
pay_end_date,
|
|
run_status,
|
|
employee_type
|
|
)
|
|
|
|
<foreach collection="collection" item="item" separator="union all">
|
|
select
|
|
#{item.id,jdbcType=DOUBLE},
|
|
#{item.employeeId,jdbcType=DOUBLE},
|
|
#{item.createTime,jdbcType=DATE},
|
|
#{item.updateTime,jdbcType=DATE},
|
|
#{item.creator,jdbcType=DOUBLE},
|
|
#{item.tenantKey,jdbcType=VARCHAR},
|
|
#{item.taxAgentId,jdbcType=DOUBLE},
|
|
#{item.payStartDate,jdbcType=DATE},
|
|
#{item.payEndDate,jdbcType=DATE},
|
|
#{item.runStatus,jdbcType=VARCHAR},
|
|
#{item.employeeType,jdbcType=INTEGER}
|
|
from dual
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchInsert" databaseId="sqlserver">
|
|
<foreach collection="collection" item="item" separator=";">
|
|
INSERT INTO hrsa_salary_archive (
|
|
id,
|
|
employee_id,
|
|
create_time,
|
|
update_time,
|
|
creator,
|
|
tenant_key,
|
|
tax_agent_id,
|
|
pay_start_date,
|
|
pay_end_date,
|
|
run_status,
|
|
employee_type
|
|
)
|
|
VALUES
|
|
(
|
|
#{item.id},
|
|
#{item.employeeId},
|
|
#{item.createTime},
|
|
#{item.updateTime},
|
|
#{item.creator},
|
|
#{item.tenantKey},
|
|
#{item.taxAgentId},
|
|
#{item.payStartDate},
|
|
#{item.payEndDate},
|
|
#{item.runStatus},
|
|
#{item.employeeType}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="batchUpdate" parameterType="java.util.List">
|
|
update hrsa_salary_archive
|
|
<trim prefix="set" suffixOverrides=",">
|
|
<trim prefix="run_status =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.runStatus!=null">
|
|
when id=#{item.id} then #{item.runStatus}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="pay_start_date =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.payStartDate!=null">
|
|
when id=#{item.id} then #{item.payStartDate}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="pay_end_date =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.payEndDate!=null">
|
|
when id=#{item.id} then #{item.payEndDate}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
<trim prefix="update_time =case" suffix="end,">
|
|
<foreach collection="collection" item="item" index="index">
|
|
<if test="item.updateTime!=null">
|
|
when id=#{item.id} then #{item.updateTime}
|
|
</if>
|
|
</foreach>
|
|
</trim>
|
|
</trim>
|
|
where
|
|
id in
|
|
<foreach collection="collection" item="item" index="index" separator="," open="(" close=")">
|
|
#{item.id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="batchUpdate" parameterType="java.util.List" databaseId="postgresql">
|
|
<foreach collection="collection" item="item" separator=";">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
<if test="item.runStatus != null">
|
|
run_status=#{item.runStatus},
|
|
</if>
|
|
<if test="item.payStartDate != null">
|
|
pay_start_date=#{item.payStartDate},
|
|
</if>
|
|
<if test="item.payEndDate != null">
|
|
pay_end_date=#{item.payEndDate},
|
|
</if>
|
|
</set>
|
|
WHERE id = #{item.id} AND delete_type = 0
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
<select id="getHistoryData" resultMap="BaseResultMap">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_salary_archive t
|
|
WHERE delete_type = 0 and tax_agent_id is null
|
|
</select>
|
|
|
|
<delete id="batchDeleteHistoryData" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
SET delete_type=1
|
|
WHERE delete_type = 0
|
|
and tax_agent_id is null
|
|
AND id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteByIds">
|
|
UPDATE hrsa_salary_archive
|
|
SET delete_type=1
|
|
WHERE delete_type = 0
|
|
AND id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="listSome" resultType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM
|
|
hrsa_salary_archive t
|
|
WHERE t.delete_type = 0
|
|
<if test="param.employeeId != null ">
|
|
AND t.employee_id = #{param.employeeId}
|
|
</if>
|
|
<if test="param.employeeIds != null and param.employeeIds.size()>0">
|
|
AND t.employee_id IN
|
|
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
|
|
#{employeeId}
|
|
</foreach>
|
|
</if>
|
|
<!-- 个税扣缴义务人 -->
|
|
<if test="param.taxAgentId != null">
|
|
AND t.tax_agent_id = #{param.taxAgentId}
|
|
</if>
|
|
<!-- 档案状态 -->
|
|
<if test="param.runStatus != null">
|
|
AND t.run_status = #{param.runStatus}
|
|
</if>
|
|
<!-- 档案状态 -->
|
|
<if test="param.runStatusList != null and param.runStatusList.size()>0">
|
|
AND t.run_status IN
|
|
<foreach collection="param.runStatusList" open="(" item="runStatus" separator="," close=")">
|
|
#{runStatus}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.ids != null and param.ids.size()>0">
|
|
AND t.id IN
|
|
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<if test="param.taxAgentIds != null and param.taxAgentIds.size()>0">
|
|
AND t.tax_agent_id IN
|
|
<foreach collection="param.taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
|
|
#{taxAgentId}
|
|
</foreach>
|
|
</if>
|
|
ORDER BY t.id DESC
|
|
</select>
|
|
|
|
<select id="getStatusIsNullData" resultMap="BaseResultMap">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_salary_archive t
|
|
WHERE run_status is null
|
|
</select>
|
|
|
|
<select id="listPayEndDateIsNull" resultType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_salary_archive t
|
|
WHERE t.delete_type=0
|
|
AND pay_end_date is null
|
|
AND employee_id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="listPayStartDateIsNull" resultType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_salary_archive t
|
|
WHERE t.delete_type=0
|
|
AND pay_start_date is null
|
|
AND run_status = #{runStatus}
|
|
</select>
|
|
|
|
<update id="updateStatus" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
run_status=#{runStatus}
|
|
</set>
|
|
WHERE id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="updateRunStatusByIdsAndPayEndDate"
|
|
parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
run_status=#{runStatus}
|
|
</set>
|
|
WHERE id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
and pay_end_date is null
|
|
</update>
|
|
|
|
<update id="updateFixed" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
run_status='FIXED'
|
|
</set>
|
|
WHERE run_status = 'SUSPEND' and pay_end_date is not null and pay_end_date <![CDATA[ > ]]> #{payEndDate}
|
|
</update>
|
|
|
|
<update id="updateSuspend" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
run_status='SUSPEND'
|
|
</set>
|
|
WHERE run_status = 'FIXED' and pay_end_date is not null and pay_end_date <![CDATA[ <= ]]> #{payEndDate}
|
|
</update>
|
|
|
|
<update id="gotoFixed" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
run_status='FIXED'
|
|
</set>
|
|
WHERE run_status = 'PENDING' and pay_start_date is not null
|
|
and id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="gotoStop" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
run_status='STOP_FROM_SUSPEND'
|
|
</set>
|
|
WHERE run_status = 'SUSPEND' and pay_end_date is not null
|
|
and id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="gotoPendingFromStop" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
run_status='PENDING'
|
|
</set>
|
|
WHERE run_status = 'STOP_FROM_PENDING'
|
|
and id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="gotoFixedFromStop" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
run_status='FIXED'
|
|
</set>
|
|
WHERE run_status = 'STOP_FROM_SUSPEND'
|
|
and id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="deletePendingTodo" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
run_status='STOP_FROM_PENDING'
|
|
</set>
|
|
WHERE run_status = 'PENDING'
|
|
and id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="deleteSuspendTodo" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
|
|
UPDATE hrsa_salary_archive
|
|
<set>
|
|
run_status='FIXED',
|
|
pay_end_date= null
|
|
</set>
|
|
WHERE id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
</mapper> |