wangzhibo
7 天以前 665ba0f9ae078c2859209451a163d10515171d11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Provide } from '@midwayjs/core';
import { BaseService } from '@cool-midway/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { Repository } from 'typeorm';
import { BasicdataSorterEntity } from '../entity/sorter';
import * as md5 from 'md5';
 
/**
 * 分拣人员服务
 */
@Provide()
export class BasicdataSorterService extends BaseService {
  @InjectEntityModel(BasicdataSorterEntity)
  basicdataSorterEntity: Repository<BasicdataSorterEntity>;
 
   /**
     * 修改之前处理密码加密
     */
    async modifyBefore(data: any, type: 'delete' | 'update' | 'add') {
      if ((type === 'add' || type === 'update') && data.password) {
        data.password = md5(data.password);
      }
    }
}