接口开发
This commit is contained in:
parent
5487ae47ce
commit
39d4f2b90b
|
|
@ -3,6 +3,8 @@ package com.bonus.common.utils.file;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.bonus.common.utils.uuid.Seq;
|
||||
|
|
@ -21,8 +23,7 @@ import com.bonus.common.utils.StringUtils;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class FileUploadUtils
|
||||
{
|
||||
public class FileUploadUtils {
|
||||
/**
|
||||
* 默认大小 50M
|
||||
*/
|
||||
|
|
@ -38,13 +39,11 @@ public class FileUploadUtils
|
|||
*/
|
||||
private static String defaultBaseDir = RuoYiConfig.getProfile();
|
||||
|
||||
public static void setDefaultBaseDir(String defaultBaseDir)
|
||||
{
|
||||
public static void setDefaultBaseDir(String defaultBaseDir) {
|
||||
FileUploadUtils.defaultBaseDir = defaultBaseDir;
|
||||
}
|
||||
|
||||
public static String getDefaultBaseDir()
|
||||
{
|
||||
public static String getDefaultBaseDir() {
|
||||
return defaultBaseDir;
|
||||
}
|
||||
|
||||
|
|
@ -55,14 +54,10 @@ public class FileUploadUtils
|
|||
* @return 文件名称
|
||||
* @throws Exception
|
||||
*/
|
||||
public static final String upload(MultipartFile file) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
public static final String upload(MultipartFile file) throws IOException {
|
||||
try {
|
||||
return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
throw new IOException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
|
@ -71,18 +66,14 @@ public class FileUploadUtils
|
|||
* 根据文件路径上传
|
||||
*
|
||||
* @param baseDir 相对应用的基目录
|
||||
* @param file 上传的文件
|
||||
* @param file 上传的文件
|
||||
* @return 文件名称
|
||||
* @throws IOException
|
||||
*/
|
||||
public static final String upload(String baseDir, MultipartFile file) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
public static final String upload(String baseDir, MultipartFile file) throws IOException {
|
||||
try {
|
||||
return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
throw new IOException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
|
@ -90,22 +81,20 @@ public class FileUploadUtils
|
|||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @param baseDir 相对应用的基目录
|
||||
* @param file 上传的文件
|
||||
* @param baseDir 相对应用的基目录
|
||||
* @param file 上传的文件
|
||||
* @param allowedExtension 上传文件类型
|
||||
* @return 返回上传成功的文件名
|
||||
* @throws FileSizeLimitExceededException 如果超出最大大小
|
||||
* @throws FileSizeLimitExceededException 如果超出最大大小
|
||||
* @throws FileNameLengthLimitExceededException 文件名太长
|
||||
* @throws IOException 比如读写文件出错时
|
||||
* @throws InvalidExtensionException 文件校验异常
|
||||
* @throws IOException 比如读写文件出错时
|
||||
* @throws InvalidExtensionException 文件校验异常
|
||||
*/
|
||||
public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
|
||||
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
|
||||
InvalidExtensionException
|
||||
{
|
||||
InvalidExtensionException {
|
||||
int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
|
||||
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
|
||||
{
|
||||
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
|
||||
throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
|
||||
}
|
||||
|
||||
|
|
@ -121,28 +110,23 @@ public class FileUploadUtils
|
|||
/**
|
||||
* 编码文件名
|
||||
*/
|
||||
public static final String extractFilename(MultipartFile file)
|
||||
{
|
||||
public static final String extractFilename(MultipartFile file) {
|
||||
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
|
||||
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
|
||||
}
|
||||
|
||||
public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
|
||||
{
|
||||
public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
|
||||
File desc = new File(uploadDir + File.separator + fileName);
|
||||
|
||||
if (!desc.exists())
|
||||
{
|
||||
if (!desc.getParentFile().exists())
|
||||
{
|
||||
if (!desc.exists()) {
|
||||
if (!desc.getParentFile().exists()) {
|
||||
desc.getParentFile().mkdirs();
|
||||
}
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
public static final String getPathFileName(String uploadDir, String fileName) throws IOException
|
||||
{
|
||||
public static final String getPathFileName(String uploadDir, String fileName) throws IOException {
|
||||
int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
|
||||
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
|
||||
return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
|
||||
|
|
@ -157,40 +141,28 @@ public class FileUploadUtils
|
|||
* @throws InvalidExtensionException
|
||||
*/
|
||||
public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
|
||||
throws FileSizeLimitExceededException, InvalidExtensionException
|
||||
{
|
||||
throws FileSizeLimitExceededException, InvalidExtensionException {
|
||||
long size = file.getSize();
|
||||
if (size > DEFAULT_MAX_SIZE)
|
||||
{
|
||||
if (size > DEFAULT_MAX_SIZE) {
|
||||
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
|
||||
}
|
||||
|
||||
String fileName = file.getOriginalFilename();
|
||||
String extension = getExtension(file);
|
||||
if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension))
|
||||
{
|
||||
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
|
||||
{
|
||||
if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
|
||||
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) {
|
||||
throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
|
||||
fileName);
|
||||
}
|
||||
else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
|
||||
{
|
||||
} else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) {
|
||||
throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
|
||||
fileName);
|
||||
}
|
||||
else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
|
||||
{
|
||||
} else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) {
|
||||
throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
|
||||
fileName);
|
||||
}
|
||||
else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION)
|
||||
{
|
||||
} else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) {
|
||||
throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
|
||||
fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
throw new InvalidExtensionException(allowedExtension, extension, fileName);
|
||||
}
|
||||
}
|
||||
|
|
@ -203,12 +175,9 @@ public class FileUploadUtils
|
|||
* @param allowedExtension
|
||||
* @return
|
||||
*/
|
||||
public static final boolean isAllowedExtension(String extension, String[] allowedExtension)
|
||||
{
|
||||
for (String str : allowedExtension)
|
||||
{
|
||||
if (str.equalsIgnoreCase(extension))
|
||||
{
|
||||
public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
|
||||
for (String str : allowedExtension) {
|
||||
if (str.equalsIgnoreCase(extension)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -221,11 +190,9 @@ public class FileUploadUtils
|
|||
* @param file 表单文件
|
||||
* @return 后缀名
|
||||
*/
|
||||
public static final String getExtension(MultipartFile file)
|
||||
{
|
||||
public static final String getExtension(MultipartFile file) {
|
||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||
if (StringUtils.isEmpty(extension))
|
||||
{
|
||||
if (StringUtils.isEmpty(extension)) {
|
||||
extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType()));
|
||||
}
|
||||
return extension;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ package com.bonus.waterdesign.controller.common;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
|
@ -15,10 +17,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.bonus.common.config.RuoYiConfig;
|
||||
import com.bonus.common.constant.Constants;
|
||||
|
|
@ -35,8 +34,7 @@ import com.bonus.framework.config.ServerConfig;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
public class CommonController
|
||||
{
|
||||
public class CommonController {
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
|
|
@ -56,15 +54,12 @@ public class CommonController
|
|||
* 通用下载请求
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@GetMapping("/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(fileName))
|
||||
{
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
|
||||
try {
|
||||
if (!FileUtils.checkAllowDownload(fileName)) {
|
||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
}
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
|
|
@ -73,13 +68,10 @@ public class CommonController
|
|||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, realFileName);
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
if (delete) {
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
|
@ -88,10 +80,8 @@ public class CommonController
|
|||
* 通用上传请求(单个)
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
public AjaxResult uploadModelFile(MultipartFile file) throws Exception {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
|
|
@ -101,33 +91,31 @@ public class CommonController
|
|||
/*目前我直接用公用的上传组件方法,后续有其他上传的方法
|
||||
除了我下面写的方法之外,其他的保留 我这个是单纯的dxf上传方法 需注意*/
|
||||
|
||||
// 2. 上传返回路径(例如:/profile/upload/2025/07/16/xxx.dxf)
|
||||
// 2. 上传返回路径(例如:/profile/upload/2025/07/16/xxx.dxf)
|
||||
String getfileName = FileUploadUtils.upload(filePath, file);
|
||||
|
||||
// 3. 去掉前缀 /profile/upload
|
||||
// 3. 去掉前缀 /profile/upload
|
||||
String relativePath = getfileName.replaceFirst("^/profile/upload", "");
|
||||
|
||||
// 4. 拼接本地路径(确保用正确的文件分隔符)
|
||||
// 4. 拼接本地路径(确保用正确的文件分隔符)
|
||||
String fullLocalPath = filePath + relativePath.replace("/", File.separator);
|
||||
|
||||
// ✅ 打印检查
|
||||
// 打印检查
|
||||
System.out.println("📁 实际读取的DXF文件路径:" + fullLocalPath);
|
||||
|
||||
// 5. 调用工具类
|
||||
// 5. 调用工具类
|
||||
String layersInfo = DxfClient.getLayersInfo(fullLocalPath);
|
||||
List<CadData> cadData = dxfParser.parseAndSave(layersInfo);
|
||||
System.err.println(cadData);
|
||||
//projectService.insertCadData(cadData);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
ajax.put("cadData", cadData);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("url", url);
|
||||
map.put("fileName", fileName);
|
||||
map.put("newFileName", FileUtils.getName(fileName));
|
||||
map.put("originalFilename", file.getOriginalFilename());
|
||||
map.put("cadData", cadData);
|
||||
return AjaxResult.success(map);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -135,19 +123,42 @@ public class CommonController
|
|||
/**
|
||||
* 通用上传请求(多个)
|
||||
*/
|
||||
@PostMapping("/uploads")
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
@PostMapping("/uploadFile")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
List<String> fileNames = new ArrayList<String>();
|
||||
List<String> newFileNames = new ArrayList<String>();
|
||||
List<String> originalFilenames = new ArrayList<String>();
|
||||
for (MultipartFile file : files)
|
||||
{
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
urls.add(url);
|
||||
fileNames.add(fileName);
|
||||
newFileNames.add(FileUtils.getName(fileName));
|
||||
originalFilenames.add(file.getOriginalFilename());
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("url", StringUtils.join(urls, FILE_DELIMETER));
|
||||
map.put("fileName", StringUtils.join(fileNames, FILE_DELIMETER));
|
||||
map.put("newFileName", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||
map.put("originalFilename", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||
return AjaxResult.success(map);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
@PostMapping("/uploads")
|
||||
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception {
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
List<String> fileNames = new ArrayList<String>();
|
||||
List<String> newFileNames = new ArrayList<String>();
|
||||
List<String> originalFilenames = new ArrayList<String>();
|
||||
for (MultipartFile file : files) {
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
|
|
@ -162,9 +173,7 @@ public class CommonController
|
|||
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
|
||||
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -174,12 +183,9 @@ public class CommonController
|
|||
*/
|
||||
@GetMapping("/download/resource")
|
||||
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
|
||||
throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.checkAllowDownload(resource))
|
||||
{
|
||||
throws Exception {
|
||||
try {
|
||||
if (!FileUtils.checkAllowDownload(resource)) {
|
||||
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
|
||||
}
|
||||
// 本地资源路径
|
||||
|
|
@ -191,9 +197,7 @@ public class CommonController
|
|||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import java.util.UUID;
|
|||
|
||||
public class DxfClient {
|
||||
|
||||
private static final String GET_LAYERS_URL = "http://127.0.0.1:5001/get_layers";
|
||||
private static final String EXTRACT_LAYERS_URL = "http://127.0.0.1:5001/extract_layers";
|
||||
private static final String GET_LAYERS_URL = "http://192.168.0.14:21010/get_layers";
|
||||
private static final String EXTRACT_LAYERS_URL = "http://192.168.0.14:21010/extract_layers";
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
//获取图层函数代码
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.bonus.common.core.page.TableDataInfo;
|
|||
import com.bonus.common.enums.BusinessType;
|
||||
import com.bonus.common.utils.poi.ExcelUtil;
|
||||
import com.bonus.waterdesign.domain.Project;
|
||||
import com.bonus.waterdesign.domain.ProjectSelect;
|
||||
import com.bonus.waterdesign.domain.ProjectUser;
|
||||
import com.bonus.waterdesign.service.ProjectService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -24,8 +25,7 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/project")
|
||||
public class ProjectController extends BaseController
|
||||
{
|
||||
public class ProjectController extends BaseController {
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
|
||||
|
|
@ -34,18 +34,26 @@ public class ProjectController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('project:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Project project)
|
||||
{
|
||||
public TableDataInfo list(Project project) {
|
||||
startPage();
|
||||
List<Project> list = projectService.selectProjectList(project);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取项目下拉框
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('project:list')")
|
||||
@GetMapping("/SelectList")
|
||||
public AjaxResult SelectList(ProjectSelect projectSelect) {
|
||||
List<ProjectSelect> list = projectService.selectProjectList1(projectSelect);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Log(title = "项目管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('project:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Project post)
|
||||
{
|
||||
public void export(HttpServletResponse response, Project post) {
|
||||
List<Project> list = projectService.selectProjectList(post);
|
||||
ExcelUtil<Project> util = new ExcelUtil<Project>(Project.class);
|
||||
util.exportExcel(response, list, "项目数据");
|
||||
|
|
@ -56,8 +64,7 @@ public class ProjectController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('project:query')")
|
||||
@GetMapping(value = "/{proId}")
|
||||
public AjaxResult getInfo(@PathVariable Long proId)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable Long proId) {
|
||||
return success(projectService.selectProjectById(proId));
|
||||
}
|
||||
|
||||
|
|
@ -67,10 +74,8 @@ public class ProjectController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('project:add')")
|
||||
@Log(title = "项目管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody Project project)
|
||||
{
|
||||
if (!projectService.checkProjectNameUnique(project))
|
||||
{
|
||||
public AjaxResult add(@Validated @RequestBody Project project) {
|
||||
if (!projectService.checkProjectNameUnique(project)) {
|
||||
return error("新增项目'" + project.getProName() + "'失败,项目名称已存在");
|
||||
}
|
||||
project.setCreateBy(getUsername());
|
||||
|
|
@ -83,10 +88,8 @@ public class ProjectController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('project:edit')")
|
||||
@Log(title = "项目管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody Project project)
|
||||
{
|
||||
if (!projectService.checkProjectNameUnique(project))
|
||||
{
|
||||
public AjaxResult edit(@Validated @RequestBody Project project) {
|
||||
if (!projectService.checkProjectNameUnique(project)) {
|
||||
return error("修改项目'" + project.getProName() + "'失败,项目名称已存在");
|
||||
}
|
||||
project.setUpdateBy(getUsername());
|
||||
|
|
@ -99,8 +102,7 @@ public class ProjectController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('project:remove')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{proId}")
|
||||
public AjaxResult remove(@PathVariable Long proId)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long proId) {
|
||||
return toAjax(projectService.deleteProjectById(proId));
|
||||
}
|
||||
|
||||
|
|
@ -110,10 +112,8 @@ public class ProjectController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('projectUser:add')")
|
||||
@Log(title = "项目管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addProjectUser")
|
||||
public AjaxResult addProjectUser(@Validated @RequestBody ProjectUser projectUser)
|
||||
{
|
||||
if (projectService.checkProjectUserUnique(projectUser))
|
||||
{
|
||||
public AjaxResult addProjectUser(@Validated @RequestBody ProjectUser projectUser) {
|
||||
if (projectService.checkProjectUserUnique(projectUser)) {
|
||||
return error("人员'" + projectUser.getUserName() + "'也绑定工程,请不要重复绑定");
|
||||
}
|
||||
return toAjax(projectService.insertProjectUser(projectUser));
|
||||
|
|
@ -125,8 +125,7 @@ public class ProjectController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('projectUser:del')")
|
||||
@Log(title = "项目管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/delProjectUser")
|
||||
public AjaxResult delProjectUser(@Validated @RequestBody ProjectUser projectUser)
|
||||
{
|
||||
public AjaxResult delProjectUser(@Validated @RequestBody ProjectUser projectUser) {
|
||||
return toAjax(projectService.delProjectUser(projectUser));
|
||||
}
|
||||
|
||||
|
|
@ -135,8 +134,7 @@ public class ProjectController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('projectUser:list')")
|
||||
@GetMapping("/projectUserList")
|
||||
public TableDataInfo projectUserList(ProjectUser projectUser)
|
||||
{
|
||||
public TableDataInfo projectUserList(ProjectUser projectUser) {
|
||||
startPage();
|
||||
List<ProjectUser> list = projectService.projectUserList(projectUser);
|
||||
return getDataTable(list);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.bonus.common.core.controller.BaseController;
|
|||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.common.enums.BusinessType;
|
||||
import com.bonus.common.utils.file.FileUploadUtils;
|
||||
import com.bonus.common.utils.poi.ExcelUtil;
|
||||
import com.bonus.waterdesign.domain.Survey;
|
||||
import com.bonus.waterdesign.service.SurveyService;
|
||||
|
|
@ -12,9 +13,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 勘查信息操作处理
|
||||
|
|
@ -23,8 +27,7 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/survey")
|
||||
public class SurveyController extends BaseController
|
||||
{
|
||||
public class SurveyController extends BaseController {
|
||||
@Autowired
|
||||
private SurveyService surveyService;
|
||||
|
||||
|
|
@ -33,8 +36,7 @@ public class SurveyController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:survey:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Survey survey)
|
||||
{
|
||||
public TableDataInfo list(Survey survey) {
|
||||
startPage();
|
||||
List<Survey> list = surveyService.selectSurveyList(survey);
|
||||
return getDataTable(list);
|
||||
|
|
@ -45,8 +47,7 @@ public class SurveyController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:survey:select')")
|
||||
@GetMapping("/select")
|
||||
public List<Survey> projectList()
|
||||
{
|
||||
public List<Survey> projectList() {
|
||||
List<Survey> list = surveyService.selectProjectList();
|
||||
return list;
|
||||
}
|
||||
|
|
@ -54,8 +55,7 @@ public class SurveyController extends BaseController
|
|||
@Log(title = "勘查管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('basic:survey:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Survey post)
|
||||
{
|
||||
public void export(HttpServletResponse response, Survey post) {
|
||||
List<Survey> list = surveyService.selectSurveyList(post);
|
||||
ExcelUtil<Survey> util = new ExcelUtil<Survey>(Survey.class);
|
||||
util.exportExcel(response, list, "勘查数据");
|
||||
|
|
@ -66,8 +66,7 @@ public class SurveyController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('basic:survey:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable Long id) {
|
||||
return success(surveyService.selectSurveyById(id));
|
||||
}
|
||||
|
||||
|
|
@ -77,8 +76,7 @@ public class SurveyController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('basic:survey:add')")
|
||||
@Log(title = "勘查管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody Survey survey)
|
||||
{
|
||||
public AjaxResult add(@Validated @RequestBody Survey survey) {
|
||||
survey.setCreateBy(getUsername());
|
||||
return toAjax(surveyService.insertSurvey(survey));
|
||||
}
|
||||
|
|
@ -89,8 +87,7 @@ public class SurveyController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('basic:survey:edit')")
|
||||
@Log(title = "勘查管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody Survey survey)
|
||||
{
|
||||
public AjaxResult edit(@Validated @RequestBody Survey survey) {
|
||||
survey.setUpdateBy(getUsername());
|
||||
return toAjax(surveyService.updateSurvey(survey));
|
||||
}
|
||||
|
|
@ -101,8 +98,7 @@ public class SurveyController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('basic:survey:remove')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long id) {
|
||||
return toAjax(surveyService.deleteSurveyById(id));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.bonus.waterdesign.domain;
|
||||
|
||||
import com.bonus.common.annotation.Excel;
|
||||
import com.bonus.common.annotation.Excel.ColumnType;
|
||||
import com.bonus.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位表 sys_post
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Data
|
||||
public class ProjectSelect {
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
}
|
||||
|
|
@ -40,6 +40,28 @@ public class Survey extends BaseEntity
|
|||
/** 项目名称 */
|
||||
|
||||
private String proName;
|
||||
/** 模型id */
|
||||
|
||||
private String modelId;
|
||||
/** 勘查结果 */
|
||||
|
||||
private String surveyResult;
|
||||
|
||||
public String getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(String modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public String getSurveyResult() {
|
||||
return surveyResult;
|
||||
}
|
||||
|
||||
public void setSurveyResult(String surveyResult) {
|
||||
this.surveyResult = surveyResult;
|
||||
}
|
||||
|
||||
/** 勘察附件 */
|
||||
|
||||
|
|
|
|||
|
|
@ -27,5 +27,6 @@ public class SysLevelConfig {
|
|||
private String createTime;
|
||||
|
||||
private String updateTime;
|
||||
private Integer level;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.waterdesign.mapper;
|
|||
|
||||
import com.bonus.waterdesign.domain.CadData;
|
||||
import com.bonus.waterdesign.domain.Project;
|
||||
import com.bonus.waterdesign.domain.ProjectSelect;
|
||||
import com.bonus.waterdesign.domain.ProjectUser;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -89,4 +90,6 @@ public interface ProjectMapper
|
|||
List<ProjectUser> selectProjectUserList(ProjectUser projectUser);
|
||||
|
||||
void insertCadData(CadData data);
|
||||
|
||||
List<ProjectSelect> selectProjectList1(ProjectSelect projectSelect);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.waterdesign.service;
|
|||
|
||||
import com.bonus.waterdesign.domain.CadData;
|
||||
import com.bonus.waterdesign.domain.Project;
|
||||
import com.bonus.waterdesign.domain.ProjectSelect;
|
||||
import com.bonus.waterdesign.domain.ProjectUser;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -89,4 +90,6 @@ public interface ProjectService
|
|||
List<ProjectUser> projectUserList(ProjectUser projectUser);
|
||||
|
||||
void insertCadData(List<CadData> cadData);
|
||||
|
||||
List<ProjectSelect> selectProjectList1(ProjectSelect projectSelect);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,13 +19,17 @@ public class ILevelConfigServiceImpl implements ILevelConfigService {
|
|||
|
||||
@Resource
|
||||
private SysLevelConfigMapper configMapper;
|
||||
|
||||
@Override
|
||||
public int addConfigWithNodes(SysLevelConfig config) {
|
||||
// 插入配置
|
||||
configMapper.insert(config);
|
||||
List<SysLevelNode> nodes = config.getNodes();
|
||||
if (nodes != null && !nodes.isEmpty()) {
|
||||
// 插入配置
|
||||
config.setLevel(nodes.size());
|
||||
configMapper.insert(config);
|
||||
}
|
||||
|
||||
// 处理节点层级关系
|
||||
List<SysLevelNode> nodes = config.getNodes();
|
||||
if (nodes != null && !nodes.isEmpty()) {
|
||||
Long parentId = 0L;
|
||||
int orderNum = 1;
|
||||
|
|
|
|||
|
|
@ -2,10 +2,7 @@ package com.bonus.waterdesign.service.impl;
|
|||
|
||||
import com.bonus.common.constant.UserConstants;
|
||||
import com.bonus.common.utils.StringUtils;
|
||||
import com.bonus.waterdesign.domain.CadData;
|
||||
import com.bonus.waterdesign.domain.ClassifiedOrganization;
|
||||
import com.bonus.waterdesign.domain.Project;
|
||||
import com.bonus.waterdesign.domain.ProjectUser;
|
||||
import com.bonus.waterdesign.domain.*;
|
||||
import com.bonus.waterdesign.mapper.ProjectMapper;
|
||||
import com.bonus.waterdesign.service.ClassifiedOrganizationService;
|
||||
import com.bonus.waterdesign.service.ProjectService;
|
||||
|
|
@ -21,8 +18,7 @@ import java.util.List;
|
|||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class ProjectServiceImpl implements ProjectService
|
||||
{
|
||||
public class ProjectServiceImpl implements ProjectService {
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
|
|
@ -36,12 +32,11 @@ public class ProjectServiceImpl implements ProjectService
|
|||
* @return 项目信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<Project> selectProjectList(Project project)
|
||||
{
|
||||
List<Project> projectList =projectMapper.selectProjectList(project);
|
||||
public List<Project> selectProjectList(Project project) {
|
||||
List<Project> projectList = projectMapper.selectProjectList(project);
|
||||
//获取团队信息
|
||||
if (projectList.size()>0){
|
||||
for (Project projectNew:projectList) {
|
||||
if (projectList.size() > 0) {
|
||||
for (Project projectNew : projectList) {
|
||||
ProjectUser projectUser = new ProjectUser();
|
||||
projectUser.setProjectId(projectNew.getProId().intValue());
|
||||
List<ProjectUser> projectUserList = projectMapper.selectProjectUserList(projectUser);
|
||||
|
|
@ -58,8 +53,7 @@ public class ProjectServiceImpl implements ProjectService
|
|||
* @return 角色对象信息
|
||||
*/
|
||||
@Override
|
||||
public Project selectProjectById(Long proId)
|
||||
{
|
||||
public Project selectProjectById(Long proId) {
|
||||
return projectMapper.selectProjectById(proId);
|
||||
}
|
||||
|
||||
|
|
@ -70,12 +64,10 @@ public class ProjectServiceImpl implements ProjectService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkProjectNameUnique(Project project)
|
||||
{
|
||||
public boolean checkProjectNameUnique(Project project) {
|
||||
Long proId = StringUtils.isNull(project.getProId()) ? -1L : project.getProId();
|
||||
Project info = projectMapper.checkProjectNameUnique(project.getProName());
|
||||
if (StringUtils.isNotNull(info) && info.getProId().longValue() != proId.longValue())
|
||||
{
|
||||
if (StringUtils.isNotNull(info) && info.getProId().longValue() != proId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
|
|
@ -88,8 +80,7 @@ public class ProjectServiceImpl implements ProjectService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteProjectById(Long proId)
|
||||
{
|
||||
public int deleteProjectById(Long proId) {
|
||||
return projectMapper.deleteProjectById(proId);
|
||||
}
|
||||
|
||||
|
|
@ -100,8 +91,7 @@ public class ProjectServiceImpl implements ProjectService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertProject(Project project)
|
||||
{
|
||||
public int insertProject(Project project) {
|
||||
projectMapper.insertProject(project);
|
||||
//保存到分类组织
|
||||
ClassifiedOrganization classifiedOrganization = new ClassifiedOrganization();
|
||||
|
|
@ -118,21 +108,20 @@ public class ProjectServiceImpl implements ProjectService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateProject(Project project)
|
||||
{
|
||||
public int updateProject(Project project) {
|
||||
return projectMapper.updateProject(project);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验人员是否绑定
|
||||
*
|
||||
* @param projectUser
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean checkProjectUserUnique(ProjectUser projectUser) {
|
||||
ProjectUser projectUserOld = projectMapper.checkProjectUserUnique(projectUser.getUserId());
|
||||
if (StringUtils.isNotNull(projectUserOld) )
|
||||
{
|
||||
if (StringUtils.isNotNull(projectUserOld)) {
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
|
|
@ -140,6 +129,7 @@ public class ProjectServiceImpl implements ProjectService
|
|||
|
||||
/**
|
||||
* 新增项目团队人员
|
||||
*
|
||||
* @param projectUser
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -150,6 +140,7 @@ public class ProjectServiceImpl implements ProjectService
|
|||
|
||||
/**
|
||||
* 删除项目团队人员
|
||||
*
|
||||
* @param projectUser
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -175,4 +166,10 @@ public class ProjectServiceImpl implements ProjectService
|
|||
projectMapper.insertCadData(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProjectSelect> selectProjectList1(ProjectSelect projectSelect) {
|
||||
List<ProjectSelect> projectList = projectMapper.selectProjectList1(projectSelect);
|
||||
return projectList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ import java.util.List;
|
|||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class SurveyServiceImpl implements SurveyService
|
||||
{
|
||||
public class SurveyServiceImpl implements SurveyService {
|
||||
@Autowired
|
||||
private SurveyMapper surveyMapper;
|
||||
|
||||
|
|
@ -26,8 +25,7 @@ public class SurveyServiceImpl implements SurveyService
|
|||
* @return 勘察信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<Survey> selectSurveyList(Survey survey)
|
||||
{
|
||||
public List<Survey> selectSurveyList(Survey survey) {
|
||||
return surveyMapper.selectSurveyList(survey);
|
||||
}
|
||||
|
||||
|
|
@ -38,8 +36,7 @@ public class SurveyServiceImpl implements SurveyService
|
|||
* @return 角色对象信息
|
||||
*/
|
||||
@Override
|
||||
public Survey selectSurveyById(Long id)
|
||||
{
|
||||
public Survey selectSurveyById(Long id) {
|
||||
return surveyMapper.selectSurveyById(id);
|
||||
}
|
||||
|
||||
|
|
@ -51,8 +48,7 @@ public class SurveyServiceImpl implements SurveyService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSurveyById(Long id)
|
||||
{
|
||||
public int deleteSurveyById(Long id) {
|
||||
return surveyMapper.deleteSurveyById(id);
|
||||
}
|
||||
|
||||
|
|
@ -63,8 +59,7 @@ public class SurveyServiceImpl implements SurveyService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSurvey(Survey survey)
|
||||
{
|
||||
public int insertSurvey(Survey survey) {
|
||||
return surveyMapper.insertSurvey(survey);
|
||||
}
|
||||
|
||||
|
|
@ -75,13 +70,12 @@ public class SurveyServiceImpl implements SurveyService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSurvey(Survey survey)
|
||||
{
|
||||
public int updateSurvey(Survey survey) {
|
||||
return surveyMapper.updateSurvey(survey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Survey> selectProjectList(){
|
||||
public List<Survey> selectProjectList() {
|
||||
return surveyMapper.selectProjectList();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,10 +62,12 @@
|
|||
INSERT INTO sys_level_config (
|
||||
<if test="configName != null and configName != ''">config_name,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="level != null">level,</if>
|
||||
create_time
|
||||
) VALUES (
|
||||
<if test="configName != null and configName != ''">#{configName},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="level != null">#{level},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@
|
|||
) m ON m.project_id = n.id
|
||||
|
||||
WHERE p.del_flag = '0'
|
||||
<if test="proName != null and proName != ''">
|
||||
AND p.pro_name like concat('%',#{proName},'%')
|
||||
<if test="projectId != null and projectId != ''">
|
||||
AND p.id = #{projectId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="openView" resultType="com.bonus.waterdesign.domain.CadData">
|
||||
|
|
|
|||
|
|
@ -87,6 +87,19 @@
|
|||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectProjectList1" resultType="com.bonus.waterdesign.domain.ProjectSelect">
|
||||
SELECT
|
||||
tp.id,
|
||||
tp.pro_name name
|
||||
FROM
|
||||
tb_project tp
|
||||
LEFT JOIN sys_level_config sc ON sc.config_id = tp.LEVEL
|
||||
WHERE
|
||||
del_flag = '0'
|
||||
<if test="id != null and id != ''">
|
||||
AND tp.id = #{id}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="updateProject" parameterType="Project">
|
||||
update tb_project
|
||||
|
|
|
|||
|
|
@ -17,10 +17,19 @@
|
|||
<result property="updateBy" column="update_user" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="modelId" column="model_id" />
|
||||
<result property="surveyResult" column="survey_result" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSurvey">
|
||||
select tsi.id, tsi.survey_user, tsi.survey_attach, tsi.survey_content,tp.pro_name
|
||||
select tsi.id,
|
||||
tsi.survey_user,
|
||||
tsi.survey_attach,
|
||||
tsi.survey_time,
|
||||
tsi.survey_content,
|
||||
tsi.survey_result,
|
||||
tsi.model_id,
|
||||
tp.pro_name
|
||||
from tb_survey_info tsi
|
||||
left join tb_project tp on tp.id=tsi.pro_id
|
||||
where tsi.del_flag = '0'
|
||||
|
|
@ -40,7 +49,14 @@
|
|||
</select>
|
||||
|
||||
<select id="selectSurveyById" parameterType="Long" resultMap="SurveyResult">
|
||||
select tsi.id, tsi.survey_user, tsi.survey_attach, tsi.survey_content,tsi.survey_time,tp.pro_name
|
||||
select tsi.id,
|
||||
tsi.survey_user,
|
||||
tsi.survey_attach,
|
||||
tsi.survey_time,
|
||||
tsi.survey_content,
|
||||
tsi.survey_result,
|
||||
tsi.model_id,
|
||||
tp.pro_name
|
||||
from tb_survey_info tsi
|
||||
left join tb_project tp on tp.id=tsi.pro_id
|
||||
where tsi.del_flag = '0' and tsi.id = #{id}
|
||||
|
|
@ -55,6 +71,8 @@
|
|||
<if test="surveyContent != null and surveyContent != ''">survey_content = #{surveyContent},</if>
|
||||
<if test="surveyAttach != null and surveyAttach != ''">survey_attach = #{surveyAttach},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_user = #{updateBy},</if>
|
||||
<if test="modelId != null and modelId != ''">model_id = #{modelId},</if>
|
||||
<if test="surveyResult != null and surveyResult != ''">survey_result = #{surveyResult},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where id = #{id}
|
||||
|
|
@ -68,6 +86,8 @@
|
|||
<if test="surveyContent != null and surveyContent != ''">survey_content,</if>
|
||||
<if test="surveyAttach != null and surveyAttach != ''">survey_attach,</if>
|
||||
<if test="createBy != null and createBy != ''">create_user,</if>
|
||||
<if test="modelId != null and modelId != ''">model_id,</if>
|
||||
<if test="surveyResult != null and surveyResult != ''">survey_result,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="proId != null and proId != 0">#{proId},</if>
|
||||
|
|
@ -76,6 +96,8 @@
|
|||
<if test="surveyContent != null and surveyContent != ''">#{surveyContent},</if>
|
||||
<if test="surveyAttach != null and surveyAttach != ''">#{surveyAttach},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="modelId != null and modelId != ''">#{modelId},</if>
|
||||
<if test="surveyResult != null and surveyResult != ''">#{surveyResult},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
|
|
|||
Loading…
Reference in New Issue