diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java index 14be112..d31ae11 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java @@ -1,28 +1,34 @@ package com.ruoyi.web.controller.api; +import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.RequestParamsUtil; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.system.domain.THospital; import com.ruoyi.system.domain.TPatient; import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.TRecord; -import com.ruoyi.system.domain.req.AppPatientHospitalDoctor; -import com.ruoyi.system.domain.req.AppPatientReq; -import com.ruoyi.system.domain.req.AppRecordReq; -import com.ruoyi.system.domain.req.TRecordResultReq; +import com.ruoyi.system.domain.req.*; import com.ruoyi.system.domain.resp.TRecordResp; import com.ruoyi.system.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; +import sun.misc.BASE64Decoder; import javax.annotation.Resource; +import java.lang.reflect.Field; import java.util.List; /** @@ -52,6 +58,15 @@ public class AppController extends BaseController @Resource private ISysConfigService configService; + @Resource + private ITImageService imageService; + + @Value("${aiPost.ip}") + private String ip; + @Value("${aiPost.port}") + private String port; + @Value("${aiPost.url}") + private String url; /** * 完成AI诊断 @@ -75,7 +90,8 @@ public class AppController extends BaseController */ @ApiOperation("医院列表") @GetMapping("/hospital/list") - public AjaxResult hospitalList() { + public AjaxResult hospitalList() + { List tHospitals = tHospitalService.selectTHospitalList(new THospital()); return AjaxResult.success(tHospitals); } @@ -127,15 +143,17 @@ public class AppController extends BaseController @PutMapping("/record/ai/finish/{id}") @ApiOperation("患者记录预约到已诊状态转换") @Log(title = "患者记录预约到已诊状态转换", businessType = BusinessType.UPDATE) - public AjaxResult updateStatus(@PathVariable("id") Long id){ - if(id == null){ + public AjaxResult updateStatus(@PathVariable("id") Long id) + { + if (id == null) + { return AjaxResult.error("未获取到记录id"); } TRecord tRecord = new TRecord(); tRecord.setId(id); tRecord.setStatus("1"); tRecordService.updateTRecord(tRecord); - return AjaxResult.success("更新状态成功",null); + return AjaxResult.success("更新状态成功", null); } @GetMapping(value = "/config/ai/refreshtime") @@ -143,7 +161,7 @@ public class AppController extends BaseController @ApiOperation("获取AI结果刷新时间接口") public AjaxResult getConfigKey() { - String configKey="t.ai.refreshtime"; + String configKey = "t.ai.refreshtime"; return AjaxResult.success(configService.selectConfigByKey(configKey)); } @@ -155,7 +173,8 @@ public class AppController extends BaseController @ApiOperation("诊断记录上传") @Log(title = "App诊断记录上传", businessType = BusinessType.UPDATE) @PostMapping("/record/diagnostic/upload") - public AjaxResult diagnosticRecordsUploaded(@RequestBody AppRecordReq appRecordReq) { + public AjaxResult diagnosticRecordsUploaded(@RequestBody AppRecordReq appRecordReq) + { TRecord tRecord = new TRecord(); BeanUtils.copyProperties(appRecordReq, tRecord); return AjaxResult.success(tRecordService.updateTRecord(tRecord)); @@ -174,7 +193,8 @@ public class AppController extends BaseController { TPatient tPatient = new TPatient(); BeanUtils.copyProperties(appPatientReq, tPatient); - if(UserConstants.NOT_UNIQUE.equals(tPatientService.checkPhoneUnique(tPatient.getPhone()))){ + if (UserConstants.NOT_UNIQUE.equals(tPatientService.checkPhoneUnique(tPatient.getPhone()))) + { return AjaxResult.error("手机号已注册"); } tPatientService.insertTPatient(tPatient); @@ -202,15 +222,17 @@ public class AppController extends BaseController @ApiOperation("患者信息修改") @Log(title = "App患者修改", businessType = BusinessType.UPDATE) @PostMapping("/patient/modify") - public AjaxResult patientsWithModified(@RequestBody AppPatientReq appPatientReq) { + public AjaxResult patientsWithModified(@RequestBody AppPatientReq appPatientReq) + { TPatient tPatient = new TPatient(); BeanUtils.copyProperties(appPatientReq, tPatient); return AjaxResult.success(tPatientService.updateTPatient(tPatient)); } @ApiOperation("获取患者详细信息") - @GetMapping ("/patient/info/{id}") - public AjaxResult getPatientInfo2(@PathVariable("id") Long id) { + @GetMapping("/patient/info/{id}") + public AjaxResult getPatientInfo2(@PathVariable("id") Long id) + { return AjaxResult.success(tPatientService.selectTPatientById(id)); } @@ -219,12 +241,13 @@ public class AppController extends BaseController /** * 诊断记录列表 * - * @param appPatientHospitalDoctor 应用病人医院医生 + * @param patientId 应用病人医院医生 * @return {@code AjaxResult} */ @ApiOperation("患者诊断记录历史列表") @GetMapping("/record/list/{patientId}") - public AjaxResult diagnosisOfRecordList(@PathVariable("patientId") Long patientId) { + public AjaxResult diagnosisOfRecordList(@PathVariable("patientId") Long patientId) + { TPatientHospitalDoctor tPatientHospitalDoctor = new TPatientHospitalDoctor(); tPatientHospitalDoctor.setPatientId(patientId); List tRecords = tRecordService.queryRecordListByPHDids(tPatientHospitalDoctor); @@ -239,7 +262,8 @@ public class AppController extends BaseController */ @ApiOperation("患者诊断记录信息详情") @GetMapping("/record/info/{id}") - public AjaxResult patientsWithDiagnosisOfRecordInformationDetails(@PathVariable("id") Long id) { + public AjaxResult patientsWithDiagnosisOfRecordInformationDetails(@PathVariable("id") Long id) + { return AjaxResult.success(tRecordService.selectById(id)); } @@ -251,7 +275,8 @@ public class AppController extends BaseController */ @ApiOperation("患者已诊列表") @GetMapping("/record/diagnosedList") - public TableDataInfo patientsDiagnosedList(TRecordResultReq recordResultReq) { + public TableDataInfo patientsDiagnosedList(TRecordResultReq recordResultReq) + { recordResultReq.setStatus("1"); startPage(); return getDataTable(tRecordService.selectTRecordListWithoutResult(recordResultReq)); @@ -265,24 +290,96 @@ public class AppController extends BaseController */ @ApiOperation("患者候诊列表") @GetMapping("/record/waitingList") - public TableDataInfo patientsWaitingList(TRecordResultReq recordResultReq) { + public TableDataInfo patientsWaitingList(TRecordResultReq recordResultReq) + { recordResultReq.setStatus("0"); startPage(); return getDataTable(tRecordService.selectTRecordListWithoutResult(recordResultReq)); } @ApiOperation("小程序获取患者详细信息") - @GetMapping ("/patient/info") - public AjaxResult getPatientInfo() { + @GetMapping("/patient/info") + public AjaxResult getPatientInfo() + { return AjaxResult.success(tPatientService.selectTPatientById(getUserId())); } @GetMapping("/patient/record/historyData") @ApiOperation("查询患者历史数据图表") - public AjaxResult getHistoryRecordList(AppRecordReq appRecordReq){ + public AjaxResult getHistoryRecordList(AppRecordReq appRecordReq) + { TRecord tRecord = new TRecord(); BeanUtils.copyProperties(appRecordReq, tRecord); return tRecordService.getHistoryList(tRecord); } + @PostMapping("/ai/{recordId}") + @ApiOperation("ai接口") + public AjaxResult aiPost(@PathVariable("recordId") Long recordId, @RequestBody AiPostReq aiPostReq) + { + String URL = RequestParamsUtil.HTTP + ip + RequestParamsUtil.SEPARATOR + port + url; + JSONObject jsonObject = new JSONObject(); + String result; + try + { + result = HttpUtils.sendPost(URL, RequestParamsUtil.buildParams(aiPostReq)); + } + catch (Exception e) + { + throw new ServiceException(e.getMessage()); + } + if (!StringUtils.isEmpty(result)) + { + jsonObject = noBase64Image(JSONObject.parseObject(result)); + TRecord tRecord = new TRecord(); + tRecord.setId(recordId); + tRecord.setAiResult(result); + tRecordService.updateTRecord(tRecord); + } + return AjaxResult.success(jsonObject); + } + + + public JSONObject noBase64Image(JSONObject jsonObject) + { + try + { + jsonObject.getJSONObject("data").getJSONObject("shezhi").getJSONObject("shemian").getJSONObject("image_sz").put("v", null); + jsonObject.getJSONObject("data").getJSONObject("shezhi").getJSONObject("yudian").getJSONObject("image_sz_yudian").put("v", null); + jsonObject.getJSONObject("data").getJSONObject("shezhi").getJSONObject("yuban").getJSONObject("image_sz_yuban").put("v", null); + jsonObject.getJSONObject("data").getJSONObject("shezhi").getJSONObject("liewen").getJSONObject("image_sz_liewen").put("v", null); + jsonObject.getJSONObject("data").getJSONObject("shetai").getJSONObject("image_st").put("v", null); + jsonObject.getJSONObject("data").getJSONObject("shexia").getJSONObject("image_sx").put("v", null); + jsonObject.getJSONObject("data").getJSONObject("shexia").getJSONObject("image_sx_vein").put("v", null); + } + catch (Exception e) + { + throw new ServiceException("JSON解析错误:" + jsonObject.toJSONString()); + } + return jsonObject; + } + + public static String GenerateImage(String imgStr) + { + + BASE64Decoder decoder = new BASE64Decoder(); + try + { + //Base64解码 + byte[] b = decoder.decodeBuffer(imgStr); + for (int i = 0; i < b.length; ++i) + { + if (b[i] < 0) + { + b[i] += 256; + } + } + return FileUtils.writeImportBytes(b); + + } + catch (Exception e) + { + throw new ServiceException("转图片错误"); + } + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TImageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TImageController.java new file mode 100644 index 0000000..084755b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pc/TImageController.java @@ -0,0 +1,104 @@ +package com.ruoyi.web.controller.pc; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +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.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.TImage; +import com.ruoyi.system.service.ITImageService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 图片Controller + * + * @author ruoyi + * @date 2022-08-15 + */ +@RestController +@RequestMapping("/system/image") +public class TImageController extends BaseController +{ + @Autowired + private ITImageService tImageService; + + /** + * 查询图片列表 + */ + @PreAuthorize("@ss.hasPermi('system:image:list')") + @GetMapping("/list") + public TableDataInfo list(TImage tImage) + { + startPage(); + List list = tImageService.selectTImageList(tImage); + return getDataTable(list); + } + + /** + * 导出图片列表 + */ + @PreAuthorize("@ss.hasPermi('system:image:export')") + @Log(title = "图片", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, TImage tImage) + { + List list = tImageService.selectTImageList(tImage); + ExcelUtil util = new ExcelUtil(TImage.class); + util.exportExcel(response, list, "图片数据"); + } + + /** + * 获取图片详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:image:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(tImageService.selectTImageById(id)); + } + + /** + * 新增图片 + */ + @PreAuthorize("@ss.hasPermi('system:image:add')") + @Log(title = "图片", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody TImage tImage) + { + return toAjax(tImageService.insertTImage(tImage)); + } + + /** + * 修改图片 + */ + @PreAuthorize("@ss.hasPermi('system:image:edit')") + @Log(title = "图片", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody TImage tImage) + { + return toAjax(tImageService.updateTImage(tImage)); + } + + /** + * 删除图片 + */ + @PreAuthorize("@ss.hasPermi('system:image:remove')") + @Log(title = "图片", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(tImageService.deleteTImageByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 391f19e..cfdbd04 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -45,7 +45,7 @@ spring: messages: # 国际化资源文件路径 basename: i18n/messages - profiles: + profiles: active: druid # 文件上传 servlet: @@ -92,7 +92,7 @@ token: expireTime: 30 # app令牌有效期(默认30day) appExpireTime: 43200 - + # MyBatis配置 mybatis: # 搜索指定包别名 @@ -103,10 +103,10 @@ mybatis: configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 -pagehelper: +pagehelper: helperDialect: mysql supportMethodsArguments: true - params: count=countSql + params: count=countSql # Swagger配置 swagger: @@ -116,7 +116,7 @@ swagger: pathMapping: /dev-api # 防止XSS攻击 -xss: +xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) @@ -128,4 +128,12 @@ wx: mpAppId: wxcf05e06d4ab81582 mpSecret: 252594e6b980bc2bfc74bbaad92b5e7b wechatAppId: wxcf05e06d4ab81582 - wechatSecret: 252594e6b980bc2bfc74bbaad92b5e7b \ No newline at end of file + wechatSecret: 252594e6b980bc2bfc74bbaad92b5e7b + +aiPost + ip: 111.6.25.30 + port: 7001 + url: /tongue/algo/sm_sx + + + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/RequestParamsUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RequestParamsUtil.java new file mode 100644 index 0000000..990f12e --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RequestParamsUtil.java @@ -0,0 +1,111 @@ +package com.ruoyi.common.utils; + +import com.ruoyi.common.exception.ServiceException; + +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Field; +import java.net.URLEncoder; +import java.util.*; + +public class RequestParamsUtil +{ + /** + * http + */ + public final static String HTTP = "http://"; + + /** + * 分隔符 + */ + public final static String SEPARATOR = ":"; + + /** + * 历史遥测 + */ + public final static String HISTORY_TELEMETRY = "/ipark-device-management/device/history-telemetry/list"; + + /** + * 预览url + */ + public final static String PREVIEW_URLS = "/ipark-video/video/service/api/cameras/previewURLs"; + + /** + * 控制 + */ + public final static String CONTROLLING = "/ipark-video/video/service/api/ptzs/controlling"; + + public final static String CAMERA_SEARCH = "/ipark-video/video/resource/api/camera/search"; + + /** + * 设备信息 + */ + public final static String DEVICE_INFO = "/ipark-device-management/device-external/devices/list"; + + /** + * 设备模型 + */ + public final static String DEVICE_MODEL = "/ipark-device-management/device-external/models/{id}"; + + /** + * 设备分页列表 + */ + public final static String DEVICE_PAGE_LIST = "/ipark-device-management/device-external/devices/page"; + + /** + * 查询简明设备列表 + */ + public final static String BRIEF_DEVICE = "/ipark-device-management/device/brief-device/list"; + + /** + * 查询简明设备列表 + */ + public final static String DEVICE_TYPE = "/ipark-device-management/device/brief-device-type/list"; + + /** + * 手动抓图 + */ + public final static String MANUAL_CAPTURE = "/api/video/v1/manualCapture"; + + private RequestParamsUtil() { + } + + public static String buildParams(Object param) { + Map map = new HashMap<>(); + Field[] fields = param.getClass().getDeclaredFields(); + for (Field field : fields) { + field.setAccessible(true); + try { + if (field.get(param) == null) { + continue; + } + map.put(field.getName(), field.get(param)); + } catch (Exception e) { + throw new ServiceException("构建请求参数异常..."); + } + } + String params; + try { + params = createLinkStringByGet(map); + } catch (UnsupportedEncodingException e) { + throw new ServiceException("构建请求参数异常..."); + } + return params; + } + + private static String createLinkStringByGet(Map params) throws UnsupportedEncodingException { + List keys = new ArrayList<>(params.keySet()); + Collections.sort(keys); + StringBuilder stringBuilder = new StringBuilder(); + for (int i = 0; i < keys.size(); i++) { + String key = keys.get(i); + Object value = params.get(key); + if (i == keys.size() - 1) { + stringBuilder.append(key).append("=").append(URLEncoder.encode(String.valueOf(value), "utf-8")); + } else { + stringBuilder.append(key).append("=").append(URLEncoder.encode(String.valueOf(value), "utf-8")).append("&"); + } + + } + return stringBuilder.toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java index f85c82c..5ab36eb 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java @@ -17,6 +17,8 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; + +import com.ruoyi.common.exception.ServiceException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ruoyi.common.constant.Constants; @@ -24,7 +26,7 @@ import com.ruoyi.common.utils.StringUtils; /** * 通用http发送方法 - * + * * @author ruoyi */ public class HttpUtils @@ -155,18 +157,22 @@ public class HttpUtils catch (ConnectException e) { log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); + throw new ServiceException(e.getMessage()); } catch (SocketTimeoutException e) { log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); + throw new ServiceException(e.getMessage()); } catch (IOException e) { log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); + throw new ServiceException(e.getMessage()); } catch (Exception e) { log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); + throw new ServiceException(e.getMessage()); } finally { @@ -184,6 +190,7 @@ public class HttpUtils catch (IOException ex) { log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + throw new ServiceException(ex.getMessage()); } } return result.toString(); @@ -271,4 +278,4 @@ public class HttpUtils return true; } } -} \ No newline at end of file +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TImage.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TImage.java new file mode 100644 index 0000000..8d5a06b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TImage.java @@ -0,0 +1,80 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 图片对象 t_image + * + * @author ruoyi + * @date 2022-08-15 + */ +public class TImage extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + private Long id; + + /** thirdID */ + @Excel(name = "thirdID") + private Long thirdId; + + /** 路径 */ + @Excel(name = "路径") + private String path; + + /** 名称 */ + @Excel(name = "名称") + private String name; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setThirdId(Long thirdId) + { + this.thirdId = thirdId; + } + + public Long getThirdId() + { + return thirdId; + } + public void setPath(String path) + { + this.path = path; + } + + public String getPath() + { + return path; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("thirdId", getThirdId()) + .append("path", getPath()) + .append("name", getName()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AiPostReq.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AiPostReq.java new file mode 100644 index 0000000..f4ff025 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/AiPostReq.java @@ -0,0 +1,34 @@ +package com.ruoyi.system.domain.req; + +import io.swagger.annotations.ApiModel; + +import java.util.List; + +@ApiModel(value = "AiPostReq", description = "AI接口请求实体") +public class AiPostReq +{ + private Base64ResizedRmgSm base64_resized_img_sm; + private Base64ResizedRmgSm base64_resized_img_sx; + + public Base64ResizedRmgSm getBase64_resized_img_sm() + { + return base64_resized_img_sm; + } + + public void setBase64_resized_img_sm(Base64ResizedRmgSm base64_resized_img_sm) + { + this.base64_resized_img_sm = base64_resized_img_sm; + } + + public Base64ResizedRmgSm getBase64_resized_img_sx() + { + return base64_resized_img_sx; + } + + public void setBase64_resized_img_sx(Base64ResizedRmgSm base64_resized_img_sx) + { + this.base64_resized_img_sx = base64_resized_img_sx; + } +} + + diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/Base64ResizedRmgSm.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/Base64ResizedRmgSm.java new file mode 100644 index 0000000..e83861a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/req/Base64ResizedRmgSm.java @@ -0,0 +1,51 @@ +package com.ruoyi.system.domain.req; + +import java.util.List; + +public class Base64ResizedRmgSm +{ + private String front; + private String left; + private String right; + private List other; + + public String getFront() + { + return front; + } + + public void setFront(String front) + { + this.front = front; + } + + public String getLeft() + { + return left; + } + + public void setLeft(String left) + { + this.left = left; + } + + public String getRight() + { + return right; + } + + public void setRight(String right) + { + this.right = right; + } + + public List getOther() + { + return other; + } + + public void setOther(List other) + { + this.other = other; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TImageMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TImageMapper.java new file mode 100644 index 0000000..4c5a875 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TImageMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.TImage; + +/** + * 图片Mapper接口 + * + * @author ruoyi + * @date 2022-08-15 + */ +public interface TImageMapper +{ + /** + * 查询图片 + * + * @param id 图片主键 + * @return 图片 + */ + public TImage selectTImageById(Long id); + + /** + * 查询图片列表 + * + * @param tImage 图片 + * @return 图片集合 + */ + public List selectTImageList(TImage tImage); + + /** + * 新增图片 + * + * @param tImage 图片 + * @return 结果 + */ + public int insertTImage(TImage tImage); + + /** + * 修改图片 + * + * @param tImage 图片 + * @return 结果 + */ + public int updateTImage(TImage tImage); + + /** + * 删除图片 + * + * @param id 图片主键 + * @return 结果 + */ + public int deleteTImageById(Long id); + + /** + * 批量删除图片 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteTImageByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITImageService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITImageService.java new file mode 100644 index 0000000..da06410 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITImageService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.TImage; + +/** + * 图片Service接口 + * + * @author ruoyi + * @date 2022-08-15 + */ +public interface ITImageService +{ + /** + * 查询图片 + * + * @param id 图片主键 + * @return 图片 + */ + public TImage selectTImageById(Long id); + + /** + * 查询图片列表 + * + * @param tImage 图片 + * @return 图片集合 + */ + public List selectTImageList(TImage tImage); + + /** + * 新增图片 + * + * @param tImage 图片 + * @return 结果 + */ + public int insertTImage(TImage tImage); + + /** + * 修改图片 + * + * @param tImage 图片 + * @return 结果 + */ + public int updateTImage(TImage tImage); + + /** + * 批量删除图片 + * + * @param ids 需要删除的图片主键集合 + * @return 结果 + */ + public int deleteTImageByIds(Long[] ids); + + /** + * 删除图片信息 + * + * @param id 图片主键 + * @return 结果 + */ + public int deleteTImageById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TImageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TImageServiceImpl.java new file mode 100644 index 0000000..246a418 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TImageServiceImpl.java @@ -0,0 +1,95 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.TImageMapper; +import com.ruoyi.system.domain.TImage; +import com.ruoyi.system.service.ITImageService; + +/** + * 图片Service业务层处理 + * + * @author ruoyi + * @date 2022-08-15 + */ +@Service +public class TImageServiceImpl implements ITImageService +{ + @Autowired + private TImageMapper tImageMapper; + + /** + * 查询图片 + * + * @param id 图片主键 + * @return 图片 + */ + @Override + public TImage selectTImageById(Long id) + { + return tImageMapper.selectTImageById(id); + } + + /** + * 查询图片列表 + * + * @param tImage 图片 + * @return 图片 + */ + @Override + public List selectTImageList(TImage tImage) + { + return tImageMapper.selectTImageList(tImage); + } + + /** + * 新增图片 + * + * @param tImage 图片 + * @return 结果 + */ + @Override + public int insertTImage(TImage tImage) + { + tImage.setCreateTime(DateUtils.getNowDate()); + return tImageMapper.insertTImage(tImage); + } + + /** + * 修改图片 + * + * @param tImage 图片 + * @return 结果 + */ + @Override + public int updateTImage(TImage tImage) + { + return tImageMapper.updateTImage(tImage); + } + + /** + * 批量删除图片 + * + * @param ids 需要删除的图片主键 + * @return 结果 + */ + @Override + public int deleteTImageByIds(Long[] ids) + { + return tImageMapper.deleteTImageByIds(ids); + } + + /** + * 删除图片信息 + * + * @param id 图片主键 + * @return 结果 + */ + @Override + public int deleteTImageById(Long id) + { + return tImageMapper.deleteTImageById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/TImageMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TImageMapper.xml new file mode 100644 index 0000000..4ff15aa --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/TImageMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + select id, third_id, path, name, create_time from t_image + + + + + + + + insert into t_image + + third_id, + path, + name, + create_time, + + + #{thirdId}, + #{path}, + #{name}, + #{createTime}, + + + + + update t_image + + third_id = #{thirdId}, + path = #{path}, + name = #{name}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from t_image where id = #{id} + + + + delete from t_image where id in + + #{id} + + + \ No newline at end of file