|
@@ -0,0 +1,58 @@
|
|
|
|
+package com.management.platform.service.impl;
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.management.platform.entity.BusObject;
|
|
|
|
+import com.management.platform.entity.CusTableColumn;
|
|
|
|
+import com.management.platform.entity.User;
|
|
|
|
+import com.management.platform.mapper.BusObjectMapper;
|
|
|
|
+import com.management.platform.mapper.CusTableColumnMapper;
|
|
|
|
+import com.management.platform.mapper.UserMapper;
|
|
|
|
+import com.management.platform.service.CusTableColumnService;
|
|
|
|
+import com.management.platform.util.HttpRespMsg;
|
|
|
|
+import com.management.platform.util.MessageUtils;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class CusTableColumnServiceImpl extends ServiceImpl<CusTableColumnMapper, CusTableColumn> implements CusTableColumnService {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private CusTableColumnMapper cusTableColumnMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private UserMapper userMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private BusObjectMapper busObjectMapper;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg getStructByTableName(String tableName, HttpServletRequest request) {
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ String userId = request.getHeader("Token");
|
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
|
+ if(null == user){
|
|
|
|
+ msg.setError(MessageUtils.message("user.notExists"));
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ BusObject busObject = busObjectMapper.selectOne(new LambdaQueryWrapper<BusObject>()
|
|
|
|
+ .eq(BusObject::getTblName, tableName)
|
|
|
|
+ );
|
|
|
|
+ if(null == busObject){
|
|
|
|
+ msg.setError("该表不存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ Map<String,Object> resMap = new HashMap<>();
|
|
|
|
+ resMap.put("busObject",busObject);
|
|
|
|
+ List<CusTableColumn> columnList = cusTableColumnMapper.getStructByTableName(tableName);
|
|
|
|
+ resMap.put("columnList",columnList);
|
|
|
|
+ msg.setData(resMap);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+}
|