mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
Fix TablePropertiesRepository related class
This commit is contained in:
parent
f6a09e8c48
commit
192c664db0
@ -112,7 +112,7 @@ public class AppCtxRefreshEventListener implements ApplicationListener<ContextRe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* 加载系统全局配置
|
||||
*/
|
||||
SystemConfigRepository systemConfigRes = event.getApplicationContext().getBean(SystemConfigRepository.class);
|
||||
|
@ -29,26 +29,26 @@ import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.metadata.DatabaseMetaDataHandler;
|
||||
import com.chatopera.cc.util.metadata.UKColumnMetadata;
|
||||
import com.chatopera.cc.util.metadata.UKTableMetaData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.jdbc.Work;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@ -56,43 +56,39 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/metadata")
|
||||
@RequiredArgsConstructor
|
||||
public class MetadataController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private MetadataRepository metadataRes;
|
||||
|
||||
@Autowired
|
||||
private BaseService<?> service;
|
||||
|
||||
@Autowired
|
||||
private SysDicRepository sysDicRes;
|
||||
|
||||
@Autowired
|
||||
private TablePropertiesRepository tablePropertiesRes;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MetadataController.class);
|
||||
|
||||
@Autowired
|
||||
@NonNull
|
||||
private final MetadataRepository metadataRes;
|
||||
@NonNull
|
||||
private final BaseService<?> service;
|
||||
@NonNull
|
||||
private final SysDicRepository sysDicRes;
|
||||
@NonNull
|
||||
private final TablePropertiesRepository tablePropertiesRes;
|
||||
@NonNull
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
private final EntityManager em;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request) throws SQLException {
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request) {
|
||||
map.addAttribute("metadataList", metadataRes.findAll(PageRequest.of(super.getP(request), super.getPs(request))));
|
||||
return request(super.createAdminTempletResponse("/admin/system/metadata/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView edit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
||||
public ModelAndView edit(ModelMap map, @Valid String id) {
|
||||
map.addAttribute("metadata", metadataRes.findById(id));
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/metadata/edit"));
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView update(ModelMap map, HttpServletRequest request, @Valid MetadataTable metadata) throws SQLException {
|
||||
public ModelAndView update(@Valid MetadataTable metadata) {
|
||||
MetadataTable table = metadataRes.findById(metadata.getId());
|
||||
table.setName(metadata.getName());
|
||||
table.setFromdb(metadata.isFromdb());
|
||||
@ -104,7 +100,7 @@ public class MetadataController extends Handler {
|
||||
|
||||
@RequestMapping("/properties/edit")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView propertiesedit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
||||
public ModelAndView propertiesedit(ModelMap map, @Valid String id) {
|
||||
map.addAttribute("tp", tablePropertiesRes.findById(id));
|
||||
map.addAttribute("sysdicList", sysDicRes.findByParentid("0"));
|
||||
map.addAttribute("dataImplList", Dict.getInstance().getDic("com.dic.data.impl"));
|
||||
@ -114,8 +110,9 @@ public class MetadataController extends Handler {
|
||||
|
||||
@RequestMapping("/properties/update")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView propertiesupdate(ModelMap map, HttpServletRequest request, @Valid TableProperties tp) throws SQLException {
|
||||
TableProperties tableProperties = tablePropertiesRes.findById(tp.getId());
|
||||
public ModelAndView propertiesupdate(@Valid TableProperties tp) {
|
||||
TableProperties tableProperties = tablePropertiesRes.findById(tp.getId())
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Table properties %s not found", tp.getId())));
|
||||
tableProperties.setName(tp.getName());
|
||||
tableProperties.setSeldata(tp.isSeldata());
|
||||
tableProperties.setSeldatacode(tp.getSeldatacode());
|
||||
@ -139,7 +136,7 @@ public class MetadataController extends Handler {
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView delete(ModelMap map, HttpServletRequest request, @Valid String id) throws SQLException {
|
||||
public ModelAndView delete(@Valid String id) {
|
||||
MetadataTable table = metadataRes.findById(id);
|
||||
metadataRes.delete(table);
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
|
||||
@ -147,33 +144,34 @@ public class MetadataController extends Handler {
|
||||
|
||||
@RequestMapping("/batdelete")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView batdelete(ModelMap map, HttpServletRequest request, @Valid String[] ids) throws SQLException {
|
||||
public ModelAndView batdelete(@Valid String[] ids) {
|
||||
if (ids != null && ids.length > 0) {
|
||||
metadataRes.delete(metadataRes.findAll(Arrays.asList(ids)));
|
||||
metadataRes.deleteAll(metadataRes.findAllById(Arrays.asList(ids)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
|
||||
}
|
||||
|
||||
@RequestMapping("/properties/delete")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView propertiesdelete(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String tbid) throws SQLException {
|
||||
TableProperties prop = tablePropertiesRes.findById(id);
|
||||
public ModelAndView propertiesdelete(@Valid String id, @Valid String tbid) {
|
||||
TableProperties prop = tablePropertiesRes.findById(id)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Table properties %s not found", id)));
|
||||
tablePropertiesRes.delete(prop);
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/table.html?id=" + (!StringUtils.isBlank(tbid) ? tbid : prop.getDbtableid())));
|
||||
}
|
||||
|
||||
@RequestMapping("/properties/batdelete")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView propertiesbatdelete(ModelMap map, HttpServletRequest request, @Valid String[] ids, @Valid String tbid) throws SQLException {
|
||||
public ModelAndView propertiesbatdelete(@Valid String[] ids, @Valid String tbid) {
|
||||
if (ids != null && ids.length > 0) {
|
||||
tablePropertiesRes.delete(tablePropertiesRes.findAll(Arrays.asList(ids)));
|
||||
tablePropertiesRes.deleteAll(tablePropertiesRes.findAllById(Arrays.asList(ids)));
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/table.html?id=" + tbid));
|
||||
}
|
||||
|
||||
@RequestMapping("/table")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView table(ModelMap map, HttpServletRequest request, @Valid String id) throws SQLException {
|
||||
public ModelAndView table(ModelMap map, @Valid String id) {
|
||||
map.addAttribute("propertiesList", tablePropertiesRes.findByDbtableid(id));
|
||||
map.addAttribute("tbid", id);
|
||||
map.addAttribute("table", metadataRes.findById(id));
|
||||
@ -182,18 +180,16 @@ public class MetadataController extends Handler {
|
||||
|
||||
@RequestMapping("/imptb")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView imptb(final ModelMap map, HttpServletRequest request) throws Exception {
|
||||
public ModelAndView imptb(final ModelMap map) {
|
||||
|
||||
Session session = (Session) em.getDelegate();
|
||||
session.doWork(new Work() {
|
||||
public void execute(Connection connection) throws SQLException {
|
||||
session.doWork(connection -> {
|
||||
try {
|
||||
map.addAttribute("tablesList",
|
||||
DatabaseMetaDataHandler.getTables(connection));
|
||||
} catch (Exception e) {
|
||||
logger.error("When import metadata", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return request(super
|
||||
@ -202,13 +198,12 @@ public class MetadataController extends Handler {
|
||||
|
||||
@RequestMapping("/imptbsave")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView imptb(ModelMap map, HttpServletRequest request, final @Valid String[] tables) throws Exception {
|
||||
public ModelAndView imptb(HttpServletRequest request, final @Valid String[] tables) {
|
||||
final User user = super.getUser(request);
|
||||
if (tables != null && tables.length > 0) {
|
||||
Session session = (Session) em.getDelegate();
|
||||
session.doWork(
|
||||
new Work() {
|
||||
public void execute(Connection connection) throws SQLException {
|
||||
connection -> {
|
||||
try {
|
||||
for (String table : tables) {
|
||||
int count = metadataRes.countByTablename(table);
|
||||
@ -231,7 +226,6 @@ public class MetadataController extends Handler {
|
||||
logger.error("When import metadata", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
@ -240,7 +234,7 @@ public class MetadataController extends Handler {
|
||||
}
|
||||
|
||||
private MetadataTable processMetadataTable(UKTableMetaData metaData, MetadataTable table) {
|
||||
table.setTableproperty(new ArrayList<TableProperties>());
|
||||
table.setTableproperty(new ArrayList<>());
|
||||
if (metaData != null) {
|
||||
for (UKColumnMetadata colum : metaData.getColumnMetadatas()) {
|
||||
TableProperties tablePorperties = new TableProperties(colum.getName().toLowerCase(), colum.getTypeName(), colum.getColumnSize(), metaData.getName().toLowerCase());
|
||||
@ -263,7 +257,7 @@ public class MetadataController extends Handler {
|
||||
|
||||
public String getDataTypeName(String type) {
|
||||
String typeName = "text";
|
||||
if (type.indexOf("varchar") >= 0) {
|
||||
if (type.contains("varchar")) {
|
||||
typeName = "text";
|
||||
} else if (type.equalsIgnoreCase("date") || type.equalsIgnoreCase("datetime")) {
|
||||
typeName = type.toLowerCase();
|
||||
@ -275,7 +269,7 @@ public class MetadataController extends Handler {
|
||||
|
||||
@RequestMapping("/clean")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView clean(ModelMap map, HttpServletRequest request, @Valid String id) throws SQLException, BeansException, ClassNotFoundException {
|
||||
public ModelAndView clean(@Valid String id) throws BeansException, ClassNotFoundException {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
MetadataTable table = metadataRes.findById(id);
|
||||
if (table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
|
||||
@ -295,7 +289,7 @@ public class MetadataController extends Handler {
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@RequestMapping("/synctoes")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView synctoes(ModelMap map, HttpServletRequest request, @Valid String id) throws SQLException, BeansException, ClassNotFoundException {
|
||||
public ModelAndView synctoes(@Valid String id) throws BeansException, ClassNotFoundException {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
MetadataTable table = metadataRes.findById(id);
|
||||
if (table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
|
||||
@ -309,9 +303,7 @@ public class MetadataController extends Handler {
|
||||
SysDic jpaDic = Dict.getInstance().getDicItem(table.getPreviewtemplet());
|
||||
List dataList = service.list(jpaDic.getCode());
|
||||
List values = new CskefuList();
|
||||
for (Object object : dataList) {
|
||||
values.add(object);
|
||||
}
|
||||
values.addAll(dataList);
|
||||
if (dataList.size() > 0) {
|
||||
jpa.save(values);
|
||||
}
|
||||
@ -326,7 +318,7 @@ public class MetadataController extends Handler {
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
@RequestMapping("/synctodb")
|
||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||
public ModelAndView synctodb(ModelMap map, HttpServletRequest request, @Valid String id) throws SQLException, BeansException, ClassNotFoundException {
|
||||
public ModelAndView synctodb(@Valid String id) throws BeansException, ClassNotFoundException {
|
||||
if (!StringUtils.isBlank(id)) {
|
||||
MetadataTable table = metadataRes.findById(id);
|
||||
if (table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
|
||||
|
@ -26,11 +26,14 @@ import com.chatopera.cc.persistence.repository.CubeMetadataRepository;
|
||||
import com.chatopera.cc.persistence.repository.DimensionRepository;
|
||||
import com.chatopera.cc.persistence.repository.TablePropertiesRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -39,19 +42,20 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/apps/report/cubelevel")
|
||||
@RequiredArgsConstructor
|
||||
public class CubeLevelController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private CubeLevelRepository cubeLevelRes;
|
||||
@NonNull
|
||||
private final CubeLevelRepository cubeLevelRes;
|
||||
|
||||
@Autowired
|
||||
private DimensionRepository dimensionRes;
|
||||
@NonNull
|
||||
private final DimensionRepository dimensionRes;
|
||||
|
||||
@Autowired
|
||||
private TablePropertiesRepository tablePropertiesRes;
|
||||
@NonNull
|
||||
private final TablePropertiesRepository tablePropertiesRes;
|
||||
|
||||
@Autowired
|
||||
private CubeMetadataRepository cubeMetadataRes;
|
||||
@NonNull
|
||||
private final CubeMetadataRepository cubeMetadataRes;
|
||||
|
||||
@RequestMapping("/add")
|
||||
@Menu(type = "report", subtype = "cubelevel")
|
||||
@ -77,7 +81,7 @@ public class CubeLevelController extends Handler{
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "report", subtype = "cubelevel")
|
||||
public ModelAndView cubeLevelsave(ModelMap map , HttpServletRequest request , @Valid CubeLevel cubeLevel,@Valid String tableid) {
|
||||
public ModelAndView cubeLevelsave(HttpServletRequest request, @Valid CubeLevel cubeLevel, @Valid String tableid) {
|
||||
if (!StringUtils.isBlank(cubeLevel.getName())) {
|
||||
cubeLevel.setOrgi(super.getOrgi(request));
|
||||
cubeLevel.setCreater(super.getUser(request).getId());
|
||||
@ -85,7 +89,8 @@ public class CubeLevelController extends Handler{
|
||||
if (!StringUtils.isBlank(tableid)) {
|
||||
TableProperties tb = new TableProperties();
|
||||
tb.setId(tableid);
|
||||
TableProperties t = tablePropertiesRes.findById(tableid);
|
||||
TableProperties t = tablePropertiesRes.findById(tableid)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Table properties %s not found", tableid)));
|
||||
cubeLevel.setTablename(t.getTablename());
|
||||
cubeLevel.setCode(t.getFieldname());
|
||||
cubeLevel.setColumname(t.getFieldname());
|
||||
@ -98,17 +103,18 @@ public class CubeLevelController extends Handler{
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "report", subtype = "cubelevel")
|
||||
public ModelAndView quickreplydelete(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
CubeLevel cubeLevel = cubeLevelRes.findOne(id) ;
|
||||
if(cubeLevel!=null){
|
||||
public ModelAndView quickreplydelete(@Valid String id) {
|
||||
CubeLevel cubeLevel = cubeLevelRes.findById(id)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Cube level %s not found", id)));
|
||||
cubeLevelRes.delete(cubeLevel);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + cubeLevel.getCubeid() + "&dimensionId=" + cubeLevel.getDimid()));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "report", subtype = "cubelevel", admin = true)
|
||||
public ModelAndView quickreplyedit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
||||
CubeLevel cubeLevel = cubeLevelRes.findOne(id) ;
|
||||
CubeLevel cubeLevel = cubeLevelRes.findById(id)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Cube level %s not found", id)));
|
||||
map.put("cubeLevel", cubeLevel);
|
||||
Dimension dim = dimensionRes.findByIdAndOrgi(cubeLevel.getDimid(), super.getOrgi(request));
|
||||
if (dim != null) {
|
||||
@ -129,18 +135,17 @@ public class CubeLevelController extends Handler{
|
||||
|
||||
@RequestMapping("/update")
|
||||
@Menu(type = "report", subtype = "cubelevel", admin = true)
|
||||
public ModelAndView quickreplyupdate(ModelMap map , HttpServletRequest request , @Valid CubeLevel cubeLevel,@Valid String tableid) {
|
||||
public ModelAndView quickreplyupdate(HttpServletRequest request, @Valid CubeLevel cubeLevel, @Valid String tableid) {
|
||||
if (!StringUtils.isBlank(cubeLevel.getId())) {
|
||||
CubeLevel temp = cubeLevelRes.findOne(cubeLevel.getId()) ;
|
||||
cubeLevel.setOrgi(super.getOrgi(request));
|
||||
cubeLevel.setCreater(super.getUser(request).getId());
|
||||
if(temp!=null){
|
||||
cubeLevel.setCreatetime(temp.getCreatetime());
|
||||
}
|
||||
cubeLevelRes.findById(cubeLevel.getId())
|
||||
.ifPresent(it -> cubeLevel.setCreatetime(it.getCreatetime()));
|
||||
if (!StringUtils.isBlank(tableid)) {
|
||||
TableProperties tb = new TableProperties();
|
||||
tb.setId(tableid);
|
||||
TableProperties t = tablePropertiesRes.findById(tableid);
|
||||
TableProperties t = tablePropertiesRes.findById(tableid)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Table properties %s not found", tableid)));
|
||||
cubeLevel.setTablename(t.getTablename());
|
||||
cubeLevel.setCode(t.getFieldname());
|
||||
cubeLevel.setColumname(t.getFieldname());
|
||||
@ -150,9 +155,10 @@ public class CubeLevelController extends Handler{
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + cubeLevel.getCubeid() + "&dimensionId=" + cubeLevel.getDimid()));
|
||||
}
|
||||
|
||||
@RequestMapping("/fktableid")
|
||||
@Menu(type = "report", subtype = "cubelevel", admin = true)
|
||||
public ModelAndView fktableid(ModelMap map , HttpServletRequest request , @Valid String tableid) {
|
||||
public ModelAndView fktableid(ModelMap map, @Valid String tableid) {
|
||||
if (!StringUtils.isBlank(tableid)) {
|
||||
map.put("fktableidList", tablePropertiesRes.findByDbtableid(tableid));
|
||||
}
|
||||
|
@ -23,11 +23,13 @@ import com.chatopera.cc.persistence.repository.CubeMeasureRepository;
|
||||
import com.chatopera.cc.persistence.repository.CubeMetadataRepository;
|
||||
import com.chatopera.cc.persistence.repository.TablePropertiesRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -36,20 +38,21 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/apps/report/cubemeasure")
|
||||
@RequiredArgsConstructor
|
||||
public class CubeMeasureController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private CubeMeasureRepository cubeMeasureRes;
|
||||
@org.springframework.lang.NonNull
|
||||
private final CubeMeasureRepository cubeMeasureRes;
|
||||
|
||||
@Autowired
|
||||
private TablePropertiesRepository tablePropertiesRes;
|
||||
@org.springframework.lang.NonNull
|
||||
private final TablePropertiesRepository tablePropertiesRes;
|
||||
|
||||
@Autowired
|
||||
private CubeMetadataRepository cubeMetadataRes;
|
||||
@org.springframework.lang.NonNull
|
||||
private final CubeMetadataRepository cubeMetadataRes;
|
||||
|
||||
@RequestMapping("/add")
|
||||
@Menu(type = "report", subtype = "cubemeasure")
|
||||
public ModelAndView cubeMeasureadd(ModelMap map , HttpServletRequest request , @Valid String cubeid) {
|
||||
public ModelAndView cubeMeasureadd(ModelMap map, @Valid String cubeid) {
|
||||
map.addAttribute("cubeid", cubeid);
|
||||
List<CubeMetadata> cmList = cubeMetadataRes.findByCubeidAndMtype(cubeid, "0");
|
||||
if (!cmList.isEmpty() && cmList.get(0) != null) {
|
||||
@ -61,7 +64,7 @@ public class CubeMeasureController extends Handler{
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "report", subtype = "cubemeasure")
|
||||
public ModelAndView cubeMeasuresave(ModelMap map , HttpServletRequest request , @Valid CubeMeasure cubeMeasure) {
|
||||
public ModelAndView cubeMeasuresave(HttpServletRequest request, @Valid CubeMeasure cubeMeasure) {
|
||||
if (!StringUtils.isBlank(cubeMeasure.getName())) {
|
||||
cubeMeasure.setOrgi(super.getOrgi(request));
|
||||
cubeMeasure.setCreater(super.getUser(request).getId());
|
||||
@ -73,17 +76,17 @@ public class CubeMeasureController extends Handler{
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "report", subtype = "cubemeasure")
|
||||
public ModelAndView quickreplydelete(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
CubeMeasure cubeMeasure = cubeMeasureRes.findOne(id) ;
|
||||
if(cubeMeasure!=null){
|
||||
cubeMeasureRes.delete(cubeMeasure);
|
||||
}
|
||||
public ModelAndView quickreplydelete(@Valid String id) {
|
||||
cubeMeasureRes.deleteById(id);
|
||||
CubeMeasure cubeMeasure = cubeMeasureRes.findById(id)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Cube measure %s not found", id)));
|
||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?dimensionId=cubemeasure&id=" + cubeMeasure.getCubeid()));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "report", subtype = "cubemeasure", admin = true)
|
||||
public ModelAndView quickreplyedit(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
CubeMeasure cubeMeasure = cubeMeasureRes.findOne(id) ;
|
||||
public ModelAndView quickreplyedit(ModelMap map, @Valid String id) {
|
||||
CubeMeasure cubeMeasure = cubeMeasureRes.findById(id).orElse(null);
|
||||
map.put("cubemeasure", cubeMeasure);
|
||||
if (cubeMeasure != null) {
|
||||
List<CubeMetadata> cmList = cubeMetadataRes.findByCubeidAndMtype(cubeMeasure.getCubeid(), "0");
|
||||
@ -97,22 +100,20 @@ public class CubeMeasureController extends Handler{
|
||||
|
||||
@RequestMapping("/update")
|
||||
@Menu(type = "report", subtype = "cubemeasure", admin = true)
|
||||
public ModelAndView quickreplyupdate(ModelMap map , HttpServletRequest request , @Valid CubeMeasure cubeMeasure) {
|
||||
public ModelAndView quickreplyupdate(HttpServletRequest request, @Valid CubeMeasure cubeMeasure) {
|
||||
if (!StringUtils.isBlank(cubeMeasure.getId())) {
|
||||
CubeMeasure temp = cubeMeasureRes.findOne(cubeMeasure.getId()) ;
|
||||
cubeMeasure.setOrgi(super.getOrgi(request));
|
||||
cubeMeasure.setCreater(super.getUser(request).getId());
|
||||
if(temp!=null){
|
||||
cubeMeasure.setCreatetime(temp.getCreatetime());
|
||||
}
|
||||
cubeMeasureRes.findById(cubeMeasure.getId()).ifPresent(temp -> cubeMeasure.setCreatetime(temp.getCreatetime()));
|
||||
cubeMeasure.setCode(cubeMeasure.getColumname());
|
||||
cubeMeasureRes.save(cubeMeasure);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?dimensionId=cubemeasure&id=" + cubeMeasure.getCubeid()));
|
||||
}
|
||||
|
||||
@RequestMapping("/fktableid")
|
||||
@Menu(type = "report", subtype = "cubemeasure", admin = true)
|
||||
public ModelAndView fktableid(ModelMap map , HttpServletRequest request , @Valid String tableid) {
|
||||
public ModelAndView fktableid(ModelMap map, @Valid String tableid) {
|
||||
if (!StringUtils.isBlank(tableid)) {
|
||||
map.put("fktableidList", tablePropertiesRes.findByDbtableid(tableid));
|
||||
}
|
||||
|
@ -25,11 +25,13 @@ import com.chatopera.cc.persistence.repository.CubeMetadataRepository;
|
||||
import com.chatopera.cc.persistence.repository.DimensionRepository;
|
||||
import com.chatopera.cc.persistence.repository.TablePropertiesRepository;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@ -38,23 +40,24 @@ import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/apps/report/dimension")
|
||||
@RequiredArgsConstructor
|
||||
public class DimensionController extends Handler {
|
||||
|
||||
@Autowired
|
||||
private DimensionRepository dimensionRes;
|
||||
@org.springframework.lang.NonNull
|
||||
private final DimensionRepository dimensionRes;
|
||||
|
||||
@Autowired
|
||||
private CubeLevelRepository cubeLevelRes;
|
||||
@org.springframework.lang.NonNull
|
||||
private final CubeLevelRepository cubeLevelRes;
|
||||
|
||||
@Autowired
|
||||
private CubeMetadataRepository cubeMetadataRes;
|
||||
@org.springframework.lang.NonNull
|
||||
private final CubeMetadataRepository cubeMetadataRes;
|
||||
|
||||
@Autowired
|
||||
private TablePropertiesRepository tablePropertiesRes;
|
||||
@org.springframework.lang.NonNull
|
||||
private final TablePropertiesRepository tablePropertiesRes;
|
||||
|
||||
@RequestMapping("/add")
|
||||
@Menu(type = "report", subtype = "dimension")
|
||||
public ModelAndView dimensionadd(ModelMap map , HttpServletRequest request , @Valid String cubeid) {
|
||||
public ModelAndView dimensionadd(ModelMap map, @Valid String cubeid) {
|
||||
map.addAttribute("cubeid", cubeid);
|
||||
map.addAttribute("fkfieldList", cubeMetadataRes.findByCubeidAndMtype(cubeid, "0"));
|
||||
map.addAttribute("fktableList", cubeMetadataRes.findByCubeidAndMtypeNot(cubeid, "0"));
|
||||
@ -63,7 +66,7 @@ public class DimensionController extends Handler{
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "report", subtype = "dimension")
|
||||
public ModelAndView dimensionsave(ModelMap map , HttpServletRequest request , @Valid Dimension dimension) {
|
||||
public ModelAndView dimensionsave(HttpServletRequest request, @Valid Dimension dimension) {
|
||||
if (!StringUtils.isBlank(dimension.getName())) {
|
||||
dimension.setOrgi(super.getOrgi(request));
|
||||
dimension.setCreater(super.getUser(request).getId());
|
||||
@ -74,21 +77,22 @@ public class DimensionController extends Handler{
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "report", subtype = "dimension")
|
||||
public ModelAndView quickreplydelete(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
Dimension dimension = dimensionRes.findOne(id) ;
|
||||
if(dimension!=null){
|
||||
public ModelAndView quickreplydelete(HttpServletRequest request, @Valid String id) {
|
||||
Dimension dimension = dimensionRes.findById(id)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Dimension %s not found", id)));
|
||||
dimensionRes.delete(dimension);
|
||||
List<CubeLevel> cubeLevelList = cubeLevelRes.findByOrgiAndDimid(super.getOrgi(request), id);
|
||||
if (!cubeLevelList.isEmpty()) {
|
||||
cubeLevelRes.delete(cubeLevelList);
|
||||
}
|
||||
cubeLevelRes.deleteAll(cubeLevelList);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + dimension.getCubeid()));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "report", subtype = "dimension", admin = true)
|
||||
public ModelAndView quickreplyedit(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
Dimension dimension = dimensionRes.findOne(id) ;
|
||||
public ModelAndView quickreplyedit(ModelMap map, @Valid String id) {
|
||||
Dimension dimension = dimensionRes.findById(id)
|
||||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Dimension %s not found", id)));
|
||||
map.put("dimension", dimension);
|
||||
String cubeid = dimension.getCubeid();
|
||||
map.addAttribute("cubeid", cubeid);
|
||||
@ -101,21 +105,19 @@ public class DimensionController extends Handler{
|
||||
|
||||
@RequestMapping("/update")
|
||||
@Menu(type = "report", subtype = "dimension", admin = true)
|
||||
public ModelAndView quickreplyupdate(ModelMap map , HttpServletRequest request , @Valid Dimension dimension) {
|
||||
public ModelAndView quickreplyupdate(HttpServletRequest request, @Valid Dimension dimension) {
|
||||
if (!StringUtils.isBlank(dimension.getId())) {
|
||||
Dimension temp = dimensionRes.findOne(dimension.getId()) ;
|
||||
dimension.setOrgi(super.getOrgi(request));
|
||||
dimension.setCreater(super.getUser(request).getId());
|
||||
if(temp!=null){
|
||||
dimension.setCreatetime(temp.getCreatetime());
|
||||
}
|
||||
dimensionRes.findById(dimension.getId()).ifPresent(it -> dimension.setCreatetime(it.getCreatetime()));
|
||||
dimensionRes.save(dimension);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + dimension.getCubeid() + "&dimensionId=" + dimension.getId()));
|
||||
}
|
||||
|
||||
@RequestMapping("/fktableid")
|
||||
@Menu(type = "report", subtype = "dimension", admin = true)
|
||||
public ModelAndView fktableid(ModelMap map , HttpServletRequest request , @Valid String tableid) {
|
||||
public ModelAndView fktableid(ModelMap map, @Valid String tableid) {
|
||||
if (!StringUtils.isBlank(tableid)) {
|
||||
map.put("fktableidList", tablePropertiesRes.findByDbtableid(tableid));
|
||||
}
|
||||
|
@ -24,11 +24,12 @@ import com.chatopera.cc.model.*;
|
||||
import com.chatopera.cc.persistence.repository.*;
|
||||
import com.chatopera.cc.util.Menu;
|
||||
import com.chatopera.cc.util.bi.ReportData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -40,47 +41,36 @@ import java.util.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/apps/report/design")
|
||||
@RequiredArgsConstructor
|
||||
public class ReportDesignController extends Handler {
|
||||
|
||||
@NonNull
|
||||
private final TemplateRepository templateRes;
|
||||
@NonNull
|
||||
private final ReportRepository reportRes;
|
||||
@NonNull
|
||||
private final ReportModelRepository reportModelRes;
|
||||
@NonNull
|
||||
private final PublishedCubeRepository publishedCubeRepository;
|
||||
@NonNull
|
||||
private final ColumnPropertiesRepository columnPropertiesRepository;
|
||||
@NonNull
|
||||
private final ReportFilterRepository reportFilterRepository;
|
||||
@NonNull
|
||||
private final ReportCubeService reportCubeService;
|
||||
@NonNull
|
||||
private final TablePropertiesRepository tablePropertiesRes;
|
||||
@NonNull
|
||||
private final PublishedReportRepository publishedReportRes;
|
||||
@NonNull
|
||||
private final SysDicRepository sysDicRes;
|
||||
@NonNull
|
||||
private final MetadataRepository metadataRes;
|
||||
@Value("${web.upload-path}")
|
||||
private String path;
|
||||
|
||||
@Value("${uk.im.server.port}")
|
||||
private Integer port;
|
||||
|
||||
@Autowired
|
||||
private TemplateRepository templateRes;
|
||||
|
||||
@Autowired
|
||||
private ReportRepository reportRes;
|
||||
|
||||
@Autowired
|
||||
private ReportModelRepository reportModelRes;
|
||||
|
||||
@Autowired
|
||||
private PublishedCubeRepository publishedCubeRepository;
|
||||
|
||||
@Autowired
|
||||
private ColumnPropertiesRepository columnPropertiesRepository;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ReportFilterRepository reportFilterRepository;
|
||||
|
||||
@Autowired
|
||||
private ReportCubeService reportCubeService;
|
||||
|
||||
@Autowired
|
||||
private TablePropertiesRepository tablePropertiesRes;
|
||||
|
||||
@Autowired
|
||||
private PublishedReportRepository publishedReportRes;
|
||||
|
||||
@Autowired
|
||||
private SysDicRepository sysDicRes;
|
||||
@Autowired
|
||||
private MetadataRepository metadataRes;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "report", subtype = "reportdesign")
|
||||
public ModelAndView index(ModelMap map, HttpServletRequest request, @Valid String q, @Valid String id) throws Exception {
|
||||
@ -162,12 +152,6 @@ public class ReportDesignController extends Handler {
|
||||
|
||||
/**
|
||||
* 请求 报表的模板组件, 请求的时候,生成个报表组件,报表组件 需要存放在列的对应关系中
|
||||
*
|
||||
* @param map
|
||||
* @param request
|
||||
* @param template
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/element")
|
||||
@Menu(type = "report", subtype = "reportdesign")
|
||||
@ -223,6 +207,7 @@ public class ReportDesignController extends Handler {
|
||||
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/layout"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求 过滤器的模板组件, 请求的时候,生成个过滤器组件
|
||||
*
|
||||
@ -262,6 +247,7 @@ public class ReportDesignController extends Handler {
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/filter"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板组件
|
||||
*
|
||||
@ -277,7 +263,7 @@ public class ReportDesignController extends Handler {
|
||||
if (model != null) {
|
||||
List<ReportModel> childsList = reportModelRes.findByParentidAndOrgi(model.getId(), super.getOrgi(request));
|
||||
if (!childsList.isEmpty()) {
|
||||
reportModelRes.delete(childsList);
|
||||
reportModelRes.deleteAll(childsList);
|
||||
}
|
||||
reportModelRes.delete(model);
|
||||
}
|
||||
@ -309,7 +295,7 @@ public class ReportDesignController extends Handler {
|
||||
map.addAttribute("reportModel", model);
|
||||
map.addAttribute("element", model);
|
||||
if (model != null && !StringUtils.isBlank(model.getPublishedcubeid())) {
|
||||
PublishedCube cube = publishedCubeRepository.findOne(model.getPublishedcubeid());
|
||||
PublishedCube cube = publishedCubeRepository.findById(model.getPublishedcubeid());
|
||||
map.addAttribute("cube", cube);
|
||||
if (canGetReportData(model, cube.getCube())) {
|
||||
ReportData reportData = null;
|
||||
@ -325,9 +311,11 @@ public class ReportDesignController extends Handler {
|
||||
map.addAttribute("tabid", tabid);
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign"));
|
||||
}
|
||||
|
||||
private boolean canGetReportData(ReportModel model, Cube cube) {
|
||||
return !model.getProperties().isEmpty() || !model.getColproperties().isEmpty() || !model.getMeasures().isEmpty();
|
||||
}
|
||||
|
||||
private ReportModel getModel(String id, String orgi) {
|
||||
ReportModel model = reportModelRes.findByIdAndOrgi(id, orgi);
|
||||
if (model != null) {
|
||||
@ -368,12 +356,10 @@ public class ReportDesignController extends Handler {
|
||||
ReportModel model = this.getModel(mid, super.getOrgi(request));
|
||||
if (!StringUtils.isBlank(cubeid)) {
|
||||
model.setPublishedcubeid(cubeid);
|
||||
if(model!=null) {
|
||||
columnPropertiesRepository.delete(model.getProperties());
|
||||
columnPropertiesRepository.delete(model.getColproperties());
|
||||
columnPropertiesRepository.delete(model.getMeasures());
|
||||
reportFilterRepository.delete(model.getFilters());
|
||||
}
|
||||
columnPropertiesRepository.deleteAll(model.getProperties());
|
||||
columnPropertiesRepository.deleteAll(model.getColproperties());
|
||||
columnPropertiesRepository.deleteAll(model.getMeasures());
|
||||
reportFilterRepository.deleteAll(model.getFilters());
|
||||
}
|
||||
reportModelRes.save(model);
|
||||
map.put("reportModel", model);
|
||||
@ -402,8 +388,10 @@ public class ReportDesignController extends Handler {
|
||||
map.addAttribute("dtype", dtype);
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加过滤器
|
||||
*
|
||||
* @param map
|
||||
* @param request
|
||||
* @return
|
||||
@ -432,6 +420,7 @@ public class ReportDesignController extends Handler {
|
||||
map.addAttribute("dtype", dtype);
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存过滤器
|
||||
*
|
||||
@ -469,6 +458,7 @@ public class ReportDesignController extends Handler {
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/apps/report/design/modeldesign.html?id=" + modelId + "&tabid=filter"));
|
||||
}
|
||||
|
||||
@RequestMapping("/gettableid")
|
||||
@Menu(type = "report", subtype = "reportdesign")
|
||||
public ModelAndView gettableid(ModelMap map, HttpServletRequest request, @Valid String tableid) {
|
||||
@ -477,6 +467,7 @@ public class ReportDesignController extends Handler {
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/fktableid"));
|
||||
}
|
||||
|
||||
@RequestMapping("/values")
|
||||
@Menu(type = "report", subtype = "reportdesign")
|
||||
public ModelAndView values(ModelMap map, HttpServletRequest request, @Valid String mid, @Valid String dsid,
|
||||
@ -633,7 +624,6 @@ public class ReportDesignController extends Handler {
|
||||
*
|
||||
* @param map
|
||||
* @param request
|
||||
* @param template
|
||||
* @param id
|
||||
* @return
|
||||
* @throws Exception
|
||||
@ -668,6 +658,7 @@ public class ReportDesignController extends Handler {
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/elementajax"));
|
||||
}
|
||||
|
||||
private ReportModel getModel(String id, String orgi, String publishedid) {
|
||||
if (!StringUtils.isBlank(publishedid)) {
|
||||
PublishedReport publishedReport = publishedReportRes.findById(publishedid);
|
||||
@ -718,6 +709,7 @@ public class ReportDesignController extends Handler {
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/filteredit"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑过滤器
|
||||
*
|
||||
@ -777,6 +769,7 @@ public class ReportDesignController extends Handler {
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/apps/report/design/index.html?id=" + reportId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑模型过滤器
|
||||
*
|
||||
@ -818,6 +811,7 @@ public class ReportDesignController extends Handler {
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/filteredit"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑过滤器
|
||||
*
|
||||
@ -877,6 +871,7 @@ public class ReportDesignController extends Handler {
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/apps/report/design/modeldesign.html?id=" + modelId + "&tabid=filter"));
|
||||
}
|
||||
|
||||
@RequestMapping("/fktableid")
|
||||
@Menu(type = "report", subtype = "reportdesign", admin = true)
|
||||
public ModelAndView fktableid(ModelMap map, HttpServletRequest request, @Valid String fid, @Valid String fkId) {
|
||||
@ -894,6 +889,7 @@ public class ReportDesignController extends Handler {
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/fktableiddiv"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑过滤器
|
||||
*
|
||||
@ -915,6 +911,7 @@ public class ReportDesignController extends Handler {
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/apps/report/design/modeldesign.html?id=" + modelId + "&tabid=filter"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑过滤器
|
||||
*
|
||||
@ -936,6 +933,7 @@ public class ReportDesignController extends Handler {
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/apps/report/design/index.html?id=" + reportId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*
|
||||
@ -1103,7 +1101,7 @@ public class ReportDesignController extends Handler {
|
||||
map.addAttribute("eltemplet", templateRes.findByIdAndOrgi(model.getTempletid(), super.getOrgi(request)));
|
||||
map.addAttribute("element", model);
|
||||
map.addAttribute("reportModel", model);
|
||||
if (model != null && !StringUtils.isBlank(model.getPublishedcubeid())) {
|
||||
if (!StringUtils.isBlank(model.getPublishedcubeid())) {
|
||||
PublishedCube cube = publishedCubeRepository.findOne(model.getPublishedcubeid());
|
||||
map.addAttribute("cube", cube);
|
||||
if (!model.getMeasures().isEmpty()) {
|
||||
@ -1183,6 +1181,7 @@ public class ReportDesignController extends Handler {
|
||||
|
||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/filter"));
|
||||
}
|
||||
|
||||
@RequestMapping("/editmodelname")
|
||||
@Menu(type = "report", subtype = "reportdesign")
|
||||
public ModelAndView editmodelname(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String name) {
|
||||
@ -1191,6 +1190,7 @@ public class ReportDesignController extends Handler {
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"/apps/business/report/design/modeldesign/editmodelname"));
|
||||
}
|
||||
|
||||
@RequestMapping("/updatemodelname")
|
||||
@Menu(type = "report", subtype = "reportdesign")
|
||||
public ModelAndView updatemodelname(ModelMap map, HttpServletRequest request, @Valid String name, @Valid String id) {
|
||||
@ -1202,10 +1202,11 @@ public class ReportDesignController extends Handler {
|
||||
return request(super.createRequestPageTempletResponse(
|
||||
"redirect:/apps/report/design/modeldesign.html?id=" + model.getId() + "&tabid=data"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 报表发布页面加载
|
||||
*
|
||||
* @param request
|
||||
* @param cubeid
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@ -1218,6 +1219,7 @@ public class ReportDesignController extends Handler {
|
||||
|
||||
/**
|
||||
* 报表发布
|
||||
*
|
||||
* @param request
|
||||
* @param reportid
|
||||
* @return
|
||||
@ -1256,7 +1258,7 @@ public class ReportDesignController extends Handler {
|
||||
publishedReport.setDataversion(maxVersion + 1);
|
||||
publishedReportRes.save(publishedReport);
|
||||
} else {
|
||||
publishedReportRes.delete(pbReportList);
|
||||
publishedReportRes.deleteAll(pbReportList);
|
||||
publishedReport.setDataversion(1);
|
||||
publishedReportRes.save(publishedReport);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import java.util.List;
|
||||
|
||||
public interface TablePropertiesRepository extends JpaRepository<TableProperties, String> {
|
||||
|
||||
TableProperties findById(String id);
|
||||
// TableProperties findById(String id);
|
||||
|
||||
List<TableProperties> findByDbtableid(String dbtableid);
|
||||
|
||||
@ -31,5 +31,5 @@ public interface TablePropertiesRepository extends JpaRepository<TableProperties
|
||||
|
||||
List<TableProperties> findBySecfield(boolean secfield);
|
||||
|
||||
TableProperties findByTablenameAndFieldname(String tablename, String fieldname) ;
|
||||
// TableProperties findByTablenameAndFieldname(String tablename, String fieldname) ;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user