OperationLogServiceImpl.java 24.1 KB
Newer Older
eddie.woo's avatar
eddie.woo committed
1 2
package pwc.taxtech.atms.service.impl;

gary's avatar
gary committed
3
import com.google.common.collect.Lists;
eddie.woo's avatar
eddie.woo committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
import org.apache.ibatis.session.RowBounds;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.CommonConstants;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.OperateLogType;
import pwc.taxtech.atms.common.OperationAction;
import pwc.taxtech.atms.common.OperationModule;
import pwc.taxtech.atms.constant.EnterpriseAccountConstant;
import pwc.taxtech.atms.constant.OrganizationConstant;
import pwc.taxtech.atms.constant.UserConstant;
import pwc.taxtech.atms.dao.OperationLogBasicDataMapper;
23
import pwc.taxtech.atms.dpo.PagingDto;
eddie.woo's avatar
eddie.woo committed
24 25 26 27
import pwc.taxtech.atms.dto.OperationLogDto;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.QueryOperateParamDto;
import pwc.taxtech.atms.dto.UpdateLogParams;
28 29
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.entity.OperationLogBasicDataExample.Criteria;
30
import pwc.taxtech.atms.exception.ApplicationException;
eddie.woo's avatar
eddie.woo committed
31

32 33 34 35 36 37
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;

eddie.woo's avatar
eddie.woo committed
38 39 40
/**
 */
@Service
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
public class OperationLogServiceImpl extends AbstractService {
    private static final Logger logger = LoggerFactory.getLogger(OperationLogServiceImpl.class);
    @Autowired
    private OperationLogBasicDataMapper operationLogBasicDataMapper;

    @Autowired
    private AuthUserHelper authUserHelper;

    public void addOperationLog(OperationLogDto operationLogDto) {
        OperationLogSmart record = new OperationLogSmart();
        Integer logtype = operationLogDto.getLogType();
        Assert.notNull(logtype, "Null logType");
        String table = OperateLogType.getTableName(logtype);
        Assert.hasText(table, "Empty tableName");
        record.setTableName(table);
gary's avatar
gary committed
56 57 58 59 60 61 62 63
        // 股权变更记录不生成新id和创建时间
        if(operationLogDto.isEquityLog()){
            record.setId(operationLogDto.getId());
            record.setCreateTime(operationLogDto.getCreateTime());
        }else{
            record.setId(CommonUtils.getUUID());
            record.setCreateTime(new Date());
        }
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
        record.setIp(authUserHelper.getClientIp());
        record.setOperationUser(authUserHelper.getCurrentAuditor().get());

        record.setOperationContent(operationLogDto.getOperationContent());
        Assert.notNull(operationLogDto.getModule(), "Null module");
        String operationModuleString = OperationModule.getName(operationLogDto.getModule());
        Assert.hasText(operationModuleString, "Wrong int value for OperationModule: " + operationLogDto.getModule());
        record.setModuleName(operationModuleString);
        record.setOperationObject(operationLogDto.getOperationObject());
        record.setOperationAction(OperationAction.getName(operationLogDto.getAction()));
        record.setOriginalState(operationLogDto.getOriginalState());
        record.setUpdateState(operationLogDto.getUpdateState());
        record.setComment(operationLogDto.getComment());
        if (Strings.isNotBlank(record.getOperationObject()) && record.getOperationObject().length() > 100) {
            record.setOperationObject(record.getOperationObject().substring(0, 100));
        }
        if (Strings.isNotBlank(record.getOperationContent()) && record.getOperationContent().length() > 1000) {
            record.setOperationContent(record.getOperationContent().substring(0, 1000));
        }
        if (Strings.isNotBlank(record.getOperationAction()) && record.getOperationAction().length() > 100) {
            record.setOperationAction(record.getOperationAction().substring(0, 100));
        }
        if (Strings.isNotBlank(record.getModuleName()) && record.getModuleName().length() > 1000) {
            record.setModuleName(record.getModuleName().substring(0, 100));
        }
        if (Strings.isNotBlank(record.getOperationUser()) && record.getOperationUser().length() > 100) {
            record.setOperationUser(record.getOperationUser().substring(0, 100));
        }
        operationLogBasicDataMapper.insertSmart(record);
    }

