11
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -30,6 +30,7 @@ | |||||||
|         <poi.version>3.17</poi.version> |         <poi.version>3.17</poi.version> | ||||||
|         <velocity.version>1.7</velocity.version> |         <velocity.version>1.7</velocity.version> | ||||||
|         <jwt.version>0.9.1</jwt.version> |         <jwt.version>0.9.1</jwt.version> | ||||||
|  |         <aliyun-oss.version>3.8.0</aliyun-oss.version> | ||||||
|     </properties> |     </properties> | ||||||
|  |  | ||||||
|     <!-- 依赖声明 --> |     <!-- 依赖声明 --> | ||||||
| @@ -187,10 +188,18 @@ | |||||||
|                 <artifactId>stdiet-common</artifactId> |                 <artifactId>stdiet-common</artifactId> | ||||||
|                 <version>${stdiet.version}</version> |                 <version>${stdiet.version}</version> | ||||||
|             </dependency> |             </dependency> | ||||||
|  |  | ||||||
|         </dependencies> |         </dependencies> | ||||||
|     </dependencyManagement> |     </dependencyManagement> | ||||||
|  |  | ||||||
|  |     <dependencies> | ||||||
|  |         <!-- OSS存储--> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.aliyun.oss</groupId> | ||||||
|  |             <artifactId>aliyun-sdk-oss</artifactId> | ||||||
|  |             <version>${aliyun-oss.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |     </dependencies> | ||||||
|  |  | ||||||
|     <modules> |     <modules> | ||||||
|         <module>stdiet-admin</module> |         <module>stdiet-admin</module> | ||||||
|         <module>stdiet-framework</module> |         <module>stdiet-framework</module> | ||||||
|   | |||||||
| @@ -0,0 +1,27 @@ | |||||||
|  | package com.stdiet.web.controller; | ||||||
|  |  | ||||||
|  | import com.stdiet.common.config.AliyunOSSConfig; | ||||||
|  | import com.stdiet.common.utils.oss.AliyunOSSUtils; | ||||||
|  | import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper; | ||||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||||
|  | import org.springframework.boot.ApplicationArguments; | ||||||
|  | import org.springframework.boot.ApplicationRunner; | ||||||
|  | import org.springframework.core.annotation.Order; | ||||||
|  | import org.springframework.stereotype.Component; | ||||||
|  |  | ||||||
|  | import java.io.File; | ||||||
|  |  | ||||||
|  | @Component | ||||||
|  | @Order(value = 1) | ||||||
|  | public class MyApplicationRunner implements ApplicationRunner { | ||||||
|  |  | ||||||
|  |     @Autowired | ||||||
|  |     private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper; | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public void run(ApplicationArguments args) throws Exception { | ||||||
|  |         System.out.println("项目启动调用方法"); | ||||||
|  |         String path = AliyunOSSUtils.uploadFileInputSteam(AliyunOSSConfig.casePrefix,"ceshi.png",new File("D:\\ceshi.png")); | ||||||
|  |         System.out.println(path); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,103 @@ | |||||||
|  | package com.stdiet.web.controller.custom; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  | import org.springframework.security.access.prepost.PreAuthorize; | ||||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||||
|  | import org.springframework.web.bind.annotation.GetMapping; | ||||||
|  | import org.springframework.web.bind.annotation.PostMapping; | ||||||
|  | import org.springframework.web.bind.annotation.PutMapping; | ||||||
|  | import org.springframework.web.bind.annotation.DeleteMapping; | ||||||
|  | import org.springframework.web.bind.annotation.PathVariable; | ||||||
|  | import org.springframework.web.bind.annotation.RequestBody; | ||||||
|  | import org.springframework.web.bind.annotation.RequestMapping; | ||||||
|  | import org.springframework.web.bind.annotation.RestController; | ||||||
|  | import com.stdiet.common.annotation.Log; | ||||||
|  | import com.stdiet.common.core.controller.BaseController; | ||||||
|  | import com.stdiet.common.core.domain.AjaxResult; | ||||||
|  | import com.stdiet.common.enums.BusinessType; | ||||||
|  | import com.stdiet.custom.domain.SysCustomerCase; | ||||||
|  | import com.stdiet.custom.service.ISysCustomerCaseService; | ||||||
|  | import com.stdiet.common.utils.poi.ExcelUtil; | ||||||
|  | import com.stdiet.common.core.page.TableDataInfo; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 客户案例管理Controller | ||||||
|  |  * | ||||||
|  |  * @author xiezhijun | ||||||
|  |  * @date 2021-03-04 | ||||||
|  |  */ | ||||||
|  | @RestController | ||||||
|  | @RequestMapping("/custom/customerCase") | ||||||
|  | public class SysCustomerCaseController extends BaseController | ||||||
|  | { | ||||||
|  |     @Autowired | ||||||
|  |     private ISysCustomerCaseService sysCustomerCaseService; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询客户案例管理列表 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:customerCase:list')") | ||||||
|  |     @GetMapping("/list") | ||||||
|  |     public TableDataInfo list(SysCustomerCase sysCustomerCase) | ||||||
|  |     { | ||||||
|  |         startPage(); | ||||||
|  |         List<SysCustomerCase> list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase); | ||||||
|  |         return getDataTable(list); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 导出客户案例管理列表 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:customerCase:export')") | ||||||
|  |     @Log(title = "客户案例管理", businessType = BusinessType.EXPORT) | ||||||
|  |     @GetMapping("/export") | ||||||
|  |     public AjaxResult export(SysCustomerCase sysCustomerCase) | ||||||
|  |     { | ||||||
|  |         List<SysCustomerCase> list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase); | ||||||
|  |         ExcelUtil<SysCustomerCase> util = new ExcelUtil<SysCustomerCase>(SysCustomerCase.class); | ||||||
|  |         return util.exportExcel(list, "customerCase"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取客户案例管理详细信息 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:customerCase:query')") | ||||||
|  |     @GetMapping(value = "/{id}") | ||||||
|  |     public AjaxResult getInfo(@PathVariable("id") Long id) | ||||||
|  |     { | ||||||
|  |         return AjaxResult.success(sysCustomerCaseService.selectSysCustomerCaseById(id)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增客户案例管理 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:customerCase:add')") | ||||||
|  |     @Log(title = "客户案例管理", businessType = BusinessType.INSERT) | ||||||
|  |     @PostMapping | ||||||
|  |     public AjaxResult add(@RequestBody SysCustomerCase sysCustomerCase) | ||||||
|  |     { | ||||||
|  |         return toAjax(sysCustomerCaseService.insertSysCustomerCase(sysCustomerCase)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改客户案例管理 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:customerCase:edit')") | ||||||
|  |     @Log(title = "客户案例管理", businessType = BusinessType.UPDATE) | ||||||
|  |     @PutMapping | ||||||
|  |     public AjaxResult edit(@RequestBody SysCustomerCase sysCustomerCase) | ||||||
|  |     { | ||||||
|  |         return toAjax(sysCustomerCaseService.updateSysCustomerCase(sysCustomerCase)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除客户案例管理 | ||||||
|  |      */ | ||||||
|  |     @PreAuthorize("@ss.hasPermi('custom:customerCase:remove')") | ||||||
|  |     @Log(title = "客户案例管理", businessType = BusinessType.DELETE) | ||||||
|  |     @DeleteMapping("/{ids}") | ||||||
|  |     public AjaxResult remove(@PathVariable Long[] ids) | ||||||
|  |     { | ||||||
|  |         return toAjax(sysCustomerCaseService.deleteSysCustomerCaseByIds(ids)); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -76,7 +76,7 @@ public class SysOrderPauseController extends BaseController | |||||||
|     @PostMapping |     @PostMapping | ||||||
|     public AjaxResult add(@RequestBody SysOrderPause sysOrderPause) |     public AjaxResult add(@RequestBody SysOrderPause sysOrderPause) | ||||||
|     { |     { | ||||||
|         int count = sysOrderPauseService.getCountByOrderIdAndPauseDate(sysOrderPause); |         int count = sysOrderPauseService.getCountByCusIdAndPauseDate(sysOrderPause); | ||||||
|         if(count > 0){ |         if(count > 0){ | ||||||
|             return AjaxResult.error("时间范围重叠,请检查时间"); |             return AjaxResult.error("时间范围重叠,请检查时间"); | ||||||
|         } |         } | ||||||
| @@ -96,7 +96,7 @@ public class SysOrderPauseController extends BaseController | |||||||
|     @PutMapping |     @PutMapping | ||||||
|     public AjaxResult edit(@RequestBody SysOrderPause sysOrderPause) |     public AjaxResult edit(@RequestBody SysOrderPause sysOrderPause) | ||||||
|     { |     { | ||||||
|         int count = sysOrderPauseService.getCountByOrderIdAndPauseDate(sysOrderPause); |         int count = sysOrderPauseService.getCountByCusIdAndPauseDate(sysOrderPause); | ||||||
|         if(count > 0){ |         if(count > 0){ | ||||||
|             return AjaxResult.error("时间范围重叠,请检查时间"); |             return AjaxResult.error("时间范围重叠,请检查时间"); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -0,0 +1,43 @@ | |||||||
|  | package com.stdiet.common.config; | ||||||
|  |  | ||||||
|  | import org.springframework.beans.factory.annotation.Value; | ||||||
|  | import org.springframework.stereotype.Component; | ||||||
|  |  | ||||||
|  | @Component | ||||||
|  | public class AliyunOSSConfig { | ||||||
|  |  | ||||||
|  |     public static String AccessKeyID; | ||||||
|  |  | ||||||
|  |     public static String AccessKeySecret; | ||||||
|  |  | ||||||
|  |     public static String Buckets; | ||||||
|  |  | ||||||
|  |     public static String EndPoint; | ||||||
|  |  | ||||||
|  |     public static String casePrefix; | ||||||
|  |  | ||||||
|  |     @Value("${aliyun.oss.AccessKeyID}") | ||||||
|  |     public void setAccessKeyID(String AccessKeyID){ | ||||||
|  |         AliyunOSSConfig.AccessKeyID = AccessKeyID; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Value("${aliyun.oss.AccessKeySecret}") | ||||||
|  |     public void setAccessKeySecret(String AccessKeySecret){ | ||||||
|  |         AliyunOSSConfig.AccessKeySecret = AccessKeySecret; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Value("${aliyun.oss.Buckets}") | ||||||
|  |     public void setBuckets(String Buckets){ | ||||||
|  |         AliyunOSSConfig.Buckets = Buckets; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Value("${aliyun.oss.EndPoint}") | ||||||
|  |     public void setEndPoint(String EndPoint){ | ||||||
|  |         AliyunOSSConfig.EndPoint = EndPoint; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @Value("${aliyun.oss.casePrefix}") | ||||||
|  |     public void setCasePrefix(String casePrefix){ | ||||||
|  |         AliyunOSSConfig.casePrefix = casePrefix; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,293 @@ | |||||||
|  | package com.stdiet.common.utils.oss; | ||||||
|  |  | ||||||
|  | import com.aliyun.oss.model.GetObjectRequest; | ||||||
|  | import com.aliyun.oss.model.OSSObject; | ||||||
|  | import com.stdiet.common.config.AliyunOSSConfig; | ||||||
|  | import org.springframework.web.multipart.MultipartFile; | ||||||
|  |  | ||||||
|  | import com.aliyun.oss.OSS; | ||||||
|  | import com.aliyun.oss.OSSClientBuilder; | ||||||
|  | import java.io.File; | ||||||
|  | import java.io.FileInputStream; | ||||||
|  | import java.io.IOException; | ||||||
|  | import java.io.InputStream; | ||||||
|  | import java.util.UUID; | ||||||
|  |  | ||||||
|  | public class AliyunOSSUtils { | ||||||
|  |  | ||||||
|  |     // 创建OSSClient实例 | ||||||
|  |     private static OSS ossClient = null; | ||||||
|  |  | ||||||
|  |     public static OSS getOssClient() { | ||||||
|  |         if (ossClient == null) { | ||||||
|  |             synchronized (OSS.class) { | ||||||
|  |                 if (ossClient == null) { | ||||||
|  |                     ossClient = new OSSClientBuilder().build(AliyunOSSConfig.EndPoint, AliyunOSSConfig.AccessKeyID, AliyunOSSConfig.AccessKeySecret); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return ossClient; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取图片的URL头信息 | ||||||
|  |      * | ||||||
|  |      * @return 返回url头信息 | ||||||
|  |      */ | ||||||
|  |     private static String getURLHead() { | ||||||
|  |         //从哪个位置截取 | ||||||
|  |         int cutPoint = AliyunOSSConfig.EndPoint.lastIndexOf('/') + 1; | ||||||
|  |         //http头 | ||||||
|  |         String head = AliyunOSSConfig.EndPoint.substring(0, cutPoint); | ||||||
|  |         //服务器地址信息 | ||||||
|  |         String tail = AliyunOSSConfig.EndPoint.substring(cutPoint); | ||||||
|  |         //返回结果 | ||||||
|  |         return head + AliyunOSSConfig.Buckets + "." + tail + "/"; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取存储在服务器上的地址 | ||||||
|  |      * | ||||||
|  |      * @param oranName 文件名 | ||||||
|  |      * @return 文件URL | ||||||
|  |      */ | ||||||
|  |     private static String getRealName(String oranName) { | ||||||
|  |         return getURLHead() + oranName; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取一个随机的文件名 | ||||||
|  |      * | ||||||
|  |      * @param oranName 初始的文件名 | ||||||
|  |      * @return 返回加uuid后的文件名 | ||||||
|  |      */ | ||||||
|  |     private static String getRandomImageName(String prefix, String oranName) { | ||||||
|  |         //获取一个uuid 去掉- | ||||||
|  |         String uuid = UUID.randomUUID().toString().replace("-", ""); | ||||||
|  |         //查一下是否带路径 | ||||||
|  |         int cutPoint = oranName.lastIndexOf("/") + 1; | ||||||
|  |         //如果存在路径 | ||||||
|  |         if (cutPoint != 0) { | ||||||
|  |             //掐头 如果开头是/ 则去掉 | ||||||
|  |             String head = oranName.indexOf("/") == 0 ? oranName.substring(1, cutPoint) : oranName.substring(0, cutPoint); | ||||||
|  |             //去尾 | ||||||
|  |             String tail = oranName.substring(cutPoint); | ||||||
|  |             //返回正确的带路径的图片名称 | ||||||
|  |             return prefix + head + uuid + tail; | ||||||
|  |         } | ||||||
|  |         //不存在 直接返回 | ||||||
|  |         return prefix + uuid + oranName; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * MultipartFile2File | ||||||
|  |      * @param multipartFile | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     private static File transferToFile(MultipartFile multipartFile) { | ||||||
|  |         //选择用缓冲区来实现这个转换即使用java 创建的临时文件 使用 MultipartFile.transferto()方法 。 | ||||||
|  |         File file = null; | ||||||
|  |         try { | ||||||
|  |             //获取文件名 | ||||||
|  |             String originalFilename = multipartFile.getOriginalFilename(); | ||||||
|  |             //获取最后一个"."的位置 | ||||||
|  |             int cutPoint = originalFilename.lastIndexOf("."); | ||||||
|  |             //获取文件名 | ||||||
|  |             String prefix = originalFilename.substring(0,cutPoint); | ||||||
|  |             //获取后缀名 | ||||||
|  |             String suffix = originalFilename.substring(cutPoint + 1); | ||||||
|  |             //创建临时文件 | ||||||
|  |             file = File.createTempFile(prefix, suffix); | ||||||
|  |             //multipartFile2file | ||||||
|  |             multipartFile.transferTo(file); | ||||||
|  |             //删除临时文件 | ||||||
|  |             file.deleteOnExit(); | ||||||
|  |         } catch (IOException e) { | ||||||
|  |             e.printStackTrace(); | ||||||
|  |         } | ||||||
|  |         return file; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 通过文件URL反向解析文件名 | ||||||
|  |      * | ||||||
|  |      * @param fileURL 文件URL | ||||||
|  |      * @return 原文件名 | ||||||
|  |      */ | ||||||
|  |     private static String getObjectName(String fileURL) { | ||||||
|  |         return fileURL.substring(getURLHead().length()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 上传文件流 | ||||||
|  |      * @param prefix 路径的前缀路径目录 | ||||||
|  |      * @param oranFileName 上传到服务器上的文件路径和名称 | ||||||
|  |      * @param file         来自本地的文件或者文件流 | ||||||
|  |      */ | ||||||
|  |     public static String uploadFileInputSteam(String prefix, String oranFileName, MultipartFile file) { | ||||||
|  |  | ||||||
|  |         // <yourObjectName>上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg | ||||||
|  |         String objectName = getRandomImageName(prefix, oranFileName); | ||||||
|  |  | ||||||
|  |         // 创建OSSClient实例。 | ||||||
|  |         OSS ossClient = getOssClient(); | ||||||
|  |  | ||||||
|  |         // 上传文件流 | ||||||
|  |         try (InputStream inputStream = new FileInputStream(transferToFile(file))) { | ||||||
|  |             //上传到OSS | ||||||
|  |             ossClient.putObject(AliyunOSSConfig.Buckets, objectName, inputStream); | ||||||
|  |         } catch (Exception ex) { | ||||||
|  |             ex.printStackTrace(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // 关闭OSSClient。 | ||||||
|  |         ossClient.shutdown(); | ||||||
|  |  | ||||||
|  |         //返回文件在服务器上的全路径+名称 | ||||||
|  |         return getRealName(objectName); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 上传文件流 | ||||||
|  |      * @param prefix 路径的前缀路径目录 | ||||||
|  |      * @param oranFileName 上传到服务器上的文件路径和名称 | ||||||
|  |      * @param file         来自本地的文件或者文件流 | ||||||
|  |      */ | ||||||
|  |     public static String uploadFileInputSteam(String prefix, String oranFileName, File file) { | ||||||
|  |  | ||||||
|  |         // <yourObjectName>上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg | ||||||
|  |         String objectName = getRandomImageName(prefix, oranFileName); | ||||||
|  |  | ||||||
|  |         // 创建OSSClient实例。 | ||||||
|  |         OSS ossClient = getOssClient(); | ||||||
|  |  | ||||||
|  |         // 上传文件流。 | ||||||
|  |         try (InputStream inputStream = new FileInputStream(file);) { | ||||||
|  |             //上传到OSS | ||||||
|  |             ossClient.putObject(AliyunOSSConfig.Buckets, objectName, inputStream); | ||||||
|  |         } catch (Exception ex) { | ||||||
|  |             ex.printStackTrace(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // 关闭OSSClient。 | ||||||
|  |         ossClient.shutdown(); | ||||||
|  |  | ||||||
|  |         //返回文件在服务器上的全路径+名称 | ||||||
|  |         return getRealName(objectName); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 从OSS中下载一个文件 | ||||||
|  |      * | ||||||
|  |      * @param fileURL       文件的url | ||||||
|  |      * @param localFileName 下载到本地的文件名称 | ||||||
|  |      */ | ||||||
|  |     public static void downloadFileToLoacal(String fileURL, String localFileName) { | ||||||
|  |  | ||||||
|  |         //将url解析成objectName | ||||||
|  |         String objectName = getObjectName(fileURL); | ||||||
|  |  | ||||||
|  |         // 创建OSSClient实例。 | ||||||
|  |         OSS ossClient = getOssClient(); | ||||||
|  |  | ||||||
|  |         // 下载OSS文件到本地文件。如果指定的本地文件存在会覆盖,不存在则新建。 | ||||||
|  |         ossClient.getObject(new GetObjectRequest(AliyunOSSConfig.Buckets, objectName), new File(localFileName)); | ||||||
|  |  | ||||||
|  |         // 关闭OSSClient。 | ||||||
|  |         ossClient.shutdown(); | ||||||
|  |  | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 从OSS中下载一个文件流 | ||||||
|  |      * | ||||||
|  |      * @param fileURL       文件的url | ||||||
|  |      */ | ||||||
|  |     public InputStream downloadFile(String fileURL) throws IOException { | ||||||
|  |  | ||||||
|  |         //将url解析成objectName | ||||||
|  |         String objectName = getObjectName(fileURL); | ||||||
|  |  | ||||||
|  |         // 创建OSSClient实例。 | ||||||
|  |         OSS ossClient = getOssClient(); | ||||||
|  |  | ||||||
|  |         OSSObject ossObject = ossClient.getObject(AliyunOSSConfig.Buckets, objectName); | ||||||
|  |  | ||||||
|  |         //获取流 | ||||||
|  |         InputStream streamData = ossObject.getObjectContent(); | ||||||
|  |  | ||||||
|  |         // 关闭OSSClient。 | ||||||
|  |         ossClient.shutdown(); | ||||||
|  |  | ||||||
|  |         return streamData; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除指定路径下的一个文件 | ||||||
|  |      * | ||||||
|  |      * @param fileURL 文件的全称 | ||||||
|  |      */ | ||||||
|  |     public static void deleteFile(String fileURL) { | ||||||
|  |  | ||||||
|  |         // 反向解析文件名 | ||||||
|  |         String objectName = getObjectName(fileURL); | ||||||
|  |  | ||||||
|  |         // 创建OSSClient实例。 | ||||||
|  |         OSS ossClient = getOssClient(); | ||||||
|  |  | ||||||
|  |         // 删除文件。如需删除文件夹,请将ObjectName设置为对应的文件夹名称。如果文件夹非空,则需要将文件夹下的所有object删除后才能删除该文件夹。 | ||||||
|  |         ossClient.deleteObject(AliyunOSSConfig.Buckets, objectName); | ||||||
|  |  | ||||||
|  |         //删除成功 打印文件存储地址 | ||||||
|  |         printDeleteSuccessInfo(fileURL); | ||||||
|  |  | ||||||
|  |         // 关闭OSSClient。 | ||||||
|  |         ossClient.shutdown(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 打印文件的存储地址 | ||||||
|  |      * | ||||||
|  |      * @param fileURL 文件URL | ||||||
|  |      */ | ||||||
|  |     private static void printUploadSuccessInfo(String fileURL) { | ||||||
|  |         //上传成功 | ||||||
|  |         System.out.println("upload success, path = " + getRealName(fileURL)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 打印文件的存储地址 | ||||||
|  |      * | ||||||
|  |      * @param fileURL 文件URL | ||||||
|  |      */ | ||||||
|  |     private static void printDeleteSuccessInfo(String fileURL) { | ||||||
|  |         //上传成功 | ||||||
|  |         System.out.println("delete success, path = " + getRealName(fileURL)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 通过文件的URL 判断文件是否存在 | ||||||
|  |      * | ||||||
|  |      * @param fileURL 文件的URL | ||||||
|  |      * @return 文件是否存在 | ||||||
|  |      */ | ||||||
|  |     public static boolean exists(String fileURL) { | ||||||
|  |  | ||||||
|  |         // 反向解析文件名 | ||||||
|  |         String objectName = getObjectName(fileURL); | ||||||
|  |  | ||||||
|  |         // 创建OSSClient实例。 | ||||||
|  |         OSS ossClient = getOssClient(); | ||||||
|  |  | ||||||
|  |         // 判断文件是否存在。doesObjectExist还有一个参数isOnlyInOSS,如果为true则忽略302重定向或镜像;如果为false,则考虑302重定向或镜像。 | ||||||
|  |         boolean found = ossClient.doesObjectExist(AliyunOSSConfig.Buckets, objectName); | ||||||
|  |  | ||||||
|  |         // 关闭OSSClient。 | ||||||
|  |         ossClient.shutdown(); | ||||||
|  |  | ||||||
|  |         //  返回是否存在 | ||||||
|  |         return found; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -0,0 +1,35 @@ | |||||||
|  | package com.stdiet.custom.domain; | ||||||
|  |  | ||||||
|  | import com.stdiet.common.annotation.Excel; | ||||||
|  | import com.stdiet.common.core.domain.BaseEntity; | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 客户案例管理对象 sys_customer_case | ||||||
|  |  * | ||||||
|  |  * @author xiezhijun | ||||||
|  |  * @date 2021-03-04 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | public class SysCustomerCase extends BaseEntity | ||||||
|  | { | ||||||
|  |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
|  |     /** $column.columnComment */ | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** 案例名称 */ | ||||||
|  |     @Excel(name = "案例名称") | ||||||
|  |     private String name; | ||||||
|  |  | ||||||
|  |     /** 案例关键词 */ | ||||||
|  |     @Excel(name = "案例关键词") | ||||||
|  |     private String keyword; | ||||||
|  |  | ||||||
|  |     /** 案例所属客户ID */ | ||||||
|  |     @Excel(name = "案例所属客户ID") | ||||||
|  |     private Long customerId; | ||||||
|  |  | ||||||
|  |     /** 删除标识 0未删除 1已删除,默认0 */ | ||||||
|  |     private Long delFlag; | ||||||
|  | } | ||||||
| @@ -0,0 +1,35 @@ | |||||||
|  | package com.stdiet.custom.domain; | ||||||
|  |  | ||||||
|  | import com.stdiet.common.annotation.Excel; | ||||||
|  | import com.stdiet.common.core.domain.BaseEntity; | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 客户案例对应文件管理对象 sys_customer_case_file | ||||||
|  |  * | ||||||
|  |  * @author xiezhijun | ||||||
|  |  * @date 2021-03-04 | ||||||
|  |  */ | ||||||
|  | @Data | ||||||
|  | public class SysCustomerCaseFile extends BaseEntity | ||||||
|  | { | ||||||
|  |     private static final long serialVersionUID = 1L; | ||||||
|  |  | ||||||
|  |     /** $column.columnComment */ | ||||||
|  |     private Long id; | ||||||
|  |  | ||||||
|  |     /** 案例文件 */ | ||||||
|  |     @Excel(name = "案例文件") | ||||||
|  |     private Long caseId; | ||||||
|  |  | ||||||
|  |     /** 文件路径 */ | ||||||
|  |     @Excel(name = "文件路径") | ||||||
|  |     private String fileUrl; | ||||||
|  |  | ||||||
|  |     /** 文件名字 */ | ||||||
|  |     @Excel(name = "文件名字") | ||||||
|  |     private String fileName; | ||||||
|  |  | ||||||
|  |     /** 删除标识 0未删除 1已删除 */ | ||||||
|  |     private Long delFlag; | ||||||
|  | } | ||||||
| @@ -0,0 +1,61 @@ | |||||||
|  | package com.stdiet.custom.mapper; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  | import com.stdiet.custom.domain.SysCustomerCaseFile; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 客户案例对应文件管理Mapper接口 | ||||||
|  |  * | ||||||
|  |  * @author xiezhijun | ||||||
|  |  * @date 2021-03-04 | ||||||
|  |  */ | ||||||
|  | public interface SysCustomerCaseFileMapper | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * 查询客户案例对应文件管理 | ||||||
|  |      * | ||||||
|  |      * @param id 客户案例对应文件管理ID | ||||||
|  |      * @return 客户案例对应文件管理 | ||||||
|  |      */ | ||||||
|  |     public SysCustomerCaseFile selectSysCustomerCaseFileById(Long id); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询客户案例对应文件管理列表 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCaseFile 客户案例对应文件管理 | ||||||
|  |      * @return 客户案例对应文件管理集合 | ||||||
|  |      */ | ||||||
|  |     public List<SysCustomerCaseFile> selectSysCustomerCaseFileList(SysCustomerCaseFile sysCustomerCaseFile); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增客户案例对应文件管理 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCaseFile 客户案例对应文件管理 | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int insertSysCustomerCaseFile(SysCustomerCaseFile sysCustomerCaseFile); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改客户案例对应文件管理 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCaseFile 客户案例对应文件管理 | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int updateSysCustomerCaseFile(SysCustomerCaseFile sysCustomerCaseFile); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除客户案例对应文件管理 | ||||||
|  |      * | ||||||
|  |      * @param id 客户案例对应文件管理ID | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int deleteSysCustomerCaseFileById(Long id); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 批量删除客户案例对应文件管理 | ||||||
|  |      * | ||||||
|  |      * @param ids 需要删除的数据ID | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int deleteSysCustomerCaseFileByIds(Long[] ids); | ||||||
|  | } | ||||||
| @@ -0,0 +1,61 @@ | |||||||
|  | package com.stdiet.custom.mapper; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  | import com.stdiet.custom.domain.SysCustomerCase; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 客户案例管理Mapper接口 | ||||||
|  |  * | ||||||
|  |  * @author xiezhijun | ||||||
|  |  * @date 2021-03-04 | ||||||
|  |  */ | ||||||
|  | public interface SysCustomerCaseMapper | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * 查询客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param id 客户案例管理ID | ||||||
|  |      * @return 客户案例管理 | ||||||
|  |      */ | ||||||
|  |     public SysCustomerCase selectSysCustomerCaseById(Long id); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询客户案例管理列表 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCase 客户案例管理 | ||||||
|  |      * @return 客户案例管理集合 | ||||||
|  |      */ | ||||||
|  |     public List<SysCustomerCase> selectSysCustomerCaseList(SysCustomerCase sysCustomerCase); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCase 客户案例管理 | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int insertSysCustomerCase(SysCustomerCase sysCustomerCase); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCase 客户案例管理 | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int updateSysCustomerCase(SysCustomerCase sysCustomerCase); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param id 客户案例管理ID | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int deleteSysCustomerCaseById(Long id); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 批量删除客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param ids 需要删除的数据ID | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int deleteSysCustomerCaseByIds(Long[] ids); | ||||||
|  | } | ||||||
| @@ -65,7 +65,7 @@ public interface SysOrderPauseMapper | |||||||
|      * @param sysOrderPause |      * @param sysOrderPause | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     int getCountByOrderIdAndPauseDate(SysOrderPause sysOrderPause); |     int getCountByCusIdAndPauseDate(SysOrderPause sysOrderPause); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据订单ID删除暂停记录 |      * 根据订单ID删除暂停记录 | ||||||
|   | |||||||
| @@ -0,0 +1,61 @@ | |||||||
|  | package com.stdiet.custom.service; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  | import com.stdiet.custom.domain.SysCustomerCase; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 客户案例管理Service接口 | ||||||
|  |  * | ||||||
|  |  * @author xiezhijun | ||||||
|  |  * @date 2021-03-04 | ||||||
|  |  */ | ||||||
|  | public interface ISysCustomerCaseService { | ||||||
|  |     /** | ||||||
|  |      * 查询客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param id 客户案例管理ID | ||||||
|  |      * @return 客户案例管理 | ||||||
|  |      */ | ||||||
|  |     public SysCustomerCase selectSysCustomerCaseById(Long id); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询客户案例管理列表 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCase 客户案例管理 | ||||||
|  |      * @return 客户案例管理集合 | ||||||
|  |      */ | ||||||
|  |     public List<SysCustomerCase> selectSysCustomerCaseList(SysCustomerCase sysCustomerCase); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCase 客户案例管理 | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int insertSysCustomerCase(SysCustomerCase sysCustomerCase); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCase 客户案例管理 | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int updateSysCustomerCase(SysCustomerCase sysCustomerCase); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 批量删除客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param ids 需要删除的客户案例管理ID | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int deleteSysCustomerCaseByIds(Long[] ids); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除客户案例管理信息 | ||||||
|  |      * | ||||||
|  |      * @param id 客户案例管理ID | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     public int deleteSysCustomerCaseById(Long id); | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -64,7 +64,7 @@ public interface ISysOrderPauseService | |||||||
|      * @param sysOrderPause |      * @param sysOrderPause | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     int getCountByOrderIdAndPauseDate(SysOrderPause sysOrderPause); |     int getCountByCusIdAndPauseDate(SysOrderPause sysOrderPause); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 根据订单ID删除暂停记录 |      * 根据订单ID删除暂停记录 | ||||||
|   | |||||||
| @@ -0,0 +1,96 @@ | |||||||
|  | package com.stdiet.custom.service.impl; | ||||||
|  |  | ||||||
|  | import java.util.List; | ||||||
|  | import com.stdiet.common.utils.DateUtils; | ||||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | import com.stdiet.custom.mapper.SysCustomerCaseMapper; | ||||||
|  | import com.stdiet.custom.domain.SysCustomerCase; | ||||||
|  | import com.stdiet.custom.service.ISysCustomerCaseService; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * 客户案例管理Service业务层处理 | ||||||
|  |  * | ||||||
|  |  * @author xiezhijun | ||||||
|  |  * @date 2021-03-04 | ||||||
|  |  */ | ||||||
|  | @Service | ||||||
|  | public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService | ||||||
|  | { | ||||||
|  |     @Autowired | ||||||
|  |     private SysCustomerCaseMapper sysCustomerCaseMapper; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param id 客户案例管理ID | ||||||
|  |      * @return 客户案例管理 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public SysCustomerCase selectSysCustomerCaseById(Long id) | ||||||
|  |     { | ||||||
|  |         return sysCustomerCaseMapper.selectSysCustomerCaseById(id); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询客户案例管理列表 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCase 客户案例管理 | ||||||
|  |      * @return 客户案例管理 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public List<SysCustomerCase> selectSysCustomerCaseList(SysCustomerCase sysCustomerCase) | ||||||
|  |     { | ||||||
|  |         return sysCustomerCaseMapper.selectSysCustomerCaseList(sysCustomerCase); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 新增客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCase 客户案例管理 | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public int insertSysCustomerCase(SysCustomerCase sysCustomerCase) | ||||||
|  |     { | ||||||
|  |         sysCustomerCase.setCreateTime(DateUtils.getNowDate()); | ||||||
|  |         return sysCustomerCaseMapper.insertSysCustomerCase(sysCustomerCase); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 修改客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param sysCustomerCase 客户案例管理 | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public int updateSysCustomerCase(SysCustomerCase sysCustomerCase) | ||||||
|  |     { | ||||||
|  |         sysCustomerCase.setUpdateTime(DateUtils.getNowDate()); | ||||||
|  |         return sysCustomerCaseMapper.updateSysCustomerCase(sysCustomerCase); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 批量删除客户案例管理 | ||||||
|  |      * | ||||||
|  |      * @param ids 需要删除的客户案例管理ID | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public int deleteSysCustomerCaseByIds(Long[] ids) | ||||||
|  |     { | ||||||
|  |         return sysCustomerCaseMapper.deleteSysCustomerCaseByIds(ids); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 删除客户案例管理信息 | ||||||
|  |      * | ||||||
|  |      * @param id 客户案例管理ID | ||||||
|  |      * @return 结果 | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public int deleteSysCustomerCaseById(Long id) | ||||||
|  |     { | ||||||
|  |         return sysCustomerCaseMapper.deleteSysCustomerCaseById(id); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -126,8 +126,8 @@ public class SysOrderPauseServiceImpl implements ISysOrderPauseService | |||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     @Override |     @Override | ||||||
|     public int getCountByOrderIdAndPauseDate(SysOrderPause sysOrderPause){ |     public int getCountByCusIdAndPauseDate(SysOrderPause sysOrderPause){ | ||||||
|         return sysOrderPauseMapper.getCountByOrderIdAndPauseDate(sysOrderPause); |         return sysOrderPauseMapper.getCountByCusIdAndPauseDate(sysOrderPause); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -0,0 +1,84 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8" ?> | ||||||
|  | <!DOCTYPE mapper | ||||||
|  |         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||||
|  |         "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||||
|  | <mapper namespace="com.stdiet.custom.mapper.SysCustomerCaseFileMapper"> | ||||||
|  |  | ||||||
|  |     <resultMap type="SysCustomerCaseFile" id="SysCustomerCaseFileResult"> | ||||||
|  |         <result property="id"    column="id"    /> | ||||||
|  |         <result property="caseId"    column="case_id"    /> | ||||||
|  |         <result property="fileUrl"    column="file_url"    /> | ||||||
|  |         <result property="fileName"    column="file_name"    /> | ||||||
|  |         <result property="createTime"    column="create_time"    /> | ||||||
|  |         <result property="createBy"    column="create_by"    /> | ||||||
|  |         <result property="updateTime"    column="update_time"    /> | ||||||
|  |         <result property="updateBy"    column="update_by"    /> | ||||||
|  |         <result property="delFlag"    column="del_flag"    /> | ||||||
|  |     </resultMap> | ||||||
|  |  | ||||||
|  |     <sql id="selectSysCustomerCaseFileVo"> | ||||||
|  |         select id, case_id, file_url, file_name, create_time, create_by, update_time, update_by, del_flag from sys_customer_case_file | ||||||
|  |     </sql> | ||||||
|  |  | ||||||
|  |     <select id="selectSysCustomerCaseFileList" parameterType="SysCustomerCaseFile" resultMap="SysCustomerCaseFileResult"> | ||||||
|  |         <include refid="selectSysCustomerCaseFileVo"/> | ||||||
|  |         <where> | ||||||
|  |         </where> | ||||||
|  |     </select> | ||||||
|  |  | ||||||
|  |     <select id="selectSysCustomerCaseFileById" parameterType="Long" resultMap="SysCustomerCaseFileResult"> | ||||||
|  |         <include refid="selectSysCustomerCaseFileVo"/> | ||||||
|  |         where id = #{id} | ||||||
|  |     </select> | ||||||
|  |  | ||||||
|  |     <insert id="insertSysCustomerCaseFile" parameterType="SysCustomerCaseFile" useGeneratedKeys="true" keyProperty="id"> | ||||||
|  |         insert into sys_customer_case_file | ||||||
|  |         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||||
|  |             <if test="caseId != null">case_id,</if> | ||||||
|  |             <if test="fileUrl != null">file_url,</if> | ||||||
|  |             <if test="fileName != null">file_name,</if> | ||||||
|  |             <if test="createTime != null">create_time,</if> | ||||||
|  |             <if test="createBy != null">create_by,</if> | ||||||
|  |             <if test="updateTime != null">update_time,</if> | ||||||
|  |             <if test="updateBy != null">update_by,</if> | ||||||
|  |             <if test="delFlag != null">del_flag,</if> | ||||||
|  |         </trim> | ||||||
|  |         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||||
|  |             <if test="caseId != null">#{caseId},</if> | ||||||
|  |             <if test="fileUrl != null">#{fileUrl},</if> | ||||||
|  |             <if test="fileName != null">#{fileName},</if> | ||||||
|  |             <if test="createTime != null">#{createTime},</if> | ||||||
|  |             <if test="createBy != null">#{createBy},</if> | ||||||
|  |             <if test="updateTime != null">#{updateTime},</if> | ||||||
|  |             <if test="updateBy != null">#{updateBy},</if> | ||||||
|  |             <if test="delFlag != null">#{delFlag},</if> | ||||||
|  |         </trim> | ||||||
|  |     </insert> | ||||||
|  |  | ||||||
|  |     <update id="updateSysCustomerCaseFile" parameterType="SysCustomerCaseFile"> | ||||||
|  |         update sys_customer_case_file | ||||||
|  |         <trim prefix="SET" suffixOverrides=","> | ||||||
|  |             <if test="caseId != null">case_id = #{caseId},</if> | ||||||
|  |             <if test="fileUrl != null">file_url = #{fileUrl},</if> | ||||||
|  |             <if test="fileName != null">file_name = #{fileName},</if> | ||||||
|  |             <if test="createTime != null">create_time = #{createTime},</if> | ||||||
|  |             <if test="createBy != null">create_by = #{createBy},</if> | ||||||
|  |             <if test="updateTime != null">update_time = #{updateTime},</if> | ||||||
|  |             <if test="updateBy != null">update_by = #{updateBy},</if> | ||||||
|  |             <if test="delFlag != null">del_flag = #{delFlag},</if> | ||||||
|  |         </trim> | ||||||
|  |         where id = #{id} | ||||||
|  |     </update> | ||||||
|  |  | ||||||
|  |     <delete id="deleteSysCustomerCaseFileById" parameterType="Long"> | ||||||
|  |         delete from sys_customer_case_file where id = #{id} | ||||||
|  |     </delete> | ||||||
|  |  | ||||||
|  |     <delete id="deleteSysCustomerCaseFileByIds" parameterType="String"> | ||||||
|  |         delete from sys_customer_case_file where id in | ||||||
|  |         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||||
|  |             #{id} | ||||||
|  |         </foreach> | ||||||
|  |     </delete> | ||||||
|  |  | ||||||
|  | </mapper> | ||||||
| @@ -0,0 +1,87 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8" ?> | ||||||
|  | <!DOCTYPE mapper | ||||||
|  |         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||||
|  |         "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||||||
|  | <mapper namespace="com.stdiet.custom.mapper.SysCustomerCaseMapper"> | ||||||
|  |  | ||||||
|  |     <resultMap type="SysCustomerCase" id="SysCustomerCaseResult"> | ||||||
|  |         <result property="id"    column="id"    /> | ||||||
|  |         <result property="name"    column="name"    /> | ||||||
|  |         <result property="keyword"    column="keyword"    /> | ||||||
|  |         <result property="remark"    column="remark"    /> | ||||||
|  |         <result property="customerId"    column="customer_id"    /> | ||||||
|  |         <result property="createTime"    column="create_time"    /> | ||||||
|  |         <result property="createBy"    column="create_by"    /> | ||||||
|  |         <result property="updateTime"    column="update_time"    /> | ||||||
|  |         <result property="updateBy"    column="update_by"    /> | ||||||
|  |         <result property="delFlag"    column="del_flag"    /> | ||||||
|  |     </resultMap> | ||||||
|  |  | ||||||
|  |     <sql id="selectSysCustomerCaseVo"> | ||||||
|  |         select id, name, keyword, remark, customer_id, create_time, create_by, update_time, update_by, del_flag from sys_customer_case | ||||||
|  |     </sql> | ||||||
|  |  | ||||||
|  |     <select id="selectSysCustomerCaseList" parameterType="SysCustomerCase" resultMap="SysCustomerCaseResult"> | ||||||
|  |         <include refid="selectSysCustomerCaseVo"/> where del_flag = 0  | ||||||
|  |         <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if> | ||||||
|  |     </select> | ||||||
|  |  | ||||||
|  |     <select id="selectSysCustomerCaseById" parameterType="Long" resultMap="SysCustomerCaseResult"> | ||||||
|  |         <include refid="selectSysCustomerCaseVo"/> | ||||||
|  |         where id = #{id} and del_flag = 0 | ||||||
|  |     </select> | ||||||
|  |  | ||||||
|  |     <insert id="insertSysCustomerCase" parameterType="SysCustomerCase" useGeneratedKeys="true" keyProperty="id"> | ||||||
|  |         insert into sys_customer_case | ||||||
|  |         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||||
|  |             <if test="name != null">name,</if> | ||||||
|  |             <if test="keyword != null">keyword,</if> | ||||||
|  |             <if test="remark != null">remark,</if> | ||||||
|  |             <if test="customerId != null">customer_id,</if> | ||||||
|  |             <if test="createTime != null">create_time,</if> | ||||||
|  |             <if test="createBy != null">create_by,</if> | ||||||
|  |             <if test="updateTime != null">update_time,</if> | ||||||
|  |             <if test="updateBy != null">update_by,</if> | ||||||
|  |             <if test="delFlag != null">del_flag,</if> | ||||||
|  |         </trim> | ||||||
|  |         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||||
|  |             <if test="name != null">#{name},</if> | ||||||
|  |             <if test="keyword != null">#{keyword},</if> | ||||||
|  |             <if test="remark != null">#{remark},</if> | ||||||
|  |             <if test="customerId != null">#{customerId},</if> | ||||||
|  |             <if test="createTime != null">#{createTime},</if> | ||||||
|  |             <if test="createBy != null">#{createBy},</if> | ||||||
|  |             <if test="updateTime != null">#{updateTime},</if> | ||||||
|  |             <if test="updateBy != null">#{updateBy},</if> | ||||||
|  |             <if test="delFlag != null">#{delFlag},</if> | ||||||
|  |         </trim> | ||||||
|  |     </insert> | ||||||
|  |  | ||||||
|  |     <update id="updateSysCustomerCase" parameterType="SysCustomerCase"> | ||||||
|  |         update sys_customer_case | ||||||
|  |         <trim prefix="SET" suffixOverrides=","> | ||||||
|  |             <if test="name != null">name = #{name},</if> | ||||||
|  |             <if test="keyword != null">keyword = #{keyword},</if> | ||||||
|  |             <if test="remark != null">remark = #{remark},</if> | ||||||
|  |             <if test="customerId != null">customer_id = #{customerId},</if> | ||||||
|  |             <if test="createTime != null">create_time = #{createTime},</if> | ||||||
|  |             <if test="createBy != null">create_by = #{createBy},</if> | ||||||
|  |             <if test="updateTime != null">update_time = #{updateTime},</if> | ||||||
|  |             <if test="updateBy != null">update_by = #{updateBy},</if> | ||||||
|  |             <if test="delFlag != null">del_flag = #{delFlag},</if> | ||||||
|  |         </trim> | ||||||
|  |         where id = #{id} | ||||||
|  |     </update> | ||||||
|  |  | ||||||
|  |     <update id="deleteSysCustomerCaseById" parameterType="Long"> | ||||||
|  |         update sys_customer_case set del_flag = 1 where id = #{id} | ||||||
|  |     </update> | ||||||
|  |  | ||||||
|  |     <update id="deleteSysCustomerCaseByIds" parameterType="String"> | ||||||
|  |         update sys_customer_case set del_flag = 1 where id in | ||||||
|  |         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||||
|  |             #{id} | ||||||
|  |         </foreach> | ||||||
|  |     </update> | ||||||
|  |  | ||||||
|  | </mapper> | ||||||
| @@ -106,9 +106,9 @@ | |||||||
|         </foreach> |         </foreach> | ||||||
|     </update> |     </update> | ||||||
|  |  | ||||||
|     <!-- 根据订单ID、时间范围查询数量 --> |     <!-- 根据用户ID、时间范围查询数量 --> | ||||||
|     <select id="getCountByOrderIdAndPauseDate" parameterType="SysOrderPause" resultType="int"> |     <select id="getCountByCusIdAndPauseDate" parameterType="SysOrderPause" resultType="int"> | ||||||
|         select count(id) from sys_recipes_pause where del_flag = 0 and order_id = #{orderId} |         select count(id) from sys_recipes_pause where del_flag = 0 and cus_id = #{cusId} | ||||||
|         AND (#{pauseStartDate} >= pause_start_date AND pause_end_date >= #{pauseStartDate} |         AND (#{pauseStartDate} >= pause_start_date AND pause_end_date >= #{pauseStartDate} | ||||||
|         OR #{pauseEndDate} >= pause_start_date AND pause_end_date >= #{pauseEndDate}) |         OR #{pauseEndDate} >= pause_start_date AND pause_end_date >= #{pauseEndDate}) | ||||||
|         <if test="id != null"> |         <if test="id != null"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user