All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.mingsoft.organization.biz.impl.EmployeeBizImpl Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
/**
The MIT License (MIT) * Copyright (c) 2019 铭飞科技

 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:

 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.

 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package net.mingsoft.organization.biz.impl;

import cn.hutool.crypto.SecureUtil;
import net.mingsoft.base.entity.BaseEntity;
import net.mingsoft.basic.biz.IManagerBiz;
import net.mingsoft.basic.entity.ModelEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import net.mingsoft.base.biz.impl.BaseBizImpl;
import net.mingsoft.base.dao.IBaseDao;
import java.util.*;
import net.mingsoft.organization.entity.EmployeeEntity;
import net.mingsoft.organization.biz.IEmployeeBiz;
import net.mingsoft.organization.dao.IEmployeeDao;

/**
 * 员工管理持久化层
 * @author 铭飞开源团队
 * 创建日期:2020-1-6 14:53:26
* 历史修订:
*/ @Service("organizationemployeeBizImpl") public class EmployeeBizImpl extends BaseBizImpl implements IEmployeeBiz { @Autowired private IEmployeeDao employeeDao; @Autowired private IManagerBiz managerBiz; @Override protected IBaseDao getDao() { // TODO Auto-generated method stub return employeeDao; } @Override public void saveEntity(EmployeeEntity employeeEntity) { if (StringUtils.isNotBlank(employeeEntity.getManagerPassword())) { employeeEntity.setManagerPassword(SecureUtil.md5(employeeEntity.getManagerPassword())); } this.managerBiz.saveEntity(employeeEntity); employeeDao.saveEntity(employeeEntity); } @Override public void updateEntity(EmployeeEntity employeeEntity) { if (StringUtils.isNotBlank(employeeEntity.getManagerPassword())) { employeeEntity.setManagerPassword(SecureUtil.md5(employeeEntity.getManagerPassword())); } this.managerBiz.updateEntity(employeeEntity); employeeDao.updateEntity(employeeEntity); } @Override public List queryModelByRoleIds(int[] ids) { return employeeDao.queryModelByRoleIds(ids); } @Override public List queryListByOrganization(EmployeeEntity employeeEntity) { return employeeDao.queryListByOrganization(employeeEntity); } @Override public void delete(int[] ids){ List managerIds=new ArrayList<>(); for (int id : ids) { EmployeeEntity employeEntity = (EmployeeEntity)employeeDao.getEntity(id); if(employeEntity!=null){ managerIds.add(employeEntity.getManagerId()); } } this.managerBiz.delete(managerIds.stream().mapToInt(Integer::valueOf).toArray()); super.delete(ids); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy