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.detach.vo.ManagerDetachVO; import com.engine.organization.entity.personnelcard.po.CardAccessPO; 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 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 CardAccessMapper getCardAccessMapper() { return MapperProxyFactory.getProxy(CardAccessMapper.class); } @Override public Map tablePage() { Map resultMap = new HashMap<>(); OrganizationWeaTable table = new OrganizationWeaTable<>(user, ManagerDetachVO.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 hasRight() { Map resultMap = new HashMap<>(); boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true); resultMap.put("hasRight", hasRight); return resultMap; } @Override public int save(Map params) { int rowNum = Util.getIntValue((String) params.get("rownum")); List> dataList = new ArrayList<>(); for (int i = 0; i < rowNum; i++) { HashMap 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 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); } }