薪酬问题手册
所有离职人员的缺勤扣款都不对
代码修改:
细分 EntryLeave的本月是否入离职(0法定节假日之前入职,1入,2离,3入离)
/**
* 计算缺勤扣款及调整后的缺勤时长
*
* 当没有缺勤时,缺勤扣款为0
* 当实际算薪时长为0时,缺勤扣款为税前工资合计
* 其他情况:
* 一.
* 1、在职状态为在职and入职日期在当月法定节假日之后
* 2、在职状态为离职and离职日期在当月法定节假之前
* 3、在职状态为离职and入职日期在当月法定节假日之后and离职日期在当月法定节假之后
* 缺勤扣款[(基本工资+岗位工资+满额绩效+全勤奖)/(应出勤时长+节假日工时+节假日调整工时)*(缺勤工时+节假日工时+节假日调整工时]
* 二.
* 1、在职状态为在职and在当月法定节假日之前入职
* 2、在职状态为离职and在当月法定节假日之前入职and离职日期在当月法定节假之后
* 缺勤扣款[(基本工资+岗位工资+满额绩效+全勤奖)/(应出勤时长+节假日工时+节假日调整工时)*缺勤工时]
* @param compWage
* @param absenceSum
* @return
*/
public static CompWage meritPay(CompWage compWage, BigDecimal absenceSum) throws ParseException {
CompAtteMonth compAtteMonth = new CompAtteMonth();
compAtteMonth.setUserId(compWage.getUserId());
compAtteMonth.setMonthStr(compWage.getDataStr());
List<CompAtteMonth> compAtteMonthList = compAtteMonthService.selectCompAtteMonthList(compAtteMonth);
for (CompAtteMonth compAtteMonth1 : compAtteMonthList) {
BigDecimal absenceWithhold = new BigDecimal(0);//缺勤扣款
BigDecimal divide = new BigDecimal(1);
compAtteMonth1.setReallyAbsenteeismTime(null);
compAtteMonth1.setSalaryHour(compAtteMonth1.getSalaryHour());
compAtteMonth1.setAbsenteeismTime(compAtteMonth1.getAbsenteeismTime());//调整后的缺勤时长=应出勤时长-实际算薪时长
BigDecimal absenteeismTime = compAtteMonth1.getAbsenteeismTime();//调整后缺勤时长
BigDecimal multiply = absenteeismTime;
//0正式工计时工资 (1,2 计件工资劳务派遣工资 没有缺勤扣款) 3固定工资-入离职日期计算 4计时+计件工资
if (compAtteMonth1.getType().equals("0") || compAtteMonth1.getType().equals("4")) { //正式工:
if (compAtteMonth1.getAbsenteeismTime().doubleValue() <= 0) { //正式工:调整后的缺勤时长=0 则:扣款=0
} else if (compAtteMonth1.getSalaryHour().doubleValue() <= 0) { //正式工:当实际算薪时长为0时,缺勤扣款=税前工资合计
absenceWithhold = absenceSum;
} else { //本月是否入离职(0法定节假日之前入职,1入,2离,3入离)
divide = new BigDecimal(compAtteMonth1.getEchoWorkHour()).add(compAtteMonth1.getHolidaysHour()).add(compAtteMonth1.getHolidaysAdjustHour());
//本月无节假日
if (compWage.getHolidays().length() <= 0) { //离职,法定节假日之前 在职,法定节假日之前
if (compAtteMonth1.getEntryLeave().doubleValue() == 2) {
multiply = absenteeismTime.add(compAtteMonth1.getHolidaysHour()).add(compAtteMonth1.getHolidaysAdjustHour());
}
} else if (compAtteMonth1.getEntryLeave().doubleValue() == 2//本月离职
&& format01.parse(compWage.getLeaveTime()).getTime() < format01.parse(compWage.getHolidays().split(",")[0]).getTime()) {
//在职状态为离职and离职日期在当月法定节假之前
//multiply=(缺勤工时+节假日工时+节假日调整工时
multiply = absenteeismTime.add(compAtteMonth1.getHolidaysHour()).add(compAtteMonth1.getHolidaysAdjustHour());
//节假日之后 multiply不变
} else if (compAtteMonth1.getEntryLeave().doubleValue() == 3
&& format01.parse(compWage.getLeaveTime()).getTime() < format01.parse(compWage.getHolidays().split(",")[0]).getTime()
|| format01.parse(compWage.getEntryTime()).getTime() > format01.parse(compWage.getHolidays().split(",")[0]).getTime()) {//本月即入也离
multiply = absenteeismTime.add(compAtteMonth1.getHolidaysHour()).add(compAtteMonth1.getHolidaysAdjustHour());
} else if (compAtteMonth1.getEntryLeave().doubleValue() == 1
&& format01.parse(compWage.getEntryTime()).getTime() > format01.parse(compWage.getHolidays().split(",")[0]).getTime()) {
multiply = absenteeismTime.add(compAtteMonth1.getHolidaysHour()).add(compAtteMonth1.getHolidaysAdjustHour());
}
absenceWithhold = absenceSum.multiply(multiply).divide(divide, 2, BigDecimal.ROUND_HALF_UP);
}
} else if (compAtteMonth1.getType().equals("3") && compAtteMonth1.getEntryLeave().doubleValue() > 0) { //入离职日期来算 工资*在职期间应出勤天数/应出勤天数
absenceWithhold = absenceSum
.multiply(compAtteMonth1.getUnrzTime().add(compWage.getEchoWorkHour().subtract(compAtteMonth1.getJobDay().multiply(new BigDecimal(8)))))
.divide(compWage.getEchoWorkHour(), 2, BigDecimal.ROUND_HALF_UP);
} else
absenceWithhold = new BigDecimal(0);
compWage.setAbsenteeismTime(absenteeismTime);
compWage.setAbsenceWithhold(absenceWithhold);
}
return compWage;
}
考勤报表_自由制的考勤日历工作时长要显示实际工作时长
正确数据: 4号 工作时长:8.45 5号 工作时长:8.17 6号 工作时长:8.47 7号 工作时长:8.7
修改代码:
当是自由制时不比较实际工作时长和班次时长
//当是自由制时不比较实际工作时长和班次时长
if (!f && dayAttendanceWorkTime.compareTo(bcTime) > -1) {
dayAttendanceWorkTime = bcTime;
}
考勤报表 自由制 计算月工作时长
月工作时长=每天工作时长累加+带薪时长 比较 应出勤时长时长 谁小取小
代码修改:
/**
* 自由制的数据修改载入 更新他的未入职缺勤时长unrz_time,调整后的缺勤时长(absenteeismTime)
*/
public void ziyouzhi(CompAtteMonth compAtteMonth1) {
//计算自由制的实际算薪时长,更新考勤报表和薪资记录报表中的实际算薪时长
if (compAtteMonth1.getStructureName() != null && compAtteMonth1.getStructureName().contains("自由制")) {
//计算他的应出勤时长
//+annual_leave*8+funeral_leave*8+marital_leave*8+paternity_leave*8+leave_lieu
long EchoWorkHour = (long) (8.0 * compAtteMonth1.getJobDay().doubleValue());//这个月在职期间的应出勤时长
BigDecimal num2 = new BigDecimal(8);
//带薪假
BigDecimal dayss = compAtteMonth1.getAnnualLeave().multiply(num2);
dayss = dayss.add(compAtteMonth1.getFuneralLeave().multiply(num2));
dayss = dayss.add(compAtteMonth1.getMaritalLeave().multiply(num2));
dayss = dayss.add(compAtteMonth1.getPaternityLeave().multiply(num2));
dayss = dayss.add(compAtteMonth1.getLeaveLieu());
if (EchoWorkHour > compAtteMonth1.getEchoWorkHour()) {
EchoWorkHour = compAtteMonth1.getEchoWorkHour();
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
if (BigDecimal.valueOf(EchoWorkHour).compareTo(compAtteMonth1.getAttendanceWorkTime().add(dayss)) > -1)
compAtteMonth1.setSalaryHour(compAtteMonth1.getAttendanceWorkTime().add(dayss));
else {
compAtteMonth1.setSalaryHour(BigDecimal.valueOf(EchoWorkHour));
}
//更新他的未入职缺勤时长unrz_time
Date dateD = null;
try {
dateD = sdf.parse(compAtteMonth1.getMonthStr());
} catch (ParseException e) {
e.printStackTrace();
}
CompUser EntryTime = userService.selectCompUserByUserId(compAtteMonth1.getUserId());
if (EntryTime.getEntryTime().getTime() >= dateD.getTime()) {
compAtteMonth1.setUnrzTime(new BigDecimal(compAtteMonth1.getEchoWorkHour()).subtract(compAtteMonth1.getAttendanceWorkTime()));
} else {
compAtteMonth1.setUnrzTime(new BigDecimal(0.00));
}
//数据更新到数据库AttendanceWorkTime
compAtteMonthService.updateCompAtteMonth(compAtteMonth1);
compAtteMonth1.setFinalAbsenteeismTime(compAtteMonth1.getAbsenteeismTime());
} else {//除自由制的其他对象
compAtteMonth1.setSalaryHour(compAtteMonth1.getSalaryHour());
}
}
解决在接受页面数据CompAtteMonth对象时的absenteeismTime(调整后的缺勤时长)问题
原代码 : 存在salaryHour为null,无法计算this.absenteeismTime
//调整后的缺勤时长
public void setAbsenteeismTime(BigDecimal absenteeismTime) {
if (ObjectUtils.isEmpty(absenteeismTime))
absenteeismTime = new BigDecimal(0);
//正式工 or 固定工资 : 应出勤时长-实际算薪时长
if (!ObjectUtils.isEmpty(salaryHour) && type.equals("0") || type.equals("3") || type.equals("4")) {
this.absenteeismTime = new BigDecimal(echoWorkHour).subtract(salaryHour);
if (absenteeismTime.doubleValue() < 0)
this.absenteeismTime = new BigDecimal(0);
} else
this.absenteeismTime = new BigDecimal(0);
}
改代码:
//调整后的缺勤时长
public void setAbsenteeismTime(BigDecimal absenteeismTime) {
if (ObjectUtils.isEmpty(absenteeismTime))
absenteeismTime = new BigDecimal(0);
this.absenteeismTime = absenteeismTime;
}
在设置setSalaryHour时完成absenteeismTime初始化
//实际算薪时长
public void setSalaryHour(BigDecimal salaryHour) {
if (ObjectUtils.isEmpty(salaryHour)) {
salaryHour = new BigDecimal(0);
}
//正式工 or 固定工资 :调整后缺勤时长 = 应出勤时长-实际算薪时长
if (!ObjectUtils.isEmpty(salaryHour) && type.equals("0") || type.equals("3") || type.equals("4")) {
this.absenteeismTime = new BigDecimal(echoWorkHour).subtract(salaryHour);
if (absenteeismTime.doubleValue() < 0)
this.absenteeismTime = new BigDecimal(0);
} else
this.absenteeismTime = new BigDecimal(0);
特殊需求 2022年2月7号 , 工作时长<8,则工作时长=8
Date entryTime = compUser.getEntryTime();//入职日期
Date entryTimeTS=entryTime;
BigDecimal attendanceWorkTime = new BigDecimal(0);
BigDecimal attendanceWorkTimeYue = new BigDecimal(0);
String day = days.get(i);
//特殊需求
if (day.equals("2022-02-07"))
attendanceWorkTimeYue =attendanceWorkTime;
/**
* 特殊需求 2022年2月7号 , 工作时长<8,则工作时长=8
*/
if (day.equals("2022-02-07") && entryTimeTS.getTime() <= dayDate.getTime()
&& dayAttendanceWorkTime.doubleValue() < 8) {
dayAttendanceWorkTime = BigDecimal.valueOf(8);//日.工作时长 = 8
attendanceWorkTime = attendanceWorkTimeYue.add(dayAttendanceWorkTime);//月.工作时长+8
}
给所有确认有误的员工发生确认通知
请求:
http://localhost:61818/dev-api/comp/atteMonth/sendMonthAtteMonthMsgByUntype?month=2022-01
原:
操作
代码:
/**
* 有误的状态发送消息
*
* @param month
* @return
* @throws ApiException
*/
@PreAuthorize("@ss.hasPermi('comp:atteMonth:sendDeptMsg')")
@GetMapping("/sendMonthAtteMonthMsgByUntype")
public AjaxResult sendMonthAtteMonthMsgByUntype(String month) throws ApiException {
String accessToken = DdUtils.getAccessToken();
sendMonthMsgByUntype(month, accessToken);//发送消息业务
return AjaxResult.success();
}
修改:
/**
* 有误的状态发送消息
*
* @param month
* @param accessToken
* @throws ApiException
*/
private Integer sendMonthMsgByUntype(String month, String accessToken) throws ApiException {
CompAtteMonth compAtteMonth = new CompAtteMonth();
compAtteMonth.setMonthStr(month);
int i=0;
/* compAtteMonth.setUntype("2");*///有误的状态
compAtteMonth.setIsConfirm("2");
List<CompAtteMonth> compAtteMonths = compAtteMonthService.selectCompAtteMonthList(compAtteMonth);
String atteMonth_url = configService.selectConfigByKey("atteMonth_url");
for (CompAtteMonth atteMonth : compAtteMonths) {
CompMonthConfirm compMonthConfirm = new CompMonthConfirm();
compMonthConfirm.setMonth(month);
compMonthConfirm.setUserId(atteMonth.getUserId());
DdUtils.sendOaMag(accessToken, atteMonth.getUserId(), "考勤确认通知", "考勤已发送,请点击进入网址,查看确认\n"
+ dateFormat.format(new Date()), atteMonth_url + "userId=" + atteMonth.getUserId() + "&&monthStr=" + month);
compMonthConfirm.setIsConfirm("0");
i+=compMonthConfirmMapper.updateCompMonthConfirmByMonAndUserId(compMonthConfirm);
}
return i;
}
/**
* 根据月份及userId修改考勤确认状态
* @param compMonthConfirm
* @return
*/
public int updateCompMonthConfirmByMonAndUserId(CompMonthConfirm compMonthConfirm);
<update id="updateCompMonthConfirmByMonAndUserId" parameterType="CompMonthConfirm">
update comp_month_confirm
<trim prefix="SET" suffixOverrides=",">
<if test="isConfirm != null">is_confirm = #{isConfirm},</if>
</trim>
where month = #{month} and user_id = #{userId}
</update>
缺勤扣款:删除 正式工:当实际算薪时长为0时,缺勤扣款=税前工资合计
// else if (compAtteMonth1.getSalaryHour().doubleValue() <= 0) { //正式工:当实际算薪时长为0时,缺勤扣款=税前工资合计
// absenceWithhold = absenceSum;
// }
加班费调整
"加班基数:基本工资/21.75/8
平时加班1.5倍:加班基数*1.5
周末加班2倍:加班基数*2
假日加班3倍:加班基数*3"
需求:
加班规则上显示的加班基数保留2位小数。
计算加班费的时候直接用公式计算,计算完了在加班费保留2位小数
修改调整后的缺勤时长
考勤报表
马平的加班时长>缺勤时长 调整后的缺勤时长=0 缺勤扣款=0
同步代码
/**
* 查询月度考勤列表
*/
@PreAuthorize("@ss.hasPermi('comp:atteMonth:list')")
@GetMapping("/list")
public TableDataInfo list(CompAtteMonth compAtteMonth) {
startPage();
List<CompAtteMonth> list = compAtteMonthService.selectCompAtteMonthList(compAtteMonth);
for (CompAtteMonth compAtteMonth1 : list) {
compAtteMonth1.setReallyAbsenteeismTime(null);
FreeSystem(compAtteMonth1);
//调整后的缺勤时长
compAtteMonth1.setAbsenteeismTime(compAtteMonth1.getAbsenteeismTime(),true);
//调整后其他...加班
compAtteMonth1.setAfterOvertimeWorkday(null);
compAtteMonth1.setAfterOvertimeDayOff(null);
compAtteMonth1.setAfterOvertimeHoliday(null);
if (compAtteMonth1.getUserId().equals("01075342625623542172"))//英俊
compAtteMonth1.setSalaryHour(new BigDecimal(compAtteMonth1.getEchoWorkHour()).subtract(compAtteMonth1.getAbsenteeismTime()));
}
return getDataTable(list);
}
CompAtteMonth对象调整
/**
* 设置调整缺勤时长
* hyang
*
* @param absenteeismTime
* @param tf
*/
public void setAbsenteeismTime(BigDecimal absenteeismTime, boolean tf) {
if (tf && lateFiveToTen != null && echoWorkHour != null && attendanceWorkTime != null && minutesLate != null && echoWorkHour > 0
&& annualLeave != null && leaveLieu != null && funeralLeave != null && maritalLeave != null && paternityLeave != null) {
BigDecimal t = new BigDecimal(
echoWorkHour - attendanceWorkTime.doubleValue() - lateFiveToTen.doubleValue() / 60 - minutesLate.doubleValue() / 60
- annualLeave.doubleValue() * 8
- leaveLieu.doubleValue() - funeralLeave.doubleValue() * 8 - maritalLeave.doubleValue() * 8
- paternityLeave.doubleValue() * 8).setScale(2, BigDecimal.ROUND_DOWN);
if (overtimeId != null && overtimeId == 4 && overtimeWorkday != null && overtimeDayOff != null && overtimeHoliday != null)
t = t.subtract(overtimeWorkday).subtract(overtimeDayOff).subtract(overtimeHoliday);
if (t.doubleValue() < 0.02) {
t = new BigDecimal(0);
}
this.absenteeismTime = t;
} else {
this.absenteeismTime = absenteeismTime;
}
}
计算薪资代码
public static CompWage meritPay(CompWage compWage, BigDecimal absenceSum) throws ParseException {
CompAtteMonth compAtteMonth = new CompAtteMonth();
compAtteMonth.setUserId(compWage.getUserId());
compAtteMonth.setMonthStr(compWage.getDataStr());
List<CompAtteMonth> compAtteMonthList = compAtteMonthService.selectCompAtteMonthList(compAtteMonth);
for (CompAtteMonth compAtteMonth1 : compAtteMonthList) {
BigDecimal absenceWithhold = new BigDecimal(0);//缺勤扣款
BigDecimal divide = new BigDecimal(1);
compAtteMonth1.setReallyAbsenteeismTime(null);
compAtteMonth1.setSalaryHour(compAtteMonth1.getSalaryHour());
compAtteMonth1.setAbsenteeismTime(compAtteMonth1.getAbsenteeismTime(),true);//调整后的缺勤时长=应出勤时长-实际算薪时长
BigDecimal absenteeismTime = compAtteMonth1.getAbsenteeismTime();//调整后缺勤时长
需求 加班基数
需求
薪酬配置 加班规则
有加班费 和 有加班费,缺勤时长先用加班时长抵扣
加班基数:基本工资(CompWage.basicWage)/21.75/8
平时加班1.5倍:加班基数*1.5
周末加班2倍:加班基数*2
假日加班3倍:加班基数*3
加班规则上显示的加班基数保留2位小数。
计算加班费的时候直接用公式计算,计算完了在加班费保留2位小数。
/**
* 设置加班工资
* @param subsidy
*/
public void setSubsidy(BigDecimal subsidy) {
this.subsidy = subsidy;
}
底层代码修改
-- 计算加班费
CASE
WHEN overtime_id = 1 THEN
0
-- WHEN overtime_id=3 THEN -- 旧
-- IFNULL((overtime_usually*overtime_workday+overtime_week*overtime_day_off+overtime_feast*overtime_holiday),0)
WHEN overtime_id=3 THEN
IFNULL(basic_wage/21.75/8*(1.5*overtime_workday+2*overtime_day_off+3*overtime_holiday),0)
WHEN overtime_id = 2 THEN
0
-- WHEN overtime_id=4 THEN -- 旧
-- IFNULL((overtime_usually*overtime_workday01+overtime_week*overtime_day_off01+overtime_feast*overtime_holiday01),0)
WHEN overtime_id=4 THEN
IFNULL(basic_wage/21.75/8*(1.5*overtime_workday01+2*overtime_day_off01+3*overtime_holiday01),0)
ELSE 0
END subsidy,
入职打卡
package com.docer.comp.domain;
import com.docer.common.core.domain.BaseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
@Component
public class CompEnrollment extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private String userId;
private String entryPunch;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getEntryPunch() {
return entryPunch;
}
public void setEntryPunch(String entryPunch) {
if (ObjectUtils.isEmpty(entryPunch))
entryPunch = "0";
this.entryPunch = entryPunch;
}
@Override
public String toString() {
return "CompEnrollment{" +
"id=" + id +
", userId='" + userId + '\'' +
", entryPunch=" + entryPunch +
'}';
}
}
package com.docer.comp.service;
import com.docer.comp.domain.CompEnrollment;
import java.util.List;
public interface ICompEnrollmentService {
/**
* 新增数据
*/
public int insertCompEnrollment(CompEnrollment compEnrollment);
/**
* 查询数据
*/
public CompEnrollment selectByCompEnrollment(CompEnrollment compEnrollment);
/**
* 查询数据 批量查询
*/
public List<CompEnrollment> selectByCompEnrollmentList(CompEnrollment compEnrollment);
/**
* 修改数据
*/
public int updateByCompEnrollment(CompEnrollment compEnrollment);
}
package com.docer.comp.service.impl;
import com.docer.comp.domain.CompEnrollment;
import com.docer.comp.mapper.CompEnrollmentMapper;
import com.docer.comp.service.ICompEnrollmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CompEnrollmentServiceImpl implements ICompEnrollmentService {
@Autowired
private CompEnrollmentMapper compEnrollmentMapper;
@Override
public int insertCompEnrollment(CompEnrollment compEnrollment) {
return compEnrollmentMapper.insertCompEnrollment(compEnrollment);
}
@Override
public CompEnrollment selectByCompEnrollment(CompEnrollment compEnrollment) {
return compEnrollmentMapper.selectByCompEnrollment(compEnrollment);
}
@Override
public List<CompEnrollment> selectByCompEnrollmentList(CompEnrollment compEnrollment) {
return compEnrollmentMapper.selectByCompEnrollmentList(compEnrollment);
}
@Override
public int updateByCompEnrollment(CompEnrollment compEnrollment) {
return compEnrollmentMapper.updateByCompEnrollment(compEnrollment);
}
}
package com.docer.comp.mapper;
import com.docer.comp.domain.CompEnrollment;
import java.util.List;
public interface CompEnrollmentMapper {
int insertCompEnrollment(CompEnrollment compEnrollment);
CompEnrollment selectByCompEnrollment(CompEnrollment compEnrollment);
int updateByCompEnrollment(CompEnrollment compEnrollment);
List<CompEnrollment> selectByCompEnrollmentList(CompEnrollment compEnrollment);
}
<?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.docer.comp.mapper.CompEnrollmentMapper">
<resultMap type="CompEnrollment" id="CompEnrollmentResult">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="entryPunch" column="entry_punch"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<insert id="insertCompEnrollment" parameterType="CompEnrollment" useGeneratedKeys="true" keyProperty="id">
insert into comp_enrollment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="entryPunch != null">entry_punch,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="entryPunch != null">entry_punch,</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<select id="selectByCompEnrollment" parameterType="CompEnrollment" resultMap="CompEnrollmentResult">
select id,user_id,entry_punch from comp_enrollment ce
<where>
<if test="userId != null and userId != ''">and ce.user_id = #{userId}</if>
<if test="entryPunch != null and entryPunch != ''">and ce.entry_punch = #{entryPunch}</if>
</where>
</select>
<select id="selectByCompEnrollmentList" parameterType="CompEnrollment" resultMap="CompEnrollmentResult">
select id,user_id,entry_punch from comp_enrollment ce
<where>
<if test="userId != null and userId != ''">and ce.user_id = #{userId}</if>
<if test="entryPunch != null and entryPunch != ''">and ce.entry_punch = #{entryPunch}</if>
</where>
order by ce.id desc
</select>
<update id="updateByCompEnrollment" parameterType="CompEnrollment">
update comp_enrollment
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="entryPunch != null">entry_punch = #{entryPunch},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
</mapper>