123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <?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.jsh.erp.datasource.mappers.AuditMapper">
- <select id="pendingApprovalList" parameterType="com.jsh.erp.datasource.dto.AuditQueryDTO" resultType="com.jsh.erp.datasource.vo.AuditVo">
- SELECT
- a.*,
- a.business_number AS 'number',
- u.username AS 'initiatorName',
- an.node_order
- FROM audit_node an
- LEFT JOIN audit a ON an.audit_id = a.id
- LEFT JOIN jsh_user u ON a.submit_user = u.id
- <where>
- an.auditor_user = #{uid} AND an.audit_result = 0 AND a.delete_flag = 0
- <if test="number != null and number != ''">
- AND a.business_number LIKE CONCAT('%',#{number},'%')
- </if>
- <if test="type != null and type != ''">
- AND a.type LIKE CONCAT('%',#{type},'%')
- </if>
- <if test="initiatorName != null and initiatorName != ''">
- AND u.username LIKE CONCAT('%',#{initiatorName},'%')
- </if>
- </where>
- ORDER BY a.submit_time DESC
- </select>
- <select id="processedApprovalList" parameterType="com.jsh.erp.datasource.dto.AuditQueryDTO" resultType="com.jsh.erp.datasource.vo.AuditVo">
- SELECT
- a.*,
- a.business_number AS 'number',
- an.audit_time,
- an.node_order,
- u.username AS 'initiatorName'
- FROM audit_node an
- LEFT JOIN audit a ON an.audit_id = a.id
- LEFT JOIN jsh_user u ON a.submit_user = u.id
- <where>
- an.auditor_user = #{uid} AND an.audit_result != 0 AND a.delete_flag = 0
- <if test="number != null and number != ''">
- AND a.business_number LIKE CONCAT('%',#{number},'%')
- </if>
- <if test="type != null and type != ''">
- AND a.type LIKE CONCAT('%',#{type},'%')
- </if>
- <if test="initiatorName != null and initiatorName != ''">
- AND u.username LIKE CONCAT('%',#{initiatorName},'%')
- </if>
- <if test="auditStatus != null">
- AND a.audit_status = #{auditStatus}
- </if>
- <if test="beginTime != null">
- AND an.audit_time >= #{beginTime}
- </if>
- <if test="endTime != null">
- AND an.audit_time <= #{endTime}
- </if>
- </where>
- ORDER BY an.audit_time DESC
- </select>
- <select id="myApprovalList" parameterType="com.jsh.erp.datasource.dto.AuditQueryDTO" resultType="com.jsh.erp.datasource.vo.AuditVo">
- SELECT
- a.*,
- a.business_number AS 'number',
- an.audit_time,
- an.node_order,
- u.username AS 'auditorName'
- FROM audit a
- LEFT JOIN (SELECT MAX(id) AS 'id',audit_id FROM audit_node GROUP BY audit_id) tb ON a.id = tb.audit_id
- LEFT JOIN audit_node an ON tb.id = an.id
- LEFT JOIN jsh_user u ON an.auditor_user = u.id
- <where>
- a.submit_user = #{uid} AND a.delete_flag = 0
- <if test="number != null and number != ''">
- AND a.business_number LIKE CONCAT('%',#{number},'%')
- </if>
- <if test="type != null and type != ''">
- AND a.type LIKE CONCAT('%',#{type},'%')
- </if>
- <if test="auditStatus != null">
- AND an.audit_result = #{auditStatus}
- </if>
- <if test="beginTime != null">
- AND an.audit_time >= #{beginTime}
- </if>
- <if test="endTime != null">
- AND an.audit_time <= #{endTime}
- </if>
- </where>
- ORDER BY a.submit_time DESC
- </select>
- <select id="pdaList" parameterType="com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO" resultType="com.jsh.erp.datasource.pda.vo.PDADepotHeadVO">
- SELECT
- dh.id,
- dh.number,
- dh.create_time,
- dh.goods_quantity,
- dh.goods_type_count,
- dh.oper_time,
- s.supplier AS supplier_name,
- dh.status,
- dh.receiver_address,
- dh.type,
- dh.oper_id,
- u.username AS 'operName'
- FROM audit_node an
- LEFT JOIN audit a ON an.audit_id = a.id
- LEFT JOIN jsh_depot_head dh ON a.business_id = dh.id
- LEFT JOIN jsh_supplier s ON dh.organ_id = s.id
- LEFT JOIN jsh_user u ON dh.oper_id = u.id
- <where>
- an.auditor_user = #{uid}
- AND (a.type = '采购' OR a.type = '销售')
- AND an.delete_flag = 0
- <if test="number != null and number != ''">
- AND dh.number like CONCAT('%',#{number},'%')
- </if>
- <if test="status != null and status != ''">
- AND dh.status = #{status}
- </if>
- <if test="beginTime != null and beginTime != ''">
- AND dh.create_time between #{beginTime} and #{endTime}
- </if>
- <if test="depotId != null and depotId !=0">
- AND dh.depot_id = #{depotId}
- </if>
- </where>
- GROUP BY dh.id
- ORDER BY dh.create_time DESC
- </select>
- </mapper>
|