    public void addOperationLogList(List<OperationLogDto> operationLogDtoList) {
        logger.debug("OperationLogService addOperationLogList");
        if (!operationLogDtoList.isEmpty()) {
            for (OperationLogDto operationLogDto : operationLogDtoList) {
                addOperationLog(operationLogDto);
            }
        }
    }

    public PagingResultDto<OperationLogDto> getOperationLogList(QueryOperateParamDto queryOperateParamDto) {
        logger.debug("OperationLogService getOperationLogList");
        // validate
107
       // Assert.hasText(queryOperateParamDto.getModuleName(), "Empty moduleName");
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181

        final PagingDto pageInfo = queryOperateParamDto.getPageInfo();

        final PagingResultDto<OperationLogDto> pagingResultDto = new PagingResultDto<>();
        pagingResultDto.setList(new ArrayList<>());
        // build the smart example
        final OperationLogSmartExample example = buildExample(queryOperateParamDto);

        // 查找总记录数
        final int totalCount = (int) operationLogBasicDataMapper.countByExampleSmart(example);

        final PagingDto outputPageInfo = new PagingDto();
        outputPageInfo.setPageIndex(pageInfo.getPageIndex());
        outputPageInfo.setPageSize(pageInfo.getPageSize());
        outputPageInfo.setTotalCount(totalCount);
        pagingResultDto.setPageInfo(outputPageInfo);

        if (totalCount > 0) {
            final RowBounds rowBounds = buildRowBounds(pageInfo);
            List<OperationLogBasicData> operationLogBasicDataList = operationLogBasicDataMapper
                    .selectByExampleWithRowboundsSmart(example, rowBounds);
            Assert.notNull(operationLogBasicDataList, "Null list");
            List<OperationLogDto> operationLogDtoList = new ArrayList<>();
            for (OperationLogBasicData operationLogBasicData : operationLogBasicDataList) {
                OperationLogDto operationLogDto = toOperationLogDto(operationLogBasicData);
                operationLogDtoList.add(operationLogDto);
            }
            pagingResultDto.setList(operationLogDtoList);
        }

        return pagingResultDto;
    }

    private OperationLogDto toOperationLogDto(OperationLogBasicData operationLogBasicData) {
        OperationLogDto operationLogDto = new OperationLogDto();
        operationLogDto.setId(operationLogBasicData.getId());
        operationLogDto.setCreateTime(operationLogBasicData.getCreateTime());
        operationLogDto.setOperationObject(operationLogBasicData.getOperationObject());
        operationLogDto.setOperationContent(operationLogBasicData.getOperationContent());
        operationLogDto.setOriginalState(operationLogBasicData.getOriginalState());
        operationLogDto.setUpdateState(operationLogBasicData.getUpdateState());
        operationLogDto.setOperationUser(operationLogBasicData.getOperationUser());
        operationLogDto.setComment(operationLogBasicData.getComment());
        operationLogDto.setIp(operationLogBasicData.getIp());
        // 参考C#代码,logtype为null,所以这里填零
        operationLogDto.setLogType(0);
        try {
            OperationAction actionEnum = OperationAction.valueOf(operationLogBasicData.getOperationAction());
            if (actionEnum != null) {
                operationLogDto.setAction(actionEnum.value());
            }
        } catch (Exception e) {
            logger.warn("Data error: not found the OperationAction by database value:"
                    + operationLogBasicData.getOperationAction());
            operationLogDto.setAction(0);
        }
        try {
            OperationModule moduleEnum = OperationModule.valueOf(operationLogBasicData.getModuleName());
            if (moduleEnum != null) {
                operationLogDto.setModule(moduleEnum.value());
            }
        } catch (Exception e) {
            logger.warn("Data error: not found the OperationModule by database value:"
                    + operationLogBasicData.getModuleName());
            // not found the OperationModule
            operationLogDto.setModule(0);
        }
        return operationLogDto;
    }

