三表一册数据来源

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 @Data
public class AttProMonthPo { public class AttProMonthPo {
private Integer id;
private Integer proId; private Integer proId;
private String month; private String month;
private Integer rosterNum; private Integer rosterNum;

View File

@ -92,9 +92,11 @@ public interface WorkerJobMapper {
List<AttProMonthPo> getProMonthData(String lastMonth); List<AttProMonthPo> getProMonthData(String lastMonth);
boolean getProMonthDataByTable(AttProMonthPo attProMonthPo); Integer getProMonthDataByTable(AttProMonthPo attProMonthPo);
void insertProMonthData(AttProMonthPo attProMonthPo); void insertProMonthData(AttProMonthPo attProMonthPo);
void updateProMonthData(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()); List<AttProMonthPo> listRosterMonthAll = mapper.getProMonthData(lastMonth.toString());
for (AttProMonthPo attProMonthPo : listRosterMonthAll) { for (AttProMonthPo attProMonthPo : listRosterMonthAll) {
boolean isExistMonth =mapper.getProMonthDataByTable(attProMonthPo); Integer id =mapper.getProMonthDataByTable(attProMonthPo);
if(isExistMonth){ if(id>0){
attProMonthPo.setId(id);
mapper.updateProMonthData(attProMonthPo); mapper.updateProMonthData(attProMonthPo);
}else{ }else{
mapper.insertProMonthData(attProMonthPo); mapper.insertProMonthData(attProMonthPo);
} }
mapper.updateMonthId(attProMonthPo);
} }
} }
}catch (Exception e){ }catch (Exception e){
logger.error("人员入场更新表失败,{}",e.getMessage()); logger.error("人员入场更新表失败,{}",e.getMessage());

View File

@ -321,16 +321,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pro_id pro_id
</select> </select>
<select id="getProMonthDataByTable" resultType="boolean"> <select id="getProMonthDataByTable" resultType="Integer">
SELECT SELECT
COUNT(1) AS count id
FROM FROM
tb_pro_month_table tb_pro_month_table
WHERE WHERE
table_month = #{month} and pro_id = #{proId} table_month = #{month} and pro_id = #{proId}
limit 1
</select> </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) 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}) values(#{proId},#{month},#{rosterNum},#{attendanceNum},#{repairNum},#{salaryNum},#{subNum},#{teamNum},#{grossSalary},#{netSalary},#{payNum})
</insert> </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} sub_num=#{subNum},team_num=#{teamNum},gross_salary=#{grossSalary},net_salary=#{netSalary},pay_num=#{payNum}
where pro_id=#{proId} and table_month=#{month} where pro_id=#{proId} and table_month=#{month}
</update> </update>
<update id="updateMonthId">
update tb_pro_month_table_roster set month_id=#{id} where pro_id=#{proId} and month=#{month}
</update>
</mapper> </mapper>