123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- <?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.approvalFlow.mapper.AuditItemsMapper">
- <resultMap type="AuditItems" id="AuditItemsResult">
- <result property="id" column="id"/>
- <result property="billNo" column="bill_no"/>
- <result property="billId" column="bill_id"/>
- <result property="actId" column="act_id"/>
- <result property="pathId" column="path_id"/>
- <result property="levelId" column="level_id"/>
- <result property="refno1" column="refno1"/>
- <result property="iffinalItem" column="iffinal_item"/>
- <result property="refno2" column="refno2"/>
- <result property="refno3" column="refno3"/>
- <result property="branchId" column="branch_id"/>
- <result property="sendUserId" column="send_user_id"/>
- <result property="sendName" column="send_name"/>
- <result property="sendTime" column="send_time"/>
- <result property="sendMsg" column="send_msg"/>
- <result property="auditUserId" column="audit_user_id"/>
- <result property="auditItem" column="audit_item"/>
- <result property="auditOpTime" column="audit_op_time"/>
- <result property="auditMsg" column="audit_msg"/>
- <result property="auditStatus" column="audit_status"/>
- <result property="billTime" column="bill_time"/>
- </resultMap>
- <sql id="selectAuditItemsVo">
- select id,
- bill_no,
- bill_id,
- act_id,
- path_id,
- level_id,
- refno1,
- iffinal_item,
- refno2,
- refno3,
- branch_id,
- send_user_id,
- send_name,
- send_time,
- send_msg,
- audit_user_id,
- audit_item,
- audit_op_time,
- audit_msg,
- audit_status,
- bill_time
- from audit_items
- </sql>
- <select id="selectAuditItemsList" parameterType="AuditItems" resultMap="AuditItemsResult">
- <include refid="selectAuditItemsVo"/>
- <where>
- <if test="billNo != null and billNo != ''">and bill_no = #{billNo}</if>
- <if test="billId != null ">and bill_id = #{billId}</if>
- <if test="actId != null ">and act_id = #{actId}</if>
- <if test="pathId != null ">and path_id = #{pathId}</if>
- <if test="levelId != null ">and level_id = #{levelId}</if>
- <if test="refno1 != null and refno1 != ''">and refno1 = #{refno1}</if>
- <if test="iffinalItem != null and iffinalItem != ''">and iffinal_item = #{iffinalItem}</if>
- <if test="refno2 != null and refno2 != ''">and refno2 = #{refno2}</if>
- <if test="refno3 != null and refno3 != ''">and refno3 = #{refno3}</if>
- <if test="branchId != null ">and branch_id = #{branchId}</if>
- <if test="sendUserId != null ">and send_user_id = #{sendUserId}</if>
- <if test="sendName != null and sendName != ''">and send_name like concat('%', #{sendName}, '%')</if>
- <if test="sendTime != null ">and send_time = #{sendTime}</if>
- <if test="sendMsg != null and sendMsg != ''">and send_msg = #{sendMsg}</if>
- <if test="auditUserId != null ">and audit_user_id = #{auditUserId}</if>
- <if test="auditItem != null ">and audit_item = #{auditItem}</if>
- <if test="auditOpTime != null ">and audit_op_time = #{auditOpTime}</if>
- <if test="auditMsg != null and auditMsg != ''">and audit_msg = #{auditMsg}</if>
- <if test="auditStatus != null and auditStatus != ''">and audit_status = #{auditStatus}</if>
- <if test="billTime != null ">and bill_time = #{billTime},</if>
- </where>
- </select>
- <select id="selectAuditItemsById" parameterType="Long" resultMap="AuditItemsResult">
- <include refid="selectAuditItemsVo"/>
- where id = #{id}
- </select>
- <insert id="insertAuditItems" parameterType="AuditItems" useGeneratedKeys="true" keyProperty="id">
- insert into audit_items
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="billNo != null">bill_no,</if>
- <if test="billId != null">bill_id,</if>
- <if test="actId != null">act_id,</if>
- <if test="pathId != null">path_id,</if>
- <if test="levelId != null">level_id,</if>
- <if test="refno1 != null">refno1,</if>
- <if test="iffinalItem != null">iffinal_item,</if>
- <if test="refno2 != null">refno2,</if>
- <if test="refno3 != null">refno3,</if>
- <if test="branchId != null">branch_id,</if>
- <if test="sendUserId != null">send_user_id,</if>
- <if test="sendName != null">send_name,</if>
- <if test="sendTime != null">send_time,</if>
- <if test="sendMsg != null">send_msg,</if>
- <if test="auditUserId != null">audit_user_id,</if>
- <if test="auditItem != null">audit_item,</if>
- <if test="auditOpTime != null ">audit_op_time,</if>
- <if test="auditMsg != null">audit_msg,</if>
- <if test="auditStatus != null">audit_status,</if>
- <if test="billTime != null ">bill_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="billNo != null">#{billNo},</if>
- <if test="billId != null">#{billId},</if>
- <if test="actId != null">#{actId},</if>
- <if test="pathId != null">#{pathId},</if>
- <if test="levelId != null">#{levelId},</if>
- <if test="refno1 != null">#{refno1},</if>
- <if test="iffinalItem != null">#{iffinalItem},</if>
- <if test="refno2 != null">#{refno2},</if>
- <if test="refno3 != null">#{refno3},</if>
- <if test="branchId != null">#{branchId},</if>
- <if test="sendUserId != null">#{sendUserId},</if>
- <if test="sendName != null">#{sendName},</if>
- <if test="sendTime != null">#{sendTime},</if>
- <if test="sendMsg != null">#{sendMsg},</if>
- <if test="auditUserId != null">#{auditUserId},</if>
- <if test="auditItem != null">#{auditItem},</if>
- <if test="auditOpTime != null ">#{auditOpTime},</if>
- <if test="auditMsg != null">#{auditMsg},</if>
- <if test="auditStatus != null">#{auditStatus},</if>
- <if test="billTime != null ">#{billTime},</if>
- </trim>
- </insert>
- <update id="updateAuditItems" parameterType="AuditItems">
- update audit_items
- <trim prefix="SET" suffixOverrides=",">
- <if test="billNo != null">bill_no = #{billNo},</if>
- <if test="billId != null">bill_id = #{billId},</if>
- <if test="actId != null">act_id = #{actId},</if>
- <if test="pathId != null">path_id = #{pathId},</if>
- <if test="levelId != null">level_id = #{levelId},</if>
- <if test="refno1 != null">refno1 = #{refno1},</if>
- <if test="iffinalItem != null">iffinal_item = #{iffinalItem},</if>
- <if test="refno2 != null">refno2 = #{refno2},</if>
- <if test="refno3 != null">refno3 = #{refno3},</if>
- <if test="branchId != null">branch_id = #{branchId},</if>
- <if test="sendUserId != null">send_user_id = #{sendUserId},</if>
- <if test="sendName != null">send_name = #{sendName},</if>
- <if test="sendTime != null">send_time = #{sendTime},</if>
- <if test="sendMsg != null">send_msg = #{sendMsg},</if>
- <if test="auditUserId != null">audit_user_id = #{auditUserId},</if>
- <if test="auditItem != null">audit_item = #{auditItem},</if>
- <if test="auditOpTime != null ">audit_op_time = #{auditOpTime},</if>
- <if test="auditMsg != null">audit_msg = #{auditMsg},</if>
- <if test="auditStatus != null">audit_status = #{auditStatus},</if>
- <if test="billTime != null ">bill_time = #{billTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteAuditItemsById" parameterType="Long">
- delete
- from audit_items
- where id = #{id}
- </delete>
- <delete id="deleteAuditItemsByIds" parameterType="String">
- delete from audit_items where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="selectCountAuditItems" resultType="java.lang.Integer">
- SELECT count(*)
- FROM
- audit_items item
- LEFT JOIN t_corps corp ON corp.f_id = item.refno1
- LEFT JOIN audit_items_users us ON us.pid = item.id
- LEFT JOIN sys_user usr ON usr.user_id = item.audit_user_id
- where
- us.audit_status = 'S'
- AND item.audit_status = 'S'
- <if test="billNo != null and billNo != ''">and item.bill_no = #{billNo}</if>
- <if test="actId != null and actId != ''">and item.act_id = #{actId}</if>
- <if test="refno2 != null and refno2 != ''">and item.refno2 = #{refno2}</if>
- <if test="billId != null and billId != ''">and item.bill_id like concat('%', #{billId}, '%')</if>
- <if test="refno1 != null and refno1 != ''">and corp.f_name like concat('%', #{refno1}, '%')</if>
- <if test="sendUserId != null and sendUserId != ''">and item.send_user_id like concat('%', #{sendUserId}, '%')
- </if>
- <if test="billTime != null and billTime != ''">and item.bill_time = #{billTime}</if>
- <if test="auditUserId != null and auditUserId != ''">AND us.user_id = #{auditUserId}</if>
- <if test='sendTime != null and sendTime[0] != null and sendTime[0]!= ""'>
- and item.send_time >= #{sendTime[0]}
- </if>
- <if test='sendTime != null and sendTime[1] != null and sendTime[1]!= ""'>
- and item.send_time <= #{sendTime[1]}
- </if>
- <if test='auditOpTime != null and auditOpTime[0] != null and auditOpTime[0]!= ""'>
- and item.audit_op_time >= #{auditOpTime[0]}
- </if>
- <if test='auditOpTime != null and auditOpTime[1] != null and auditOpTime[1]!= ""'>
- and item.audit_op_time <= #{auditOpTime[1]}
- </if>
- ORDER BY
- item.send_time DESC
- </select>
- <select id="selectAuditItems" parameterType="AuditItems" resultType="Map">
- SELECT
- item.id,
- CASE
- item.act_id
- WHEN 410 THEN
- '下单审批'
- WHEN 420 THEN
- '配船审批'
- END actId,
- item.bill_id AS billId,
- corp.f_name AS refno1,
- item.refno2,
- item.refno3,
- item.refno2 AS refno4,
- item.bill_no AS billNo,
- us.user_id AS userId,
- item.audit_item,
- item.audit_user_id AS auditUserId,
- CASE
- item.audit_status
- WHEN 'O' THEN
- '提交'
- WHEN 'N' THEN
- '未知状态'
- WHEN 'S' THEN
- '待审'
- WHEN 'B' THEN
- '审核退回'
- WHEN 'A' THEN
- '审核通过'
- END audit,
- item.send_user_id AS sendUserId,
- item.send_name AS sendName,
- usr.user_name AS auditUserName,
- usr.nick_name AS nickName,
- item.send_time AS sendTime,
- item.audit_op_time AS auditOpTime,
- item.bill_time AS billTime,
- <if test="refno2 == 'SQ' or refno2 == 'CK' or refno2 == 'RK' or refno2 == 'XS' ">
- tw.f_money As monry,
- </if>
- item.audit_msg AS auditMsg
- FROM
- audit_items item
- LEFT JOIN t_corps corp ON corp.f_id = item.refno1
- LEFT JOIN audit_items_users us ON us.pid = item.id
- LEFT JOIN sys_user usr ON usr.user_id = item.audit_user_id
- <if test="refno2 == 'SQ' or refno2 == 'CK' or refno2 == 'RK' or refno2 == 'XS' ">
- LEFT JOIN t_warehousebills tw ON item.bill_id = tw.f_id
- </if>
- where
- 1=1
- <if test="billNo != null and billNo != ''">and item.bill_no = #{billNo}</if>
- <if test="actId != null and actId != ''">and item.act_id = #{actId}</if>
- <if test="refno3 != null and refno3 != ''">and item.refno3 = #{refno3}</if>
- <if test="auditStatus != null and auditStatus != ''">and item.audit_status = #{auditStatus} and us.audit_status = #{auditStatus} </if>
- <if test="refno2 != null and refno2 != ''">and item.refno2 = #{refno2}</if>
- <if test="billId != null and billId != ''">and item.bill_id like concat('%', #{billId}, '%')</if>
- <if test="refno1 != null and refno1 != ''">and corp.f_name like concat('%', #{refno1}, '%')</if>
- <if test="sendUserId != null">and item.send_user_id = #{sendUserId}
- </if>
- <if test="auditUserId != null">and item.audit_user_id = #{auditUserId}</if>
- <if test="billTime != null and billTime != ''">and item.bill_time = #{billTime}</if>
- <if test="auditUserId != null">AND us.user_id = #{auditUserId}</if>
- <if test='sendTimeList != null and sendTimeList[0] != null and sendTimeList[0]!= ""'>
- and item.send_time >= #{sendTimeList[0]}
- </if>
- <if test='sendTimeList != null and sendTimeList[1] != null and sendTimeList[1]!= ""'>
- and item.send_time <= #{sendTimeList[1]}
- </if>
- <if test='auditOpTimeList != null and auditOpTimeList[0] != null and auditOpTimeList[0]!= ""'>
- and item.audit_op_time >= #{auditOpTimeList[0]}
- </if>
- <if test='auditOpTimeList != null and auditOpTimeList[1] != null and auditOpTimeList[1]!= ""'>
- and item.audit_op_time <= #{auditOpTimeList[1]}
- </if>
- ORDER BY
- CONVERT(item.audit_status USING GBK) DESC,item.send_time DESC
- </select>
- <delete id="deleteUpLevelId" parameterType="com.ruoyi.approvalFlow.domain.AuditItems">
- DELETE
- item.*,
- userItem.*
- FROM audit_items item
- LEFT JOIN audit_items_users userItem ON userItem.pid = item.id
- WHERE item.id > #{id}
- AND item.bill_id = #{billId}
- AND item.level_id > #{levelId}
- </delete>
- <select id="selectWarehouseApprover" parameterType="com.ruoyi.approvalFlow.domain.AuditItems" resultType="Map">
- SELECT aud.id,
- us.user_name AS userName,
- us.nick_name AS nickName,
- aud.audit_status AS auditStatus,
- aud.audit_msg AS auditMsg,
- aud.audit_item AS auditItem,
- aud.audit_op_time AS auditOpTime,
- aud.bill_time AS billTime
- FROM audit_items aud
- LEFT JOIN sys_user us ON us.user_id = aud.audit_user_id
- WHERE aud.act_id = #{actId}
- AND aud.bill_id = #{id}
- </select>
- <delete id="deletePurchaseApproval" parameterType="com.ruoyi.approvalFlow.domain.AuditItems">
- DELETE item, userItem
- FROM audit_items item
- LEFT JOIN audit_items_users userItem ON userItem.pid = item.id
- WHERE item.act_id = #{actId}
- AND item.level_id >= 0
- AND item.bill_id = #{billId}
- </delete>
- <update id="updateAuditStatus" parameterType="com.ruoyi.approvalFlow.domain.AuditItems">
- UPDATE audit_items it
- LEFT JOIN audit_items_users us ON us.pid = it.id
- SET it.audit_status = 'S',
- us.audit_status = 'S'
- WHERE it.level_id = #{levelId}
- AND it.bill_no = #{billNo}
- AND it.bill_id = #{billId}
- AND it.act_id = #{actId}
- AND it.audit_status = "N"
- </update>
- <select id="selectOrderAuditItems" parameterType="AuditItems" resultType="Map">
- SELECT
- item.id,
- CASE
- item.act_id
- WHEN 410 THEN
- '下单审批'
- WHEN 420 THEN
- '配船审批'
- END actId,
- item.bill_id AS billId,
- corp.f_name AS refno1,
- item.refno2,
- item.refno3,
- item.refno2 AS refno4,
- item.bill_no AS billNo,
- us.user_id AS userId,
- item.audit_item,
- item.audit_user_id AS auditUserId,
- CASE
- item.audit_status
- WHEN 'O' THEN
- '提交'
- WHEN 'N' THEN
- '未知状态'
- WHEN 'S' THEN
- '待审'
- WHEN 'B' THEN
- '审核退回'
- WHEN 'A' THEN
- '审核通过'
- END audit,
- item.send_user_id AS sendUserId,
- item.send_name AS sendName,
- usr.user_name AS auditUserName,
- usr.nick_name AS nickName,
- item.send_time AS sendTime,
- item.audit_op_time AS auditOpTime,
- item.bill_time AS billTime,
- <if test="refno2 == 'SQ' or refno2 == 'CK' or refno2 == 'RK' or refno2 == 'XS' ">
- tw.f_money As monry,
- tw.f_bsdate fBsdate,
- tp.f_name projectName,
- </if>
- item.audit_msg AS auditMsg
- FROM
- audit_items item
- LEFT JOIN t_corps corp ON corp.f_id = item.refno1
- LEFT JOIN audit_items_users us ON us.pid = item.id
- LEFT JOIN sys_user usr ON usr.user_id = item.audit_user_id
- <if test="refno2 == 'SQ' or refno2 == 'CK' or refno2 == 'RK' or refno2 == 'XS' ">
- LEFT JOIN t_warehousebills tw ON item.bill_id = tw.f_id
- LEFT JOIN t_project tp ON tp.f_id = tw.f_goodsid
- </if>
- where
- 1=1
- <if test="billNo != null and billNo != ''">and item.bill_no = #{billNo}</if>
- <if test="actId != null and actId != ''">and item.act_id = #{actId}</if>
- <if test="refno3 != null and refno3 != ''">and item.refno3 = #{refno3}</if>
- <if test="auditStatus != null and auditStatus != ''">and item.audit_status = #{auditStatus} and us.audit_status = #{auditStatus} </if>
- <if test="refno2 != null and refno2 != ''">and item.refno2 = #{refno2}</if>
- <if test="billId != null and billId != ''">and item.bill_id like concat('%', #{billId}, '%')</if>
- <if test="refno1 != null and refno1 != ''">and corp.f_name like concat('%', #{refno1}, '%')</if>
- <if test="sendUserId != null">and item.send_user_id = #{sendUserId}
- </if>
- <if test="auditUserId != null">and item.audit_user_id = #{auditUserId}</if>
- <if test="billTime != null">and item.bill_time = #{billTime}</if>
- <if test="auditUserId != null">AND us.user_id = #{auditUserId}</if>
- <if test="sendTimeList != null and (refno2 == 'SQ' or refno2 == 'CK' or refno2 == 'RK' or refno2 == 'XS') and sendTimeList[0] != null and sendTimeList[0]!= ''">
- and tw.f_bsdate >= #{sendTimeList[0]}
- </if>
- <if test="sendTimeList != null and sendTimeList[1] != null and sendTimeList[1]!= '' and (refno2 == 'SQ' or refno2 == 'CK' or refno2 == 'RK' or refno2 == 'XS')">
- and tw.f_bsdate <= #{sendTimeList[1]}
- </if>
- <if test='auditOpTimeList != null and auditOpTimeList[0] != null and auditOpTimeList[0]!= ""'>
- and item.audit_op_time >= #{auditOpTimeList[0]}
- </if>
- <if test='auditOpTimeList != null and auditOpTimeList[1] != null and auditOpTimeList[1]!= ""'>
- and item.audit_op_time <= #{auditOpTimeList[1]}
- </if>
- ORDER BY
- CONVERT(item.audit_status USING GBK) DESC,item.send_time DESC
- </select>
- <select id="selectAuditItemsUser" parameterType="AuditItems" resultMap="AuditItemsResult">
- <include refid="selectAuditItemsVo"/>
- <where>
- <if test="billNo != null and billNo != ''">and bill_no = #{billNo}</if>
- <if test="billId != null ">and bill_id = #{billId}</if>
- <if test="actId != null ">and act_id = #{actId}</if>
- <if test="pathId != null ">and path_id = #{pathId}</if>
- <if test="levelId != null ">and level_id = #{levelId}</if>
- <if test="refno1 != null and refno1 != ''">and refno1 = #{refno1}</if>
- <if test="iffinalItem != null and iffinalItem != ''">and iffinal_item = #{iffinalItem}</if>
- <if test="refno2 != null and refno2 != ''">and refno2 = #{refno2}</if>
- <if test="refno3 != null and refno3 != ''">and refno3 = #{refno3}</if>
- <if test="branchId != null ">and branch_id = #{branchId}</if>
- <if test="sendUserId != null ">and send_user_id = #{sendUserId}</if>
- <if test="sendName != null and sendName != ''">and send_name like concat('%', #{sendName}, '%')</if>
- <if test="sendTime != null ">and send_time = #{sendTime}</if>
- <if test="sendMsg != null and sendMsg != ''">and send_msg = #{sendMsg}</if>
- <if test="auditUserId != null ">and audit_user_id = #{auditUserId}</if>
- <if test="auditItem != null ">and audit_item = #{auditItem}</if>
- <if test="auditOpTime != null ">and audit_op_time = #{auditOpTime}</if>
- <if test="auditMsg != null and auditMsg != ''">and audit_msg = #{auditMsg}</if>
- <if test="auditStatus != null and auditStatus != ''">and audit_status = #{auditStatus}</if>
- <if test="billTime != null ">and bill_time = #{billTime},</if>
- </where>
- ORDER BY level_id ASC
- </select>
- </mapper>
|