815 lines
29 KiB
XML
815 lines
29 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.salarybill.SalarySendInfoMapper">
|
|
<resultMap id="BaseResultMap" type="com.engine.salary.entity.salaryBill.po.SalarySendInfoPO">
|
|
<result column="id" property="id"/>
|
|
<result column="salary_send_id" property="salarySendId"/>
|
|
<result column="salary_month" property="salaryMonth"/>
|
|
<result column="salary_acct_record_id" property="salaryAcctRecordId"/>
|
|
<result column="employee_id" property="employeeId"/>
|
|
<result column="tax_agent_id" property="taxAgentId"/>
|
|
<result column="send_status" property="sendStatus"/>
|
|
<result column="send_time" property="sendTime"/>
|
|
<result column="salary_template" property="salaryTemplate"/>
|
|
<result column="creator" property="creator"/>
|
|
<result column="create_time" property="createTime"/>
|
|
<result column="update_time" property="updateTime"/>
|
|
<result column="delete_type" property="deleteType"/>
|
|
<result column="tenant_key" property="tenantKey"/>
|
|
<result column="salary_acct_type" property="salaryAcctType"/>
|
|
<result column="employee_type" property="employeeType"/>
|
|
</resultMap>
|
|
|
|
<!-- 表字段 -->
|
|
<sql id="baseColumns">
|
|
t.id
|
|
, t.salary_send_id
|
|
, t.salary_month
|
|
, t.salary_acct_record_id
|
|
, t.employee_id
|
|
, t.tax_agent_id
|
|
, t.send_status
|
|
, t.send_time
|
|
, t.salary_template
|
|
, t.creator
|
|
, t.create_time
|
|
, t.update_time
|
|
, t.delete_type
|
|
, t.tenant_key
|
|
, t.salary_acct_type
|
|
, t.employee_type
|
|
, t.bill_read_status
|
|
, t.bill_confirm_status
|
|
, t.send_employee_id
|
|
</sql>
|
|
<update id="deleteBySalaryAcctRecordIds">
|
|
update hrsa_salary_send_info
|
|
set delete_type = 1
|
|
where salary_acct_record_id in
|
|
<foreach collection="salaryAcctRecordId" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
<select id="getById" resultType="com.engine.salary.entity.salaryBill.po.SalarySendInfoPO">
|
|
SELECT
|
|
<include refid="baseColumns"/>
|
|
FROM hrsa_salary_send_info t
|
|
WHERE delete_type = 0
|
|
AND id = #{id}
|
|
</select>
|
|
|
|
<insert id="batchInsert">
|
|
INSERT INTO hrsa_salary_send_info (
|
|
id,
|
|
salary_send_id,
|
|
salary_month,
|
|
salary_acct_record_id,
|
|
tax_agent_id,
|
|
employee_id,
|
|
send_status,
|
|
creator,
|
|
create_time,
|
|
update_time,
|
|
tenant_key,
|
|
salary_acct_type,
|
|
employee_type
|
|
)
|
|
VALUES
|
|
<foreach collection="collection" item="item" separator=",">
|
|
(
|
|
#{item.id},
|
|
#{item.salarySendId},
|
|
#{item.salaryMonth},
|
|
#{item.salaryAcctRecordId},
|
|
#{item.taxAgentId},
|
|
#{item.employeeId},
|
|
#{item.sendStatus},
|
|
#{item.creator},
|
|
#{item.createTime},
|
|
#{item.updateTime},
|
|
#{item.tenantKey},
|
|
#{item.salaryAcctType},
|
|
#{item.employeeType}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchInsert" databaseId="oracle">
|
|
INSERT INTO hrsa_salary_send_info (
|
|
id,
|
|
salary_send_id,
|
|
salary_month,
|
|
salary_acct_record_id,
|
|
tax_agent_id,
|
|
employee_id,
|
|
send_status,
|
|
creator,
|
|
create_time,
|
|
update_time,
|
|
tenant_key,
|
|
salary_acct_type,
|
|
employee_type
|
|
)
|
|
|
|
<foreach collection="collection" item="item" separator="union all">
|
|
select
|
|
#{item.id,jdbcType=DOUBLE},
|
|
#{item.salarySendId,jdbcType=DOUBLE},
|
|
#{item.salaryMonth,jdbcType=DATE},
|
|
#{item.salaryAcctRecordId,jdbcType=DOUBLE},
|
|
#{item.taxAgentId,jdbcType=DOUBLE},
|
|
#{item.employeeId,jdbcType=DOUBLE},
|
|
#{item.sendStatus,jdbcType=INTEGER},
|
|
#{item.creator,jdbcType=DOUBLE},
|
|
#{item.createTime,jdbcType=DATE},
|
|
#{item.updateTime,jdbcType=DATE},
|
|
#{item.tenantKey,jdbcType=VARCHAR},
|
|
#{item.salaryAcctType,jdbcType=INTEGER},
|
|
#{item.employeeType,jdbcType=INTEGER}
|
|
from dual
|
|
</foreach>
|
|
</insert>
|
|
<insert id="batchInsert" databaseId="sqlserver">
|
|
<foreach collection="collection" item="item" separator=";">
|
|
INSERT INTO hrsa_salary_send_info (
|
|
id,
|
|
salary_send_id,
|
|
salary_month,
|
|
salary_acct_record_id,
|
|
tax_agent_id,
|
|
employee_id,
|
|
send_status,
|
|
creator,
|
|
create_time,
|
|
update_time,
|
|
tenant_key,
|
|
salary_acct_type,
|
|
employee_type
|
|
)
|
|
VALUES
|
|
(
|
|
#{item.id},
|
|
#{item.salarySendId},
|
|
#{item.salaryMonth},
|
|
#{item.salaryAcctRecordId},
|
|
#{item.taxAgentId},
|
|
#{item.employeeId},
|
|
#{item.sendStatus},
|
|
#{item.creator},
|
|
#{item.createTime},
|
|
#{item.updateTime},
|
|
#{item.tenantKey},
|
|
#{item.salaryAcctType},
|
|
#{item.employeeType}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<sql id="salarySendInfoColumn">
|
|
t1.id,
|
|
t1.salary_acct_record_id as salaryAcctRecordId,
|
|
t1.salary_acct_type as salaryAcctType,
|
|
t1.tax_agent_id as taxAgentId,
|
|
e.lastname as username,
|
|
t2.name AS tax_agent,
|
|
d.departmentname AS department,
|
|
e.mobile,
|
|
e.workcode as jobNum,
|
|
t1.send_status,
|
|
t1.employee_id,
|
|
t1.salary_month,
|
|
t1.employee_type,
|
|
t1.bill_read_status as billReadStatus,
|
|
t1.bill_confirm_status as billConfirmStatus,
|
|
e.email
|
|
</sql>
|
|
|
|
<sql id="paramSql">
|
|
<if test="param.ids != null and param.ids.size()>0">
|
|
AND t1.id IN
|
|
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
<!-- 个税扣缴义务人id -->
|
|
<if test="param.salarySendId != null">
|
|
AND t1.salary_send_id = #{param.salarySendId}
|
|
</if>
|
|
<!-- 关键字 -->
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
AND e.lastname like CONCAT('%',#{param.keyword},'%')
|
|
</if>
|
|
<!-- 姓名 -->
|
|
<if test="param.username != null and param.username != ''">
|
|
AND e.lastname like CONCAT('%',#{param.username},'%')
|
|
</if>
|
|
<if test="param.userId != null">
|
|
AND e.id = #{param.userId}
|
|
</if>
|
|
<!-- 个税扣缴义务人id -->
|
|
<if test="param.taxAgentId != null">
|
|
AND t2.id = #{param.taxAgentId}
|
|
</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.sendStatuss != null and param.sendStatuss.size() > 0">
|
|
AND t1.send_status IN
|
|
<foreach collection="param.sendStatuss" open="(" item="status" separator="," close=")">
|
|
#{status}
|
|
</foreach>
|
|
</if>
|
|
<!-- 入职日期 -->
|
|
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
|
AND (e.hiredate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
|
</if>
|
|
</sql>
|
|
<sql id="paramSql" databaseId="oracle">
|
|
<if test="param.ids != null and param.ids.size()>0">
|
|
AND t1.id IN
|
|
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="param.salarySendId != null">
|
|
AND t1.salary_send_id = #{param.salarySendId}
|
|
</if>
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
AND e.lastname like '%'||#{param.keyword}||'%'
|
|
</if>
|
|
|
|
<if test="param.username != null and param.username != ''">
|
|
AND e.lastname like '%'||#{param.username}||'%'
|
|
</if>
|
|
|
|
<if test="param.userId != null">
|
|
AND e.id = #{param.userId}
|
|
</if>
|
|
|
|
<if test="param.taxAgentId != null">
|
|
AND t2.id = #{param.taxAgentId}
|
|
</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.sendStatuss != null and param.sendStatuss.size() > 0">
|
|
AND t1.send_status IN
|
|
<foreach collection="param.sendStatuss" open="(" item="status" separator="," close=")">
|
|
#{status}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
|
AND (e.hiredate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
|
</if>
|
|
</sql>
|
|
<sql id="paramSql" databaseId="sqlserver">
|
|
<if test="param.ids != null and param.ids.size()>0">
|
|
AND t1.id IN
|
|
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="param.salarySendId != null">
|
|
AND t1.salary_send_id = #{param.salarySendId}
|
|
</if>
|
|
|
|
<if test="param.keyword != null and param.keyword != ''">
|
|
AND e.lastname like '%'+#{param.keyword}+'%'
|
|
</if>
|
|
|
|
<if test="param.username != null and param.username != ''">
|
|
AND e.lastname like '%'+#{param.username}+'%'
|
|
</if>
|
|
|
|
<if test="param.userId != null">
|
|
AND e.id = #{param.userId}
|
|
</if>
|
|
|
|
<if test="param.taxAgentId != null">
|
|
AND t2.id = #{param.taxAgentId}
|
|
</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.sendStatuss != null and param.sendStatuss.size() > 0">
|
|
AND t1.send_status IN
|
|
<foreach collection="param.sendStatuss" open="(" item="status" separator="," close=")">
|
|
#{status}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="param.hiredate != null and param.hiredate.size() == 2">
|
|
AND (e.hiredate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
|
|
</if>
|
|
</sql>
|
|
|
|
<select id="list" resultType="com.engine.salary.entity.salaryBill.dto.SalarySendInfoListDTO">
|
|
SELECT
|
|
<include refid="salarySendInfoColumn"/>
|
|
FROM
|
|
hrsa_salary_send_info t1
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t2.id = t1.tax_agent_id
|
|
WHERE
|
|
t1.delete_type = 0
|
|
|
|
<!-- 发送状态 -->
|
|
<if test="param.sendStatusVal != null">
|
|
AND t1.send_status = #{param.sendStatusVal}
|
|
</if>
|
|
<if test="param.isGranted != null">
|
|
<if test="param.isGranted">
|
|
and t1.send_status = 1
|
|
</if>
|
|
<if test="!param.isGranted">
|
|
and t1.send_status in (0, 2)
|
|
</if>
|
|
</if>
|
|
<include refid="paramSql"/>
|
|
<!-- 排序 -->
|
|
<if test="param.orderRule != null">
|
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
|
</if>
|
|
</select>
|
|
<select id="list" resultType="com.engine.salary.entity.salaryBill.dto.SalarySendInfoListDTO" databaseId="oracle">
|
|
SELECT
|
|
|
|
<include refid="salarySendInfoColumn"/>
|
|
|
|
FROM
|
|
hrsa_salary_send_info t1
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t2.id = t1.tax_agent_id
|
|
WHERE
|
|
t1.delete_type = 0
|
|
|
|
<if test="param.sendStatusVal != null">
|
|
AND t1.send_status = #{param.sendStatusVal}
|
|
</if>
|
|
<if test="param.isGranted != null">
|
|
<if test="param.isGranted">
|
|
and t1.send_status = 1
|
|
</if>
|
|
<if test="!param.isGranted">
|
|
and t1.send_status in (0, 2)
|
|
</if>
|
|
</if>
|
|
<include refid="paramSql"/>
|
|
<!-- 排序 -->
|
|
<if test="param.orderRule != null">
|
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
|
</if>
|
|
</select>
|
|
<select id="list" resultType="com.engine.salary.entity.salaryBill.dto.SalarySendInfoListDTO" databaseId="sqlserver">
|
|
SELECT
|
|
|
|
<include refid="salarySendInfoColumn"/>
|
|
|
|
FROM
|
|
hrsa_salary_send_info t1
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t2.id = t1.tax_agent_id
|
|
WHERE t1.delete_type = 0
|
|
<if test="param.sendStatusVal != null">
|
|
AND t1.send_status = #{param.sendStatusVal}
|
|
</if>
|
|
<if test="param.isGranted != null">
|
|
<if test="param.isGranted">
|
|
and t1.send_status = 1
|
|
</if>
|
|
<if test="!param.isGranted">
|
|
and t1.send_status in (0, 2)
|
|
</if>
|
|
</if>
|
|
|
|
<include refid="paramSql"/>
|
|
<!-- 排序 -->
|
|
<if test="param.orderRule != null">
|
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="listSalaryAccRecordIds" resultType="java.lang.Long">
|
|
SELECT distinct
|
|
salary_acct_record_id
|
|
FROM
|
|
hrsa_salary_send_info t1
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t2.id = t1.tax_agent_id
|
|
WHERE
|
|
t1.delete_type = 0
|
|
<include refid="paramSql"/>
|
|
</select>
|
|
|
|
<select id="listSalaryAccRecordIds" resultType="java.lang.Long" databaseId="oracle">
|
|
SELECT distinct
|
|
salary_acct_record_id
|
|
FROM
|
|
hrsa_salary_send_info t1
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t2.id = t1.tax_agent_id
|
|
WHERE
|
|
t1.delete_type = 0
|
|
<include refid="paramSql"/>
|
|
</select>
|
|
|
|
<select id="listSalaryAccRecordIds" resultType="java.lang.Long" databaseId="sqlserver">
|
|
SELECT distinct
|
|
salary_acct_record_id
|
|
FROM
|
|
hrsa_salary_send_info t1
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t2.id = t1.tax_agent_id
|
|
WHERE
|
|
t1.delete_type = 0
|
|
<include refid="paramSql"/>
|
|
</select>
|
|
|
|
<select id="detailList" resultType="com.engine.salary.entity.salaryBill.dto.SalarySendDetailListDTO">
|
|
SELECT
|
|
<include refid="salarySendInfoColumn"/>
|
|
FROM
|
|
hrsa_salary_send_info t1
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t2.id = t1.tax_agent_id
|
|
WHERE
|
|
t1.delete_type = 0
|
|
<!-- 合并计税 todo -->
|
|
<if test="param.mergeCountTax != null">
|
|
and (t1.employee_id, t1.tax_agent_id)
|
|
in (select employee_id, tax_agent_id
|
|
from hrsa_salary_send_info
|
|
where delete_type = 0 and salary_acct_record_id in (
|
|
<foreach collection="otherSalaryAccRecordIds" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
))
|
|
</if>
|
|
<include refid="paramSql"/>
|
|
<!-- 排序 -->
|
|
<if test="param.orderRule != null">
|
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
|
</if>
|
|
</select>
|
|
<select id="detailList" resultType="com.engine.salary.entity.salaryBill.dto.SalarySendDetailListDTO" databaseId="oracle">
|
|
SELECT
|
|
<include refid="salarySendInfoColumn"/>
|
|
FROM
|
|
hrsa_salary_send_info t1
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t2.id = t1.tax_agent_id
|
|
WHERE
|
|
t1.delete_type = 0
|
|
<if test="param.mergeCountTax != null">
|
|
and (t1.employee_id, t1.tax_agent_id)
|
|
in (select employee_id, tax_agent_id
|
|
from hrsa_salary_send_info
|
|
where delete_type = 0 and salary_acct_record_id in (
|
|
<foreach collection="otherSalaryAccRecordIds" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
))
|
|
</if>
|
|
<include refid="paramSql"/>
|
|
<!-- 排序 -->
|
|
<if test="param.orderRule != null">
|
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
|
</if>
|
|
</select>
|
|
<select id="detailList" resultType="com.engine.salary.entity.salaryBill.dto.SalarySendDetailListDTO" databaseId="sqlserver">
|
|
SELECT
|
|
<include refid="salarySendInfoColumn"/>
|
|
FROM
|
|
hrsa_salary_send_info t1
|
|
LEFT JOIN hrmresource e ON e.id = t1.employee_id
|
|
LEFT JOIN hrmdepartment d ON d.id = e.DEPARTMENTID
|
|
LEFT JOIN hrmsubcompany c ON c.id = e.subcompanyid1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t2.id = t1.tax_agent_id
|
|
WHERE
|
|
t1.delete_type = 0
|
|
<if test="param.mergeCountTax != null">
|
|
and (t1.employee_id, t1.tax_agent_id)
|
|
in (select employee_id, tax_agent_id
|
|
from hrsa_salary_send_info
|
|
where delete_type = 0 and salary_acct_record_id in (
|
|
<foreach collection="otherSalaryAccRecordIds" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
))
|
|
</if>
|
|
<include refid="paramSql"/>
|
|
<!-- 排序 -->
|
|
<if test="param.orderRule != null">
|
|
ORDER BY ${param.orderRule.orderRule} ${param.orderRule.ascOrDesc}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="mySalaryBillList" resultType="com.engine.salary.entity.salaryBill.dto.SalaryMySalaryBillListDTO">
|
|
SELECT
|
|
t1.id,
|
|
t1.salary_month AS salaryYearMonth,
|
|
t2.name AS tax_agent,
|
|
t3.acct_times,
|
|
t1.send_time,
|
|
t1.send_status
|
|
FROM
|
|
hrsa_salary_send_info t1
|
|
LEFT JOIN hrsa_tax_agent t2 ON t2.id = t1.tax_agent_id
|
|
LEFT JOIN hrsa_salary_acct_record t3 ON t3.id = t1.salary_acct_record_id
|
|
WHERE
|
|
t1.delete_type = 0 AND t1.send_status = 1
|
|
<!-- id -->
|
|
<if test="param.id != null">
|
|
AND t1.id = #{param.id}
|
|
</if>
|
|
<!-- 人员id -->
|
|
<if test="param.employeeId != null">
|
|
AND t1.employee_id = #{param.employeeId}
|
|
</if>
|
|
<!-- 薪资所属月 -->
|
|
<if test="param.salaryMonth != null">
|
|
<if test="param.salaryMonth.size() == 1">
|
|
AND t1.salary_month = #{param.salaryMonth[0]}
|
|
</if>
|
|
<if test="param.salaryMonth.size() == 2">
|
|
AND (t1.salary_month BETWEEN #{param.salaryMonth[0]} AND #{param.salaryMonth[1]})
|
|
</if>
|
|
</if>
|
|
<if test="param.startSalaryMonth != null">
|
|
AND t1.salary_month >= #{param.startSalaryMonth}
|
|
</if>
|
|
ORDER BY t1.id DESC
|
|
</select>
|
|
|
|
|
|
<update id="updateGrantWithdraw">
|
|
UPDATE
|
|
hrsa_salary_send_info
|
|
|
|
<set>
|
|
<if test="po.sendStatus != null">
|
|
send_status = #{po.sendStatus},
|
|
</if>
|
|
<if test="po.sendTime != null">
|
|
send_time = #{po.sendTime},
|
|
</if>
|
|
<if test="po.deleteType != null">
|
|
delete_type = #{po.deleteType},
|
|
</if>
|
|
<if test="po.salaryTemplate != null">
|
|
salary_template = #{po.salaryTemplate},
|
|
</if>
|
|
<if test="po.billReadStatus != null">
|
|
bill_read_status = #{po.billReadStatus},
|
|
</if>
|
|
<if test="po.billConfirmStatus != null">
|
|
bill_confirm_status = #{po.billConfirmStatus},
|
|
</if>
|
|
<if test="po.sendEmployeeId != null">
|
|
send_employee_id = #{po.sendEmployeeId}
|
|
</if>
|
|
</set>
|
|
|
|
WHERE
|
|
delete_type = 0
|
|
<if test="statusList != null and statusList.size() > 0">
|
|
AND send_status IN
|
|
|
|
<foreach collection="statusList" open="(" item="status" separator="," close=")">
|
|
#{status}
|
|
</foreach>
|
|
</if>
|
|
|
|
|
|
<if test="ids != null and ids.size() > 0">
|
|
AND id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
|
|
AND salary_send_id = #{salarySendId}
|
|
</update>
|
|
|
|
<!-- 条件查询 -->
|
|
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.salaryBill.po.SalaryTemplatePO">
|
|
SELECT
|
|
<include refid="baseColumns" />
|
|
FROM hrsa_salary_send_info t
|
|
WHERE delete_type = 0
|
|
<if test="id != null and id != ''">
|
|
AND id = #{id}
|
|
</if>
|
|
<if test="salarySendId != null and salarySendId != ''">
|
|
AND salary_send_id = #{salarySendId}
|
|
</if>
|
|
<if test="salaryMonth != null and salaryMonth != ''">
|
|
AND salary_month = #{salaryMonth}
|
|
</if>
|
|
<if test="salaryAcctRecordId != null and salaryAcctRecordId != ''">
|
|
AND salary_acct_record_id = #{salaryAcctRecordId}
|
|
</if>
|
|
<if test="employeeId != null and employeeId != ''">
|
|
AND employee_id = #{employeeId}
|
|
</if>
|
|
<if test="taxAgentId != null and taxAgentId != ''">
|
|
AND tax_agent_id = #{taxAgentId}
|
|
</if>
|
|
<if test="sendStatus != null and sendStatus != ''">
|
|
AND send_status = #{sendStatus}
|
|
</if>
|
|
<if test="sendTime != null and sendTime != ''">
|
|
AND send_time = #{sendTime}
|
|
</if>
|
|
<if test="salaryTemplate != null and salaryTemplate != ''">
|
|
AND salary_template = #{salaryTemplate}
|
|
</if>
|
|
<if test="creator != null and creator != ''">
|
|
AND creator = #{creator}
|
|
</if>
|
|
<if test="createTime != null and createTime != ''">
|
|
AND create_time = #{createTime}
|
|
</if>
|
|
<if test="updateTime != null and updateTime != ''">
|
|
AND update_time = #{updateTime}
|
|
</if>
|
|
<if test="deleteType != null and deleteType != ''">
|
|
AND delete_type = #{deleteType}
|
|
</if>
|
|
<if test="tenantKey != null and tenantKey != ''">
|
|
AND tenant_key = #{tenantKey}
|
|
</if>
|
|
<if test="billConfirmStatus != null and billConfirmStatus != ''">
|
|
AND bill_confirm_status = #{billConfirmStatus}
|
|
</if>
|
|
<if test="billReadStatus != null and billReadStatus != ''">
|
|
AND bill_read_status = #{billReadStatus}
|
|
</if>
|
|
ORDER BY id DESC
|
|
</select>
|
|
<select id="getNeedSendInfoList" resultType="com.engine.salary.entity.salaryBill.po.SalarySendInfoPO">
|
|
select id,salary_send_id
|
|
from hrsa_salary_send_info a
|
|
where a.delete_type=0
|
|
and a.send_status in (0,2)
|
|
and (a.salary_acct_type!=1 or a.salary_acct_type is null)
|
|
<if test="salarySendIds != null and salarySendIds.size() > 0">
|
|
AND a.salary_send_id IN
|
|
<foreach collection="salarySendIds" open="(" item="salarySendId" separator="," close=")">
|
|
#{salarySendId}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
<select id="listUnConfirmedSendInfo" resultType="com.engine.salary.entity.salaryBill.po.SalarySendInfoPO">
|
|
SELECT
|
|
<include refid="baseColumns" />
|
|
FROM hrsa_salary_send_info t
|
|
LEFT JOIN hrsa_salary_send s
|
|
ON t.salary_send_id = s.id
|
|
WHERE t.delete_type = 0
|
|
AND t.send_status = 1
|
|
AND s.salary_sob_id IN
|
|
<foreach collection="salarySobIds" separator="," item="salarySobId" open="(" close=")">
|
|
#{salarySobId}
|
|
</foreach>
|
|
AND (t.bill_confirm_status = 0 or bill_confirm_status is null)
|
|
</select>
|
|
|
|
|
|
<!-- 更新不为NULL的字段 -->
|
|
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salaryBill.po.SalarySendInfoPO">
|
|
UPDATE hrsa_salary_send_info
|
|
<set>
|
|
<if test="salarySendId != null">
|
|
salary_send_id=#{salarySendId},
|
|
</if>
|
|
<if test="salaryMonth != null">
|
|
salary_month=#{salaryMonth},
|
|
</if>
|
|
<if test="salaryAcctRecordId != null">
|
|
salary_acct_record_id=#{salaryAcctRecordId},
|
|
</if>
|
|
<if test="employeeId != null">
|
|
employee_id=#{employeeId},
|
|
</if>
|
|
<if test="taxAgentId != null">
|
|
tax_agent_id=#{taxAgentId},
|
|
</if>
|
|
<if test="sendStatus != null">
|
|
send_status=#{sendStatus},
|
|
</if>
|
|
<if test="sendTime != null">
|
|
send_time=#{sendTime},
|
|
</if>
|
|
<if test="salaryTemplate != null">
|
|
salary_template=#{salaryTemplate},
|
|
</if>
|
|
<if test="creator != null">
|
|
creator=#{creator},
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time=#{createTime},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time=#{updateTime},
|
|
</if>
|
|
<if test="deleteType != null">
|
|
delete_type=#{deleteType},
|
|
</if>
|
|
<if test="tenantKey != null">
|
|
tenant_key=#{tenantKey},
|
|
</if>
|
|
<if test="billReadStatus != null">
|
|
bill_read_status=#{billReadStatus},
|
|
</if>
|
|
<if test="billConfirmStatus != null">
|
|
bill_confirm_status=#{billConfirmStatus},
|
|
</if>
|
|
</set>
|
|
WHERE id = #{id} AND delete_type = 0
|
|
</update>
|
|
<update id="autoConfirmSalaryBill">
|
|
UPDATE hrsa_salary_send_info
|
|
set
|
|
bill_confirm_status = 1
|
|
where
|
|
delete_type = 0
|
|
<if test="ids != null and ids.size() > 0">
|
|
AND id IN
|
|
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
</update>
|
|
|
|
</mapper>
|