Commit 6283fa65 authored by 廖旭伟's avatar 廖旭伟

考勤组删除人员后删除当月考勤汇总数据

parent 80ea368c
......@@ -6,6 +6,8 @@ import com.mortals.framework.model.Result;
import com.mortals.xhx.module.attendance.model.AttendanceStatEntity;
import com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery;
import java.util.Map;
/**
* 考勤汇总信息Dao
* 考勤汇总信息 DAO接口
......@@ -22,4 +24,17 @@ public interface AttendanceStatDao extends ICRUDDao<AttendanceStatEntity,Long>{
Result<AttendanceStatEntity> getListExt(AttendanceSummaryQuery params, PageInfo pageInfo);
/**
* 删除当前月份没有在考勤组的数据
* @param condition
* @return
*/
int deleteAttendanceStat(Map<String,Object> condition);
/**
* 删除当前月份没有在考勤组的数据
* @param condition
* @return
*/
int deleteAttendanceStaffStat(Map<String,Object> condition);
}
......@@ -13,6 +13,7 @@ import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 考勤汇总信息DaoImpl DAO接口
......@@ -65,4 +66,22 @@ public class AttendanceStatDaoImpl extends BaseCRUDDaoMybatis<AttendanceStatEnti
public int getCountExt(AttendanceSummaryQuery paramDto) {
return (Integer)this.getSqlSession().selectOne(this.getSqlId("getListCountExt"), paramDto);
}
@Override
public int deleteAttendanceStat(Map<String, Object> condition) {
if (condition != null && !condition.isEmpty()) {
return this.getSqlSession().delete(this.getSqlId("deleteAttendanceStat"), condition);
} else {
return 0;
}
}
@Override
public int deleteAttendanceStaffStat(Map<String, Object> condition) {
if (condition != null && !condition.isEmpty()) {
return this.getSqlSession().delete(this.getSqlId("deleteAttendanceStaffStat"), condition);
} else {
return 0;
}
}
}
......@@ -27,5 +27,10 @@ public interface AttendanceStatService extends ICRUDService<AttendanceStatEntity
void homeStat(Context context) throws AppException;
/**
* 删除不在考勤组的考勤汇总数据
* @param year
* @param month
*/
void removeNotInGroupStaff(Integer year,Integer month);
}
\ No newline at end of file
......@@ -696,4 +696,13 @@ public class AttendanceStatServiceImpl extends AbstractCRUDServiceImpl<Attendanc
cacheService.set(RedisKey.KEY_HOME_STAT_CACHE, JSON.toJSONString(homeStatInfo));
}
@Override
public void removeNotInGroupStaff(Integer year, Integer month) {
Map<String,Object> condition = new HashMap<>();
condition.put("year",year);
condition.put("month",month);
dao.deleteAttendanceStat(condition);
dao.deleteAttendanceStaffStat(condition);
}
}
\ No newline at end of file
......@@ -55,7 +55,7 @@ public class AttendanceGroupController extends BaseCRUDJsonBodyMappingController
@Autowired
private AttendanceGroupFreeworkService freeworkService;
@Autowired
private AttendanceGroupService attendanceGroupService;
private AttendanceStatService attendanceStatService;
public AttendanceGroupController(){
super.setModuleDesc( "考勤组信息");
......@@ -110,6 +110,10 @@ public class AttendanceGroupController extends BaseCRUDJsonBodyMappingController
entity.getAttendanceGroupFreeworkEntity().setCreateTime(new Date());
freeworkService.save(entity.getAttendanceGroupFreeworkEntity(),context);
}
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
attendanceStatService.removeNotInGroupStaff(year,month);
return super.saveAfter(entity, model, context);
}
......
......@@ -143,4 +143,12 @@
s.staffName
) AS a
</select>
<!-- 删除当前月份没有在考勤组的数据 -->
<delete id="deleteAttendanceStat" parameterType="Map">
DELETE FROM mortals_xhx_attendance_stat WHERE `year` = #{year} AND `month` = #{month} AND staffId NOT IN (SELECT staffId FROM mortals_xhx_attendance_group_staff)
</delete>
<delete id="deleteAttendanceStaffStat" parameterType="Map">
DELETE FROM mortals_xhx_attendance_staff_stat WHERE `year` = #{year} AND `month` = #{month} AND staffId NOT IN (SELECT staffId FROM mortals_xhx_attendance_group_staff)
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment