Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.javaboy.vhr.mapper;

import org.javaboy.vhr.model.Attendance;

import java.util.List;

public interface AttendanceMapper {
int deleteByPrimaryKey(Integer id);

int insert(Attendance record);

int insertSelective(Attendance record);

Attendance selectByPrimaryKey(Integer id);

int updateByPrimaryKeySelective(Attendance record);

int updateByPrimaryKey(Attendance record);

List<Attendance> getAllAttendance();

List<Attendance> getAttendanceByEmpId(Integer empId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ public interface EmployeeMapper {
List<Employee> getEmployeeByPageWithSalary(@Param("page") Integer page, @Param("size") Integer size);

Integer updateEmployeeSalaryById(@Param("eid") Integer eid, @Param("sid") Integer sid);

List<Employee> getEmployeesBySalaryId(@Param("salaryId") Integer salaryId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@
<insert id="updateEmployeeSalaryById">
REPLACE INTO empsalary (eid,sid) VALUES(#{eid},#{sid})
</insert>
<select id="getEmployeesBySalaryId" resultMap="AllEmployeeInfo">
SELECT e.*,p.`id` as pid,p.`name` as pname,n.`id` as nid,n.`name` as nname,d.`id` as did,d.`name` as dname,j.`id` as jid,j.`name` as jname,pos.`id` as posid,pos.`name` as posname
FROM employee e
JOIN empsalary es ON e.`id`=es.`eid`
JOIN nation n ON e.`nationId`=n.`id`
JOIN politicsstatus p ON e.`politicId`=p.`id`
JOIN department d ON e.`departmentId`=d.`id`
JOIN joblevel j ON e.`jobLevelId`=j.`id`
JOIN position pos ON e.`posId`=pos.`id`
WHERE es.`sid`=#{salaryId}
</select>
<select id="getEmployeeById" resultMap="AllEmployeeInfo">
select e.*,p.`id` as pid,p.`name` as pname,n.`id` as nid,n.`name` as nname,d.`id` as did,d.`name` as
dname,j.`id` as jid,j.`name` as jname,pos.`id` as posid,pos.`name` as posname from employee e,nation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
<result column="accumulationFundBase" property="accumulationFundBase" jdbcType="INTEGER"/>
<result column="accumulationFundPer" property="accumulationFundPer" jdbcType="REAL"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="enabled" property="enabled" jdbcType="BIT"/>
</resultMap>
<sql id="Base_Column_List">
id, basicSalary, bonus, lunchSalary, trafficSalary, allSalary, pensionBase, pensionPer,
createDate, medicalBase, medicalPer, accumulationFundBase, accumulationFundPer, name
createDate, medicalBase, medicalPer, accumulationFundBase, accumulationFundPer, name, enabled
</sql>
<select id="getAllSalaries" resultMap="BaseResultMap">
select
Expand All @@ -41,12 +42,12 @@
lunchSalary, trafficSalary, allSalary,
pensionBase, pensionPer, createDate,
medicalBase, medicalPer, accumulationFundBase,
accumulationFundPer, name)
accumulationFundPer, name, enabled)
values (#{id,jdbcType=INTEGER}, #{basicSalary,jdbcType=INTEGER}, #{bonus,jdbcType=INTEGER},
#{lunchSalary,jdbcType=INTEGER}, #{trafficSalary,jdbcType=INTEGER}, #{allSalary,jdbcType=INTEGER},
#{pensionBase,jdbcType=INTEGER}, #{pensionPer,jdbcType=REAL}, #{createDate,jdbcType=TIMESTAMP},
#{medicalBase,jdbcType=INTEGER}, #{medicalPer,jdbcType=REAL}, #{accumulationFundBase,jdbcType=INTEGER},
#{accumulationFundPer,jdbcType=REAL}, #{name,jdbcType=VARCHAR})
#{accumulationFundPer,jdbcType=REAL}, #{name,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="org.javaboy.vhr.model.Salary">
insert into salary
Expand Down Expand Up @@ -93,6 +94,9 @@
<if test="name != null">
name,
</if>
<if test="enabled != null">
enabled,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
Expand Down Expand Up @@ -137,6 +141,9 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="enabled != null">
#{enabled,jdbcType=BIT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="org.javaboy.vhr.model.Salary">
Expand Down Expand Up @@ -181,6 +188,9 @@
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="enabled != null">
enabled = #{enabled,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
Expand All @@ -198,7 +208,8 @@
medicalPer = #{medicalPer,jdbcType=REAL},
accumulationFundBase = #{accumulationFundBase,jdbcType=INTEGER},
accumulationFundPer = #{accumulationFundPer,jdbcType=REAL},
name = #{name,jdbcType=VARCHAR}
name = #{name,jdbcType=VARCHAR},
enabled = #{enabled,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?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="org.javaboy.vhr.mapper.AttendanceMapper">
<resultMap id="BaseResultMap" type="org.javaboy.vhr.model.Attendance">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="eid" jdbcType="INTEGER" property="eid"/>
<result column="attendDate" jdbcType="DATE" property="attendDate"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>

<sql id="Base_Column_List">
id, eid, attendDate, type, remark
</sql>

<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from attendance
where id = #{id,jdbcType=INTEGER}
</select>

<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from attendance
where id = #{id,jdbcType=INTEGER}
</delete>

<insert id="insert" parameterType="org.javaboy.vhr.model.Attendance">
insert into attendance (id, eid, attendDate, type, remark)
values (#{id,jdbcType=INTEGER}, #{eid,jdbcType=INTEGER}, #{attendDate,jdbcType=DATE}, #{type,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR})
</insert>

<insert id="insertSelective" parameterType="org.javaboy.vhr.model.Attendance">
insert into attendance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="eid != null">eid,</if>
<if test="attendDate != null">attendDate,</if>
<if test="type != null">type,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=INTEGER},</if>
<if test="eid != null">#{eid,jdbcType=INTEGER},</if>
<if test="attendDate != null">#{attendDate,jdbcType=DATE},</if>
<if test="type != null">#{type,jdbcType=VARCHAR},</if>
<if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
</trim>
</insert>

<update id="updateByPrimaryKeySelective" parameterType="org.javaboy.vhr.model.Attendance">
update attendance
<set>
<if test="eid != null">eid = #{eid,jdbcType=INTEGER},</if>
<if test="attendDate != null">attendDate = #{attendDate,jdbcType=DATE},</if>
<if test="type != null">type = #{type,jdbcType=VARCHAR},</if>
<if test="remark != null">remark = #{remark,jdbcType=VARCHAR},</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>

<update id="updateByPrimaryKey" parameterType="org.javaboy.vhr.model.Attendance">
update attendance
set eid = #{eid,jdbcType=INTEGER}, attendDate = #{attendDate,jdbcType=DATE}, type = #{type,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>

<select id="getAllAttendance" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from attendance
</select>

<select id="getAttendanceByEmpId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from attendance
where eid = #{eid,jdbcType=INTEGER}
</select>
</mapper>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package org.javaboy.vhr.model;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;

public class Attendance {
private Integer id;
private Integer eid;
private Date attendDate;
private String type;
private String remark;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public Integer getEid() {
return eid;
}

public void setEid(Integer eid) {
this.eid = eid;
}

@JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
public Date getAttendDate() {
return attendDate;
}

public void setAttendDate(Date attendDate) {
this.attendDate = attendDate;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public String getRemark() {
return remark;
}

public void setRemark(String remark) {
this.remark = remark;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class Salary {

private String name;

private Boolean enabled;

public Integer getId() {
return id;
}
Expand Down Expand Up @@ -145,4 +147,12 @@ public String getName() {
public void setName(String name) {
this.name = name;
}

public Boolean getEnabled() {
return enabled;
}

public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
}
Loading