package com.ruoyi.web;

import com.ruoyi.system.domain.*;
import com.ruoyi.system.mapper.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 为已有表新增的id字段赋值
 */
@SpringBootTest
@RunWith(SpringRunner.class)
public class GenerateId {

    @Resource
    private StringRedisTemplate stringRedisTemplate;

    @Resource
    private SysUserMapper sysUserMapper;

    @Resource
    private SysDailyMapper sysDailyMapper;

    @Resource
    private SysLogininforMapper sysLogininforMapper;

    @Resource
    private DailyReportUploadPermissionMapper dailyReportUploadPermissionMapper;

    @Resource
    private B1Mapper b1Mapper;

    @Resource
    private B2Mapper b2Mapper;

    @Resource
    private B3Mapper b3Mapper;

    @Resource
    private B4Mapper b4Mapper;

    @Resource
    private B6Mapper b6Mapper;

    @Resource
    private B7Mapper b7Mapper;

    @Resource
    private B8Mapper b8Mapper;

    @Resource
    private B9Mapper b9Mapper;

    @Resource
    private B10Mapper b10Mapper;

    @Resource
    private B11Mapper b11Mapper;

    @Resource
    private B12Mapper b12Mapper;

    @Resource
    private B13Mapper b13Mapper;

    @Resource
    private B14Mapper b14Mapper;

    @Resource
    private B14cMapper b14cMapper;

    @Resource
    private B15Mapper b15Mapper;

    @Resource
    private B15cMapper b15cMapper;

    @Resource
    private B16ToB19Mapper b16ToB19Mapper;

    @Resource
    private BalanceDayMapper balanceDayMapper;

    @Resource
    private BalancePieceMapper balancePieceMapper;

    @Resource
    private BalanceStatusMapper balanceStatusMapper;

    @Resource
    private CashInStatusMapper cashInStatusMapper;

    @Resource
    private CashOutStatusMapper cashOutStatusMapper;

    @Resource
    private DailyReportDeletePermissionMapper dailyReportDeletePermissionMapper;

    @Resource
    private IncomeMapper incomeMapper;

    @Resource
    private IncomeStatusMapper incomeStatusMapper;

    @Resource
    private SalaryMapper salaryMapper;

    @Resource
    private Salary1Mapper salary1Mapper;

    @Resource
    private Salary2Mapper salary2Mapper;

    @Resource
    private Salary3Mapper salary3Mapper;

    @Resource
    private SysWeekMapper sysWeekMapper;

    @Resource
    private InvoiceMapper invoiceMapper;

    /**
     * user表中id与userid的 映射关系
     * @return
     */
    private Map<String, String> userIdToId() {
        Map<String, String> map = new HashMap<>();
        List<Users> users = sysUserMapper.selectList();
        for (Users user : users) {
            map.put(user.getUserid(), user.getId());
        }
        return map;
    }

    private Map<Object, Object> getMap() {
        return stringRedisTemplate.opsForHash().entries("sys_map");
    }

    /**
     * 查询表中所有数据
     * 设置id
     * 批量更新
     * @param date
     */
    private void setIdByDate(int date) {
        Map<Object, Object> map = getMap();
//        Map<String, String> map = userIdToId();

        List<DailyReportStatus> list = sysDailyMapper.selectAll(date);
        for (DailyReportStatus dailyReportStatus : list) {
            String userId = dailyReportStatus.getUserId();
            String id = (String) map.get(userId);
            dailyReportStatus.setId(id);
        }
        // 批量更新
        sysDailyMapper.updateList(list, date);
    }

    /**
     * 表daily_report_status_XX增加字段id，并赋值
     */
    @Test
    public void test_daily_report_status_XX() {
        // 2022年份
        for (int date1 = 202201; date1 < 202213; date1++) {
            sysDailyMapper.addUserIdColumn(date1);
            if (date1 == 202201 || date1 == 202202 || date1 == 202203 || date1 == 202204) {
                continue;
            }

            setIdByDate(date1);
        }
        // 2023年份
        for (int date2 = 202301; date2 < 202307; date2++) {
            sysDailyMapper.addUserIdColumn(date2);

            setIdByDate(date2);
        }
    }

