三表一册数据来源

This commit is contained in:
方亮 2025-09-25 15:52:43 +08:00
parent 43f47ec34d
commit 0abe4478d9
4 changed files with 17 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import lombok.Data;
@Data
public class AttProMonthPo {
private Integer id;
private Integer proId;
private String month;
private Integer rosterNum;

View File

@ -92,9 +92,11 @@ public interface WorkerJobMapper {
List<AttProMonthPo> getProMonthData(String lastMonth);
boolean getProMonthDataByTable(AttProMonthPo attProMonthPo);
Integer getProMonthDataByTable(AttProMonthPo attProMonthPo);
void insertProMonthData(AttProMonthPo attProMonthPo);
void updateProMonthData(AttProMonthPo attProMonthPo);
void updateMonthId(AttProMonthPo attProMonthPo);
}

View File

@ -137,13 +137,16 @@ public class ThreeTableOneRosterTask {
//获取整合数据
List<AttProMonthPo> listRosterMonthAll = mapper.getProMonthData(lastMonth.toString());
for (AttProMonthPo attProMonthPo : listRosterMonthAll) {
boolean isExistMonth =mapper.getProMonthDataByTable(attProMonthPo);
if(isExistMonth){
Integer id =mapper.getProMonthDataByTable(attProMonthPo);
if(id>0){
attProMonthPo.setId(id);
mapper.updateProMonthData(attProMonthPo);
}else{
mapper.insertProMonthData(attProMonthPo);
}
mapper.updateMonthId(attProMonthPo);
}
}
}catch (Exception e){
logger.error("人员入场更新表失败,{}",e.getMessage());

View File

@ -321,16 +321,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pro_id
</select>
<select id="getProMonthDataByTable" resultType="boolean">
<select id="getProMonthDataByTable" resultType="Integer">
SELECT
COUNT(1) AS count
id
FROM
tb_pro_month_table
WHERE
table_month = #{month} and pro_id = #{proId}
limit 1
</select>
<insert id="insertProMonthData">
<insert id="insertProMonthData" keyProperty="id" keyColumn="id" useGeneratedKeys="true">
insert into tb_pro_month_table(pro_id,table_month,roster_num,attendance_num,repair_num,salary_num,sub_num,team_num,gross_salary,net_salary,pay_num)
values(#{proId},#{month},#{rosterNum},#{attendanceNum},#{repairNum},#{salaryNum},#{subNum},#{teamNum},#{grossSalary},#{netSalary},#{payNum})
</insert>
@ -340,4 +341,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sub_num=#{subNum},team_num=#{teamNum},gross_salary=#{grossSalary},net_salary=#{netSalary},pay_num=#{payNum}
where pro_id=#{proId} and table_month=#{month}
</update>
<update id="updateMonthId">
update tb_pro_month_table_roster set month_id=#{id} where pro_id=#{proId} and month=#{month}
</update>
</mapper>