2022-08-23 17:51:20 +08:00
|
|
|
package com.engine.organization.wrapper;
|
|
|
|
|
|
2022-08-24 17:57:04 +08:00
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.api.browser.bean.SearchConditionGroup;
|
2022-08-23 17:51:20 +08:00
|
|
|
import com.engine.common.util.ServiceUtil;
|
2022-08-24 17:57:04 +08:00
|
|
|
import com.engine.organization.annotation.Log;
|
2022-08-23 17:51:20 +08:00
|
|
|
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
2022-08-24 17:57:04 +08:00
|
|
|
import com.engine.organization.entity.hrmresource.po.ResourceItemPO;
|
|
|
|
|
import com.engine.organization.enums.DeleteTypeEnum;
|
|
|
|
|
import com.engine.organization.enums.LogModuleNameEnum;
|
|
|
|
|
import com.engine.organization.enums.OperateTypeEnum;
|
|
|
|
|
import com.engine.organization.mapper.hrmresource.ResourceBasicInfoMapper;
|
2022-08-23 17:51:20 +08:00
|
|
|
import com.engine.organization.service.ResourceBasicInfoService;
|
|
|
|
|
import com.engine.organization.service.impl.ResourceBasicInfoServiceImpl;
|
2022-08-24 17:57:04 +08:00
|
|
|
import com.engine.organization.util.MenuBtn;
|
2022-08-23 17:51:20 +08:00
|
|
|
import com.engine.organization.util.OrganizationWrapper;
|
2022-08-24 17:57:04 +08:00
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
2022-08-23 17:51:20 +08:00
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
2022-08-24 17:57:04 +08:00
|
|
|
import java.util.*;
|
2022-08-23 17:51:20 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author weaver_cl
|
|
|
|
|
* @Description:
|
|
|
|
|
* @Date 2022/8/23
|
|
|
|
|
* @Version V1.0
|
|
|
|
|
**/
|
|
|
|
|
public class ResourceBasicInfoWrapper extends OrganizationWrapper {
|
|
|
|
|
|
|
|
|
|
private ResourceBasicInfoService getResourceBasicInfoService(User user){
|
|
|
|
|
return ServiceUtil.getService(ResourceBasicInfoServiceImpl.class,user);
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-24 17:57:04 +08:00
|
|
|
private ResourceBasicInfoMapper getResourceBasicInfoMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(ResourceBasicInfoMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-23 17:51:20 +08:00
|
|
|
public Map<String, Object> getResourceBasicInfo(Map<String, Object> params) {
|
|
|
|
|
return getResourceBasicInfoService(user).listPage(params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<TypeTreeVO> getTreeData() {
|
|
|
|
|
return getResourceBasicInfoService(user).getTreeData();
|
|
|
|
|
}
|
2022-08-24 17:57:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<SearchConditionGroup> getForm(Map<String, Object> params) {
|
|
|
|
|
return getResourceBasicInfoService(user).getForm(params);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Map<String, Object> getHasRight() {
|
|
|
|
|
Map<String, Object> btnDatas = new HashMap<>();
|
|
|
|
|
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
|
|
|
|
|
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
|
|
|
|
|
// 新增
|
|
|
|
|
topMenuList.add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("addItemClass").menuIcon("icon-coms-New-Flow").menuName("新增类型").type("BTN_AddItemClass").build());
|
|
|
|
|
topMenuList.add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("editItemClass").menuIcon("icon-coms-edit").menuName("修改类型").type("BTN_EditItemClass").build());
|
|
|
|
|
topMenuList.add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("delItemClass").menuIcon("icon-coms-Delete").menuName("删除类型").type("BTN_DelItemClass").build());
|
|
|
|
|
topMenuList.add(MenuBtn.topMenu_addNew());
|
|
|
|
|
// 批量删除
|
|
|
|
|
topMenuList.add(MenuBtn.topMenu_batchDelete());
|
|
|
|
|
btnDatas.put("topMenu", topMenuList);
|
|
|
|
|
// 新增
|
|
|
|
|
rightMenuList.add(MenuBtn.rightMenu_addNew());
|
|
|
|
|
// 日志
|
|
|
|
|
rightMenuList.add(MenuBtn.rightMenu_btnLog());
|
|
|
|
|
// 显示列定制
|
|
|
|
|
rightMenuList.add(MenuBtn.rightMenu_btnColumn());
|
|
|
|
|
btnDatas.put("rightMenu", rightMenuList);
|
|
|
|
|
return btnDatas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Log(operateType = OperateTypeEnum.DELETE, operateModule = LogModuleNameEnum.RESOURCE, operateDesc = "删除人员信息资料")
|
|
|
|
|
public int deleteByIds(Collection<Long> ids) {
|
|
|
|
|
List<ResourceItemPO> resourceItemPOS = getResourceBasicInfoMapper().selectItemByIds(ids);
|
|
|
|
|
int result = getResourceBasicInfoService(user).deletByIds(ids);
|
|
|
|
|
for (ResourceItemPO resourceItemPO : resourceItemPOS) {
|
|
|
|
|
writeOperateLog(new Object() {}.getClass(),resourceItemPO.getFname(), JSON.toJSONString(ids),"删除人员信息资料");
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Log(operateType = OperateTypeEnum.RECOVER, operateModule = LogModuleNameEnum.RESOURCE, operateDesc = "恢复人员信息资料")
|
|
|
|
|
public int recoverByIds(Collection<Long> ids) {
|
|
|
|
|
List<ResourceItemPO> resourceItemPOS = getResourceBasicInfoMapper().selectItemByIds(ids);
|
|
|
|
|
int result = getResourceBasicInfoService(user).recoverByIds(ids);
|
|
|
|
|
for (ResourceItemPO resourceItemPO : resourceItemPOS) {
|
|
|
|
|
writeOperateLog(new Object() {}.getClass(),resourceItemPO.getFname(), JSON.toJSONString(ids),"恢复人员信息资料");
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Log(operateType = OperateTypeEnum.ADD, operateModule = LogModuleNameEnum.RESOURCE, operateDesc = "新增人员信息资料")
|
|
|
|
|
public int save(ResourceItemPO resourceItemPO) {
|
|
|
|
|
resourceItemPO.setCreateTime(new Date());
|
|
|
|
|
resourceItemPO.setCreator((long)user.getUID());
|
|
|
|
|
resourceItemPO.setFdelete(DeleteTypeEnum.NOT_DELETED.getValue());
|
|
|
|
|
int result = getResourceBasicInfoService(user).save(resourceItemPO);
|
|
|
|
|
writeOperateLog(new Object() {}.getClass(),resourceItemPO.getFname(),JSON.toJSONString(resourceItemPO),"新增人员信息资料");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Log(operateType = OperateTypeEnum.UPDATE, operateModule = LogModuleNameEnum.RESOURCE, operateDesc = "更新人员信息资料")
|
|
|
|
|
public int update(ResourceItemPO resourceItemPO) {
|
|
|
|
|
resourceItemPO.setUpdateTime(new Date());
|
|
|
|
|
ResourceItemPO resourceItem = getResourceBasicInfoService(user).selectById(resourceItemPO.getFid());
|
|
|
|
|
int result = getResourceBasicInfoService(user).update(resourceItemPO);
|
|
|
|
|
writeOperateLog(new Object() {}.getClass(),resourceItem.getFname(),JSON.toJSONString(resourceItemPO),resourceItem,
|
|
|
|
|
getResourceBasicInfoService(user).selectById(resourceItemPO.getFid()));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2022-08-23 17:51:20 +08:00
|
|
|
}
|