feat(warehouse): 优化仓库管理模块的用户信息显示

- 在入库记录查询中关联用户表以显示操作员昵称
- 在出库记录查询中关联用户表以显示操作员昵称
- 在采购到货记录中关联用户表以显示申请人、验收人等昵称
- 在采购申请中关联用户表以显示申请人昵称并支持按昵称搜索
- 在库存盘点记录中关联用户表以显示检查人和确认人昵称
- 在系统公告中关联用户表以显示创建人和更新人昵称
- 在操作日志中关联用户表以显示操作员昵称
- 移除已废弃的OpenAI配置项
- 优化SQL查询中的字段别名和表关联逻辑
This commit is contained in:
lixiaolong 2026-09-15 16:41:53 +08:00
parent 2ea0df3e1b
commit 79773cc96e
8 changed files with 84 additions and 38 deletions

View File

@ -150,8 +150,3 @@ agent:
model: ${AGENT_MODEL_NAME:Qwen/Qwen3.8-27B-FP8}
timeout-ms: ${AGENT_MODEL_TIMEOUT_MS:8000}
max-output-tokens: ${AGENT_MODEL_MAX_OUTPUT_TOKENS:512}
# 图片批量导入仍使用支持视觉输入的远程模型。
openai:
base-url: ${OPENAI_BASE_URL:http://192.168.28.10:18080}
api-key: ${OPENAI_API_KEY:sk-dd185946191d42eaa54892dec488bf7b54cad2d7433aee8aac7a017365b0829d}
model: ${OPENAI_MODEL:gpt-5.5}

View File

@ -18,29 +18,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectNoticeVo">
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
from sys_notice
select sn.notice_id, sn.notice_title, sn.notice_type, cast(sn.notice_content as char) as notice_content,
sn.status, coalesce(cu.nick_name, sn.create_by) as create_by, sn.create_time,
coalesce(uu.nick_name, sn.update_by) as update_by, sn.update_time, sn.remark
from sys_notice sn
left join sys_user cu on cu.user_name = sn.create_by
left join sys_user uu on uu.user_name = sn.update_by
</sql>
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
where notice_id = #{noticeId}
where sn.notice_id = #{noticeId}
</select>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
AND sn.notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
AND sn.notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
AND (sn.create_by like concat('%', #{createBy}, '%')
OR cu.nick_name like concat('%', #{createBy}, '%'))
</if>
</where>
order by notice_id desc
order by sn.notice_id desc
</select>
<insert id="insertNotice" parameterType="SysNotice">
@ -87,4 +92,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
</mapper>
</mapper>

View File

@ -25,8 +25,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectOperLogVo">
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, cost_time
from sys_oper_log
select sol.oper_id, sol.title, sol.business_type, sol.method, sol.request_method, sol.operator_type,
coalesce(su.nick_name, sol.oper_name) as oper_name, sol.dept_name, sol.oper_url, sol.oper_ip,
sol.oper_location, sol.oper_param, sol.json_result, sol.status, sol.error_msg, sol.oper_time, sol.cost_time
from sys_oper_log sol
left join sys_user su on su.user_name = sol.oper_name
</sql>
<insert id="insertOperlog" parameterType="SysOperLog">
@ -38,34 +41,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectOperLogVo"/>
<where>
<if test="operIp != null and operIp != ''">
AND oper_ip like concat('%', #{operIp}, '%')
AND sol.oper_ip like concat('%', #{operIp}, '%')
</if>
<if test="title != null and title != ''">
AND title like concat('%', #{title}, '%')
AND sol.title like concat('%', #{title}, '%')
</if>
<if test="businessType != null">
AND business_type = #{businessType}
AND sol.business_type = #{businessType}
</if>
<if test="businessTypes != null and businessTypes.length > 0">
AND business_type in
AND sol.business_type in
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
#{businessType}
</foreach>
</if>
<if test="status != null">
AND status = #{status}
AND sol.status = #{status}
</if>
<if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%')
AND (sol.oper_name like concat('%', #{operName}, '%')
OR su.nick_name like concat('%', #{operName}, '%'))
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND oper_time &gt;= #{params.beginTime}
AND sol.oper_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND oper_time &lt;= #{params.endTime}
AND sol.oper_time &lt;= #{params.endTime}
</if>
</where>
order by oper_id desc
order by sol.oper_id desc
</select>
<delete id="deleteOperLogByIds" parameterType="Long">
@ -77,11 +81,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/>
where oper_id = #{operId}
where sol.oper_id = #{operId}
</select>
<update id="cleanOperLog">
truncate table sys_oper_log
</update>
</mapper>
</mapper>

View File

@ -31,11 +31,15 @@
<sql id="selectInRecordVo">
select ir.id, ir.in_no, ir.area_id, ir.product_id, ir.purchase_request_id, ir.arrival_id, ir.source_no,
ir.in_type, ir.in_num, ir.in_status,
ir.operator, ir.in_operator, ir.confirm_time, ir.remark, ir.create_time, ir.update_time,
coalesce(operator_user.nick_name, ir.operator) as operator,
coalesce(in_user.nick_name, ir.in_operator) as in_operator,
ir.confirm_time, ir.remark, ir.create_time, ir.update_time,
wa.area_code, wa.area_name, pi.product_code, pi.product_name, pi.brand, pi.category, pi.spec, pi.unit
from in_record ir
left join warehouse_area wa on wa.id = ir.area_id
left join product_info pi on pi.id = ir.product_id
left join sys_user operator_user on operator_user.user_name = ir.operator
left join sys_user in_user on in_user.user_name = ir.in_operator
</sql>
<select id="selectInRecordList" parameterType="InRecord" resultMap="InRecordResult">
@ -51,7 +55,9 @@
<if test="spec != null and spec != ''">and pi.spec like concat('%', #{spec}, '%')</if>
<if test="inType != null">and ir.in_type = #{inType}</if>
<if test="inStatus != null">and ir.in_status = #{inStatus}</if>
<if test="inOperator != null and inOperator != ''">and ir.in_operator like concat('%', #{inOperator}, '%')</if>
<if test="inOperator != null and inOperator != ''">
and coalesce(in_user.nick_name, ir.in_operator) like concat('%', #{inOperator}, '%')
</if>
</where>
order by ir.id desc
</select>

View File

@ -27,11 +27,16 @@
<sql id="selectOutRecordVo">
select orr.id, orr.out_no, orr.area_id, orr.product_id, orr.out_type, orr.out_num,
orr.source_no, orr.operator, orr.out_operator, orr.out_time, orr.remark, orr.create_time, orr.update_time,
orr.source_no,
coalesce(operator_user.nick_name, orr.operator) as operator,
coalesce(out_user.nick_name, orr.out_operator) as out_operator,
orr.out_time, orr.remark, orr.create_time, orr.update_time,
wa.area_code, wa.area_name, pi.product_code, pi.product_name, pi.brand, pi.category, pi.spec, pi.unit
from out_record orr
left join warehouse_area wa on wa.id = orr.area_id
left join product_info pi on pi.id = orr.product_id
left join sys_user operator_user on operator_user.user_name = orr.operator
left join sys_user out_user on out_user.user_name = orr.out_operator
</sql>
<select id="selectOutRecordList" parameterType="OutRecord" resultMap="OutRecordResult">
@ -46,7 +51,9 @@
<if test="category != null and category != ''">and pi.category like concat('%', #{category}, '%')</if>
<if test="spec != null and spec != ''">and pi.spec like concat('%', #{spec}, '%')</if>
<if test="outType != null">and orr.out_type = #{outType}</if>
<if test="outOperator != null and outOperator != ''">and orr.out_operator like concat('%', #{outOperator}, '%')</if>
<if test="outOperator != null and outOperator != ''">
and coalesce(out_user.nick_name, orr.out_operator) like concat('%', #{outOperator}, '%')
</if>
<if test="sourceNo != null and sourceNo != ''">and orr.source_no like concat('%', #{sourceNo}, '%')</if>
</where>
order by orr.id desc

View File

@ -33,14 +33,24 @@
<sql id="selectPurchaseArrivalVo">
select pa.id, pa.arrival_no, pa.purchase_request_id, pa.arrival_quantity, pa.arrival_date,
pa.acceptance_status, pa.acceptance_remark, pa.accepted_by, pa.accepted_time,
pa.pre_accept_purchase_status, pa.revoked_by, pa.revoked_time, pa.revoke_remark,
pa.remark, pa.create_by, pa.create_time, pa.update_by, pa.update_time,
pr.request_no, pr.applicant_id, pr.applicant_name, pr.product_id,
pa.acceptance_status, pa.acceptance_remark,
coalesce(accepted_user.nick_name, pa.accepted_by) as accepted_by, pa.accepted_time,
pa.pre_accept_purchase_status,
coalesce(revoked_user.nick_name, pa.revoked_by) as revoked_by,
pa.revoked_time, pa.revoke_remark, pa.remark,
coalesce(created_user.nick_name, pa.create_by) as create_by, pa.create_time,
coalesce(updated_user.nick_name, pa.update_by) as update_by, pa.update_time,
pr.request_no, pr.applicant_id,
coalesce(applicant_user.nick_name, pr.applicant_name) as applicant_name, pr.product_id,
pi.product_code, pr.material_name, pr.material_brand, pr.material_params, pr.unit
from purchase_arrival pa
join purchase_request pr on pr.id = pa.purchase_request_id
left join product_info pi on pi.id = pr.product_id
left join sys_user applicant_user on applicant_user.user_id = pr.applicant_id
left join sys_user accepted_user on accepted_user.user_name = pa.accepted_by collate utf8mb4_unicode_ci
left join sys_user revoked_user on revoked_user.user_name = pa.revoked_by collate utf8mb4_unicode_ci
left join sys_user created_user on created_user.user_name = pa.create_by collate utf8mb4_unicode_ci
left join sys_user updated_user on updated_user.user_name = pa.update_by collate utf8mb4_unicode_ci
</sql>
<select id="selectPurchaseArrivalList" parameterType="Long" resultMap="PurchaseArrivalResult">
@ -54,7 +64,16 @@
</select>
<select id="selectPurchaseArrivalByIdForUpdate" parameterType="Long" resultMap="PurchaseArrivalResult">
<include refid="selectPurchaseArrivalVo"/> where pa.id = #{id} for update
select pa.id, pa.arrival_no, pa.purchase_request_id, pa.arrival_quantity, pa.arrival_date,
pa.acceptance_status, pa.acceptance_remark, pa.accepted_by, pa.accepted_time,
pa.pre_accept_purchase_status, pa.revoked_by, pa.revoked_time, pa.revoke_remark,
pa.remark, pa.create_by, pa.create_time, pa.update_by, pa.update_time,
pr.request_no, pr.applicant_id, pr.applicant_name, pr.product_id,
pi.product_code, pr.material_name, pr.material_brand, pr.material_params, pr.unit
from purchase_arrival pa
join purchase_request pr on pr.id = pa.purchase_request_id
left join product_info pi on pi.id = pr.product_id
where pa.id = #{id} for update
</select>
<select id="selectActiveQuantityByRequestId" parameterType="Long" resultType="java.math.BigDecimal">

View File

@ -38,7 +38,8 @@
<sql id="selectPurchaseRequestVo">
select pr.id, pr.request_no, pr.product_id, pr.purchase_batch_id, pr.material_name, pr.material_brand, pr.category, pr.material_params,
pr.purchase_link, pr.quantity, pr.unit, pr.expected_date, pr.applicant_id, pr.applicant_name,
pr.purchase_link, pr.quantity, pr.unit, pr.expected_date, pr.applicant_id,
coalesce(applicant_user.nick_name, pr.applicant_name) as applicant_name,
pr.purchase_status, pr.purchase_batch_no, pr.progress_remark, pr.remark,
pr.create_by, pr.create_time, pr.update_by, pr.update_time,
pi.product_code, pi.product_name, pi.brand as product_brand,
@ -48,6 +49,7 @@
greatest(pr.quantity - coalesce(pa.accepted_quantity, 0) - coalesce(pa.pending_quantity, 0), 0) as remaining_quantity
from purchase_request pr
left join product_info pi on pi.id = pr.product_id
left join sys_user applicant_user on applicant_user.user_id = pr.applicant_id
left join (
select purchase_request_id,
sum(case when acceptance_status = 1 then arrival_quantity else 0 end) as accepted_quantity,
@ -68,7 +70,10 @@
</if>
<if test="category != null and category != ''">and pr.category like concat('%', #{category}, '%')</if>
<if test="applicantId != null">and pr.applicant_id = #{applicantId}</if>
<if test="applicantName != null and applicantName != ''">and pr.applicant_name like concat('%', #{applicantName}, '%')</if>
<if test="applicantName != null and applicantName != ''">
and (pr.applicant_name like concat('%', #{applicantName}, '%')
or applicant_user.nick_name like concat('%', #{applicantName}, '%'))
</if>
<if test="purchaseStatus != null">and pr.purchase_status = #{purchaseStatus}</if>
<if test="purchaseBatchNo != null and purchaseBatchNo != ''">and pr.purchase_batch_no like concat('%', #{purchaseBatchNo}, '%')</if>
</where>

View File

@ -28,11 +28,16 @@
<sql id="selectStockCheckRecordVo">
select scr.id, scr.check_no, scr.area_id, scr.product_id, scr.book_num, scr.real_num, scr.diff_num,
scr.check_status, scr.check_user, scr.confirm_user, scr.confirm_time, scr.reason, scr.create_time, scr.update_time,
scr.check_status,
coalesce(check_user.nick_name, scr.check_user) as check_user,
coalesce(confirm_user.nick_name, scr.confirm_user) as confirm_user,
scr.confirm_time, scr.reason, scr.create_time, scr.update_time,
wa.area_code, wa.area_name, pi.product_code, pi.product_name, pi.brand, pi.category, pi.spec, pi.unit
from stock_check_record scr
left join warehouse_area wa on wa.id = scr.area_id
left join product_info pi on pi.id = scr.product_id
left join sys_user check_user on check_user.user_name = scr.check_user
left join sys_user confirm_user on confirm_user.user_name = scr.confirm_user
</sql>
<select id="selectStockCheckRecordList" parameterType="StockCheckRecord" resultMap="StockCheckRecordResult">