Commit fb16c0154915103f6f7f9302f57d3b5692a2d1c5

Authored by 房远帅
1 parent 1b46a048

楚江ERP:查询客户组件新增来源字段(客户资信的排除已有客户资信的数据)

... ... @@ -28,4 +28,10 @@ public class QueryCustomerSelectorVo extends PageVo implements BaseVo, Serializa
28 28 */
29 29 @ApiModelProperty("状态")
30 30 private Boolean available;
  31 +
  32 + /**
  33 + * 来源
  34 + */
  35 + @ApiModelProperty("来源")
  36 + private String source;
31 37 }
... ...
... ... @@ -30,30 +30,30 @@
30 30
31 31 <sql id="CustomerDto_sql">
32 32 SELECT
33   - id,
34   - code,
35   - name,
36   - mnemonic_code,
37   - contact,
38   - telephone,
39   - email,
40   - zip_code,
41   - fax,
42   - city_id,
43   - address,
44   - settle_type,
45   - credit_code,
46   - tax_identify_no,
47   - bank_name,
48   - account_name,
49   - account_no,
50   - available,
51   - description,
52   - create_by,
53   - create_time,
54   - update_by,
55   - update_time
56   - FROM base_data_customer
  33 + c.id,
  34 + c.code,
  35 + c.name,
  36 + c.mnemonic_code,
  37 + c.contact,
  38 + c.telephone,
  39 + c.email,
  40 + c.zip_code,
  41 + c.fax,
  42 + c.city_id,
  43 + c.address,
  44 + c.settle_type,
  45 + c.credit_code,
  46 + c.tax_identify_no,
  47 + c.bank_name,
  48 + c.account_name,
  49 + c.account_no,
  50 + c.available,
  51 + c.description,
  52 + c.create_by,
  53 + c.create_time,
  54 + c.update_by,
  55 + c.update_time
  56 + FROM base_data_customer c
57 57 </sql>
58 58
59 59 <select id="query" resultMap="CustomerDto">
... ... @@ -61,17 +61,17 @@
61 61 <where>
62 62 <if test="vo != null">
63 63 <if test="vo.code != null and vo.code != ''">
64   - AND code like CONCAT('%', #{vo.code}, '%')
  64 + AND c.code like CONCAT('%', #{vo.code}, '%')
65 65 </if>
66 66 <if test="vo.name != null and vo.name != ''">
67   - AND name LIKE CONCAT('%', #{vo.name}, '%')
  67 + AND c.name LIKE CONCAT('%', #{vo.name}, '%')
68 68 </if>
69 69 <if test="vo.available != null">
70   - AND available = #{vo.available}
  70 + AND c.available = #{vo.available}
71 71 </if>
72 72 </if>
73 73 </where>
74   - ORDER BY code
  74 + ORDER BY c.code
75 75 </select>
76 76
77 77 <select id="getByName" resultMap="CustomerDto">
... ... @@ -91,16 +91,24 @@
91 91 <where>
92 92 <if test="vo != null">
93 93 <if test="vo.code != null and vo.code != ''">
94   - AND code = #{vo.code}
  94 + AND c.code = #{vo.code}
95 95 </if>
96 96 <if test="vo.name != null and vo.name != ''">
97   - AND name LIKE CONCAT('%', #{vo.name}, '%')
  97 + AND c.name LIKE CONCAT('%', #{vo.name}, '%')
98 98 </if>
99 99 <if test="vo.available != null">
100   - AND available = #{vo.available}
  100 + AND c.available = #{vo.available}
  101 + </if>
  102 + <if test="vo.source == 'CUSTOMER_CREDIT'">
  103 + AND NOT EXISTS (
  104 + SELECT 1
  105 + FROM customer_credit cc
  106 + WHERE cc.company_id = c.id
  107 + AND cc.status != 'CANCEL'
  108 + )
101 109 </if>
102 110 </if>
103 111 </where>
104   - ORDER BY code
  112 + ORDER BY c.code
105 113 </select>
106 114 </mapper>
... ...