“djh”
4 days ago 9abc6588d464269024d3e680b98cfd71e2acc84e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?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.gkhy.exam.system.mapper.ContractReviewMapper">
    <update id="updateByUserid">
        update contract_review set status = 1 ,suggest=#{suggest} where id = #{id} and legal_person = #{legalPerson}
    </update>
 
    <select id="selectReviewList" resultType="com.gkhy.exam.system.domain.ContractReview">
        SELECT
            cr.`id`,
            cr.`company_id`,
            cr.`type`,
            cr.`contract_id`,
            cl.contract_name,
            cl.number,
            cl.sign_date,
            cr.`record_time`,
            cr.`registrant_id`,
            su1.`name` as registrant_name,
            cr.`customer_name`,
            cr.`customer_user`,
            cr.`costomer_phone`,
            cr.`delivery_time`,
            cr.`delivery_addr`,
            cr.`delivery_type`,
            cr.`pay_type`,
            cr.`product_mess`,
            cr.`risk_mess`,
            cr.`suggest`,
            cr.`legal_person`,
            su2.`name` as legal_name,
            cr.`legal_time`,
            cr.`del_flag`,
            cr.`create_by`,
            cr.`create_time`,
            cr.`update_by`,
            cr.`update_time`,
            cr.`file_name`,
            cr.`file_path`,
            cr.`status`
        FROM
            `contract_review` cr
                LEFT JOIN sys_company sc ON cr.company_id = sc.id
                LEFT JOIN sys_user su1 ON cr.registrant_id = su1.id
                LEFT JOIN sys_user su2 ON cr.legal_person = su2.id
                LEFT JOIN contract_ledger cl ON cr.contract_id = cl.id
        WHERE
            cr.del_flag = 1
        <if test="companyId!=null">
            and cr.company_id =#{companyId}
        </if>
        <if test="status !=null">
            and cr.status = #{status}
        </if>
        <if test="type!=null">
            and cr.type = #{type}
        </if>
        ORDER BY
            cr.create_time DESC
    </select>
    <select id="selectByContractId" resultType="java.lang.Integer">
        select count(*) from contract_review where contract_id =#{contractId} and type = 1
    </select>
    <select id="selectByUserId" resultType="com.gkhy.exam.system.domain.vo.ContractReviewVo">
        SELECT
            cr.`id`,
            cr.`type`,
            cl.`contract_name`,
            cr.`file_name`,
            cr.`file_path`
        FROM
            `contract_review` cr
                LEFT JOIN contract_ledger cl ON cr.contract_id = cl.id
                LEFT JOIN contract_review_mess crm ON cr.id = crm.review_id
        WHERE
            cr.`status` = 0
          AND cr.del_flag = 1
          AND (
                    crm.review_user = #{userId}
                AND crm.`status` = 0)
    </select>
    <select id="selectByUserIdMain" resultType="com.gkhy.exam.system.domain.vo.ContractReviewVo">
        SELECT
            cr.`id`,
            cr.`type`,
            cl.`contract_name`,
            cr.`file_name`,
            cr.`file_path`
        FROM
            `contract_review` cr
                LEFT JOIN contract_ledger cl ON cr.contract_id = cl.id
                LEFT JOIN contract_review_mess crm ON cr.id = crm.review_id
        WHERE
            cr.`status` = 0
          AND cr.del_flag = 1
          and cr.legal_person = #{userId}
    </select>
</mapper>