mirror of
https://github.com/dataease/dataease.git
synced 2026-05-21 04:08:10 +08:00
feat(dashboard):仪表盘 Table Label支持,大小自适应;收藏取消bug fix
This commit is contained in:
@@ -31,6 +31,6 @@ public interface StoreApi {
|
||||
|
||||
@ApiOperation("移除收藏")
|
||||
@PostMapping("/remove/{storeId}")
|
||||
void remove(@PathVariable("storeId") Long storeId);
|
||||
void remove(@PathVariable("storeId") String storeId);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class StoreServer implements StoreApi {
|
||||
private StoreService storeService;
|
||||
|
||||
@Override
|
||||
public void store( String id) {
|
||||
public void store(String id) {
|
||||
storeService.save(id);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,12 @@ public class StoreServer implements StoreApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove( Long storeId) {
|
||||
storeService.remove(storeId);
|
||||
public void remove(String storeId) {
|
||||
try {
|
||||
Long id = Long.parseLong(storeId);
|
||||
storeService.remove(id);
|
||||
} catch (Exception e) {
|
||||
storeService.removeByPanelId(storeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.dataease.service.panel;
|
||||
|
||||
import io.dataease.base.domain.PanelStore;
|
||||
import io.dataease.base.domain.PanelStoreExample;
|
||||
import io.dataease.base.mapper.PanelStoreMapper;
|
||||
import io.dataease.base.mapper.ext.ExtPanelStoreMapper;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
@@ -9,6 +10,7 @@ import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.controller.sys.base.ConditionEntity;
|
||||
import io.dataease.dto.panel.PanelStoreDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -22,7 +24,7 @@ public class StoreService {
|
||||
@Resource
|
||||
private ExtPanelStoreMapper extPanelStoreMapper;
|
||||
|
||||
public void save(String panelGroupId){
|
||||
public void save(String panelGroupId) {
|
||||
Long userId = AuthUtils.getUser().getUserId();
|
||||
PanelStore panelStore = new PanelStore();
|
||||
panelStore.setCreateTime(System.currentTimeMillis());
|
||||
@@ -31,24 +33,31 @@ public class StoreService {
|
||||
panelStoreMapper.insert(panelStore);
|
||||
}
|
||||
|
||||
public void removeByPanelId(String panelId) {
|
||||
PanelStoreExample panelStoreExample = new PanelStoreExample();
|
||||
panelStoreExample.createCriteria().andPanelGroupIdEqualTo(panelId);
|
||||
panelStoreMapper.deleteByExample(panelStoreExample);
|
||||
}
|
||||
|
||||
|
||||
public void remove(Long storeId){
|
||||
public void remove(Long storeId) {
|
||||
panelStoreMapper.deleteByPrimaryKey(storeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按照当前用户ID查询收藏仪表板
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public List<PanelStoreDto> query(BaseGridRequest request){
|
||||
public List<PanelStoreDto> query(BaseGridRequest request) {
|
||||
Long userId = AuthUtils.getUser().getUserId();
|
||||
ConditionEntity condition = new ConditionEntity();
|
||||
condition.setField("s.user_id");
|
||||
condition.setOperator("eq");
|
||||
condition.setValue(userId);
|
||||
request.setConditions(new ArrayList<ConditionEntity>(){{add(condition);}});
|
||||
request.setConditions(new ArrayList<ConditionEntity>() {{
|
||||
add(condition);
|
||||
}});
|
||||
GridExample example = request.convertExample();
|
||||
List<PanelStoreDto> stores = extPanelStoreMapper.query(example);
|
||||
return stores;
|
||||
|
||||
Reference in New Issue
Block a user