56 lines
2.0 KiB
Java
56 lines
2.0 KiB
Java
|
|
package com.engine.wysecond.service.impl;
|
||
|
|
|
||
|
|
import com.engine.common.util.ServiceUtil;
|
||
|
|
import com.engine.core.impl.Service;
|
||
|
|
import com.engine.wysecond.entity.ResourcesPo;
|
||
|
|
import com.engine.wysecond.service.PostionMatrixService;
|
||
|
|
import com.engine.wysecond.service.ResourceCardService;
|
||
|
|
import com.weaver.general.Util;
|
||
|
|
import weaver.conn.RecordSet;
|
||
|
|
import weaver.hrm.User;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @Author liang.cheng
|
||
|
|
* @Date 2025/2/28 16:18
|
||
|
|
* @Description:
|
||
|
|
* @Version 1.0
|
||
|
|
*/
|
||
|
|
public class ResourceCardServiceImpl extends Service implements ResourceCardService {
|
||
|
|
|
||
|
|
private PostionMatrixService getService(User user) {
|
||
|
|
return ServiceUtil.getService(PostionMatrixServiceImpl.class, user);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public int upDateCard(List<ResourcesPo> resourcesPo) {
|
||
|
|
|
||
|
|
RecordSet rs = new RecordSet();
|
||
|
|
|
||
|
|
List<ResourcesPo> resourcesPoList = getService(user).postionPeoples();
|
||
|
|
|
||
|
|
String postionType = rs.getPropValue("wysecond", "postionType");
|
||
|
|
String postion = rs.getPropValue("wysecond", "postion");
|
||
|
|
resourcesPoList.forEach(resources -> {
|
||
|
|
rs.executeQuery("select count(1) as sums from cus_fielddata where id = ? and scopeid =3 and scope = 'HrmCustomFieldByInfoType'",resources.getResourceId());
|
||
|
|
rs.next();
|
||
|
|
|
||
|
|
int sums = Util.getIntValue(rs.getString("sums"));
|
||
|
|
if (sums > 0) {
|
||
|
|
//更新
|
||
|
|
rs.executeUpdate("update cus_fielddata set " + postionType + "= ?," + postion + "= ? where id = ? and scopeid =3 and scope = 'HrmCustomFieldByInfoType'", resources.getPostionType(),
|
||
|
|
resources.getPostion(), resources.getResourceId());
|
||
|
|
|
||
|
|
|
||
|
|
}else {
|
||
|
|
//插入
|
||
|
|
rs.executeUpdate("insert into cus_fielddata(id,scopeid,scope,"+postionType+","+postion+") values(?,?,?,?,?)",resources.getResourceId(),
|
||
|
|
3,"HrmCustomFieldByInfoType",resources.getPostionType(),resources.getPostion());
|
||
|
|
}
|
||
|
|
|
||
|
|
});
|
||
|
|
return resourcesPoList.size();
|
||
|
|
}
|
||
|
|
}
|