    /**
     * 表sys_logininfor增加字段id，并赋值
     */
    @Test
    public void test_sys_logininfor() {
        sysLogininforMapper.addUserIdColumn();
        List<SysLogininfor> sysLogininforList = sysLogininforMapper.selectAll();
        Map<Object, Object> map = getMap();
        for (SysLogininfor sysLogininfor : sysLogininforList) {
            String userName = sysLogininfor.getUserName();
            if (userName != null) {
                String id = (String) map.get(userName);
                if (id != null) {
                    sysLogininfor.setId(id);
                }
            }
        }
        sysLogininforMapper.updateList(sysLogininforList);
    }

    /**
     * 表daily_report_upload_permission增加字段id，并赋值
     */
    @Test
    public void test_daily_report_upload_permission() {
        dailyReportUploadPermissionMapper.addUserIdColumn();
        List<DailyReportUploadPermission> dailyReportUploadPermissionList = dailyReportUploadPermissionMapper.selectAll();
        Map<Object, Object> map = getMap();
        for (DailyReportUploadPermission dailyReportUploadPermission : dailyReportUploadPermissionList) {
            String userid = dailyReportUploadPermission.getUserid();
            String id = (String) map.get(userid);
            dailyReportUploadPermission.setId(id);
        }
        dailyReportUploadPermissionMapper.updateList(dailyReportUploadPermissionList);
    }

    /**
     * 表b1 增加字段 员工id，并赋值
     * count = 9W
     */
    @Test
    public void test_b1() {
        b1Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b1
        List<B1> b1List = b1Mapper.selectAll();
        for (B1 b1 : b1List) {
            String surveyPerson = b1.getSurveyPerson();
            if (surveyPerson != null) {
                String id = (String) map.get(surveyPerson);
                if (id != null) {
                    b1.setUserId(id);
                }
            }
        }
        b1Mapper.updateList(b1List);
    }

    /**
     * 表b2 增加字段 员工id，并赋值
     * count = 7W
     */
    @Test
    public void test_b2() {
        b2Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b2
        List<B2> b2List = b2Mapper.selectAll();
        for (B2 b2 : b2List) {
            String xinTuPerson = b2.getXinTuPerson();
            if (xinTuPerson != null) {
                String id = (String) map.get(xinTuPerson);
                if (id != null) {
                    b2.setUserId(id);
                }
            }
        }
        b2Mapper.updateList(b2List);
    }

    /**
     * 表b3 增加字段 员工id，并赋值
     * count = 4W
     */
    @Test
    public void test_b3() {
        b3Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b3
        List<B3> b3List = b3Mapper.selectAll();
        for (B3 b3 : b3List) {
            String surveyPerson = b3.getSurveyPerson();
            if (surveyPerson != null) {
                String id = (String) map.get(surveyPerson);
                if (id != null) {
                    b3.setUserId(id);
                }
            }
        }
        b3Mapper.updateList(b3List);
    }

    /**
     * 表b4 增加字段 员工id，并赋值
     * count = 4W
     */
    @Test
    public void test_b4() {
        b4Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b4
        List<B4> b4List = b4Mapper.selectAll();
        for (B4 b4 : b4List) {
            String newPerson = b4.getNewPerson();
            if (newPerson != null) {
                String id = (String) map.get(newPerson);
                if (id != null) {
                    b4.setUserId(id);
                }
            }
        }
        b4Mapper.updateList(b4List);
    }

