You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
weaver-hrm-organization/src/com/engine/organization/service/impl/CardAccessServiceImpl.java

92 lines
3.1 KiB
Java

package com.engine.organization.service.impl;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.personnelcard.po.CardAccessPO;
3 years ago
import com.engine.organization.entity.personnelcard.vo.CardAccessVO;
import com.engine.organization.mapper.personnelcard.CardAccessMapper;
import com.engine.organization.service.CardAccessService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.*;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/11/1
* @Version V1.0
**/
public class CardAccessServiceImpl extends Service implements CardAccessService {
private static final String RIGHT_NAME = "CardAccess:All";
private static CardAccessMapper getCardAccessMapper() {
return MapperProxyFactory.getProxy(CardAccessMapper.class);
}
public CardAccessServiceImpl(User user) {
super();
this.user = user;
}
@Override
public Map<String, Object> tablePage() {
Map<String, Object> resultMap = new HashMap<>();
3 years ago
OrganizationWeaTable<CardAccessVO> table = new OrganizationWeaTable<>(user, CardAccessVO.class);
String sqlWhere = " where delete_type = 0";
table.setSqlwhere(sqlWhere);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
resultMap.putAll(result.getResultMap());
return resultMap;
}
@Override
public Map<String, Object> hasRight() {
Map<String, Object> resultMap = new HashMap<>();
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
resultMap.put("hasRight", hasRight);
return resultMap;
}
@Override
public int save(Map<String, Object> params) {
int rowNum = Util.getIntValue((String) params.get("rownum"));
List<HashMap<String, Object>> dataList = new ArrayList<>();
for (int i = 0; i < rowNum; i++) {
HashMap<String, Object> data = new HashMap<>();
data.put("id", params.get("id_" + i));
data.put("status", params.get("status_" + i));
data.put("allPeople", params.get("all_people_" + i));
data.put("superior", params.get("superior_" + i));
data.put("allSuperior", params.get("all_superior_" + i));
data.put("custom", params.get("custom" + i));
data.put("updateTime", new Date());
dataList.add(data);
}
return getCardAccessMapper().saveCardAccess(dataList);
}
@Override
public int deleteByIds(Collection<Long> ids) {
return getCardAccessMapper().deleteByIds(ids);
}
@Override
public int addData(CardAccessPO cardAccessPO) {
return getCardAccessMapper().insertIgnoreNull(cardAccessPO);
}
@Override
public int updateTabName(String name, Integer id) {
return getCardAccessMapper().updateTabName(name, id);
}
}