    private OperationLogSmartExample buildExample(QueryOperateParamDto queryOperateParamDto) {
        OperationLogSmartExample example = new OperationLogSmartExample();
        Integer logtype = queryOperateParamDto.getLogType();
        Assert.notNull(logtype, "Null logType");
gary's avatar
gary committed
182
        String tableName = OperateLogType.getTableName(logtype);
183
        example.setTableName(tableName);
gary's avatar
gary committed
184
        example.setOrderByClause("create_time desc");
185 186
        String searchText = queryOperateParamDto.getSearchText();
        if (StringUtils.hasText(searchText)) {
gary's avatar
gary committed
187
            // todo 多个模糊查询的慢sql,可确认需求进行拆分
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
            String sqlValue = "%" + searchText + "%";
            Criteria criteria1 = example.createCriteria();
            criteria1.andModuleNameEqualTo(queryOperateParamDto.getModuleName());
            criteria1.andCommentLike(sqlValue);
            if (!Lang.isEmpty(queryOperateParamDto.getFilterOperationObjectList())) {
                criteria1.andOperationObjectIn(queryOperateParamDto.getFilterOperationObjectList());
            }

            Criteria criteria2 = example.createCriteria();
            criteria2.andModuleNameEqualTo(queryOperateParamDto.getModuleName());
            criteria2.andOperationObjectLike(sqlValue);
            example.or(criteria2);
            if (!Lang.isEmpty(queryOperateParamDto.getFilterOperationObjectList())) {
                criteria2.andOperationObjectIn(queryOperateParamDto.getFilterOperationObjectList());
            }

            Criteria criteria3 = example.createCriteria();
            criteria3.andModuleNameEqualTo(queryOperateParamDto.getModuleName());
            criteria3.andOperationUserLike(sqlValue);
            example.or(criteria3);
            if (!Lang.isEmpty(queryOperateParamDto.getFilterOperationObjectList())) {
                criteria3.andOperationObjectIn(queryOperateParamDto.getFilterOperationObjectList());
            }

            Criteria criteria4 = example.createCriteria();
            criteria4.andModuleNameEqualTo(queryOperateParamDto.getModuleName());
            criteria4.andUpdateStateLike(sqlValue);
            example.or(criteria4);
            if (!Lang.isEmpty(queryOperateParamDto.getFilterOperationObjectList())) {
                criteria4.andOperationObjectIn(queryOperateParamDto.getFilterOperationObjectList());
            }

            Criteria criteria5 = example.createCriteria();
            criteria5.andModuleNameEqualTo(queryOperateParamDto.getModuleName());
            criteria5.andOriginalStateLike(sqlValue);
            example.or(criteria5);
            if (!Lang.isEmpty(queryOperateParamDto.getFilterOperationObjectList())) {
                criteria5.andOperationObjectIn(queryOperateParamDto.getFilterOperationObjectList());
            }
        } else {
            Criteria criteria = example.createCriteria();
            criteria.andModuleNameEqualTo(queryOperateParamDto.getModuleName());
            if (!Lang.isEmpty(queryOperateParamDto.getFilterOperationObjectList())) {
                criteria.andOperationObjectIn(queryOperateParamDto.getFilterOperationObjectList());
            }
        }

        // @see below C# codes:
        // o.Comment.Contains(paras.SearchText) ||
        // o.OperationObject.Contains(paras.SearchText) ||
        // o.OperationUser.Contains(paras.SearchText) ||
        // o.UpdateState.Contains(paras.SearchText) ||
        // o.OriginalState.Contains(paras.SearchText))
        return example;
    }

