fix: 为 Oracle 参数显式指定 jdbcType 以解决空值绑定异常

master
zangch@mesnac.com 2 weeks ago
parent 4f16bb2eb9
commit e0ebce5486

@ -75,7 +75,7 @@ public interface OrderBomInfoMapper
* @param materialCode
* @return
*/
List<OrderBomInfo> selectChildrenBomById(String materialCode);
List<OrderBomInfo> selectChildrenBomById(@Param("materialCode") String materialCode);
/**
*

@ -86,7 +86,8 @@
<select id="selectOrderBomInfoByMaterialCode" resultMap="OrderBomInfoResult">
<include refid="selectOrderBomInfoVo"/>
where ob.material_code = #{materialCode}
<!-- Oracle 11 在字符串参数为空时不能按 JdbcType.OTHER 绑定,显式声明 VARCHAR 避免 1111 异常 -->
where ob.material_code = #{materialCode,jdbcType=VARCHAR}
</select>
<insert id="insertOrderBomInfo" parameterType="OrderBomInfo">
@ -174,7 +175,8 @@
</delete>
<select id="selectChildrenBomById" parameterType="String" resultMap="OrderBomInfoResult">
select * from order_bominfo where INSTR(',' || ancestors || ',', ',' || #{materialCode} || ',') <![CDATA[ > ]]> 0
<!-- 这里依赖 materialCode 命名参数;同时显式指定 VARCHAR避免空值传参落到 Oracle OTHER 类型 -->
select * from order_bominfo where INSTR(',' || ancestors || ',', ',' || #{materialCode,jdbcType=VARCHAR} || ',') <![CDATA[ > ]]> 0
</select>

@ -63,21 +63,22 @@
obj_id, order_code, note_type, note_content, status, remark,
create_by, create_time, update_by, update_time
) values (
#{objId}, #{orderCode}, #{noteType}, #{noteContent}, #{status}, #{remark},
#{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime}
#{objId,jdbcType=NUMERIC}, #{orderCode,jdbcType=VARCHAR}, #{noteType,jdbcType=VARCHAR},
#{noteContent,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createdBy,jdbcType=VARCHAR}, #{createdTime,jdbcType=DATE}, #{updatedBy,jdbcType=VARCHAR}, #{updatedTime,jdbcType=DATE}
)
</insert>
<update id="updateProdOrderNote" parameterType="ProdOrderNote">
update prod_order_note
<set>
order_code = #{orderCode},
note_type = #{noteType},
note_content = #{noteContent},
status = #{status},
remark = #{remark},
update_by = #{updatedBy},
update_time = #{updatedTime}
order_code = #{orderCode,jdbcType=VARCHAR},
note_type = #{noteType,jdbcType=VARCHAR},
note_content = #{noteContent,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
update_by = #{updatedBy,jdbcType=VARCHAR},
update_time = #{updatedTime,jdbcType=DATE}
</set>
where obj_id = #{objId}
</update>

@ -100,22 +100,23 @@
obj_id, route_code, route_name, material_code, version_no, status, remark,
create_by, create_time, update_by, update_time
) values (
#{objId}, #{routeCode}, #{routeName}, #{materialCode}, #{versionNo}, #{status}, #{remark},
#{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime}
#{objId,jdbcType=NUMERIC}, #{routeCode,jdbcType=VARCHAR}, #{routeName,jdbcType=VARCHAR},
#{materialCode,jdbcType=VARCHAR}, #{versionNo,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createdBy,jdbcType=VARCHAR}, #{createdTime,jdbcType=DATE}, #{updatedBy,jdbcType=VARCHAR}, #{updatedTime,jdbcType=DATE}
)
</insert>
<update id="updateProdRoute" parameterType="ProdRoute">
update prod_route
<set>
route_code = #{routeCode},
route_name = #{routeName},
material_code = #{materialCode},
version_no = #{versionNo},
status = #{status},
remark = #{remark},
update_by = #{updatedBy},
update_time = #{updatedTime}
route_code = #{routeCode,jdbcType=VARCHAR},
route_name = #{routeName,jdbcType=VARCHAR},
material_code = #{materialCode,jdbcType=VARCHAR},
version_no = #{versionNo,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
update_by = #{updatedBy,jdbcType=VARCHAR},
update_time = #{updatedTime,jdbcType=DATE}
</set>
where obj_id = #{objId}
</update>
@ -139,8 +140,9 @@
obj_id, route_code, process_code, sort_no, required_flag, standard_work_time, remark,
create_by, create_time, update_by, update_time
) values (
#{objId}, #{routeCode}, #{processCode}, #{sortNo}, #{requiredFlag}, #{standardWorkTime}, #{remark},
#{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime}
#{objId,jdbcType=NUMERIC}, #{routeCode,jdbcType=VARCHAR}, #{processCode,jdbcType=VARCHAR},
#{sortNo,jdbcType=NUMERIC}, #{requiredFlag,jdbcType=VARCHAR}, #{standardWorkTime,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR},
#{createdBy,jdbcType=VARCHAR}, #{createdTime,jdbcType=DATE}, #{updatedBy,jdbcType=VARCHAR}, #{updatedTime,jdbcType=DATE}
)
</insert>

@ -79,25 +79,27 @@
obj_id, station_code, material_code, standard_ct, shift_cap, day_cap, changeover_min,
team_code, status, remark, create_by, create_time, update_by, update_time
) values (
#{objId}, #{stationCode}, #{materialCode}, #{standardCt}, #{shiftCap}, #{dayCap}, #{changeoverMin},
#{teamCode}, #{status}, #{remark}, #{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime}
#{objId,jdbcType=NUMERIC}, #{stationCode,jdbcType=VARCHAR}, #{materialCode,jdbcType=VARCHAR},
#{standardCt,jdbcType=DECIMAL}, #{shiftCap,jdbcType=DECIMAL}, #{dayCap,jdbcType=DECIMAL}, #{changeoverMin,jdbcType=NUMERIC},
#{teamCode,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createdBy,jdbcType=VARCHAR},
#{createdTime,jdbcType=DATE}, #{updatedBy,jdbcType=VARCHAR}, #{updatedTime,jdbcType=DATE}
)
</insert>
<update id="updateProdStationCapability" parameterType="ProdStationCapability">
update prod_sta_cap
<set>
station_code = #{stationCode},
material_code = #{materialCode},
standard_ct = #{standardCt},
shift_cap = #{shiftCap},
day_cap = #{dayCap},
changeover_min = #{changeoverMin},
team_code = #{teamCode},
status = #{status},
remark = #{remark},
update_by = #{updatedBy},
update_time = #{updatedTime}
station_code = #{stationCode,jdbcType=VARCHAR},
material_code = #{materialCode,jdbcType=VARCHAR},
standard_ct = #{standardCt,jdbcType=DECIMAL},
shift_cap = #{shiftCap,jdbcType=DECIMAL},
day_cap = #{dayCap,jdbcType=DECIMAL},
changeover_min = #{changeoverMin,jdbcType=NUMERIC},
team_code = #{teamCode,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
update_by = #{updatedBy,jdbcType=VARCHAR},
update_time = #{updatedTime,jdbcType=DATE}
</set>
where obj_id = #{objId}
</update>

@ -16,7 +16,6 @@
<result property="ownerUserId" column="owner_user_id"/>
<result property="ownerUserName" column="owner_user_name"/>
<result property="priorityLevel" column="priority_level"/>
<result property="deviceCode" column="device_code"/>
<result property="endDate" column="end_date"/>
<result property="startTime" column="start_time"/>
<result property="finishTime" column="finish_time"/>
@ -51,7 +50,6 @@
tp.owner_user_id,
su.nick_name as owner_user_name,
nvl(tp.priority_level, 'NORMAL') as priority_level,
oi.device_code,
oi.end_date,
oi.start_time,
oi.end_time as finish_time,
@ -116,19 +114,20 @@
obj_id, order_code, owner_user_id, priority_level, task_remark,
create_by, create_time, update_by, update_time
) values (
#{objId}, #{orderCode}, #{ownerUserId}, #{priorityLevel}, #{remark},
#{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime}
#{objId,jdbcType=NUMERIC}, #{orderCode,jdbcType=VARCHAR}, #{ownerUserId,jdbcType=NUMERIC},
#{priorityLevel,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createdBy,jdbcType=VARCHAR}, #{createdTime,jdbcType=DATE}, #{updatedBy,jdbcType=VARCHAR}, #{updatedTime,jdbcType=DATE}
)
</insert>
<update id="updateProdTaskPool" parameterType="ProdTaskPool">
update prod_task_pool
<set>
owner_user_id = #{ownerUserId},
priority_level = #{priorityLevel},
task_remark = #{remark},
update_by = #{updatedBy},
update_time = #{updatedTime}
owner_user_id = #{ownerUserId,jdbcType=NUMERIC},
priority_level = #{priorityLevel,jdbcType=VARCHAR},
task_remark = #{remark,jdbcType=VARCHAR},
update_by = #{updatedBy,jdbcType=VARCHAR},
update_time = #{updatedTime,jdbcType=DATE}
</set>
where order_code = #{orderCode}
</update>
@ -142,11 +141,11 @@
<update id="updateOrderExecutionStatus" parameterType="ProdTaskPool">
update base_orderinfo
set execution_status = #{executionStatus},
start_time = case when #{executionStatus} = 'RUNNING' and start_time is null then sysdate else start_time end,
end_time = case when #{executionStatus} = 'COMPLETED' then sysdate else end_time end,
complete_date = case when #{executionStatus} = 'COMPLETED' then trunc(sysdate) else complete_date end,
updated_time = #{updatedTime}
where order_code = #{orderCode}
set execution_status = #{executionStatus,jdbcType=VARCHAR},
start_time = case when #{executionStatus,jdbcType=VARCHAR} = 'RUNNING' and start_time is null then sysdate else start_time end,
end_time = case when #{executionStatus,jdbcType=VARCHAR} = 'COMPLETED' then sysdate else end_time end,
complete_date = case when #{executionStatus,jdbcType=VARCHAR} = 'COMPLETED' then trunc(sysdate) else complete_date end,
updated_time = #{updatedTime,jdbcType=DATE}
where order_code = #{orderCode,jdbcType=VARCHAR}
</update>
</mapper>

@ -81,24 +81,25 @@
obj_id, team_code, shift_date, shift_code, leader_user_id, line_code, area_desc, status,
remark, create_by, create_time, update_by, update_time
) values (
#{objId}, #{teamCode}, #{shiftDate}, #{shiftCode}, #{leaderUserId}, #{lineCode}, #{areaDesc}, #{status},
#{remark}, #{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime}
#{objId,jdbcType=NUMERIC}, #{teamCode,jdbcType=VARCHAR}, #{shiftDate,jdbcType=DATE}, #{shiftCode,jdbcType=VARCHAR},
#{leaderUserId,jdbcType=NUMERIC}, #{lineCode,jdbcType=VARCHAR}, #{areaDesc,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR}, #{createdBy,jdbcType=VARCHAR}, #{createdTime,jdbcType=DATE}, #{updatedBy,jdbcType=VARCHAR}, #{updatedTime,jdbcType=DATE}
)
</insert>
<update id="updateProdTeamShift" parameterType="ProdTeamShift">
update prod_team_sch
<set>
team_code = #{teamCode},
shift_date = #{shiftDate},
shift_code = #{shiftCode},
leader_user_id = #{leaderUserId},
line_code = #{lineCode},
area_desc = #{areaDesc},
status = #{status},
remark = #{remark},
update_by = #{updatedBy},
update_time = #{updatedTime}
team_code = #{teamCode,jdbcType=VARCHAR},
shift_date = #{shiftDate,jdbcType=DATE},
shift_code = #{shiftCode,jdbcType=VARCHAR},
leader_user_id = #{leaderUserId,jdbcType=NUMERIC},
line_code = #{lineCode,jdbcType=VARCHAR},
area_desc = #{areaDesc,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
update_by = #{updatedBy,jdbcType=VARCHAR},
update_time = #{updatedTime,jdbcType=DATE}
</set>
where obj_id = #{objId}
</update>

Loading…
Cancel
Save