ai请求接口

master
chenfei 2 years ago
parent ac704bb9cd
commit 866dfb83b0

@ -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<THospital> tHospitals = tHospitalService.selectTHospitalList(new THospital());
return AjaxResult.success(tHospitals);
}
@ -127,8 +143,10 @@ 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();
@ -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,7 +222,8 @@ 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));
@ -210,7 +231,8 @@ public class AppController extends BaseController
@ApiOperation("获取患者详细信息")
@GetMapping("/patient/info/{id}")
public AjaxResult getPatientInfo2(@PathVariable("id") Long 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<TRecordResp> 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,7 +290,8 @@ 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));
@ -273,16 +299,87 @@ public class AppController extends BaseController
@ApiOperation("小程序获取患者详细信息")
@GetMapping("/patient/info")
public AjaxResult getPatientInfo() {
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("转图片错误");
}
}
}

@ -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<TImage> 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<TImage> list = tImageService.selectTImageList(tImage);
ExcelUtil<TImage> util = new ExcelUtil<TImage>(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));
}
}

@ -129,3 +129,11 @@ wx:
mpSecret: 252594e6b980bc2bfc74bbaad92b5e7b
wechatAppId: wxcf05e06d4ab81582
wechatSecret: 252594e6b980bc2bfc74bbaad92b5e7b
aiPost
ip: 111.6.25.30
port: 7001
url: /tongue/algo/sm_sx

@ -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<String, Object> 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<String, Object> params) throws UnsupportedEncodingException {
List<String> 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();
}
}

@ -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;
@ -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();

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

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

@ -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<String> 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<String> getOther()
{
return other;
}
public void setOther(List<String> other)
{
this.other = other;
}
}

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

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

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

@ -0,0 +1,70 @@
<?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.ruoyi.system.mapper.TImageMapper">
<resultMap type="TImage" id="TImageResult">
<result property="id" column="id" />
<result property="thirdId" column="third_id" />
<result property="path" column="path" />
<result property="name" column="name" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectTImageVo">
select id, third_id, path, name, create_time from t_image
</sql>
<select id="selectTImageList" parameterType="TImage" resultMap="TImageResult">
<include refid="selectTImageVo"/>
<where>
<if test="thirdId != null "> and third_id = #{thirdId}</if>
<if test="path != null and path != ''"> and path = #{path}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectTImageById" parameterType="Long" resultMap="TImageResult">
<include refid="selectTImageVo"/>
where id = #{id}
</select>
<insert id="insertTImage" parameterType="TImage" useGeneratedKeys="true" keyProperty="id">
insert into t_image
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="thirdId != null">third_id,</if>
<if test="path != null">path,</if>
<if test="name != null">name,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="thirdId != null">#{thirdId},</if>
<if test="path != null">#{path},</if>
<if test="name != null">#{name},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateTImage" parameterType="TImage">
update t_image
<trim prefix="SET" suffixOverrides=",">
<if test="thirdId != null">third_id = #{thirdId},</if>
<if test="path != null">path = #{path},</if>
<if test="name != null">name = #{name},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTImageById" parameterType="Long">
delete from t_image where id = #{id}
</delete>
<delete id="deleteTImageByIds" parameterType="String">
delete from t_image where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save