Commit 48079aa1 authored by Mr.Tang's avatar Mr.Tang

基本信息自动填入

parent 92dd23f0
......@@ -182,4 +182,10 @@ public class EmploymentApprovalController extends BaseController
{
return toAjax(employmentApprovalService.updateApproval2(employmentApproval));
}
@PreAuthorize("@ss.hasRole('admin') or @ss.hasRole('project-manager') or @ss.hasRole('hr') or @ss.hasRole('general-manager') or @ss.hasRole('common')")
@GetMapping("/listAll")
public AjaxResult listAll()
{
return AjaxResult.success(employmentApprovalService.getCurrentUserApproval());
}
}
......@@ -121,7 +121,7 @@ public class EmploymentApproval extends BaseEntity
/** 入职岗位 */
@Excel(name = "入职岗位 ")
private String entryPosition;
private String position;
/** 聘用形式 0全职 1实习 2兼职 3劳务派遣 4其他 */
@Excel(name = "聘用形式",dictType = "employment_form")
......@@ -220,4 +220,6 @@ public class EmploymentApproval extends BaseEntity
private Long empId;
private Long userId;
}
package com.ruoyi.employment.domain.dto;
import lombok.Data;
@Data
public class EmploymentApprovalDTO {
private String name;
private String idNumber;
private Integer gender;
private String phone;
private Integer serviceDepart;
private String position ;
private Integer employmentForm;
private Long userId;
private String userName;
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.employment.domain.ApprovalInstance;
import com.ruoyi.employment.domain.EmploymentApproval;
import com.ruoyi.employment.domain.dto.EmploymentApprovalDTO;
/**
* 入职审批Mapper接口
......@@ -90,4 +91,7 @@ public interface EmploymentApprovalMapper
public int updateApproval(EmploymentApproval employmentApproval);
public int updateApproval2(EmploymentApproval employmentApproval);
public EmploymentApprovalDTO selectApprovalWithUser(Long userId);
}
......@@ -2,6 +2,7 @@ package com.ruoyi.employment.service;
import java.util.List;
import com.ruoyi.employment.domain.EmploymentApproval;
import com.ruoyi.employment.domain.dto.EmploymentApprovalDTO;
/**
* 入职审批Service接口
......@@ -83,4 +84,7 @@ public interface IEmploymentApprovalService
public int updateApproval(EmploymentApproval employmentApproval);
public int updateApproval2(EmploymentApproval employmentApproval);
public EmploymentApprovalDTO getCurrentUserApproval();
}
......@@ -2,9 +2,12 @@ package com.ruoyi.employment.service.impl;
import java.util.List;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.employment.domain.ApprovalInstance;
import com.ruoyi.employment.domain.dto.EmploymentApprovalDTO;
import com.ruoyi.employment.mapper.ApprovalInstanceMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -173,4 +176,16 @@ public class EmploymentApprovalServiceImpl implements IEmploymentApprovalService
employmentApproval.setUpdateTime(DateUtils.getNowDate());
return employmentApprovalMapper.updateApproval2(employmentApproval);
}
@Override
public EmploymentApprovalDTO getCurrentUserApproval() {
// 获取当前登录用户
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser == null) {
throw new ServiceException("未登录");
}
System.out.println("loginUser = " + loginUser.getUserId());
return employmentApprovalMapper.selectApprovalWithUser(loginUser.getUserId());
}
}
......@@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="openingBank" column="opening_bank" />
<result property="serviceDate" column="service_date" />
<result property="serviceDepart" column="service_depart" />
<result property="entryPosition" column="entry_position" />
<result property="position" column="position" />
<result property="employmentForm" column="employment_form" />
<result property="formalSalary" column="formal_salary" />
<result property="employeeState" column="employee_state" />
......@@ -59,11 +59,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="employmentApprovalState" column="employment_approval_state" />
<result property="isDraft" column="is_draft" />
<result property="empId" column="emp_id"/>
<result property="userId" column="user_id"/>
</resultMap>
<sql id="selectEmploymentApprovalVo">
select id, name, id_number, gender, birthday, phone, home_type, native_place, nationality, home_address, permanent_address, political_outlook, marital_status, work_date, worker_pic, emergency_contact_name, emergency_contact_phone, emergency_contact_relation, insured_city, social_security_account, housing_fund_account, bank_account, opening_bank, service_date, service_depart, entry_position, employment_form, formal_salary, employee_state, is_trial_period,trial_period_salary, trial_period_day, date_of_confirmation, education_level,diploma_pic, degree_pic, other_certification, signature, application_time, manager_opinion, approval_time, manager_signature, submitter, submission_time, update_time, process_state, current_node, current_responsible_person,is_borrow_company_assets,assets_name,service_company,employment_approval_state,is_draft,emp_id from employment_approval
select id, name, id_number, gender, birthday, phone, home_type, native_place, nationality, home_address, permanent_address, political_outlook, marital_status, work_date, worker_pic, emergency_contact_name, emergency_contact_phone, emergency_contact_relation, insured_city, social_security_account, housing_fund_account, bank_account, opening_bank, service_date, service_depart, position, employment_form, formal_salary, employee_state, is_trial_period,trial_period_salary, trial_period_day, date_of_confirmation, education_level,diploma_pic, degree_pic, other_certification, signature, application_time, manager_opinion, approval_time, manager_signature, submitter, submission_time, update_time, process_state, current_node, current_responsible_person,is_borrow_company_assets,assets_name,service_company,employment_approval_state,is_draft,emp_id,user_id from employment_approval
</sql>
<select id="selectEmploymentApprovalList" parameterType="EmploymentApproval" resultMap="EmploymentApprovalResult">
......@@ -93,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openingBank != null and openingBank != ''"> and opening_bank = #{openingBank}</if>
<if test="serviceDate != null "> and service_date = #{serviceDate}</if>
<if test="serviceDepart != null "> and service_depart = #{serviceDepart}</if>
<if test="entryPosition != null "> and entry_position = #{entryPosition}</if>
<if test="position != null "> and position = #{position}</if>
<if test="employmentForm != null "> and employment_form = #{employmentForm}</if>
<if test="formalSalary != null "> and formal_salary = #{formalSalary}</if>
<if test="employeeState != null "> and employee_state = #{employeeState}</if>
......@@ -122,6 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="employmentApprovalState != null and employmentApprovalState != ''"> and employment_approval_state = #{employmentApprovalState}</if>
and is_draft = 1
<if test="empId != null and empId != ''"> and emp_id = #{empId}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
</where>
order by employment_approval_state
</select>
......@@ -158,7 +160,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openingBank != null">opening_bank,</if>
<if test="serviceDate != null">service_date,</if>
<if test="serviceDepart != null">service_depart,</if>
<if test="entryPosition != null">entry_position,</if>
<if test="position != null">position,</if>
<if test="employmentForm != null">employment_form,</if>
<if test="formalSalary != null">formal_salary,</if>
employee_state,
......@@ -187,6 +189,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
employment_approval_state,
is_draft,
<if test="empId != null">emp_id,</if>
<if test="userId != null">user_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
......@@ -213,7 +216,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openingBank != null">#{openingBank},</if>
<if test="serviceDate != null">#{serviceDate},</if>
<if test="serviceDepart != null">#{serviceDepart},</if>
<if test="entryPosition != null">#{entryPosition},</if>
<if test="position != null">#{position},</if>
<if test="employmentForm != null">#{employmentForm},</if>
<if test="formalSalary != null">#{formalSalary},</if>
0,
......@@ -242,6 +245,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
0,
1,
<if test="empId != null">#{empId},</if>
<if test="userId != null">#{userId},</if>
</trim>
</insert>
......@@ -272,7 +276,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openingBank != null">opening_bank = #{openingBank},</if>
<if test="serviceDate != null">service_date = #{serviceDate},</if>
<if test="serviceDepart != null">service_depart = #{serviceDepart},</if>
<if test="entryPosition != null">entry_position = #{entryPosition},</if>
<if test="position != null">position = #{position},</if>
<if test="employmentForm != null">employment_form = #{employmentForm},</if>
<if test="formalSalary != null">formal_salary = #{formalSalary},</if>
<if test="employeeState != null">employee_state = #{employeeState},</if>
......@@ -301,6 +305,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="employmentApprovalState != null">employment_approval_state = #{employmentApprovalState},</if>
<if test="isDraft != null">is_draft = #{isDraft},</if>
<if test="empId != null">emp_id = #{empId},</if>
<if test="userId != null">user_id = #{userId},</if>
</trim>
where id = #{id}
</update>
......@@ -389,7 +394,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openingBank != null and openingBank != ''"> and opening_bank = #{openingBank}</if>
<if test="serviceDate != null "> and service_date = #{serviceDate}</if>
<if test="serviceDepart != null "> and service_depart = #{serviceDepart}</if>
<if test="entryPosition != null "> and entry_position = #{entryPosition}</if>
<if test="position != null "> and position = #{position}</if>
<if test="employmentForm != null "> and employment_form = #{employmentForm}</if>
<if test="formalSalary != null "> and formal_salary = #{formalSalary}</if>
<if test="employeeState != null "> and employee_state = #{employeeState}</if>
......@@ -418,6 +423,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="employmentApprovalState != null and employmentApprovalState != ''"> and employment_approval_state = #{employmentApprovalState}</if>
and is_draft != 1
<if test="empId !=null and empId !=''"> and emp_id = #{empId}</if>
<if test="userId !=null and userId !=''"> and user_id = #{userId}</if>
</where>
</select>
......@@ -448,7 +454,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openingBank != null">opening_bank,</if>
<if test="serviceDate != null">service_date,</if>
<if test="serviceDepart != null">service_depart,</if>
<if test="entryPosition != null">entry_position,</if>
<if test="position != null">position,</if>
<if test="employmentForm != null">employment_form,</if>
<if test="formalSalary != null">formal_salary,</if>
<if test="employeeState != null">employee_state,</if>
......@@ -477,6 +483,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="employmentApprovalState != null">employment_approval_state,</if>
is_draft,
<if test="empId !=null and empId !=''">#{empId},</if>
<if test="userId !=null and userId !=''">#{userId},</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
......@@ -503,7 +510,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openingBank != null">#{openingBank},</if>
<if test="serviceDate != null">#{serviceDate},</if>
<if test="serviceDepart != null">#{serviceDepart},</if>
<if test="entryPosition != null">#{entryPosition},</if>
<if test="position != null">#{position},</if>
<if test="employmentForm != null">#{employmentForm},</if>
<if test="formalSalary != null">#{formalSalary},</if>
<if test="employeeState != null">#{employeeState},</if>
......@@ -532,6 +539,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="employmentApprovalState != null">#{employmentApprovalState},</if>
0,
<if test="empId !=null and empId !=''">#{empId},</if>
<if test="userId !=null and userId !=''">#{userId},</if>
</trim>
</insert>
......@@ -563,7 +571,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="openingBank != null">opening_bank = #{openingBank},</if>
<if test="serviceDate != null">service_date = #{serviceDate},</if>
<if test="serviceDepart != null">service_depart = #{serviceDepart},</if>
<if test="entryPosition != null">entry_position = #{entryPosition},</if>
<if test="position != null">position = #{position},</if>
<if test="employmentForm != null">employment_form = #{employmentForm},</if>
<if test="formalSalary != null">formal_salary = #{formalSalary},</if>
<if test="employeeState != null">employee_state = #{employeeState},</if>
......@@ -592,8 +600,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="employmentApprovalState != null">employment_approval_state = #{employmentApprovalState},</if>
<if test="isDraft != null">is_draft = #{isDraft},</if>
<if test="empId !=null and empId !=''">emp_id = #{empId},</if>
<if test="userId !=null and userId !=''">user_id = #{userId},</if>
</trim>
where id = #{id}
</update>
<select id="selectApprovalWithUser" resultType="com.ruoyi.employment.domain.dto.EmploymentApprovalDTO">
SELECT
a.name,
a.id_number AS idNumber, <!-- 显式别名 -->
a.gender,
a.phone,
a.user_id AS userId,
a.service_depart AS serviceDepart,
a.position,
a.employment_form AS employmentForm,
u.user_name AS userName <!-- 关键在这里 -->
FROM employment_approval a
INNER JOIN sys_user u ON a.user_id = u.user_id
WHERE a.user_id = #{userId}
</select>
</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