    private RowBounds buildRowBounds(PagingDto pageInfo) {
        Assert.notNull(pageInfo, "Null pageInfo");
        Assert.notNull(pageInfo.getPageIndex(), "Null pageInfo.pageIndex");
        Assert.notNull(pageInfo.getPageSize(), "Null pageInfo.pagesize");
        int offset = Math.max(0, pageInfo.getPageSize() * (pageInfo.getPageIndex() - 1));
        int limit = pageInfo.getPageSize();
        return new RowBounds(offset, limit);
    }

    /*
     * (non-Javadoc)
     *
     * @see
     * pwc.taxtech.atms.service.OperationLogService#updateDataAddLog(java.util.List)
     */
    public void updateDataAddLog(List<UpdateLogParams> updateLogParamsList) {

        for (UpdateLogParams updateLogParams : updateLogParamsList) {
            updateDataAddLog(updateLogParams);
        }

    }

    // check how many properties being updated and the log number should be same
    public void updateDataAddLog(UpdateLogParams updateLogParams) {
        logger.debug("OperationLogService updateDataAddLog, parameter: {}", updateLogParams);
        if (updateLogParams != null && updateLogParams.getOriginalState() != null
                && updateLogParams.getUpdateState() != null) {
            Object originObject = updateLogParams.getOriginalState();
            Object updateObject = updateLogParams.getUpdateState();
            // logger.debug("origin object: {}", JSON.toJSONString(originObject, true));
            // logger.debug("update object: {}", JSON.toJSONString(updateObject, true));
            Class<?> cls = originObject.getClass();
            Field[] fileds = cls.getDeclaredFields();
            if (fileds != null && fileds.length > 0) {
                for (Field field : fileds) {
                    field.setAccessible(true);
                    // skip create time, update time and serialVersionUId
                    if (CommonConstants.CREATETIME.equalsIgnoreCase(field.getName())
                            || CommonConstants.UPDATETIME.equalsIgnoreCase(field.getName())
                            || CommonConstants.SERIALVERSIONUId.equalsIgnoreCase(field.getName())) {
                        continue;
                    }

                    try {
                        Object originValue = field.get(originObject);
                        String originalState = getValue(field.getName(), originValue, cls);
                        Object updateValue = field.get(updateObject);
                        String updateState = getValue(field.getName(), updateValue, cls);

                        if (!Objects.equals(originalState, updateState)) {
                            logger.debug("value is updated for field: {}, origin value: {}, updated value: {}",
                                    field.getName(), originValue, updateValue);
                            OperationLogDto operationLogDto = new OperationLogDto();
                            operationLogDto.setOperationObject(updateLogParams.getOperationObject());
                            operationLogDto.setOperationContent(Strings.upperFirst(field.getName()));
                            operationLogDto.setOriginalState(originalState);
                            operationLogDto.setUpdateState(updateState);
                            operationLogDto.setModule(updateLogParams.getOperationModule());
                            operationLogDto.setComment(updateLogParams.getComment());
                            operationLogDto.setLogType(updateLogParams.getOperateLogType());
                            operationLogDto.setAction(updateLogParams.getOperationAction());
                            addOperationLog(operationLogDto);
                        }
                    } catch (IllegalArgumentException | IllegalAccessException e) {
                        throw new ApplicationException(
                                "exception happened during comparing object properties, Object name: " + cls.getName()
                                        + " exception: " + e.getMessage());
                    }
                }
            }
        }
    }

