接口开发

This commit is contained in:
liang.chao 2025-07-29 18:19:01 +08:00
parent 5487ae47ce
commit 39d4f2b90b
17 changed files with 262 additions and 215 deletions

View File

@ -3,6 +3,8 @@ package com.bonus.common.utils.file;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import com.bonus.common.utils.uuid.Seq; import com.bonus.common.utils.uuid.Seq;
@ -21,8 +23,7 @@ import com.bonus.common.utils.StringUtils;
* *
* @author ruoyi * @author ruoyi
*/ */
public class FileUploadUtils public class FileUploadUtils {
{
/** /**
* 默认大小 50M * 默认大小 50M
*/ */
@ -38,13 +39,11 @@ public class FileUploadUtils
*/ */
private static String defaultBaseDir = RuoYiConfig.getProfile(); private static String defaultBaseDir = RuoYiConfig.getProfile();
public static void setDefaultBaseDir(String defaultBaseDir) public static void setDefaultBaseDir(String defaultBaseDir) {
{
FileUploadUtils.defaultBaseDir = defaultBaseDir; FileUploadUtils.defaultBaseDir = defaultBaseDir;
} }
public static String getDefaultBaseDir() public static String getDefaultBaseDir() {
{
return defaultBaseDir; return defaultBaseDir;
} }
@ -55,14 +54,10 @@ public class FileUploadUtils
* @return 文件名称 * @return 文件名称
* @throws Exception * @throws Exception
*/ */
public static final String upload(MultipartFile file) throws IOException public static final String upload(MultipartFile file) throws IOException {
{ try {
try
{
return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
} } catch (Exception e) {
catch (Exception e)
{
throw new IOException(e.getMessage(), e); throw new IOException(e.getMessage(), e);
} }
} }
@ -75,14 +70,10 @@ public class FileUploadUtils
* @return 文件名称 * @return 文件名称
* @throws IOException * @throws IOException
*/ */
public static final String upload(String baseDir, MultipartFile file) throws IOException public static final String upload(String baseDir, MultipartFile file) throws IOException {
{ try {
try
{
return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
} } catch (Exception e) {
catch (Exception e)
{
throw new IOException(e.getMessage(), e); throw new IOException(e.getMessage(), e);
} }
} }
@ -101,11 +92,9 @@ public class FileUploadUtils
*/ */
public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException InvalidExtensionException {
{
int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length(); 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); 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(), return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file)); 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); File desc = new File(uploadDir + File.separator + fileName);
if (!desc.exists()) if (!desc.exists()) {
{ if (!desc.getParentFile().exists()) {
if (!desc.getParentFile().exists())
{
desc.getParentFile().mkdirs(); desc.getParentFile().mkdirs();
} }
} }
return desc; 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; int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
String currentDir = StringUtils.substring(uploadDir, dirLastIndex); String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName; return Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
@ -157,40 +141,28 @@ public class FileUploadUtils
* @throws InvalidExtensionException * @throws InvalidExtensionException
*/ */
public static final void assertAllowed(MultipartFile file, String[] allowedExtension) public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, InvalidExtensionException throws FileSizeLimitExceededException, InvalidExtensionException {
{
long size = file.getSize(); long size = file.getSize();
if (size > DEFAULT_MAX_SIZE) if (size > DEFAULT_MAX_SIZE) {
{
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
} }
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
String extension = getExtension(file); String extension = getExtension(file);
if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
{ if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) {
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
{
throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
fileName); fileName);
} } else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) {
else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
{
throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
fileName); fileName);
} } else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) {
else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
{
throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
fileName); fileName);
} } else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) {
else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION)
{
throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
fileName); fileName);
} } else {
else
{
throw new InvalidExtensionException(allowedExtension, extension, fileName); throw new InvalidExtensionException(allowedExtension, extension, fileName);
} }
} }
@ -203,12 +175,9 @@ public class FileUploadUtils
* @param allowedExtension * @param allowedExtension
* @return * @return
*/ */
public static final boolean isAllowedExtension(String extension, String[] allowedExtension) public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
{ for (String str : allowedExtension) {
for (String str : allowedExtension) if (str.equalsIgnoreCase(extension)) {
{
if (str.equalsIgnoreCase(extension))
{
return true; return true;
} }
} }
@ -221,11 +190,9 @@ public class FileUploadUtils
* @param file 表单文件 * @param file 表单文件
* @return 后缀名 * @return 后缀名
*/ */
public static final String getExtension(MultipartFile file) public static final String getExtension(MultipartFile file) {
{
String extension = FilenameUtils.getExtension(file.getOriginalFilename()); String extension = FilenameUtils.getExtension(file.getOriginalFilename());
if (StringUtils.isEmpty(extension)) if (StringUtils.isEmpty(extension)) {
{
extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType())); extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType()));
} }
return extension; return extension;

