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;
|
|
import java.util.List;
|
|
/**
|
* 附件
|
* @author WWW
|
*/
|
@Service
|
public class AttachService implements AttachMapper {
|
@Autowired
|
AttachMapper attachMapper;
|
|
private static String tabs;
|
|
@Override
|
public Integer selectCount(String name) {
|
name = StringHelper.getLikeUpperStr(name);
|
|
return attachMapper.selectCount(name);
|
}
|
|
@Override
|
public List<AttachEntity> selectByPage(String name, Integer limit, Integer offset) {
|
name = StringHelper.getLikeUpperStr(name);
|
|
return attachMapper.selectByPage(name, limit, offset);
|
}
|
|
@Override
|
public List<AttachEntity> selectAll() {
|
return attachMapper.selectAll();
|
}
|
|
@Override
|
public AttachEntity selectById(int id) {
|
return attachMapper.selectById(id);
|
}
|
|
@Override
|
public AttachEntity selectByGuid(String guid) {
|
return attachMapper.selectByGuid(guid);
|
}
|
|
@Override
|
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 List<AttachEntity> selectByTab(String tab, String guid) {
|
return attachMapper.selectByTab(tab, guid);
|
}
|
|
@Override
|
public Integer insert(AttachEntity entity) {
|
return attachMapper.insert(entity);
|
}
|
|
@Override
|
public Integer inserts(List<AttachEntity> list) {
|
return attachMapper.inserts(list);
|
}
|
|
@Override
|
public Integer delete(int id) {
|
return attachMapper.delete(id);
|
}
|
|
@Override
|
public Integer deletes(List<Integer> ids) {
|
return attachMapper.deletes(ids);
|
}
|
|
@Override
|
public Integer update(AttachEntity entity) {
|
return attachMapper.update(entity);
|
}
|
|
@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);
|
}
|
}
|