修改--数据库插入增加判断条件

This commit is contained in:
tjxt 2024-07-30 12:59:24 +08:00
parent 5c3676d892
commit 0915176b7b
2 changed files with 40 additions and 10 deletions

View File

@ -108,7 +108,7 @@ public class OcrRecogServiceImpl implements IOcrRecogService {
e.printStackTrace();
}
}
log.info("base64格式的图片:{}",base64Strings);
log.info("转换base64格式的图片:");
return base64Strings;
}
@ -161,7 +161,7 @@ public class OcrRecogServiceImpl implements IOcrRecogService {
.recognizeTime(LocalDateTime.now())
.responseLong(responseTime)
.invokeIp(IpUtils.getIpAddr(ServletUtils.getRequest()))
// .updateBy(loginUser.getUserid()) // 假设getUserid()已返回正确用户ID
.updateBy(String.valueOf(loginUser.getUserid())) // 假设getUserid()已返回正确用户ID
.updateTime(LocalDateTime.now())
.build();
aiIdcardrecognizeMapper.insert(aiIdcardrecognizeResult);

View File

@ -7,15 +7,45 @@
<insert id="insert" parameterType="com.bonus.ai.domain.po.AiIdcardrecognizeResult">
INSERT INTO ai_idcardrecognize_result
(service_id, name, sex, enthnic, birthday, address, idcard_number,
issuing_authority, idcard_validity, if_complete, frontImge_address,
backImg_address, recognize_time, response_long, invoke_ip,
update_by, update_time)
(
<if test="serviceId != null and serviceId != '' ">service_id,</if>
<if test="name != null and name != '' ">name,</if>
<if test="sex != null and sex != '' ">sex,</if>
<if test="enthnic != null and enthnic != '' ">enthnic,</if>
birthday,
<if test="address != null and address != '' ">address,</if>
<if test="idcardNumber != null and idcardNumber != '' ">idcard_number,</if>
<if test="issuingAuthority != null and issuingAuthority != '' ">issuing_authority,</if>
idcard_validity,
<if test="ifComplete != null and ifComplete != '' ">if_complete,</if>
<if test="frontImageAddress != null and frontImageAddress != '' ">frontImge_address,</if>
<if test="backImageAddress != null and backImageAddress != '' ">backImg_address,</if>
recognize_time,
<if test="responseLong != null and responseLong != '' ">response_long,</if>
<if test="invokeIp != null and invokeIp != '' ">invoke_ip,</if>
<if test="updateBy != null and updateBy != '' ">update_by,</if>
update_time
)
VALUES
(#{serviceId}, #{name}, #{sex}, #{enthnic}, #{birthday}, #{address}, #{idcardNumber},
#{issuingAuthority}, #{idcardValidity}, #{ifComplete}, #{frontImageAddress},
#{backImageAddress}, #{recognizeTime}, #{responseLong}, #{invokeIp},
#{updateBy}, #{updateTime})
(<if test="serviceId != null and serviceId != ''">
#{serviceId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="enthnic != null and enthnic != ''">#{enthnic},</if>
#{birthday},
<if test="address != null and address != ''">#{address},</if>
<if test="idcardNumber != null and idcardNumber != ''">#{idcardNumber},</if>
<if test="issuingAuthority != null and issuingAuthority != ''">#{issuingAuthority},</if>
#{idcardValidity},
<if test="ifComplete != null and ifComplete != ''">#{ifComplete},</if>
<if test="frontImageAddress != null and frontImageAddress != ''">#{frontImageAddress},</if>
<if test="backImageAddress != null and backImageAddress != ''">#{backImageAddress},</if>
#{recognizeTime},
<if test="responseLong != null and responseLong != ''">#{responseLong},</if>
<if test="invokeIp != null and invokeIp != ''">#{invokeIp},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
#{updateTime}
)
</insert>