View File

@ -2,7 +2,9 @@ package com.bonus.waterdesign.controller.common;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -15,10 +17,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.bonus.common.config.RuoYiConfig; import com.bonus.common.config.RuoYiConfig;
import com.bonus.common.constant.Constants; import com.bonus.common.constant.Constants;
@ -35,8 +34,7 @@ import com.bonus.framework.config.ServerConfig;
*/ */
@RestController @RestController
@RequestMapping("/common") @RequestMapping("/common")
public class CommonController public class CommonController {
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class); private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired @Autowired
@ -59,12 +57,9 @@ public class CommonController
* @param delete 是否删除 * @param delete 是否删除
*/ */
@GetMapping("/download") @GetMapping("/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
{ try {
try if (!FileUtils.checkAllowDownload(fileName)) {
{
if (!FileUtils.checkAllowDownload(fileName))
{
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
} }
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
@ -73,13 +68,10 @@ public class CommonController
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName); FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream()); FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete) if (delete) {
{
FileUtils.deleteFile(filePath); FileUtils.deleteFile(filePath);
} }
} } catch (Exception e) {
catch (Exception e)
{
log.error("下载文件失败", e); log.error("下载文件失败", e);
} }
} }
@ -88,10 +80,8 @@ public class CommonController
* 通用上传请求单个 * 通用上传请求单个
*/ */
@PostMapping("/upload") @PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception public AjaxResult uploadModelFile(MultipartFile file) throws Exception {
{ try {
try
{
// 上传文件路径 // 上传文件路径
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称 // 上传并返回新文件名称
@ -101,33 +91,31 @@ public class CommonController
/*目前我直接用公用的上传组件方法后续有其他上传的方法 /*目前我直接用公用的上传组件方法后续有其他上传的方法
除了我下面写的方法之外其他的保留 我这个是单纯的dxf上传方法 需注意*/ 除了我下面写的方法之外其他的保留 我这个是单纯的dxf上传方法 需注意*/
// 2. 上传返回路径例如/profile/upload/2025/07/16/xxx.dxf // 2. 上传返回路径例如/profile/upload/2025/07/16/xxx.dxf
String getfileName = FileUploadUtils.upload(filePath, file); String getfileName = FileUploadUtils.upload(filePath, file);
// 3. 去掉前缀 /profile/upload // 3. 去掉前缀 /profile/upload
String relativePath = getfileName.replaceFirst("^/profile/upload", ""); String relativePath = getfileName.replaceFirst("^/profile/upload", "");
// 4. 拼接本地路径确保用正确的文件分隔符 // 4. 拼接本地路径确保用正确的文件分隔符
String fullLocalPath = filePath + relativePath.replace("/", File.separator); String fullLocalPath = filePath + relativePath.replace("/", File.separator);
// 打印检查 // 打印检查
System.out.println("📁 实际读取的DXF文件路径" + fullLocalPath); System.out.println("📁 实际读取的DXF文件路径" + fullLocalPath);
// 5. 调用工具类 // 5. 调用工具类
String layersInfo = DxfClient.getLayersInfo(fullLocalPath); String layersInfo = DxfClient.getLayersInfo(fullLocalPath);
List<CadData> cadData = dxfParser.parseAndSave(layersInfo); List<CadData> cadData = dxfParser.parseAndSave(layersInfo);
System.err.println(cadData); System.err.println(cadData);
//projectService.insertCadData(cadData); //projectService.insertCadData(cadData);
AjaxResult ajax = AjaxResult.success(); HashMap<String, Object> map = new HashMap<>();
ajax.put("url", url); map.put("url", url);
ajax.put("fileName", fileName); map.put("fileName", fileName);
ajax.put("newFileName", FileUtils.getName(fileName)); map.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename()); map.put("originalFilename", file.getOriginalFilename());
ajax.put("cadData", cadData); map.put("cadData", cadData);
return ajax; return AjaxResult.success(map);
} } catch (Exception e) {
catch (Exception e)
{
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
} }
@ -135,19 +123,42 @@ public class CommonController
/** /**
* 通用上传请求多个 * 通用上传请求多个
*/ */
@PostMapping("/uploads") @PostMapping("/uploadFile")
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception public AjaxResult uploadFile(MultipartFile file) throws Exception {
{ try {
try
{
// 上传文件路径 // 上传文件路径
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();
List<String> urls = new ArrayList<String>(); List<String> urls = new ArrayList<String>();
List<String> fileNames = new ArrayList<String>(); List<String> fileNames = new ArrayList<String>();
List<String> newFileNames = new ArrayList<String>(); List<String> newFileNames = new ArrayList<String>();
List<String> originalFilenames = 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 fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName; String url = serverConfig.getUrl() + fileName;
@ -162,9 +173,7 @@ public class CommonController
ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER)); ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER)); ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
return ajax; return ajax;
} } catch (Exception e) {
catch (Exception e)
{
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
} }
@ -174,12 +183,9 @@ public class CommonController
*/ */
@GetMapping("/download/resource") @GetMapping("/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception throws Exception {
{ try {
try if (!FileUtils.checkAllowDownload(resource)) {
{
if (!FileUtils.checkAllowDownload(resource))
{
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
} }
// 本地资源路径 // 本地资源路径
@ -191,9 +197,7 @@ public class CommonController
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName); FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream()); FileUtils.writeBytes(downloadPath, response.getOutputStream());
} } catch (Exception e) {
catch (Exception e)
{
log.error("下载文件失败", e); log.error("下载文件失败", e);
} }
} }

