feat(approval): 新增业务审批流程及配置管理
- 新增审批配置主子表(biz_approval_config / biz_approval_config_user),支持或签 - 5 个业务模块接入审批: 采购订单/客户报价/供应商报价/发货单/订单异议 - 统一审批动作接口(提交/通过/驳回),status=10 表示审批中 - 新增"待我审批"聚合页面,按业务类型筛选 - 修复 logback 写本地路径报错,去除文件 appender - 修复 Redis SSL 配置在 Spring Boot 4 下需对象格式 - 补齐部分业务表缺失的 update_by/update_time 审计列 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?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.bid.BizApprovalActionMapper">
|
||||
|
||||
<update id="updateStatus">
|
||||
UPDATE ${table}
|
||||
SET ${statusCol} = #{newStatus},
|
||||
update_by = #{updateBy},
|
||||
update_time = NOW()
|
||||
WHERE ${pk} = #{id}
|
||||
<if test="fromStatuses != null and !fromStatuses.isEmpty()">
|
||||
AND ${statusCol} IN
|
||||
<foreach collection="fromStatuses" item="s" open="(" separator="," close=")">#{s}</foreach>
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<select id="selectStatus" resultType="java.lang.String">
|
||||
SELECT ${statusCol} FROM ${table} WHERE ${pk}=#{id}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?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.bid.BizApprovalConfigMapper">
|
||||
|
||||
<resultMap id="BaseRM" type="com.ruoyi.system.domain.bid.BizApprovalConfig">
|
||||
<id property="id" column="id"/>
|
||||
<result property="bizType" column="biz_type"/>
|
||||
<result property="bizName" column="biz_name"/>
|
||||
<result property="signType" column="sign_type"/>
|
||||
<result property="enabled" column="enabled"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectList" resultMap="BaseRM">
|
||||
SELECT * FROM biz_approval_config
|
||||
<where>
|
||||
<if test="bizType != null and bizType != ''"> AND biz_type LIKE CONCAT('%',#{bizType},'%')</if>
|
||||
<if test="bizName != null and bizName != ''"> AND biz_name LIKE CONCAT('%',#{bizName},'%')</if>
|
||||
<if test="enabled != null and enabled != ''"> AND enabled=#{enabled}</if>
|
||||
</where>
|
||||
ORDER BY id ASC
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="BaseRM">
|
||||
SELECT * FROM biz_approval_config WHERE id=#{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByBizType" resultMap="BaseRM">
|
||||
SELECT * FROM biz_approval_config WHERE biz_type=#{bizType}
|
||||
</select>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO biz_approval_config(biz_type,biz_name,sign_type,enabled,remark,create_by,create_time)
|
||||
VALUES(#{bizType},#{bizName},#{signType},#{enabled},#{remark},#{createBy},NOW())
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE biz_approval_config
|
||||
<set>
|
||||
<if test="bizName != null">biz_name=#{bizName},</if>
|
||||
<if test="signType != null">sign_type=#{signType},</if>
|
||||
<if test="enabled != null">enabled=#{enabled},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
update_by=#{updateBy}, update_time=NOW()
|
||||
</set>
|
||||
WHERE id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">DELETE FROM biz_approval_config WHERE id=#{id}</delete>
|
||||
|
||||
<select id="selectUserIds" resultType="java.lang.Long">
|
||||
SELECT user_id FROM biz_approval_config_user WHERE config_id=#{configId} ORDER BY sort_no, id
|
||||
</select>
|
||||
|
||||
<select id="selectUserNames" resultType="java.lang.String">
|
||||
SELECT u.nick_name FROM biz_approval_config_user cu
|
||||
JOIN sys_user u ON u.user_id=cu.user_id
|
||||
WHERE cu.config_id=#{configId} ORDER BY cu.sort_no, cu.id
|
||||
</select>
|
||||
|
||||
<delete id="deleteUsers">DELETE FROM biz_approval_config_user WHERE config_id=#{configId}</delete>
|
||||
|
||||
<insert id="insertUser">
|
||||
INSERT INTO biz_approval_config_user(config_id,user_id,sort_no)
|
||||
VALUES(#{configId},#{userId},#{sortNo})
|
||||
</insert>
|
||||
|
||||
<select id="existsUser" resultType="int">
|
||||
SELECT COUNT(1) FROM biz_approval_config c
|
||||
JOIN biz_approval_config_user cu ON cu.config_id=c.id
|
||||
WHERE c.biz_type=#{bizType} AND c.enabled='1' AND cu.user_id=#{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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.bid.BizApprovalPendingMapper">
|
||||
|
||||
<select id="selectPendingForUser" resultType="java.util.LinkedHashMap">
|
||||
SELECT * FROM (
|
||||
SELECT 'PURCHASE_ORDER' AS bizType, '采购订单' AS bizName,
|
||||
po_id AS id, po_no AS bizNo,
|
||||
CAST(total_amount AS CHAR) AS amount,
|
||||
create_by AS createBy, create_time AS createTime
|
||||
FROM biz_purchase_order
|
||||
WHERE status = '10'
|
||||
AND EXISTS (SELECT 1 FROM biz_approval_config c
|
||||
JOIN biz_approval_config_user cu ON cu.config_id = c.id
|
||||
WHERE c.biz_type = 'PURCHASE_ORDER' AND c.enabled = '1' AND cu.user_id = #{userId})
|
||||
|
||||
UNION ALL
|
||||
SELECT 'CLIENT_QUOTE', '客户报价',
|
||||
quote_id, quote_no, CAST(total_amount AS CHAR),
|
||||
create_by, create_time
|
||||
FROM biz_client_quote
|
||||
WHERE status = '10'
|
||||
AND EXISTS (SELECT 1 FROM biz_approval_config c
|
||||
JOIN biz_approval_config_user cu ON cu.config_id = c.id
|
||||
WHERE c.biz_type = 'CLIENT_QUOTE' AND c.enabled = '1' AND cu.user_id = #{userId})
|
||||
|
||||
UNION ALL
|
||||
SELECT 'QUOTATION', '供应商报价',
|
||||
quotation_id, quote_no, CAST(total_amount AS CHAR),
|
||||
create_by, create_time
|
||||
FROM biz_quotation
|
||||
WHERE status = '10'
|
||||
AND EXISTS (SELECT 1 FROM biz_approval_config c
|
||||
JOIN biz_approval_config_user cu ON cu.config_id = c.id
|
||||
WHERE c.biz_type = 'QUOTATION' AND c.enabled = '1' AND cu.user_id = #{userId})
|
||||
|
||||
UNION ALL
|
||||
SELECT 'DELIVERY_ORDER', '发货单',
|
||||
do_id, do_no, CAST(total_amount AS CHAR),
|
||||
create_by, create_time
|
||||
FROM biz_delivery_order
|
||||
WHERE delivery_status = '10'
|
||||
AND EXISTS (SELECT 1 FROM biz_approval_config c
|
||||
JOIN biz_approval_config_user cu ON cu.config_id = c.id
|
||||
WHERE c.biz_type = 'DELIVERY_ORDER' AND c.enabled = '1' AND cu.user_id = #{userId})
|
||||
|
||||
UNION ALL
|
||||
SELECT 'ORDER_OBJECTION', '订单异议',
|
||||
objection_id, CAST(objection_id AS CHAR), NULL,
|
||||
create_by, create_time
|
||||
FROM biz_order_objection
|
||||
WHERE status = '10'
|
||||
AND EXISTS (SELECT 1 FROM biz_approval_config c
|
||||
JOIN biz_approval_config_user cu ON cu.config_id = c.id
|
||||
WHERE c.biz_type = 'ORDER_OBJECTION' AND c.enabled = '1' AND cu.user_id = #{userId})
|
||||
) t
|
||||
ORDER BY t.createTime DESC
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user