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);
|
}
|
}
|
}
|