| | |
| | | package com.lf.server.service.sys; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.lf.server.entity.data.FmeLogEntity; |
| | | import com.lf.server.entity.sys.AttachEntity; |
| | | import com.lf.server.helper.ClassHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.all.BasicMapper; |
| | | import com.lf.server.mapper.sys.AttachMapper; |
| | | import com.lf.server.service.all.UploadAttachService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Autowired |
| | | AttachMapper attachMapper; |
| | | |
| | | private static String tabs; |
| | | |
| | | @Override |
| | | public Integer selectCount(String name) { |
| | | name = StringHelper.getLikeStr(name); |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return attachMapper.selectCount(name); |
| | | } |
| | | |
| | | @Override |
| | | public List<AttachEntity> selectByPage(String name, Integer limit, Integer offset) { |
| | | name = StringHelper.getLikeStr(name); |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return attachMapper.selectByPage(name, limit, offset); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AttachEntity selectByGuids(String[] guids) { |
| | | public List<AttachEntity> selectByGuids(List<String> guids) { |
| | | return attachMapper.selectByGuids(guids); |
| | | } |
| | | |
| | | @Override |
| | | public AttachEntity selectByTabAndGuid(String tab, String tabGuid, String guid) { |
| | | return attachMapper.selectByTabAndGuid(tab, tabGuid, guid); |
| | | } |
| | | |
| | | @Override |
| | | public List<AttachEntity> selectByTabGuids(String tab, List<String> guids) { |
| | | return attachMapper.selectByTabGuids(tab, guids); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public Integer updates(List<AttachEntity> list) { |
| | | return attachMapper.updates(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<FmeLogEntity> selectFmeLogs(String tabs) { |
| | | return attachMapper.selectFmeLogs(tabs); |
| | | } |
| | | |
| | | /** |
| | | * 查询FME日志 |
| | | */ |
| | | public List<FmeLogEntity> selectFmeLogs() { |
| | | if (null == tabs) { |
| | | tabs = UploadAttachService.getTabs().replace("'", ""); |
| | | } |
| | | |
| | | return attachMapper.selectFmeLogs(tabs); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateFmeLog(Integer id) { |
| | | return attachMapper.updateFmeLog(id); |
| | | } |
| | | |
| | | /** |
| | | * 同步附件 |
| | | */ |
| | | public void syncAttaches(FmeLogEntity entity) { |
| | | String tab = entity.getPgNs() + "." + entity.getTcdm(); |
| | | String field = UploadAttachService.ATTACH_TABS.get(tab); |
| | | |
| | | List<?> list = selectRowsByParentid(entity.getTcdm().replace("_", ""), entity.getParentid(), field); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | // |
| | | } |
| | | |
| | | /** |
| | | * 根据父ID查询记录 |
| | | */ |
| | | private List<?> selectRowsByParentid(String entity, String parentid, String field) { |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(entity); |
| | | if (null == baseMapper) { |
| | | return null; |
| | | } |
| | | |
| | | QueryWrapper wrapper = new QueryWrapper(); |
| | | wrapper.eq("parentid", parentid); |
| | | wrapper.apply(field + " is not null"); |
| | | |
| | | return baseMapper.selectList(wrapper); |
| | | } |
| | | } |