Authored by qianjun

update

@@ -36,27 +36,57 @@ @@ -36,27 +36,57 @@
36 </select> 36 </select>
37 37
38 ``` 38 ```
39 -## 根据品牌id获取可用分类或根据品牌id和JIT供应商ID获取可用分类 39 +## 1.根据品牌id获取非JIT供应商的可用分类
  40 +## 2.根据品牌id和JIT供应商ID获取可用分类
40 > 接口名: `/AgreementRest/getAllSortByBrandId` 41 > 接口名: `/AgreementRest/getAllSortByBrandId`
41 42
42 ### 入参 43 ### 入参
43 ```json 44 ```json
44 { 45 {
45 "brandId":1550, 46 "brandId":1550,
46 -}  
47 -or  
48 -{  
49 - "brandId":1550,  
50 "supplierId":"1418" 47 "supplierId":"1418"
51 } 48 }
52 ``` 49 ```
53 ------------------------- 50 -------------------------
54 -|属性名称|类型|例子|说明|  
55 -|--------|----|----|----|  
56 -|brandId|int|1550|品牌ID|  
57 -|supplierId|String|1418|供应商ID(可选)|  
58 - 51 +|属性名称|类型|例子|说明|是否必填|长度限制|
  52 +|--------|----|----|----|----|----|
  53 +|brandId|int|1550|品牌ID|是|无|
  54 +|supplierId|String|1418|供应商ID|可选|无|
59 --------------------------- 55 ---------------------------
  56 +### 1. 对应SQL的操作库表(数据库 erp_supplier,表 clause_settlement)
  57 +```xml
  58 + <select id="selectByBrandId" resultMap="BaseResultMap" parameterType="java.lang.Short">
  59 + select
  60 + <include refid="Base_Column_List" />
  61 + from clause_settlement
  62 + where brand_id = #{brandId,jdbcType=SMALLINT}
  63 + </select>
  64 +```
  65 +### 2. 对应SQL的操作库表(数据库 erp_supplier, 表 agreement)
  66 +```xml
  67 +<select id="selectByAgreementIds" resultMap="BaseResultMap">
  68 + select
  69 + <include refid="Base_Column_List" />
  70 + from agreement where agreement_id in (${agreementIds})
  71 + and agreement_end_time > FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m-%d') and operations != 3 and `status` in (200,500,900)
  72 + and end_agreement = 'N' and business_model != 7
  73 +</select>
  74 +```
  75 +### 3. 对应SQL的操作库表(数据库 erp_supplier, 表 agreement)
  76 +```xml
  77 +<select id="selectByAgreementIdsAndSupplierId" resultMap="BaseResultMap">
  78 + select
  79 + <include refid="Base_Column_List" />
  80 + from agreement where agreement_id in (${agreementIds})
  81 + and agreement_end_time > FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m-%d') and operations != 3 and `status` in (200,500,900) and end_agreement = 'N'
  82 + and supplier_id=#{supplierId,jdbcType=INTEGER}
  83 + </select>
  84 +```
  85 +### 错误编码
  86 +-------------------------
  87 +|错误码code|消息|说明|
  88 +|----------|----|----|
  89 +|无|无|无|
60 90
61 ### 返回 91 ### 返回
62 92
@@ -64,9 +94,6 @@ or @@ -64,9 +94,6 @@ or
64 { 94 {
65 "code": 200, 95 "code": 200,
66 "data": [ 96 "data": [
67 - 1,  
68 - 1,  
69 - 1,  
70 1 97 1
71 ], 98 ],
72 "message": "可用分类" 99 "message": "可用分类"
@@ -84,12 +111,60 @@ or @@ -84,12 +111,60 @@ or
84 } 111 }
85 ``` 112 ```
86 ------------------------- 113 -------------------------
87 -|属性名称|类型|例子|说明|  
88 -|--------|----|----|----|  
89 -|brandId|int|1550|品牌ID|  
90 - 114 +|属性名称|类型|例子|说明|是否必填|长度限制|
  115 +|--------|----|----|----|----|----|
  116 +|brandId|int|1550|品牌ID|是|无|
91 --------------------------- 117 ---------------------------
92 - 118 +### 1. 对应SQL的操作库表(数据库 erp_supplier,表 clause_settlement)
  119 +```xml
  120 + <select id="selectByBrandId" resultMap="BaseResultMap" parameterType="java.lang.Short">
  121 + select
  122 + <include refid="Base_Column_List" />
  123 + from clause_settlement
  124 + where brand_id = #{brandId,jdbcType=SMALLINT}
  125 + </select>
  126 +```
  127 +### 2. 对应SQL的操作库表(数据库 erp_supplier,表 agreement)
  128 +```xml
  129 + <select id="selectValidJitSupplierByAgreementId" resultMap="BaseResultMap">
  130 + <bind name="size" value="@com.yohobuy.platform.common.util.SqlUtils@getSize(agreementIds)" />
  131 + select <include refid="Base_Column_List" />
  132 + from agreement
  133 + <where>
  134 + <if test="agreementIds !=null and size!=0">
  135 + agreement_id in
  136 + <foreach collection="agreementIds" item="agreementId" open="(" separator="," close=")">
  137 + #{agreementId}
  138 + </foreach>
  139 + </if>
  140 + and agreement_end_time > FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m-%d') and
  141 + operations != 3 and `status` in (200,500,900) and end_agreement = 'N' and business_model = 7
  142 + </where>
  143 + </select>
  144 +```
  145 +### 3. 对应SQL的操作库表(数据库 erp_supplier,表 supplier)
  146 +```xml
  147 + <select id="selectBySupplierIds" resultMap="BaseResultMap">
  148 + <bind name="size" value="@com.yohobuy.platform.common.util.SqlUtils@getSize(supplierIds)" />
  149 + select
  150 + <include refid="Base_Column_List" />
  151 + from supplier
  152 + where is_freeze = 'N'
  153 + <if test="supplierIds !=null and size!=0">
  154 + and id in
  155 + <foreach collection="supplierIds" item="supplierId" open="(" close=")" separator=",">
  156 + #{supplierId,jdbcType=INTEGER}
  157 + </foreach>
  158 + </if>
  159 + </select>
  160 +```
  161 +### 错误编码
  162 +-------------------------
  163 +|错误码code|消息|说明|
  164 +|----------|----|----|
  165 +|500|品牌无关联的jit供应商|合同结算条款没有|
  166 +|500|品牌无关联的jit供应商|合同没有|
  167 +|200|品牌关联的jit供应商||
93 ### 返回 168 ### 返回
94 169
95 ```json 170 ```json