    /**
     * 表b6 增加字段 员工id，并赋值
     * count = 9k
     */
    @Test
    public void test_b6() {
        b6Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b6
        List<B6> b6List = b6Mapper.selectAll();
        for (B6 b6 : b6List) {
            String name = b6.getName();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b6.setUserId(id);
                }
            }
        }
        b6Mapper.updateList(b6List);
    }

    /**
     * 表b7 增加字段 员工id，并赋值
     * count = 4k
     */
    @Test
    public void test_b7() {
        b7Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b7
        List<B7> b7List = b7Mapper.selectAll();
        for (B7 b7 : b7List) {
            String name = b7.getSurveyPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b7.setUserId(id);
                }
            }
        }
        b7Mapper.updateList(b7List);
    }

    /**
     * 表b8 增加字段 员工id，并赋值
     * count = 3k
     */
    @Test
    public void test_b8() {
        b8Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b8
        List<B8> b8List = b8Mapper.selectAll();
        for (B8 b8 : b8List) {
            String name = b8.getNewPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b8.setUserId(id);
                }
            }
        }
        b8Mapper.updateList(b8List);
    }

    /**
     * 表b9 增加字段 员工id，并赋值
     * count = 2k
     */
    @Test
    public void test_b9() {
        b9Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b9
        List<B9> b9List = b9Mapper.selectAll();
        for (B9 b9 : b9List) {
            String name = b9.getNewPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b9.setUserId(id);
                }
            }
        }
        b9Mapper.updateList(b9List);
    }

    /**
     * 表b10 增加字段 员工id，并赋值
     * count = 2k
     */
    @Test
    public void test_b10() {
        b10Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b10
        List<B10> b10List = b10Mapper.selectAll();
        for (B10 b10 : b10List) {
            String name = b10.getSurveyPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b10.setUserId(id);
                }
            }
        }
        b10Mapper.updateList(b10List);
    }

    /**
     * 表b11 增加字段 员工id，并赋值
     * count = 2k
     */
    @Test
    public void test_b11() {
        b11Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b11
        List<B11> b11List = b11Mapper.selectAll();
        for (B11 b11 : b11List) {
            String name = b11.getNewPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b11.setUserId(id);
                }
            }
        }
        b11Mapper.updateList(b11List);
    }

    /**
     * 表b12 增加字段 员工id，并赋值
     * count = 1k
     */
    @Test
    public void test_b12() {
        b12Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b12
        List<B12> b12List = b12Mapper.selectAll();
        for (B12 b12 : b12List) {
            String name = b12.getSurveyPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b12.setUserId(id);
                }
            }
        }
        b12Mapper.updateList(b12List);
    }

    /**
     * 表b13 增加字段 员工id，并赋值
     * count = 1k
     */
    @Test
    public void test_b13() {
        b13Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b13
        List<B13> b13List = b13Mapper.selectAll();
        for (B13 b13 : b13List) {
            String name = b13.getNewPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b13.setUserId(id);
                }
            }
        }
        b13Mapper.updateList(b13List);
    }

    /**
     * 表b14 增加字段 员工id，并赋值
     * count = 1.1W
     */
    @Test
    public void test_b14() {
        b14Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b14
        List<B14> b14List = b14Mapper.selectAll();
        for (B14 b14 : b14List) {
            String name = b14.getSurveyPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b14.setUserId(id);
                }
            }
        }
        b14Mapper.updateList(b14List);
    }

    /**
     * 表b14c 增加字段 员工id，并赋值
     * count = 1.5W
     */
    @Test
    public void test_b14c() {
        b14cMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b14c
        List<B14c> b14cList = b14cMapper.selectAll();
        for (B14c b14c : b14cList) {
            String name = b14c.getSurveyPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b14c.setUserId(id);
                }
            }
        }
        b14cMapper.updateList(b14cList);
    }

    /**
     * 表b14c_status 增加字段 员工id，并赋值
     */
    @Test
    public void test_b14cStatus() {
        b14cMapper.addUserIdColumnStatus();
        Map<Object, Object> map = getMap();

        // b14cStatus
        List<B14cStatus> b14cStatusList = b14cMapper.selectStatusAll();
        for (B14cStatus b14cStatus : b14cStatusList) {
            String name = b14cStatus.getUserID();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b14cStatus.setId(id);
                }
            }
        }
        b14cMapper.updateStatusList(b14cStatusList);
    }

    /**
     * 表b15 增加字段 员工id，并赋值
     * count = 5.6W
     */
    @Test
    public void test_b15() {
        b15Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b15
        List<B15> b15List = b15Mapper.selectAll();
        for (B15 b15 : b15List) {
            String name = b15.getClaimPaymentPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b15.setUserId(id);
                }
            }
        }
        b15Mapper.updateList(b15List);
    }

    /**
     * 表b15c 增加字段 员工id，并赋值
     * count = 6.4W
     */
    @Test
    public void test_b15c() {
        b15cMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b15c
        List<B15c> b15List = b15cMapper.selectAll();
        for (B15c b15c : b15List) {
            String name = b15c.getClaimPaymentPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b15c.setUserId(id);
                }
            }
        }
        b15cMapper.updateList(b15List);
    }

    /**
     * 表b15c_status 增加字段 员工id，并赋值
     */
    @Test
    public void test_b15cStatus() {
        b15cMapper.addUserIdStatusColumn();
        Map<Object, Object> map = getMap();

        // b15c_status
        List<B15cStatus> b15List = b15cMapper.selectStatusAll();
        for (B15cStatus b15c : b15List) {
            String name = b15c.getUserID();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b15c.setId(id);
                }
            }
        }
        b15cMapper.updateStatusList(b15List);
    }

    /**
     * 表b16 增加字段 员工id，并赋值
     * count = 3k
     */
    @Test
    public void test_b16() {
        b16ToB19Mapper.addUserIdB16Column();
        Map<Object, Object> map = getMap();

        // b16
        List<B16> b15List = b16ToB19Mapper.selectB16All();
        for (B16 b16 : b15List) {
            String name = b16.getPreOrderPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setUserId(id);
                }
            }
        }
        b16ToB19Mapper.updateB16List(b15List);
    }

    /**
     * 表b16_to_b19_status 增加字段 员工id，并赋值
     */
    @Test
    public void test_b16_to_b19_status() {
        b16ToB19Mapper.addUserIdB16TOB19StatusColumn();
        Map<Object, Object> map = getMap();

        // b16
        List<B16ToB19Status> b15List = b16ToB19Mapper.selectB16ToB19StatusAll();
        for (B16ToB19Status b16 : b15List) {
            String name = b16.getUserID();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setId(id);
                }
            }
        }
        b16ToB19Mapper.updateB16TOB19StatusList(b15List);
    }

    /**
     * 表b17 增加字段 员工id，并赋值
     * count = 1.2w
     */
    @Test
    public void test_b17() {
        b16ToB19Mapper.addUserIdB17Column();
        Map<Object, Object> map = getMap();

        // b16
        List<B17> b15List = b16ToB19Mapper.selectB17All();
        for (B17 b16 : b15List) {
            String name = b16.getPreOrderPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setUserId(id);
                }
            }
        }
        b16ToB19Mapper.updateB17List(b15List);
    }

    /**
     * 表b18 增加字段 员工id，并赋值
     * count = 1.2w
     */
    @Test
    public void test_b18() {
        b16ToB19Mapper.addUserIdB18Column();
        Map<Object, Object> map = getMap();

        // b16
        List<B18> b15List = b16ToB19Mapper.selectB18All();
        for (B18 b16 : b15List) {
            String name = b16.getPreOrderPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setUserId(id);
                }
            }
        }
        b16ToB19Mapper.updateB18List(b15List);
    }

    /**
     * 表b19 增加字段 员工id，并赋值
     */
    @Test
    public void test_b19() {
        b16ToB19Mapper.addUserIdB19Column();
        Map<Object, Object> map = getMap();

        // b19
        List<B19> b15List = b16ToB19Mapper.selectB19All();
        for (B19 b16 : b15List) {
            String name = b16.getPreOrderPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setUserId(id);
                }
            }
        }
        b16ToB19Mapper.updateB19List(b15List);
    }

    /**
     * 表balance_day 增加字段 员工id，并赋值
     */
    @Test
    public void test_balance_day() {
        balanceDayMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<BalanceDay> b15List = balanceDayMapper.selectAll();
        for (BalanceDay b16 : b15List) {
            String name = b16.getAssistPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setUserId(id);
                }
            }
        }
        balanceDayMapper.updateList(b15List);
    }

    /**
     * 表balance_price 增加字段 员工id，并赋值
     */
    @Test
    public void test_balance_price() {
        balancePieceMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<BalancePiece> b15List = balancePieceMapper.selectAll();
        for (BalancePiece b16 : b15List) {
            String name = b16.getAssistPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setUserId(id);
                }
            }
        }
        balancePieceMapper.updateList(b15List);
    }

    /**
     * 表balance_status 增加字段 员工id，并赋值
     */
    @Test
    public void test_balance_status() {
        balanceStatusMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<BalanceStatus> b15List = balanceStatusMapper.selectAll();
        for (BalanceStatus b16 : b15List) {
            String name = b16.getUserId();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setId(id);
                }
            }
        }
        balanceStatusMapper.updateList(b15List);
    }

    /**
     * 表cash_in_status 增加字段 员工id，并赋值
     */
    @Test
    public void test_cash_in_status() {
        cashInStatusMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<CashInStatus> b15List = cashInStatusMapper.selectAll();
        for (CashInStatus b16 : b15List) {
            String name = b16.getUserId();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setId(id);
                }
            }
        }
        cashInStatusMapper.updateList(b15List);
    }

    /**
     * 表cash_out_status 增加字段 员工id，并赋值
     */
    @Test
    public void test_cash_out_status() {
        cashOutStatusMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<CashOutStatus> b15List = cashOutStatusMapper.selectAll();
        for (CashOutStatus b16 : b15List) {
            String name = b16.getUserId();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setId(id);
                }
            }
        }
        cashOutStatusMapper.updateList(b15List);
    }

    /**
     * 表daily_report_delete_permission 增加字段 员工id，并赋值
     */
    @Test
    public void test_daily_report_delete_permission() {
        dailyReportDeletePermissionMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<DailyReportDeletePermission> b15List = dailyReportDeletePermissionMapper.selectAll();
        for (DailyReportDeletePermission b16 : b15List) {
            String name = b16.getUserid();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setId(id);
                }
            }
        }
        dailyReportDeletePermissionMapper.updateList(b15List);
    }

    /**
     * 表income 增加字段 员工id，并赋值
     */
    @Test
    public void test_income() {
        incomeMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<Income> b15List = incomeMapper.selectAll();
        for (Income b16 : b15List) {
            String name = b16.getReportPerson();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setUserId(id);
                }
            }
        }
        incomeMapper.updateList(b15List);
    }

    /**
     * 表income_status 增加字段 员工id，并赋值
     */
    @Test
    public void test_income_status() {
        incomeStatusMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<IncomeStatus> b15List = incomeStatusMapper.selectAll();
        for (IncomeStatus b16 : b15List) {
            String name = b16.getUserId();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setId(id);
                }
            }
        }
        incomeStatusMapper.updateList(b15List);
    }

    /**
     * 表salary_status 增加字段 员工id，并赋值
     */
    @Test
    public void test_salary_status() {
        salaryMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<SalaryStatus> b15List = salaryMapper.selectAll();
        for (SalaryStatus b16 : b15List) {
            String name = b16.getUserId();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setId(id);
                }
            }
        }
        salaryMapper.updateList(b15List);
    }

    /**
     * 表salary1 增加字段 员工id，并赋值
     */
    @Test
    public void test_salary1() {
        salary1Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<Salary1> b15List = salary1Mapper.selectAll();
        for (Salary1 b16 : b15List) {
            String name = b16.getName();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setUserId(id);
                }
            }
        }
        salary1Mapper.updateList(b15List);
    }

    /**
     * 表salary3 增加字段 员工id，并赋值
     */
    @Test
    public void test_salary3() {
        salary3Mapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<Salary3> b15List = salary3Mapper.selectAll();
        for (Salary3 b16 : b15List) {
            String name = b16.getName();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setUserId(id);
                }
            }
        }
        salary3Mapper.updateList(b15List);
    }

    /**
     * 表week_report_status 增加字段 员工id，并赋值
     */
    @Test
    public void test_week_report_status() {
        sysWeekMapper.addUserIdColumn();
        Map<Object, Object> map = getMap();

        // b19
        List<WeekReportStatus> b15List = sysWeekMapper.selectAll();
        for (WeekReportStatus b16 : b15List) {
            String name = b16.getUserId();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setId(id);
                }
            }
        }
        sysWeekMapper.updateList(b15List);
    }

    /**
     * 表invoice 增加字段 员工id，并赋值
     */
    @Test
    public void test_invoice() {
        invoiceMapper.addUserIdColumn();
        invoiceMapper.addUserIdColumn2();

        Map<Object, Object> map = getMap();

        // b19
        List<Invoice> b15List = invoiceMapper.selectAll();
        for (Invoice b16 : b15List) {
            String name = b16.getApplicant();
            if (name != null) {
                String id = (String) map.get(name);
                if (id != null) {
                    b16.setApplicantID(id);
                }
            }

            String name2 = b16.getUploadPerson();
            if (name2 != null) {
                String id2 = (String) map.get(name2);
                if (id2 != null) {
                    b16.setUploadPersonID(id2);
                }
            }
        }
        invoiceMapper.updateList(b15List);
    }
}
