修复测试中发现的钉钉同步bug
This commit is contained in:
parent
6c95752f4b
commit
c63f6cc941
@ -56,41 +56,13 @@ public class DingTalkUtil {
|
|||||||
@Autowired
|
@Autowired
|
||||||
ThirdAppConfigService thirdAppConfigService;
|
ThirdAppConfigService thirdAppConfigService;
|
||||||
|
|
||||||
static String appid = "855818566";//"856016278";
|
|
||||||
|
|
||||||
CloseableHttpClient getHttpClient(){
|
CloseableHttpClient getHttpClient(){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String SendImageByApacheHttpClient(File file, String authorization) throws IOException {
|
|
||||||
CloseableHttpClient client = getHttpClient();
|
|
||||||
HttpPost post = new HttpPost("https://open.feishu.cn/open-apis/image/v4/put/");
|
|
||||||
final MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
|
||||||
FileBody bin = new FileBody(file);
|
|
||||||
builder.addPart("image", bin);
|
|
||||||
builder.addTextBody("image_type", "message");
|
|
||||||
HttpEntity multiPartEntity = builder.build();
|
|
||||||
post.setEntity(multiPartEntity);
|
|
||||||
post.setHeader("Authorization", "Bearer " + authorization);
|
|
||||||
CloseableHttpResponse response = client.execute(post);
|
|
||||||
logger.info("http response code:" + response.getStatusLine().getStatusCode());
|
|
||||||
// for (Header header: response.getAllHeaders()) {
|
|
||||||
// System.out.println(header.toString());
|
|
||||||
// }
|
|
||||||
if (StringUtil.equals(response.getStatusLine().getStatusCode() + "", "99991663")) {
|
|
||||||
authorization = this.getAccessToken();
|
|
||||||
redisUtils.set(Constant.FEI_SHU_ROBOT_TOKEN, authorization);
|
|
||||||
SendImageByApacheHttpClient(file, authorization);
|
|
||||||
}
|
|
||||||
HttpEntity resEntity = response.getEntity();
|
|
||||||
if (resEntity == null) {
|
|
||||||
logger.info("never here?");
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
logger.info("Response content length: " + resEntity.getContentLength());
|
|
||||||
return EntityUtils.toString(resEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取机器人的有效token值
|
* 获取机器人的有效token值
|
||||||
@ -98,7 +70,7 @@ public class DingTalkUtil {
|
|||||||
* @return
|
* @return
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public String getAccessToken() {
|
public String getAccessToken(String appid) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
|
||||||
@ -160,6 +132,8 @@ public class DingTalkUtil {
|
|||||||
|
|
||||||
list.add(departmentInfosBo);
|
list.add(departmentInfosBo);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
logger.info("获取部门详情异常{}", rsp.getBody());
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
} catch (ApiException e) {
|
} catch (ApiException e) {
|
||||||
@ -204,6 +178,7 @@ public class DingTalkUtil {
|
|||||||
departmentStaffBo.setMobile(json.getString("mobile"));//手机,需要单独授权手机权限
|
departmentStaffBo.setMobile(json.getString("mobile"));//手机,需要单独授权手机权限
|
||||||
departmentStaffBo.setEmail(json.getString("email"));//邮箱,钉钉的企业邮箱才可以,需要单独授权手机权限
|
departmentStaffBo.setEmail(json.getString("email"));//邮箱,钉钉的企业邮箱才可以,需要单独授权手机权限
|
||||||
departmentStaffBo.setAvatar(json.getString("avatar"));//头像
|
departmentStaffBo.setAvatar(json.getString("avatar"));//头像
|
||||||
|
departmentStaffBo.setPosition(json.getString("position"));
|
||||||
if(json.getBoolean("active")){
|
if(json.getBoolean("active")){
|
||||||
//在职已激活
|
//在职已激活
|
||||||
departmentStaffBo.setStatus(0);
|
departmentStaffBo.setStatus(0);
|
||||||
@ -221,6 +196,8 @@ public class DingTalkUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
logger.info("获取部门详情异常{}", rsp.getBody());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +217,7 @@ public class DingTalkUtil {
|
|||||||
*/
|
*/
|
||||||
public String getImageKey(File file, String tenant_access_token) throws IOException {
|
public String getImageKey(File file, String tenant_access_token) throws IOException {
|
||||||
// File file = new File(imgUrl);
|
// File file = new File(imgUrl);
|
||||||
String result = SendImageByApacheHttpClient(file, tenant_access_token);
|
String result = "";//SendImageByApacheHttpClient(file, tenant_access_token);
|
||||||
JSONObject dataObj = JSON.parseObject(result);
|
JSONObject dataObj = JSON.parseObject(result);
|
||||||
String image_key = dataObj.getJSONObject("data").getString("image_key");
|
String image_key = dataObj.getJSONObject("data").getString("image_key");
|
||||||
return image_key;
|
return image_key;
|
||||||
@ -264,7 +241,7 @@ public class DingTalkUtil {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
DingTalkUtil dingTalkUtil = new DingTalkUtil();
|
DingTalkUtil dingTalkUtil = new DingTalkUtil();
|
||||||
String token = dingTalkUtil.getAccessToken();
|
String token = dingTalkUtil.getAccessToken("855818566");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -50,4 +50,6 @@ public interface StaffDao extends BaseMapper<StaffEntity> {
|
|||||||
List<StaffEntity> selectByIds(@Param("staffIds") List<Long> staffIds);
|
List<StaffEntity> selectByIds(@Param("staffIds") List<Long> staffIds);
|
||||||
|
|
||||||
int addStaff(StaffEntity staff);
|
int addStaff(StaffEntity staff);
|
||||||
|
|
||||||
|
List<StaffEntity> selectByRang(@Param("id") String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.lz.modules.app.dao;
|
|||||||
import com.lz.modules.app.dto.StaffOccupationInfoDto;
|
import com.lz.modules.app.dto.StaffOccupationInfoDto;
|
||||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -29,4 +30,5 @@ public interface StaffOccupationDao extends BaseMapper<StaffOccupationEntity> {
|
|||||||
|
|
||||||
void updateAllOccupation();
|
void updateAllOccupation();
|
||||||
|
|
||||||
|
void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import com.lz.common.utils.PageUtils;
|
import com.lz.common.utils.PageUtils;
|
||||||
import com.lz.modules.app.dto.StaffOccupationInfoDto;
|
import com.lz.modules.app.dto.StaffOccupationInfoDto;
|
||||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||||
|
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -28,5 +29,7 @@ public interface StaffOccupationService extends IService<StaffOccupationEntity>
|
|||||||
StaffOccupationInfoDto getOccupationByStaffId(Long id);
|
StaffOccupationInfoDto getOccupationByStaffId(Long id);
|
||||||
|
|
||||||
void updateAllOccupation();
|
void updateAllOccupation();
|
||||||
|
|
||||||
|
void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import com.lz.modules.app.dto.StaffOccupationInfoDto;
|
|||||||
import com.lz.modules.app.dao.StaffOccupationDao;
|
import com.lz.modules.app.dao.StaffOccupationDao;
|
||||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||||
import com.lz.modules.app.service.StaffOccupationService;
|
import com.lz.modules.app.service.StaffOccupationService;
|
||||||
|
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -56,5 +57,9 @@ public class StaffOccupationServiceImpl extends ServiceImpl<StaffOccupationDao,
|
|||||||
public void updateAllOccupation() {
|
public void updateAllOccupation() {
|
||||||
staffOccupationDao.updateAllOccupation();
|
staffOccupationDao.updateAllOccupation();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo){
|
||||||
|
staffOccupationDao.updateStatusByStaff(staffId, departmentStaffBo);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.dingtalk.api.response.OapiGettokenResponse;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.lz.common.utils.DateUtils;
|
import com.lz.common.utils.DateUtils;
|
||||||
import com.lz.common.utils.DingTalkUtil;
|
import com.lz.common.utils.DingTalkUtil;
|
||||||
|
import com.lz.modules.app.dao.StaffDao;
|
||||||
import com.lz.modules.app.entity.StaffEntity;
|
import com.lz.modules.app.entity.StaffEntity;
|
||||||
import com.lz.modules.app.entity.StaffOccupationEntity;
|
import com.lz.modules.app.entity.StaffOccupationEntity;
|
||||||
import com.lz.modules.app.service.DepartmentsService;
|
import com.lz.modules.app.service.DepartmentsService;
|
||||||
@ -15,6 +16,7 @@ import com.lz.modules.app.service.StaffOccupationService;
|
|||||||
import com.lz.modules.app.service.StaffService;
|
import com.lz.modules.app.service.StaffService;
|
||||||
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
import com.lz.modules.job.model.responseBo.DepartmentInfosBo;
|
||||||
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
|
||||||
|
import com.mchange.lang.IntegerUtils;
|
||||||
import com.taobao.api.ApiException;
|
import com.taobao.api.ApiException;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -26,7 +28,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @author fumeiai
|
* @author fumeiai
|
||||||
* @date 2019-05-29 17:06
|
* @date 2019-05-29 17:06
|
||||||
* @Description 钉钉业务
|
* @Description 钉钉同步业务
|
||||||
* @注意 本内容仅限于杭州霖梓网络科技有限公司内部传阅,禁止外泄以及用于其他的商业目的
|
* @注意 本内容仅限于杭州霖梓网络科技有限公司内部传阅,禁止外泄以及用于其他的商业目的
|
||||||
*/
|
*/
|
||||||
@Component(value = "dingtalkBusiness")
|
@Component(value = "dingtalkBusiness")
|
||||||
@ -48,45 +50,71 @@ public class DingtalkBusiness {
|
|||||||
@Resource
|
@Resource
|
||||||
StaffOccupationService staffOccupationService;
|
StaffOccupationService staffOccupationService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
StaffDao staffDao;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取组织架构信息并录入到数据库
|
* 获取组织架构信息并录入到数据库
|
||||||
*/
|
*/
|
||||||
// @DataSource(name = DataSourceNames.FOUR)
|
// @DataSource(name = DataSourceNames.FOUR)
|
||||||
public void getDingTalkepartmentsIntoData() {
|
public void getDingTalkepartmentsIntoData(String appid) {
|
||||||
|
|
||||||
|
/*List<StaffEntity> staffEntityList = staffDao.selectByRang("535");//飞书数据更新为钉钉数据
|
||||||
|
for (StaffEntity staff:staffEntityList
|
||||||
|
) {
|
||||||
|
List<StaffEntity> list = staffDao.selectByName(staff.getName());
|
||||||
|
if(list.size() > 0){
|
||||||
|
StaffEntity staff1 = list.get(0);
|
||||||
|
if(staff.getId().intValue() != staff1.getId().intValue()){
|
||||||
|
staff1.setJobNumber(staff.getJobNumber());
|
||||||
|
staff1.setAvatar(staff.getAvatar());
|
||||||
|
staff1.setEmployeeId(staff.getEmployeeId());
|
||||||
|
staff1.setOpenId(staff.getOpenId());
|
||||||
|
staff1.setUnionId(staff.getUnionId());
|
||||||
|
|
||||||
|
|
||||||
|
staffDao.deleteById(staff.getId());
|
||||||
|
staffDao.updateStaff(staff1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
return;*/
|
||||||
//获取Token
|
//获取Token
|
||||||
String token = dingTalkUtil.getAccessToken();
|
String token = dingTalkUtil.getAccessToken(appid);
|
||||||
if(token != null && token.length() > 0){
|
if(token != null && token.length() > 0){
|
||||||
|
|
||||||
//获取所有的部门详情
|
//获取所有的部门详情
|
||||||
List<DepartmentInfosBo> departmentInfosBos = dingTalkUtil.getDepartmentDetails(token, "1");
|
List<DepartmentInfosBo> departmentInfosBos = dingTalkUtil.getDepartmentDetails(token, "1");
|
||||||
//更新数据库中的部门相关信息
|
if(departmentInfosBos.size() > 0){
|
||||||
departmentsService.updateDepartmentInfos(departmentInfosBos);
|
//更新数据库中的部门相关信息
|
||||||
//删除原有的对应关系下面在更新
|
departmentsService.updateDepartmentInfos(departmentInfosBos);
|
||||||
departmentsStaffRelateService.deleteAllRelates();
|
//删除原有的对应关系下面在更新
|
||||||
//未在飞书组织架构里的成员,置为离职(全部置为离职,再把在职的恢复)
|
departmentsStaffRelateService.deleteAllRelates();
|
||||||
staffOccupationService.updateAllOccupation();
|
//未在飞书组织架构里的成员,置为离职(全部置为离职,再把在职的恢复)
|
||||||
//获取飞书部门对应的用户详情
|
staffOccupationService.updateAllOccupation();
|
||||||
for (DepartmentInfosBo departmentInfo : departmentInfosBos) {
|
//获取飞书部门对应的用户详情
|
||||||
//获取部门用户详情
|
for (DepartmentInfosBo departmentInfo : departmentInfosBos) {
|
||||||
List<DepartmentStaffBo> staffs = dingTalkUtil.getDepartmentStaffDetails(token, departmentInfo.getId());
|
//获取部门用户详情
|
||||||
logger.info("=============================" + departmentInfo.getName() + "================================");
|
List<DepartmentStaffBo> staffs = dingTalkUtil.getDepartmentStaffDetails(token, departmentInfo.getId());
|
||||||
if(staffs.size() > 0){
|
logger.info("=============================" + departmentInfo.getName() + "================================");
|
||||||
//循环录入到员工信息表中
|
if(staffs.size() > 0){
|
||||||
List<StaffEntity> staffIds = staffService.updateStaffsInfo(staffs);
|
//循环录入到员工信息表中
|
||||||
|
List<StaffEntity> staffIds = staffService.updateStaffsInfo(staffs);
|
||||||
|
|
||||||
//加入到部门和员工关系表,同时更新leader关系
|
//加入到部门和员工关系表,同时更新leader关系
|
||||||
departmentsStaffRelateService.addRelateInfos(departmentInfo.getId(), staffIds);
|
departmentsStaffRelateService.addRelateInfos(departmentInfo.getId(), staffIds);
|
||||||
//录入员工职业信息表
|
//录入员工职业信息表
|
||||||
enterStaffOccupationInfos(staffs);
|
enterStaffOccupationInfos(staffs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
logger.info("部门信息为空");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enterStaffOccupationInfos(List<DepartmentStaffBo> staffs) {
|
public void enterStaffOccupationInfos(List<DepartmentStaffBo> staffs) {
|
||||||
@ -98,19 +126,19 @@ public class DingtalkBusiness {
|
|||||||
if (staffOccupationEntity == null) {
|
if (staffOccupationEntity == null) {
|
||||||
StaffOccupationEntity staffOccupation = new StaffOccupationEntity();
|
StaffOccupationEntity staffOccupation = new StaffOccupationEntity();
|
||||||
staffOccupation.setStaffId(staffId);
|
staffOccupation.setStaffId(staffId);
|
||||||
|
staffOccupation.setPosition(departmentStaffBo.getPosition());//职位信息
|
||||||
staffOccupation.setEmployeeNo(departmentStaffBo.getEmployeeNo());
|
staffOccupation.setEmployeeNo(departmentStaffBo.getEmployeeNo());
|
||||||
|
staffOccupation.setStaffNo(departmentStaffBo.getEmployeeNo());//钉钉的员工工号
|
||||||
staffOccupation.setStaffType(departmentStaffBo.getEmployeeType());
|
staffOccupation.setStaffType(departmentStaffBo.getEmployeeType());
|
||||||
staffOccupation.setStaffStatus(departmentStaffBo.getStatus());
|
staffOccupation.setStaffStatus(departmentStaffBo.getStatus());
|
||||||
staffOccupation.setEntryTime(DateUtils.getCurrentDate());
|
staffOccupation.setEntryTime(DateUtils.getCurrentDate());
|
||||||
StaffOccupations.add(staffOccupation);
|
StaffOccupations.add(staffOccupation);
|
||||||
} else {
|
} else {
|
||||||
staffOccupationService.updateStatusByStaffId(staffId, departmentStaffBo.getStatus());
|
staffOccupationService.updateStatusByStaff(staffId, departmentStaffBo);//更新职位信息,工号信息
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StaffOccupations.size() > 0) {
|
if (StaffOccupations.size() > 0) {
|
||||||
staffOccupationService.saveBatch(StaffOccupations);
|
staffOccupationService.saveBatch(StaffOccupations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,12 +29,12 @@ public class DingtalkSynDataJob implements ITask {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
DingtalkBusiness dingtalkBusiness;
|
DingtalkBusiness dingtalkBusiness;
|
||||||
|
static String appid = "855818566";
|
||||||
@Override
|
@Override
|
||||||
public void run(String params) {
|
public void run(String params) {
|
||||||
|
|
||||||
logger.info("dingtalkSynDataJob start date == {}", DateUtils.getCurrentDate());
|
logger.info("dingtalkSynDataJob start date == {}", DateUtils.getCurrentDate());
|
||||||
dingtalkBusiness.getDingTalkepartmentsIntoData();
|
dingtalkBusiness.getDingTalkepartmentsIntoData(appid);
|
||||||
logger.info("dingtalkSynDataJob end date == {}", DateUtils.getCurrentDate());
|
logger.info("dingtalkSynDataJob end date == {}", DateUtils.getCurrentDate());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,10 +8,7 @@ import com.lz.common.utils.StringUtil;
|
|||||||
import com.lz.modules.job.business.DingtalkBusiness;
|
import com.lz.modules.job.business.DingtalkBusiness;
|
||||||
import com.lz.modules.third.entity.ThirdAppConfig;
|
import com.lz.modules.third.entity.ThirdAppConfig;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.lz.modules.third.service.ThirdAppConfigService;
|
import com.lz.modules.third.service.ThirdAppConfigService;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -39,8 +36,8 @@ public class ThirdAppConfigController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/syn")
|
@GetMapping("/syn")
|
||||||
public R syn() {
|
public R syn(@RequestParam String appid) {
|
||||||
dingtalkBusiness.getDingTalkepartmentsIntoData();
|
dingtalkBusiness.getDingTalkepartmentsIntoData(appid);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
gender = #{gender,jdbcType=INTEGER},
|
gender = #{gender,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
<if test="birthday != null and birthday != '' ">
|
<if test="birthday != null and birthday != '' ">
|
||||||
birthday = #{birthday,jdbcType=VARCHAR},
|
birthday = #{birthday,jdbcType=DATETIME},
|
||||||
</if>
|
</if>
|
||||||
<if test="maritalStatus != null">
|
<if test="maritalStatus != null">
|
||||||
marital_status = #{maritalStatus,jdbcType=INTEGER},
|
marital_status = #{maritalStatus,jdbcType=INTEGER},
|
||||||
@ -82,10 +82,18 @@
|
|||||||
<if test="unionId != null and unionId != '' ">
|
<if test="unionId != null and unionId != '' ">
|
||||||
union_id = #{unionId,jdbcType=VARCHAR},
|
union_id = #{unionId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
avatar = #{avatar},
|
<if test="openId != null and openId != '' ">
|
||||||
job_number = #{jobNumber}
|
open_id = #{openId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="jobNumber != null and jobNumber != '' ">
|
||||||
|
job_number = #{jobNumber,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="avatar != null and avatar != '' ">
|
||||||
|
avatar = #{avatar,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
|
|
||||||
</set>
|
</set>
|
||||||
WHERE is_delete = 0 AND open_id = #{openId ,jdbcType=BIGINT}
|
WHERE is_delete = 0 AND id = #{id ,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<insert id="addStaffBatch">
|
<insert id="addStaffBatch">
|
||||||
@ -284,11 +292,15 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="addStaff">
|
<insert id="addStaff" useGeneratedKeys="true" keyProperty="id">
|
||||||
INSERT INTO lz_staff(name,gender,mobile,email,open_id,employee_id,union_id,avatar,job_number)
|
INSERT INTO lz_staff(name,gender,mobile,email,open_id,employee_id,union_id,avatar,job_number)
|
||||||
VALUES
|
VALUES
|
||||||
(#{name},#{gender},#{mobile},#{email},#{openId},#{employeeId},#{unionId},#{avatar},#{jobNumber})
|
(#{name},#{gender},#{mobile},#{email},#{openId},#{employeeId},#{unionId},#{avatar},#{jobNumber})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectByRang" resultType="com.lz.modules.app.entity.StaffEntity">
|
||||||
|
select * from lz_staff where is_delete=0 and id > #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -55,4 +55,8 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateStatusByStaff">
|
||||||
|
update lz_staff_occupation set staff_status=1,resignation_time=null, position=#{departmentStaffBo.position}, staff_no=#{departmentStaffBo.employeeNo} where is_delete=0 and staff_id = #{staffId}
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user