    private String getValue(String fieldName, Object fieldValue, Class objClass) {
        String value = fieldValue == null ? "" : toDotNetStyleString(fieldValue);
        try {
            if (objClass.equals(EnterpriseAccount.class)) {
                if (EnterpriseAccountConstant.DirectionField.equalsIgnoreCase(fieldName)) {
                    value = EnterpriseAccountConstant.DirectionMap.get(value);
                    return value;
                }
                if (EnterpriseAccountConstant.IgnoreFieldList.stream().anyMatch(s -> fieldName.equalsIgnoreCase(s))) {
                    return "";
                }
                if (EnterpriseAccountConstant.AcctPropField.equalsIgnoreCase(fieldName)) {
                    int temp = Integer.parseInt(value);
                    if (temp < EnterpriseAccountConstant.acctPropLogList.size()) {
                        return EnterpriseAccountConstant.acctPropLogList.get(temp - 1);
                    }
                }
            } else if (objClass.equals(Organization.class)) {
                return getOrganizationSpecialName(fieldName, value);
            } else if (objClass.equals(User.class)) {
                return getUserSpecialName(fieldName, value);
            }
        } catch (Exception e) {
            // TODO: handle exception
        }
        return value;
    }

    private String getOrganizationSpecialName(String fieldName, String value) {
        if (OrganizationConstant.IgnoreFieldList.stream().anyMatch(sa -> fieldName.equalsIgnoreCase(sa))) {
            return null;
        }
        if (OrganizationConstant.ParentIdField.equalsIgnoreCase(fieldName)) {
            Organization temp = organizationMapper.selectByPrimaryKey(value);
            if (temp != null) {
                return temp.getName();
            }
        } else if (OrganizationConstant.RegionIdField.equalsIgnoreCase(fieldName)) {
            Region temp = regionMapper.selectByPrimaryKey(value);
            if (temp != null) {
                return temp.getName();
            }
        } else if (OrganizationConstant.StructureIdField.equalsIgnoreCase(fieldName)) {
            OrganizationStructure temp = organizationStructureMapper.selectByPrimaryKey(value);
            if (temp != null) {
                return temp.getName();
            }
        } else if (OrganizationConstant.BusinessUnitIdField.equalsIgnoreCase(fieldName)) {
            BusinessUnit temp = businessUnitMapper.selectByPrimaryKey(value);
            if (temp != null) {
                return temp.getName();
            }
        } else if (OrganizationConstant.IndustryIdField.equalsIgnoreCase(fieldName)) {
            Industry temp = industryMapper.selectByPrimaryKey(value);
            if (temp != null) {
                return temp.getName();
            }
        } else if (OrganizationConstant.AreaIdField.equalsIgnoreCase(fieldName)) {
            Area temp = areaMapper.selectByPrimaryKey(value);
            if (temp != null) {
                return temp.getName();
            }
        }
        return value;
    }

    private String getUserSpecialName(String fieldName, String value) {
        if (UserConstant.OrganizationIdField.equalsIgnoreCase(fieldName)) {
            Organization temp = organizationMapper.selectByPrimaryKey(value);
            if (temp != null) {
                return temp.getName();
            }
        } else if (UserConstant.IsAdminField.equalsIgnoreCase(fieldName)) {
        }
        return value;
    }

    /*
     * (non-Javadoc)
     *
     * @see
     * pwc.taxtech.atms.service.OperationLogService#addOrDeleteDataAddLog(java.util.
     * List)
     */
    public void addOrDeleteDataAddLog(List<UpdateLogParams> updateLogParamsList) {

        for (UpdateLogParams updateLogParams : updateLogParamsList) {
            addOrDeleteDataAddLog(updateLogParams);
        }
    }

    /*
     * (non-Javadoc)
     *
     * @see pwc.taxtech.atms.service.OperationLogService#addOrDeleteDataAddLog(pwc.
     * taxtech.atms.service.dto.UpdateLogParams)
     */
    public void addOrDeleteDataAddLog(UpdateLogParams updateLogParams) {

        logger.debug("OperationLogService addOrDeleteDataAddLog, parameter: {}", updateLogParams);

        OperationLogDto operationLogDto = new OperationLogDto();
        CommonUtils.copyProperties(updateLogParams, operationLogDto);
        operationLogDto.setModule(updateLogParams.getOperationModule());
        operationLogDto.setLogType(updateLogParams.getOperateLogType());
        operationLogDto.setAction(updateLogParams.getOperationAction());
        addOperationLog(operationLogDto);
    }

