提交 5fa8d2ce 编写于 作者: Jadan-Z's avatar Jadan-Z

1、表boss_interview对应的增删改查接口

上级 3d672a8b
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.controller;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.service.BossIntervieweeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @ClassName: BossIntervieweeController
* @Description: 面试者管理控制层
* @author: skyeye云系列--卫志强
* @date: 2021/11/27 13:28
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
@Controller
public class BossIntervieweeController {
@Autowired
private BossIntervieweeService bossIntervieweeService;
/**
*
* @Title: queryBossIntervieweeList
* @Description: 分页+title模糊查询动态表单页面分类列表
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/BossIntervieweeController/queryBossIntervieweeList")
@ResponseBody
public void queryBossIntervieweeList(InputObject inputObject, OutputObject outputObject) throws Exception{
bossIntervieweeService.queryBossIntervieweeList(inputObject, outputObject);
}
/**
*
* @Title: insertBossInterviewee
* @Description: 新增面试者信息
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/BossIntervieweeController/insertBossInterviewee")
@ResponseBody
public void insertBossInterviewee(InputObject inputObject, OutputObject outputObject) throws Exception{
bossIntervieweeService.insertBossInterviewee(inputObject, outputObject);
}
/**
*
* @Title: delBossIntervieweeById
* @Description: 删除面试者信息
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/BossIntervieweeController/delBossIntervieweeById")
@ResponseBody
public void delBossIntervieweeById(InputObject inputObject, OutputObject outputObject) throws Exception{
bossIntervieweeService.delBossIntervieweeById(inputObject, outputObject);
}
/**
*
* @Title: queryBossIntervieweeById
* @Description: 根据id查询面试者详情
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/BossIntervieweeController/queryBossIntervieweeById")
@ResponseBody
public void queryBossIntervieweeById(InputObject inputObject, OutputObject outputObject) throws Exception{
bossIntervieweeService.queryBossIntervieweeById(inputObject, outputObject);
}
/**
*
* @Title: updateBossIntervieweeById
* @Description: 通过id编辑对应的面试者信息
* @param inputObject
* @param outputObject
* @throws Exception 异常
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/BossIntervieweeController/updateBossIntervieweeById")
@ResponseBody
public void updateBossIntervieweeById(InputObject inputObject, OutputObject outputObject) throws Exception{
bossIntervieweeService.updateBossIntervieweeById(inputObject, outputObject);
}
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.dao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @ClassName: BossIntervieweeDao
* @Description: 面试者管理数据层
* @author: skyeye云系列--卫志强
* @date: 2021/11/27 13:29
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface BossIntervieweeDao {
/**
* 分页+name/手机号模糊查询面试者管理列表
*
* @param map
* @return
*/
List<Map<String, Object>> queryBossIntervieweeList(Map<String, Object> map);
/**
* 新增面试者信息
*
* @param map
*/
void insertBossInterviewee(Map<String, Object> map);
/**
* 根据id查询面试者信息详情
*
* @param id 唯一标识
* @return 详情信息
*/
Map<String, Object> queryBossIntervieweeById(@Param("id") String id);
/**
* 根据姓名+手机号查询面试者信息
*
* @param map
* @return 查询结果
*/
List<Map<String, Object>> queryBossIntervieweeByCondition(Map<String, Object> map);
/**
* 根据id更新面试者信息
*
* @param map
* @throws Exception
*/
void updateBossIntervieweeById(Map<String, Object> map);
/**
* 根据id删除面试者信息
*
* @param id 唯一标识
*/
void delBossIntervieweeById(@Param("id") String id);
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.service;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
/**
* @ClassName: BossIntervieweeService
* @Description: 面试者来源管理服务接口层
* @author: skyeye云系列--卫志强
* @date: 2021/11/27 13:29
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface BossIntervieweeService {
/**
* 分页+name/手机号模糊查询动态表单页面分类列表
*
* @param inputObject
* @param outputObject
*/
void queryBossIntervieweeList(InputObject inputObject, OutputObject outputObject) throws Exception;
/**
* 新增面试者信息
*
* @param inputObject
* @param outputObject
*/
void insertBossInterviewee(InputObject inputObject, OutputObject outputObject) throws Exception;
/**
* 根据id查询面试者信息详情
*
* @param inputObject
* @param outputObject
*/
void queryBossIntervieweeById(InputObject inputObject, OutputObject outputObject) throws Exception;
/**
* 根据id更新面试者信息
*
* @param inputObject
* @param outputObject
*/
void updateBossIntervieweeById(InputObject inputObject, OutputObject outputObject) throws Exception;
/**
* 根据id删除面试者信息
*
* @param inputObject
* @param outputObject
*/
void delBossIntervieweeById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
/*******************************************************************************
* Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.DateUtil;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.dao.BossIntervieweeDao;
import com.skyeye.service.BossIntervieweeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.*;
/**
* @ClassName: BossIntervieweeServiceImpl
* @Description: 面试者来源管理服务层
* @author: skyeye云系列--卫志强
* @date: 2021/11/27 13:31
* @Copyright: 2021 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
@Service
public class BossIntervieweeServiceImpl implements BossIntervieweeService {
@Autowired
private BossIntervieweeDao bossIntervieweeDao;
// 待面试状态
private static final Integer PENDING_INTERVIEW_STATUS = 0;
// 面试中状态
private static final Integer INTERVIEW_STATUS = 1;
// 面试通过状态
private static final Integer INTERVIEW_PASS_STATUS = 2;
// 面试不通过状态
private static final Integer INTERVIEW_FAILED_STATUS = 3;
// 拒绝入职状态
private static final Integer REJECTED_STATUS = 4;
@Override
public void queryBossIntervieweeList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
List<Map<String, Object>> beans = bossIntervieweeDao.queryBossIntervieweeList(inputParams);
if(!beans.isEmpty()){
outputObject.setBeans(beans);
outputObject.settotal(beans.size());
}
}
@Override
public void insertBossInterviewee(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
if (repeatVerification(outputObject, inputParams, null)){
return;
}
// 状态(0.待面试 1.面试中 2.面试通过 3.全部面试不通过 4.拒绝入职)
inputParams.put("state", PENDING_INTERVIEW_STATUS);
inputParams.put("id", ToolUtil.getSurFaceId());
inputParams.put("createTime", DateUtil.getTimeAndToString());
inputParams.put("userId", inputObject.getLogParams().get("id"));
bossIntervieweeDao.insertBossInterviewee(inputParams);
}
// 重复面试者校验
private boolean repeatVerification(OutputObject outputObject, Map<String, Object> inputParams, String id) throws ParseException {
// 根据姓名、手机号查询面试者信息
List<Map<String, Object>> bossIntervieweeBeans = bossIntervieweeDao.queryBossIntervieweeByCondition(inputParams);
if (!CollectionUtil.isEmpty(bossIntervieweeBeans)) {
// 获取相同姓名+手机号最近的一条面试者数据
Map<String, Object> bossIntervieweeBean = bossIntervieweeBeans.get(0);
// 适配更新操作重复校验
if (bossIntervieweeBean.get("id").toString().equals(id)) {
return false;
}
Integer state = Integer.valueOf(bossIntervieweeBean.get("state").toString());
List<Integer> needCheckStates = Arrays.asList(PENDING_INTERVIEW_STATUS, INTERVIEW_STATUS, INTERVIEW_FAILED_STATUS);
if (needCheckStates.contains(state)) {
outputObject.setreturnMessage("同一个姓名、手机号的面试者已存在, 请重新确认面试者信息!");
return true;
} else if (INTERVIEW_PASS_STATUS.equals(state)) {
Date lastJoinTimeDate = DateUtil.getPointTime(bossIntervieweeBean.get("lastJoinTime").toString(), DateUtil.YYYY_MM_DD);
// 比较当前时间与最后入职的日期相差几个月
long differMonth = cn.hutool.core.date.DateUtil.betweenMonth(lastJoinTimeDate, new Date(), true);
if (differMonth < 6) {
outputObject.setreturnMessage("该面试者通过面试未没有超过半年,则不允许录入");
return true;
}
} else if (REJECTED_STATUS.equals(state)) {
Date lastJoinTimeDate = DateUtil.getPointTime(bossIntervieweeBean.get("refuseTime").toString(), DateUtil.YYYY_MM_DD);
// 比较当前时间与最后入职的日期相差几个月
long differMonth = cn.hutool.core.date.DateUtil.betweenMonth(lastJoinTimeDate, new Date(), true);
if (differMonth < 6) {
outputObject.setreturnMessage("该面试者不通过面试未没有超过半年,则不允许录入");
return true;
}
}
}
return false;
}
@Override
public void queryBossIntervieweeById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
Map<String, Object> bean = bossIntervieweeDao.queryBossIntervieweeById(inputParams.get("id").toString());
if (bean != null) {
outputObject.setBean(bean);
outputObject.settotal(1);
}
}
@Override
public void updateBossIntervieweeById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
String id = inputParams.get("id").toString();
Map<String, Object> bossIntervieweeBean = bossIntervieweeDao.queryBossIntervieweeById(id);
if (bossIntervieweeBean == null) {
outputObject.setreturnMessage("该面试者数据已被删除, 请重新刷新界面!");
return;
}
Integer state = Integer.valueOf(bossIntervieweeBean.get("state").toString());
// state=0/1可以进行编辑
if (state.equals(PENDING_INTERVIEW_STATUS) || state.equals(INTERVIEW_STATUS)) {
if (repeatVerification(outputObject, inputParams, id)){
return;
}
// 入参state
Integer inputState = Integer.valueOf(inputParams.get("state").toString());
if (INTERVIEW_PASS_STATUS.equals(inputState)) {
inputParams.put("lastJoinTime", DateUtil.getYmdTimeAndToString());
} else if (REJECTED_STATUS.equals(inputState)) {
inputParams.put("refuseTime", DateUtil.getYmdTimeAndToString());
}
inputParams.put("userId", inputObject.getLogParams().get("id"));
inputParams.put("lastUpdateTime", DateUtil.getTimeAndToString());
bossIntervieweeDao.updateBossIntervieweeById(inputParams);
} else {
outputObject.setreturnMessage("更新失败, 面试者状态为待面试、面试中的方可更新!");
}
}
@Override
public void delBossIntervieweeById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> inputParams = inputObject.getParams();
String id = inputParams.get("id").toString();
Map<String, Object> bossIntervieweeBean = bossIntervieweeDao.queryBossIntervieweeById(id);
if (bossIntervieweeBean != null) {
Integer state = Integer.valueOf(bossIntervieweeBean.get("state").toString());
if (!state.equals(0)) {
outputObject.setreturnMessage("删除失败, 只有待面试状态的数据可删除!");
return;
}
bossIntervieweeDao.delBossIntervieweeById(id);
}
}
}
<?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.skyeye.dao.BossIntervieweeDao">
<select id="queryBossIntervieweeList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.name,
a.sex,
a.idcard,
a.phone,
a.from_id fromId,
a.favorite_job favoriteJob,
a.basic_resume basicResume,
a.enclosure_resume enclosureResume,
a.work_years workYears,
a.state,
a.charge_person_id chargePersonId,
a.refuse_reason refuseReason,
a.refuse_time refuseTime,
a.last_join_department_id lastJoinDepartmentId,
a.last_join_time lastJoinTime,
b.user_name createName,
CONVERT(a.create_time, char) createTime,
c.user_name lastUpdateName,
CONVERT(a.last_update_time, char) lastUpdateTime
FROM
boss_interview a
LEFT JOIN sys_eve_user_staff b ON a.create_id = b.user_id
LEFT JOIN sys_eve_user_staff c ON a.last_update_id = c.user_id
WHERE 1 = 1
<if test="name != '' and name != null">
AND a.name LIKE '%${name}%'
</if>
<if test="phone != '' and phone != null">
AND a.phone LIKE '%${phone}%'
</if>
ORDER BY a.create_time DESC
</select>
<insert id="insertBossInterviewee" parameterType="java.util.Map">
INSERT INTO boss_interview
(id, name, sex, idcard, phone, from_id, favorite_job,
basic_resume, enclosure_resume, work_years, state, charge_person_id,
refuse_reason, refuse_time, last_join_department_id, last_join_time,
create_id, create_time, last_update_id, last_update_time)
VALUES
(#{id}, #{name}, #{sex}, #{idcard}, #{phone}, #{fromId}, #{favoriteJob},
#{basicResume}, #{enclosureResume}, #{workYears}, #{state}, #{chargePersonId},
#{refuseReason}, #{refuseTime}, #{lastJoinDepartmentId}, #{lastJoinTime},
#{userId}, #{createTime}, #{userId}, #{createTime})
</insert>
<update id="updateBossIntervieweeById" parameterType="java.util.Map">
UPDATE boss_interview
SET
name = #{name},
phone = #{phone},
from_id = #{fromId},
sex = #{sex},
idcard = #{idcard},
favorite_job = #{favoriteJob},
basic_resume = #{basicResume},
enclosure_resume = #{enclosureResume},
work_years = #{workYears},
state = #{state},
charge_person_id = #{chargePersonId},
refuse_reason = #{refuseReason},
refuse_time = #{refuseTime},
last_join_department_id = #{lastJoinDepartmentId},
last_join_time = #{lastJoinTime},
last_update_id = #{userId},
last_update_time = #{lastUpdateTime}
WHERE id = #{id}
</update>
<select id="queryBossIntervieweeById" parameterType="java.lang.String" resultType="java.util.Map">
SELECT
a.id,
a.name,
a.sex,
a.idcard,
a.phone,
a.from_id fromId,
a.favorite_job favoriteJob,
a.basic_resume basicResume,
a.enclosure_resume enclosureResume,
a.work_years workYears,
a.state,
a.charge_person_id chargePersonId,
a.refuse_reason refuseReason,
a.refuse_time refuseTime,
a.last_join_department_id lastJoinDepartmentId,
a.last_join_time lastJoinTime,
b.user_name createName,
CONVERT(a.create_time, char) createTime,
c.user_name lastUpdateName,
CONVERT(a.last_update_time, char) lastUpdateTime
FROM
boss_interview a
LEFT JOIN sys_eve_user_staff b ON a.create_id = b.user_id
LEFT JOIN sys_eve_user_staff c ON a.last_update_id = c.user_id
WHERE a.id = #{id}
</select>
<select id="queryBossIntervieweeByCondition" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.name,
a.sex,
a.idcard,
a.phone,
a.from_id fromId,
a.favorite_job favoriteJob,
a.basic_resume basicResume,
a.enclosure_resume enclosureResume,
a.work_years workYears,
a.state,
a.charge_person_id chargePersonId,
a.refuse_reason refuseReason,
a.refuse_time refuseTime,
a.last_join_department_id lastJoinDepartmentId,
a.last_join_time lastJoinTime,
b.user_name createName,
CONVERT(a.create_time, char) createTime,
c.user_name lastUpdateName,
CONVERT(a.last_update_time, char) lastUpdateTime
FROM
boss_interview a
LEFT JOIN sys_eve_user_staff b ON a.create_id = b.user_id
LEFT JOIN sys_eve_user_staff c ON a.last_update_id = c.user_id
WHERE a.name = #{name} and a.phone = #{phone}
ORDER BY a.last_update_time DESC
</select>
<delete id="delBossIntervieweeById" parameterType="java.lang.String">
DELETE FROM boss_interview
WHERE id = #{id}
</delete>
</mapper>
\ No newline at end of file
......@@ -28,4 +28,49 @@
<property id="desc" name="desc" ref="" var="简介"/>
</url>
<!-- 面试者来源信息表结束 -->
<!-- 面试者管理开始 -->
<url id="bossInterviewee001" path="/post/BossIntervieweeController/queryBossIntervieweeList" method="POST" val="获取面试者数据列表" allUse="1" groupName="面试者管理模块">
<property id="name" name="name" ref="" var="姓名"/>
<property id="phone" name="phone" ref="" var="联系方式"/>
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
</url>
<url id="bossInterviewee002" path="/post/BossIntervieweeController/insertBossInterviewee" method="POST" val="新增面试者信息" allUse="1" groupName="面试者管理模块">
<property id="name" name="name" ref="required" var="姓名"/>
<property id="sex" name="sex" ref="required,num" var="性别"/>
<property id="idcard" name="idcard" ref="required,idcard" var="身份证号"/>
<property id="phone" name="phone" ref="required,phone" var="联系方式"/>
<property id="fromId" name="fromId" ref="required" var="来源id"/>
<property id="favoriteJob" name="favoriteJob" ref="required" var="心意岗位"/>
<property id="basicResume" name="basicResume" ref="required" var="基本简历"/>
<property id="enclosureResume" name="enclosureResume" ref="" var="附件简历"/>
<property id="workYears" name="workYears" ref="required" var="工作年限"/>
<property id="chargePersonId" name="chargePersonId" ref="required" var="负责人id"/>
<property id="refuseReason" name="refuseReason" ref="" var="当state=4时,需要填写该内容"/>
<property id="lastJoinDepartmentId" name="lastJoinDepartmentId" ref="" var="当state=2时,最后入职的部门id"/>
</url>
<url id="bossInterviewee003" path="/post/BossIntervieweeController/delBossIntervieweeById" method="DELETE" val="删除待面试者" allUse="1" groupName="面试者管理模块">
<property id="id" name="id" ref="required" var="主键id"/>
</url>
<url id="bossInterviewee004" path="/post/BossIntervieweeController/queryBossIntervieweeById" method="GET" val="根据id查询面试者详情" allUse="2" groupName="面试者管理模块">
<property id="id" name="id" ref="required" var="主键id"/>
</url>
<url id="bossInterviewee005" path="/post/BossIntervieweeController/updateBossIntervieweeById" method="PUT" val="通过id编辑对应的面试者信息" allUse="1" groupName="面试者管理模块">
<property id="id" name="id" ref="required" var="主键id"/>
<property id="name" name="name" ref="required" var="姓名"/>
<property id="sex" name="sex" ref="required,num" var="性别"/>
<property id="idcard" name="idcard" ref="required,idcard" var="身份证号"/>
<property id="phone" name="phone" ref="required,phone" var="联系方式"/>
<property id="fromId" name="fromId" ref="required" var="来源id"/>
<property id="favoriteJob" name="favoriteJob" ref="required" var="心意岗位"/>
<property id="basicResume" name="basicResume" ref="required" var="基本简历"/>
<property id="enclosureResume" name="enclosureResume" ref="" var="附件简历"/>
<property id="workYears" name="workYears" ref="required" var="工作年限"/>
<property id="state" name="state" ref="required,num" var="状态(0.待面试 1.面试中 2.面试通过 3.全部面试不通过 4.拒绝入职)"/>
<property id="chargePersonId" name="chargePersonId" ref="required" var="负责人id"/>
<property id="refuseReason" name="refuseReason" ref="" var="当state=4时,需要填写该内容"/>
<property id="lastJoinDepartmentId" name="lastJoinDepartmentId" ref="" var="当state=2时,最后入职的部门id"/>
</url>
<!-- 面试者管理结束 -->
</controller>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册