View File

@ -14,8 +14,8 @@ import java.util.UUID;
public class DxfClient { public class DxfClient {
private static final String GET_LAYERS_URL = "http://127.0.0.1:5001/get_layers"; private static final String GET_LAYERS_URL = "http://192.168.0.14:21010/get_layers";
private static final String EXTRACT_LAYERS_URL = "http://127.0.0.1:5001/extract_layers"; private static final String EXTRACT_LAYERS_URL = "http://192.168.0.14:21010/extract_layers";
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
//获取图层函数代码 //获取图层函数代码

View File

@ -7,6 +7,7 @@ import com.bonus.common.core.page.TableDataInfo;
import com.bonus.common.enums.BusinessType; import com.bonus.common.enums.BusinessType;
import com.bonus.common.utils.poi.ExcelUtil; import com.bonus.common.utils.poi.ExcelUtil;
import com.bonus.waterdesign.domain.Project; import com.bonus.waterdesign.domain.Project;
import com.bonus.waterdesign.domain.ProjectSelect;
import com.bonus.waterdesign.domain.ProjectUser; import com.bonus.waterdesign.domain.ProjectUser;
import com.bonus.waterdesign.service.ProjectService; import com.bonus.waterdesign.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -24,8 +25,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/project") @RequestMapping("/project")
public class ProjectController extends BaseController public class ProjectController extends BaseController {
{
@Autowired @Autowired
private ProjectService projectService; private ProjectService projectService;
@ -34,18 +34,26 @@ public class ProjectController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('project:list')") @PreAuthorize("@ss.hasPermi('project:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(Project project) public TableDataInfo list(Project project) {
{
startPage(); startPage();
List<Project> list = projectService.selectProjectList(project); List<Project> list = projectService.selectProjectList(project);
return getDataTable(list); 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) @Log(title = "项目管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('project:export')") @PreAuthorize("@ss.hasPermi('project:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, Project post) public void export(HttpServletResponse response, Project post) {
{
List<Project> list = projectService.selectProjectList(post); List<Project> list = projectService.selectProjectList(post);
ExcelUtil<Project> util = new ExcelUtil<Project>(Project.class); ExcelUtil<Project> util = new ExcelUtil<Project>(Project.class);
util.exportExcel(response, list, "项目数据"); util.exportExcel(response, list, "项目数据");
@ -56,8 +64,7 @@ public class ProjectController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('project:query')") @PreAuthorize("@ss.hasPermi('project:query')")
@GetMapping(value = "/{proId}") @GetMapping(value = "/{proId}")
public AjaxResult getInfo(@PathVariable Long proId) public AjaxResult getInfo(@PathVariable Long proId) {
{
return success(projectService.selectProjectById(proId)); return success(projectService.selectProjectById(proId));
} }
@ -67,10 +74,8 @@ public class ProjectController extends BaseController
@PreAuthorize("@ss.hasPermi('project:add')") @PreAuthorize("@ss.hasPermi('project:add')")
@Log(title = "项目管理", businessType = BusinessType.INSERT) @Log(title = "项目管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody Project project) public AjaxResult add(@Validated @RequestBody Project project) {
{ if (!projectService.checkProjectNameUnique(project)) {
if (!projectService.checkProjectNameUnique(project))
{
return error("新增项目'" + project.getProName() + "'失败,项目名称已存在"); return error("新增项目'" + project.getProName() + "'失败,项目名称已存在");
} }
project.setCreateBy(getUsername()); project.setCreateBy(getUsername());
@ -83,10 +88,8 @@ public class ProjectController extends BaseController
@PreAuthorize("@ss.hasPermi('project:edit')") @PreAuthorize("@ss.hasPermi('project:edit')")
@Log(title = "项目管理", businessType = BusinessType.UPDATE) @Log(title = "项目管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody Project project) public AjaxResult edit(@Validated @RequestBody Project project) {
{ if (!projectService.checkProjectNameUnique(project)) {
if (!projectService.checkProjectNameUnique(project))
{
return error("修改项目'" + project.getProName() + "'失败,项目名称已存在"); return error("修改项目'" + project.getProName() + "'失败,项目名称已存在");
} }
project.setUpdateBy(getUsername()); project.setUpdateBy(getUsername());
@ -99,8 +102,7 @@ public class ProjectController extends BaseController
@PreAuthorize("@ss.hasPermi('project:remove')") @PreAuthorize("@ss.hasPermi('project:remove')")
@Log(title = "岗位管理", businessType = BusinessType.DELETE) @Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{proId}") @DeleteMapping("/{proId}")
public AjaxResult remove(@PathVariable Long proId) public AjaxResult remove(@PathVariable Long proId) {
{
return toAjax(projectService.deleteProjectById(proId)); return toAjax(projectService.deleteProjectById(proId));
} }
@ -110,10 +112,8 @@ public class ProjectController extends BaseController
@PreAuthorize("@ss.hasPermi('projectUser:add')") @PreAuthorize("@ss.hasPermi('projectUser:add')")
@Log(title = "项目管理", businessType = BusinessType.INSERT) @Log(title = "项目管理", businessType = BusinessType.INSERT)
@PostMapping("/addProjectUser") @PostMapping("/addProjectUser")
public AjaxResult addProjectUser(@Validated @RequestBody ProjectUser projectUser) public AjaxResult addProjectUser(@Validated @RequestBody ProjectUser projectUser) {
{ if (projectService.checkProjectUserUnique(projectUser)) {
if (projectService.checkProjectUserUnique(projectUser))
{
return error("人员'" + projectUser.getUserName() + "'也绑定工程,请不要重复绑定"); return error("人员'" + projectUser.getUserName() + "'也绑定工程,请不要重复绑定");
} }
return toAjax(projectService.insertProjectUser(projectUser)); return toAjax(projectService.insertProjectUser(projectUser));
@ -125,8 +125,7 @@ public class ProjectController extends BaseController
@PreAuthorize("@ss.hasPermi('projectUser:del')") @PreAuthorize("@ss.hasPermi('projectUser:del')")
@Log(title = "项目管理", businessType = BusinessType.INSERT) @Log(title = "项目管理", businessType = BusinessType.INSERT)
@PostMapping("/delProjectUser") @PostMapping("/delProjectUser")
public AjaxResult delProjectUser(@Validated @RequestBody ProjectUser projectUser) public AjaxResult delProjectUser(@Validated @RequestBody ProjectUser projectUser) {
{
return toAjax(projectService.delProjectUser(projectUser)); return toAjax(projectService.delProjectUser(projectUser));
} }
@ -135,8 +134,7 @@ public class ProjectController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('projectUser:list')") @PreAuthorize("@ss.hasPermi('projectUser:list')")
@GetMapping("/projectUserList") @GetMapping("/projectUserList")
public TableDataInfo projectUserList(ProjectUser projectUser) public TableDataInfo projectUserList(ProjectUser projectUser) {
{
startPage(); startPage();
List<ProjectUser> list = projectService.projectUserList(projectUser); List<ProjectUser> list = projectService.projectUserList(projectUser);
return getDataTable(list); return getDataTable(list);

View File

@ -5,6 +5,7 @@ import com.bonus.common.core.controller.BaseController;
import com.bonus.common.core.domain.AjaxResult; import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.core.page.TableDataInfo; import com.bonus.common.core.page.TableDataInfo;
import com.bonus.common.enums.BusinessType; import com.bonus.common.enums.BusinessType;
import com.bonus.common.utils.file.FileUploadUtils;
import com.bonus.common.utils.poi.ExcelUtil; import com.bonus.common.utils.poi.ExcelUtil;
import com.bonus.waterdesign.domain.Survey; import com.bonus.waterdesign.domain.Survey;
import com.bonus.waterdesign.service.SurveyService; 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.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 勘查信息操作处理 * 勘查信息操作处理
@ -23,8 +27,7 @@ import java.util.List;
*/ */
@RestController @RestController
@RequestMapping("/survey") @RequestMapping("/survey")
public class SurveyController extends BaseController public class SurveyController extends BaseController {
{
@Autowired @Autowired
private SurveyService surveyService; private SurveyService surveyService;
@ -33,8 +36,7 @@ public class SurveyController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('basic:survey:list')") @PreAuthorize("@ss.hasPermi('basic:survey:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(Survey survey) public TableDataInfo list(Survey survey) {
{
startPage(); startPage();
List<Survey> list = surveyService.selectSurveyList(survey); List<Survey> list = surveyService.selectSurveyList(survey);
return getDataTable(list); return getDataTable(list);
@ -45,8 +47,7 @@ public class SurveyController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('basic:survey:select')") @PreAuthorize("@ss.hasPermi('basic:survey:select')")
@GetMapping("/select") @GetMapping("/select")
public List<Survey> projectList() public List<Survey> projectList() {
{
List<Survey> list = surveyService.selectProjectList(); List<Survey> list = surveyService.selectProjectList();
return list; return list;
} }
@ -54,8 +55,7 @@ public class SurveyController extends BaseController
@Log(title = "勘查管理", businessType = BusinessType.EXPORT) @Log(title = "勘查管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('basic:survey:export')") @PreAuthorize("@ss.hasPermi('basic:survey:export')")
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, Survey post) public void export(HttpServletResponse response, Survey post) {
{
List<Survey> list = surveyService.selectSurveyList(post); List<Survey> list = surveyService.selectSurveyList(post);
ExcelUtil<Survey> util = new ExcelUtil<Survey>(Survey.class); ExcelUtil<Survey> util = new ExcelUtil<Survey>(Survey.class);
util.exportExcel(response, list, "勘查数据"); util.exportExcel(response, list, "勘查数据");
@ -66,8 +66,7 @@ public class SurveyController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('basic:survey:query')") @PreAuthorize("@ss.hasPermi('basic:survey:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable Long id) public AjaxResult getInfo(@PathVariable Long id) {
{
return success(surveyService.selectSurveyById(id)); return success(surveyService.selectSurveyById(id));
} }
@ -77,8 +76,7 @@ public class SurveyController extends BaseController
@PreAuthorize("@ss.hasPermi('basic:survey:add')") @PreAuthorize("@ss.hasPermi('basic:survey:add')")
@Log(title = "勘查管理", businessType = BusinessType.INSERT) @Log(title = "勘查管理", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@Validated @RequestBody Survey survey) public AjaxResult add(@Validated @RequestBody Survey survey) {
{
survey.setCreateBy(getUsername()); survey.setCreateBy(getUsername());
return toAjax(surveyService.insertSurvey(survey)); return toAjax(surveyService.insertSurvey(survey));
} }
@ -89,8 +87,7 @@ public class SurveyController extends BaseController
@PreAuthorize("@ss.hasPermi('basic:survey:edit')") @PreAuthorize("@ss.hasPermi('basic:survey:edit')")
@Log(title = "勘查管理", businessType = BusinessType.UPDATE) @Log(title = "勘查管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@Validated @RequestBody Survey survey) public AjaxResult edit(@Validated @RequestBody Survey survey) {
{
survey.setUpdateBy(getUsername()); survey.setUpdateBy(getUsername());
return toAjax(surveyService.updateSurvey(survey)); return toAjax(surveyService.updateSurvey(survey));
} }
@ -101,8 +98,7 @@ public class SurveyController extends BaseController
@PreAuthorize("@ss.hasPermi('basic:survey:remove')") @PreAuthorize("@ss.hasPermi('basic:survey:remove')")
@Log(title = "岗位管理", businessType = BusinessType.DELETE) @Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) public AjaxResult remove(@PathVariable Long id) {
{
return toAjax(surveyService.deleteSurveyById(id)); return toAjax(surveyService.deleteSurveyById(id));
} }

View File

@ -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;
}

View File

@ -40,6 +40,28 @@ public class Survey extends BaseEntity
/** 项目名称 */ /** 项目名称 */
private String proName; 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;
}
/** 勘察附件 */ /** 勘察附件 */

View File

@ -27,5 +27,6 @@ public class SysLevelConfig {
private String createTime; private String createTime;
private String updateTime; private String updateTime;
private Integer level;
} }

View File

@ -3,6 +3,7 @@ package com.bonus.waterdesign.mapper;
import com.bonus.waterdesign.domain.CadData; import com.bonus.waterdesign.domain.CadData;
import com.bonus.waterdesign.domain.Project; import com.bonus.waterdesign.domain.Project;
import com.bonus.waterdesign.domain.ProjectSelect;
import com.bonus.waterdesign.domain.ProjectUser; import com.bonus.waterdesign.domain.ProjectUser;
import java.util.List; import java.util.List;
@ -89,4 +90,6 @@ public interface ProjectMapper
List<ProjectUser> selectProjectUserList(ProjectUser projectUser); List<ProjectUser> selectProjectUserList(ProjectUser projectUser);
void insertCadData(CadData data); void insertCadData(CadData data);
List<ProjectSelect> selectProjectList1(ProjectSelect projectSelect);
} }

View File

@ -3,6 +3,7 @@ package com.bonus.waterdesign.service;
import com.bonus.waterdesign.domain.CadData; import com.bonus.waterdesign.domain.CadData;
import com.bonus.waterdesign.domain.Project; import com.bonus.waterdesign.domain.Project;
import com.bonus.waterdesign.domain.ProjectSelect;
import com.bonus.waterdesign.domain.ProjectUser; import com.bonus.waterdesign.domain.ProjectUser;
import java.util.List; import java.util.List;
@ -89,4 +90,6 @@ public interface ProjectService
List<ProjectUser> projectUserList(ProjectUser projectUser); List<ProjectUser> projectUserList(ProjectUser projectUser);
void insertCadData(List<CadData> cadData); void insertCadData(List<CadData> cadData);
List<ProjectSelect> selectProjectList1(ProjectSelect projectSelect);
} }

View File

@ -19,13 +19,17 @@ public class ILevelConfigServiceImpl implements ILevelConfigService {
@Resource @Resource
private SysLevelConfigMapper configMapper; private SysLevelConfigMapper configMapper;
@Override @Override
public int addConfigWithNodes(SysLevelConfig config) { public int addConfigWithNodes(SysLevelConfig config) {
List<SysLevelNode> nodes = config.getNodes();
if (nodes != null && !nodes.isEmpty()) {
// 插入配置 // 插入配置
config.setLevel(nodes.size());
configMapper.insert(config); configMapper.insert(config);
}
// 处理节点层级关系 // 处理节点层级关系
List<SysLevelNode> nodes = config.getNodes();
if (nodes != null && !nodes.isEmpty()) { if (nodes != null && !nodes.isEmpty()) {
Long parentId = 0L; Long parentId = 0L;
int orderNum = 1; int orderNum = 1;

View File

@ -2,10 +2,7 @@ package com.bonus.waterdesign.service.impl;
import com.bonus.common.constant.UserConstants; import com.bonus.common.constant.UserConstants;
import com.bonus.common.utils.StringUtils; import com.bonus.common.utils.StringUtils;
import com.bonus.waterdesign.domain.CadData; import com.bonus.waterdesign.domain.*;
import com.bonus.waterdesign.domain.ClassifiedOrganization;
import com.bonus.waterdesign.domain.Project;
import com.bonus.waterdesign.domain.ProjectUser;
import com.bonus.waterdesign.mapper.ProjectMapper; import com.bonus.waterdesign.mapper.ProjectMapper;
import com.bonus.waterdesign.service.ClassifiedOrganizationService; import com.bonus.waterdesign.service.ClassifiedOrganizationService;
import com.bonus.waterdesign.service.ProjectService; import com.bonus.waterdesign.service.ProjectService;
@ -21,8 +18,7 @@ import java.util.List;
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
public class ProjectServiceImpl implements ProjectService public class ProjectServiceImpl implements ProjectService {
{
@Resource @Resource
private ProjectMapper projectMapper; private ProjectMapper projectMapper;
@ -36,12 +32,11 @@ public class ProjectServiceImpl implements ProjectService
* @return 项目信息集合 * @return 项目信息集合
*/ */
@Override @Override
public List<Project> selectProjectList(Project project) public List<Project> selectProjectList(Project project) {
{ List<Project> projectList = projectMapper.selectProjectList(project);
List<Project> projectList =projectMapper.selectProjectList(project);
//获取团队信息 //获取团队信息
if (projectList.size()>0){ if (projectList.size() > 0) {
for (Project projectNew:projectList) { for (Project projectNew : projectList) {
ProjectUser projectUser = new ProjectUser(); ProjectUser projectUser = new ProjectUser();
projectUser.setProjectId(projectNew.getProId().intValue()); projectUser.setProjectId(projectNew.getProId().intValue());
List<ProjectUser> projectUserList = projectMapper.selectProjectUserList(projectUser); List<ProjectUser> projectUserList = projectMapper.selectProjectUserList(projectUser);
@ -58,8 +53,7 @@ public class ProjectServiceImpl implements ProjectService
* @return 角色对象信息 * @return 角色对象信息
*/ */
@Override @Override
public Project selectProjectById(Long proId) public Project selectProjectById(Long proId) {
{
return projectMapper.selectProjectById(proId); return projectMapper.selectProjectById(proId);
} }
@ -70,12 +64,10 @@ public class ProjectServiceImpl implements ProjectService
* @return 结果 * @return 结果
*/ */
@Override @Override
public boolean checkProjectNameUnique(Project project) public boolean checkProjectNameUnique(Project project) {
{
Long proId = StringUtils.isNull(project.getProId()) ? -1L : project.getProId(); Long proId = StringUtils.isNull(project.getProId()) ? -1L : project.getProId();
Project info = projectMapper.checkProjectNameUnique(project.getProName()); 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.NOT_UNIQUE;
} }
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
@ -88,8 +80,7 @@ public class ProjectServiceImpl implements ProjectService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteProjectById(Long proId) public int deleteProjectById(Long proId) {
{
return projectMapper.deleteProjectById(proId); return projectMapper.deleteProjectById(proId);
} }
@ -100,8 +91,7 @@ public class ProjectServiceImpl implements ProjectService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertProject(Project project) public int insertProject(Project project) {
{
projectMapper.insertProject(project); projectMapper.insertProject(project);
//保存到分类组织 //保存到分类组织
ClassifiedOrganization classifiedOrganization = new ClassifiedOrganization(); ClassifiedOrganization classifiedOrganization = new ClassifiedOrganization();
@ -118,21 +108,20 @@ public class ProjectServiceImpl implements ProjectService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateProject(Project project) public int updateProject(Project project) {
{
return projectMapper.updateProject(project); return projectMapper.updateProject(project);
} }
/** /**
* 校验人员是否绑定 * 校验人员是否绑定
*
* @param projectUser * @param projectUser
* @return * @return
*/ */
@Override @Override
public boolean checkProjectUserUnique(ProjectUser projectUser) { public boolean checkProjectUserUnique(ProjectUser projectUser) {
ProjectUser projectUserOld = projectMapper.checkProjectUserUnique(projectUser.getUserId()); ProjectUser projectUserOld = projectMapper.checkProjectUserUnique(projectUser.getUserId());
if (StringUtils.isNotNull(projectUserOld) ) if (StringUtils.isNotNull(projectUserOld)) {
{
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
} }
return UserConstants.NOT_UNIQUE; return UserConstants.NOT_UNIQUE;
@ -140,6 +129,7 @@ public class ProjectServiceImpl implements ProjectService
/** /**
* 新增项目团队人员 * 新增项目团队人员
*
* @param projectUser * @param projectUser
* @return * @return
*/ */
@ -150,6 +140,7 @@ public class ProjectServiceImpl implements ProjectService
/** /**
* 删除项目团队人员 * 删除项目团队人员
*
* @param projectUser * @param projectUser
* @return * @return
*/ */
@ -175,4 +166,10 @@ public class ProjectServiceImpl implements ProjectService
projectMapper.insertCadData(data); projectMapper.insertCadData(data);
} }
} }
@Override
public List<ProjectSelect> selectProjectList1(ProjectSelect projectSelect) {
List<ProjectSelect> projectList = projectMapper.selectProjectList1(projectSelect);
return projectList;
}
} }

View File

@ -14,8 +14,7 @@ import java.util.List;
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
public class SurveyServiceImpl implements SurveyService public class SurveyServiceImpl implements SurveyService {
{
@Autowired @Autowired
private SurveyMapper surveyMapper; private SurveyMapper surveyMapper;
@ -26,8 +25,7 @@ public class SurveyServiceImpl implements SurveyService
* @return 勘察信息集合 * @return 勘察信息集合
*/ */
@Override @Override
public List<Survey> selectSurveyList(Survey survey) public List<Survey> selectSurveyList(Survey survey) {
{
return surveyMapper.selectSurveyList(survey); return surveyMapper.selectSurveyList(survey);
} }
@ -38,8 +36,7 @@ public class SurveyServiceImpl implements SurveyService
* @return 角色对象信息 * @return 角色对象信息
*/ */
@Override @Override
public Survey selectSurveyById(Long id) public Survey selectSurveyById(Long id) {
{
return surveyMapper.selectSurveyById(id); return surveyMapper.selectSurveyById(id);
} }
@ -51,8 +48,7 @@ public class SurveyServiceImpl implements SurveyService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSurveyById(Long id) public int deleteSurveyById(Long id) {
{
return surveyMapper.deleteSurveyById(id); return surveyMapper.deleteSurveyById(id);
} }
@ -63,8 +59,7 @@ public class SurveyServiceImpl implements SurveyService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertSurvey(Survey survey) public int insertSurvey(Survey survey) {
{
return surveyMapper.insertSurvey(survey); return surveyMapper.insertSurvey(survey);
} }
@ -75,13 +70,12 @@ public class SurveyServiceImpl implements SurveyService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateSurvey(Survey survey) public int updateSurvey(Survey survey) {
{
return surveyMapper.updateSurvey(survey); return surveyMapper.updateSurvey(survey);
} }
@Override @Override
public List<Survey> selectProjectList(){ public List<Survey> selectProjectList() {
return surveyMapper.selectProjectList(); return surveyMapper.selectProjectList();
} }
} }

View File

@ -62,10 +62,12 @@
INSERT INTO sys_level_config ( INSERT INTO sys_level_config (
<if test="configName != null and configName != ''">config_name,</if> <if test="configName != null and configName != ''">config_name,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="level != null">level,</if>
create_time create_time
) VALUES ( ) VALUES (
<if test="configName != null and configName != ''">#{configName},</if> <if test="configName != null and configName != ''">#{configName},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="level != null">#{level},</if>
sysdate() sysdate()
) )
</insert> </insert>

View File

@ -134,8 +134,8 @@
) m ON m.project_id = n.id ) m ON m.project_id = n.id
WHERE p.del_flag = '0' WHERE p.del_flag = '0'
<if test="proName != null and proName != ''"> <if test="projectId != null and projectId != ''">
AND p.pro_name like concat('%',#{proName},'%') AND p.id = #{projectId}
</if> </if>
</select> </select>
<select id="openView" resultType="com.bonus.waterdesign.domain.CadData"> <select id="openView" resultType="com.bonus.waterdesign.domain.CadData">

View File

@ -87,6 +87,19 @@
</if> </if>
</where> </where>
</select> </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 id="updateProject" parameterType="Project">
update tb_project update tb_project

View File

@ -17,10 +17,19 @@
<result property="updateBy" column="update_user" /> <result property="updateBy" column="update_user" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="modelId" column="model_id" />
<result property="surveyResult" column="survey_result" />
</resultMap> </resultMap>
<sql id="selectSurvey"> <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 from tb_survey_info tsi
left join tb_project tp on tp.id=tsi.pro_id left join tb_project tp on tp.id=tsi.pro_id
where tsi.del_flag = '0' where tsi.del_flag = '0'
@ -40,7 +49,14 @@
</select> </select>
<select id="selectSurveyById" parameterType="Long" resultMap="SurveyResult"> <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 from tb_survey_info tsi
left join tb_project tp on tp.id=tsi.pro_id left join tb_project tp on tp.id=tsi.pro_id
where tsi.del_flag = '0' and tsi.id = #{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="surveyContent != null and surveyContent != ''">survey_content = #{surveyContent},</if>
<if test="surveyAttach != null and surveyAttach != ''">survey_attach = #{surveyAttach},</if> <if test="surveyAttach != null and surveyAttach != ''">survey_attach = #{surveyAttach},</if>
<if test="updateBy != null and updateBy != ''">update_user = #{updateBy},</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() update_time = sysdate()
</set> </set>
where id = #{id} where id = #{id}
@ -68,6 +86,8 @@
<if test="surveyContent != null and surveyContent != ''">survey_content,</if> <if test="surveyContent != null and surveyContent != ''">survey_content,</if>
<if test="surveyAttach != null and surveyAttach != ''">survey_attach,</if> <if test="surveyAttach != null and surveyAttach != ''">survey_attach,</if>
<if test="createBy != null and createBy != ''">create_user,</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 create_time
)values( )values(
<if test="proId != null and proId != 0">#{proId},</if> <if test="proId != null and proId != 0">#{proId},</if>
@ -76,6 +96,8 @@
<if test="surveyContent != null and surveyContent != ''">#{surveyContent},</if> <if test="surveyContent != null and surveyContent != ''">#{surveyContent},</if>
<if test="surveyAttach != null and surveyAttach != ''">#{surveyAttach},</if> <if test="surveyAttach != null and surveyAttach != ''">#{surveyAttach},</if>
<if test="createBy != null and createBy != ''">#{createBy},</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() sysdate()
) )
</insert> </insert>