    private String toDotNetStyleString(Object inputObject) {
        if (inputObject == null) {
            return "";
        }
        boolean upcaseFirstFlag = false;
        if (inputObject instanceof Boolean) {
            upcaseFirstFlag = true;
        }
        String result = inputObject.toString();
        return upcaseFirstFlag ? Strings.upperFirst(result) : result;
    }

    public void addDataAddLog(Object newObj, OperationModule operationModule, String userName, String operationDesc,
                              String operationContent, String OperationObject, OperateLogType logType) {
        OperationLogDto addLog = new OperationLogDto();

        addLog.setId(CommonUtils.getUUID());
        addLog.setOperationContent(operationContent);
        addLog.setOperationObject(OperationObject);
        addLog.setOriginalState("");
        addLog.setUpdateState("");
        addLog.setOperationUser(userName);
        addLog.setIp(authUserHelper.getClientIp());
        addLog.setModule(operationModule.value());
        addLog.setComment(operationDesc);
        addLog.setAction(OperationAction.New.value());
        addLog.setLogType(logType.value());

        this.addOperationLog(addLog);
    }

    public void updateDataAddLog(Object originalObj, Object updateObj, OperationModule operationModule, String userName,
                                 String comment, String operationObject, String operationContent, OperateLogType logType) {
        UpdateLogParams params = new UpdateLogParams();
        params.setOriginalState(originalObj);
        params.setOperationContent(operationContent);
        params.setOperationObject(operationObject);
        params.setUpdateState(updateObj);
        params.setOperationModule(operationModule.value());
        params.setOperationUser(userName);
        params.setComment(comment);
        params.setOperationAction(OperationAction.Update.value());
        params.setOperateLogType(logType.value());
        this.updateDataAddLog(params);
    }

    public void deleteDataAddLog(Object deleteObj, OperationModule operationModule, String userName, String comment,
                                 String operationContent, String OperationObject, OperateLogType logType) {
        OperationLogDto addLog = new OperationLogDto();
        addLog.setId(CommonUtils.getUUID());
        addLog.setOperationContent(operationContent);
        addLog.setOperationObject(OperationObject);
        addLog.setOriginalState("");
        addLog.setUpdateState("");
        addLog.setOperationUser(userName);
        addLog.setIp(authUserHelper.getClientIp());
        addLog.setModule(operationModule.value());
        addLog.setComment(comment);
        addLog.setAction(OperationAction.New.value());
        addLog.setLogType(logType.value());
        this.addOperationLog(addLog);
    }
gary's avatar
gary committed
489 490 491 492 493 494 495 496 497 498

    /**
     * 18/01/2019 14:15
     * 根据机构名称获取股权变更记录
     * [orgName]
     * @author Gary J Li
     * @return
     */
    public List<OperationLogBasicData> getEquityChangeLogByOrgName(String orgName) {
        OperationLogBasicDataExample example = new OperationLogBasicDataExample();
gary's avatar
gary committed
499 500 501 502
        List<String> opeActions = Lists.newArrayList();
        opeActions.add(OperationAction.ChangeEquity.name());
        opeActions.add(OperationAction.NewEquity.name());
        example.createCriteria().andOperationObjectEqualTo(orgName).andOperationActionIn(opeActions);
gary's avatar
gary committed
503 504 505 506 507 508 509 510 511
        example.setOrderByClause("create_time desc");
        return operationLogBasicDataMapper.selectEquityLogByExample(example);
    }

    public int deleteById(Long id) {
        OperationLogBasicDataExample example = new OperationLogBasicDataExample();
        example.createCriteria().andIdEqualTo(String.valueOf(id));
        return operationLogBasicDataMapper.deleteEquityLogByExample(example);
    }
eddie.woo's avatar
eddie.woo committed
512
}