package com.rzyc.service; import com.common.utils.RandomNumber; import com.rzyc.mapper.EntPostDutyMapper; import com.rzyc.mapper.ent.InEntListMapper; import com.rzyc.model.EntPostDuty; import com.rzyc.model.ent.EntPost; import com.rzyc.model.ent.InEntList; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * 插入企业岗位职责 * @author xuwanxin * @date 2022/12/22 * */ public class EntPostDutyThread implements Runnable{ private InEntListMapper inEntListMapper; private EntPostDutyMapper entPostDutyMapper; private Listposts; public EntPostDutyThread(InEntListMapper inEntListMapper, EntPostDutyMapper entPostDutyMapper,Listposts) { this.inEntListMapper = inEntListMapper; this.entPostDutyMapper = entPostDutyMapper; this.posts = posts; } @Override public void run() { List duties = new ArrayList<>(); for (EntPost e:posts) { List list = inEntListMapper.selectByEnterpriseId(e.getEnterpriseId()); for (InEntList s:list) { EntPostDuty entPostDuty = new EntPostDuty(); entPostDuty.setDutyId(RandomNumber.getUUid()); entPostDuty.setPostId(e.getPostId()); entPostDuty.setDutyItem(s.getItemContent()); entPostDuty.setSortId(s.getSortId()); entPostDuty.setEnterpriseId(s.getEnterpriseId()); entPostDuty.setCreateBy("系统导入"); entPostDuty.setCreateTime(new Date()); duties.add(entPostDuty); } if (duties.size() > 0){ entPostDutyMapper.insertList(duties); duties.clear(); }else { System.out.println("err"); } } } }