# ResistMappingManagerImpl.java

    package com.mycim.server.resist.manager.impl;

    import com.mycim.framework.jdbc.Page;
    import com.mycim.server.base.manager.TransactionLogManager;
    import com.mycim.server.resist.dao.ResistMappingDAO;
    import com.mycim.server.resist.manager.ResistMappingManager;
    import com.mycim.valueobject.bas.TransactionLog;
    import com.mycim.valueobject.consts.TransactionNames;
    import com.mycim.valueobject.ems.ResistMapping;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;
    import org.springframework.transaction.annotation.Transactional;

    import java.util.Date;
    import java.util.Map;

    /**
     * @author yanbing.chen
     * @version 6.0.0
     * @date 2019/10/30
     **/
    @Service
    @Transactional
    public class ResistMappingManagerImpl implements ResistMappingManager {

        @Autowired
        ResistMappingDAO resistMappingDAO;

        @Autowired
        TransactionLogManager transactionLogManager;

        @Override
        public ResistMapping getResistMappingByResistNo(String resistNo) {
            return resistMappingDAO.getResistMappingByResistNo(resistNo);
        }

        @Override
        public Page qryResistMappingByPage(Page page, Map<String, String> argMap) {
            return resistMappingDAO.qryResistMappingByPage(page, argMap);
        }

        @Override
        public void addResistMapping(ResistMapping resistMapping) {
            TransactionLog transactionLog = transactionLogManager
                    .startTransactionLog(resistMapping.getModifyBy(), TransactionNames.CREATE_KEY);
            resistMappingDAO.addResistMapping(resistMapping);

            resistMappingDAO.addResistMappingH(transactionLog.getTransRrn(), 1, resistMapping.getResistNo());

            transactionLogManager.markTransactionLog(transactionLog);
        }

        @Override
        public void modifyResistMapping(ResistMapping resistMapping) {
            TransactionLog transactionLog = transactionLogManager
                    .startTransactionLog(resistMapping.getModifyBy(), TransactionNames.MODIFY_KEY);
            resistMappingDAO.modifyResistMapping(resistMapping);

            resistMappingDAO.addResistMappingH(transactionLog.getTransRrn(), 1, resistMapping.getResistNo());

            transactionLogManager.markTransactionLog(transactionLog);
        }

        @Override
        public void deleteResistMapping(ResistMapping resistMapping) {
            TransactionLog transactionLog = transactionLogManager
                    .startTransactionLog(resistMapping.getModifyBy(), TransactionNames.DELETE_KEY);
            resistMappingDAO.deleteResistMapping(resistMapping.getResistNo());
            resistMapping.setTransRrn(transactionLog.getTransRrn());
            resistMapping.setModifyTime(new Date());
            resistMapping.setTransSequence(1);
            resistMappingDAO.addResistMappingH(resistMapping);
            transactionLogManager.markTransactionLog(transactionLog);
        }

        @Override
        public Page qryResistMappingHistByPage(Page page, Map<String, String> argMap) {
            return resistMappingDAO.qryResistMappingHistByPage(page, argMap);
        }

    }