瀏覽代碼

添加获取购物车中商品可用优惠券接口

zhh 6 年之前
父節點
當前提交
61a67c9aa9

+ 5 - 4
document/pdm/mall.pdb

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<?PowerDesigner AppLocale="UTF16" ID="{7BB41C87-EFE8-409A-A86E-B1C3FCE34F8C}" Label="" LastModificationDate="1535445127" Name="mall" Objects="1023" Symbols="127" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
+<?PowerDesigner AppLocale="UTF16" ID="{7BB41C87-EFE8-409A-A86E-B1C3FCE34F8C}" Label="" LastModificationDate="1535522371" Name="mall" Objects="1011" Symbols="127" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
 <!-- do not edit this file -->
 
 <Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@@ -11087,10 +11087,10 @@ LABL 0 新宋体,8,N</a:FontList>
 <a:Code>platform</a:Code>
 <a:CreationDate>1522215086</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
-<a:ModificationDate>1522215279</a:ModificationDate>
+<a:ModificationDate>1535445907</a:ModificationDate>
 <a:Modifier>zhenghong</a:Modifier>
 <a:Comment>使用平台:0-&gt;全部;1-&gt;移动;2-&gt;PC</a:Comment>
-<a:DataType>varchar(1)</a:DataType>
+<a:DataType>int(1)</a:DataType>
 <a:Length>1</a:Length>
 </o:Column>
 <o:Column Id="o559">
@@ -11413,9 +11413,10 @@ LABL 0 新宋体,8,N</a:FontList>
 <a:Code>id</a:Code>
 <a:CreationDate>1522217090</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
-<a:ModificationDate>1522217131</a:ModificationDate>
+<a:ModificationDate>1535522371</a:ModificationDate>
 <a:Modifier>zhenghong</a:Modifier>
 <a:DataType>bigint</a:DataType>
+<a:Identity>1</a:Identity>
 <a:Column.Mandatory>1</a:Column.Mandatory>
 </o:Column>
 <o:Column Id="o583">

+ 82 - 70
document/pdm/mall.pdm

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<?PowerDesigner AppLocale="UTF16" ID="{7BB41C87-EFE8-409A-A86E-B1C3FCE34F8C}" Label="" LastModificationDate="1535445907" Name="mall" Objects="1023" Symbols="127" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
+<?PowerDesigner AppLocale="UTF16" ID="{7BB41C87-EFE8-409A-A86E-B1C3FCE34F8C}" Label="" LastModificationDate="1535530961" Name="mall" Objects="1023" Symbols="127" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
 <!-- do not edit this file -->
 
 <Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@@ -11413,9 +11413,10 @@ LABL 0 新宋体,8,N</a:FontList>
 <a:Code>id</a:Code>
 <a:CreationDate>1522217090</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
-<a:ModificationDate>1522217131</a:ModificationDate>
+<a:ModificationDate>1535522371</a:ModificationDate>
 <a:Modifier>zhenghong</a:Modifier>
 <a:DataType>bigint</a:DataType>
+<a:Identity>1</a:Identity>
 <a:Column.Mandatory>1</a:Column.Mandatory>
 </o:Column>
 <o:Column Id="o583">
@@ -15439,7 +15440,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <a:Code>oms_cart_item</a:Code>
 <a:CreationDate>1533108597</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
-<a:ModificationDate>1533172443</a:ModificationDate>
+<a:ModificationDate>1535530955</a:ModificationDate>
 <a:Modifier>zhenghong</a:Modifier>
 <a:Comment>购物车表</a:Comment>
 <a:TotalSavingCurrency/>
@@ -15641,9 +15642,20 @@ LABL 0 新宋体,8,N</a:FontList>
 <a:DataType>int(1)</a:DataType>
 <a:Length>1</a:Length>
 </o:Column>
+<o:Column Id="o904">
+<a:ObjectID>9C9C2AC9-F58B-4D31-BEF4-1D1892931E51</a:ObjectID>
+<a:Name>product_category_id</a:Name>
+<a:Code>product_category_id</a:Code>
+<a:CreationDate>1535530934</a:CreationDate>
+<a:Creator>zhenghong</a:Creator>
+<a:ModificationDate>1535530961</a:ModificationDate>
+<a:Modifier>zhenghong</a:Modifier>
+<a:Comment>商品的分类</a:Comment>
+<a:DataType>bigint</a:DataType>
+</o:Column>
 </c:Columns>
 <c:Keys>
-<o:Key Id="o904">
+<o:Key Id="o905">
 <a:ObjectID>29D735B7-E618-4C13-AF03-3858C68E6BA4</a:ObjectID>
 <a:Name>Key_1</a:Name>
 <a:Code>Key_1</a:Code>
@@ -15657,7 +15669,7 @@ LABL 0 新宋体,8,N</a:FontList>
 </o:Key>
 </c:Keys>
 <c:PrimaryKey>
-<o:Key Ref="o904"/>
+<o:Key Ref="o905"/>
 </c:PrimaryKey>
 </o:Table>
 </c:Tables>
@@ -15683,7 +15695,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o321"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o905">
+<o:ReferenceJoin Id="o906">
 <a:ObjectID>5236F74C-2761-4AC4-834A-BECC5D040393</a:ObjectID>
 <a:CreationDate>1521706257</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -15719,7 +15731,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o906">
+<o:ReferenceJoin Id="o907">
 <a:ObjectID>6EE78803-E5F6-4090-B810-7BBF7814F60C</a:ObjectID>
 <a:CreationDate>1521710488</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -15755,7 +15767,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o907">
+<o:ReferenceJoin Id="o908">
 <a:ObjectID>84F722B4-DF57-4BC3-88FD-B249B70D21A7</a:ObjectID>
 <a:CreationDate>1521770349</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -15791,7 +15803,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o908">
+<o:ReferenceJoin Id="o909">
 <a:ObjectID>0309D83E-51C3-4973-A636-9FEB27F4A6B6</a:ObjectID>
 <a:CreationDate>1521771362</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -15827,7 +15839,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o368"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o909">
+<o:ReferenceJoin Id="o910">
 <a:ObjectID>7B820697-9FFD-4446-B6DF-F03F4F02FFE3</a:ObjectID>
 <a:CreationDate>1521773101</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -15863,7 +15875,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o377"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o910">
+<o:ReferenceJoin Id="o911">
 <a:ObjectID>13DDC5F6-372D-47FF-AAFA-8AEF349E7FA8</a:ObjectID>
 <a:CreationDate>1521783613</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -15899,7 +15911,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o911">
+<o:ReferenceJoin Id="o912">
 <a:ObjectID>31ADEBC6-F176-41A7-8EAA-9AC3B8A253AB</a:ObjectID>
 <a:CreationDate>1521791466</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -15935,7 +15947,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o912">
+<o:ReferenceJoin Id="o913">
 <a:ObjectID>F2B169B3-7AC8-4FB1-822D-E1C91DFF6FFD</a:ObjectID>
 <a:CreationDate>1521792428</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -15971,7 +15983,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o913">
+<o:ReferenceJoin Id="o914">
 <a:ObjectID>00AD7B43-F4CA-45D7-86BB-5756B4ED55BD</a:ObjectID>
 <a:CreationDate>1521792909</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16007,7 +16019,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o399"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o914">
+<o:ReferenceJoin Id="o915">
 <a:ObjectID>286E06C6-6FAD-4323-82D9-6FB781153C46</a:ObjectID>
 <a:CreationDate>1522045168</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16043,7 +16055,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o399"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o915">
+<o:ReferenceJoin Id="o916">
 <a:ObjectID>A2161167-D453-4661-9BF0-71D8908A6C42</a:ObjectID>
 <a:CreationDate>1522046100</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16079,7 +16091,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o916">
+<o:ReferenceJoin Id="o917">
 <a:ObjectID>E25FF0B6-41E2-4801-8FE9-337EF9B991F7</a:ObjectID>
 <a:CreationDate>1522046451</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16115,7 +16127,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o412"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o917">
+<o:ReferenceJoin Id="o918">
 <a:ObjectID>1E64FE44-48BA-49B0-BDE1-66DA22B89EFF</a:ObjectID>
 <a:CreationDate>1522046456</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16151,7 +16163,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o437"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o918">
+<o:ReferenceJoin Id="o919">
 <a:ObjectID>DEE74089-6A6D-4D7E-BADD-76E4D08EFA2D</a:ObjectID>
 <a:CreationDate>1522112691</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16187,7 +16199,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o919">
+<o:ReferenceJoin Id="o920">
 <a:ObjectID>5D44A212-AD69-4958-BAAF-9E16ED63FC67</a:ObjectID>
 <a:CreationDate>1522112694</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16223,7 +16235,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o368"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o920">
+<o:ReferenceJoin Id="o921">
 <a:ObjectID>ECA8F78C-7015-44EB-9CD2-F72634D7F4BD</a:ObjectID>
 <a:CreationDate>1522114406</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16259,7 +16271,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o368"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o921">
+<o:ReferenceJoin Id="o922">
 <a:ObjectID>32BD37D4-4436-4069-9BD1-90CF0B1867E0</a:ObjectID>
 <a:CreationDate>1522115961</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16295,7 +16307,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o412"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o922">
+<o:ReferenceJoin Id="o923">
 <a:ObjectID>1A23B754-71EE-4496-B70F-0A3268C6F651</a:ObjectID>
 <a:CreationDate>1522115983</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16331,7 +16343,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o923">
+<o:ReferenceJoin Id="o924">
 <a:ObjectID>1C883E67-84F9-4CD0-A4F5-D7CA2BE15DC5</a:ObjectID>
 <a:CreationDate>1522118676</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16367,7 +16379,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o461"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o924">
+<o:ReferenceJoin Id="o925">
 <a:ObjectID>1CE2FCCB-DF37-4C88-99DD-FA8C3EE7A09C</a:ObjectID>
 <a:CreationDate>1522119056</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16403,7 +16415,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o476"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o925">
+<o:ReferenceJoin Id="o926">
 <a:ObjectID>7D8DC4F2-D0A4-4CE9-B03E-44AE166786C0</a:ObjectID>
 <a:CreationDate>1522120295</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16439,7 +16451,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o496"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o926">
+<o:ReferenceJoin Id="o927">
 <a:ObjectID>7CB99F50-753B-4347-B896-1F18D8FE6691</a:ObjectID>
 <a:CreationDate>1522138613</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16475,7 +16487,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o927">
+<o:ReferenceJoin Id="o928">
 <a:ObjectID>EC89DA87-A575-4940-973B-665854268261</a:ObjectID>
 <a:CreationDate>1522138618</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16511,7 +16523,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o507"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o928">
+<o:ReferenceJoin Id="o929">
 <a:ObjectID>8E1A22EC-2246-48C4-A499-3D8A4D264C09</a:ObjectID>
 <a:CreationDate>1522138705</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16547,7 +16559,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o430"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o929">
+<o:ReferenceJoin Id="o930">
 <a:ObjectID>2EA7348D-C8E8-4FCC-8215-01FE3AD58DFB</a:ObjectID>
 <a:CreationDate>1522141157</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16583,7 +16595,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o496"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o930">
+<o:ReferenceJoin Id="o931">
 <a:ObjectID>8B858AAC-D00A-42FE-BEDC-73536876C045</a:ObjectID>
 <a:CreationDate>1522141232</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16619,7 +16631,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o530"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o931">
+<o:ReferenceJoin Id="o932">
 <a:ObjectID>FC3A22FE-FD24-4DF0-BAC8-22659D3C8987</a:ObjectID>
 <a:CreationDate>1522141317</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16655,7 +16667,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o546"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o932">
+<o:ReferenceJoin Id="o933">
 <a:ObjectID>14DB9C0C-F9F0-4D4A-B44E-592028F6E75A</a:ObjectID>
 <a:CreationDate>1522142006</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16691,7 +16703,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o573"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o933">
+<o:ReferenceJoin Id="o934">
 <a:ObjectID>15304E84-71AA-40B1-84CB-904384B34B25</a:ObjectID>
 <a:CreationDate>1522215975</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16727,7 +16739,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o934">
+<o:ReferenceJoin Id="o935">
 <a:ObjectID>457237AD-87EB-4A09-BA9F-36198B10D2FF</a:ObjectID>
 <a:CreationDate>1522216015</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16763,7 +16775,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o573"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o935">
+<o:ReferenceJoin Id="o936">
 <a:ObjectID>3C2E5F27-A07C-4D88-9357-089D36122A25</a:ObjectID>
 <a:CreationDate>1522216251</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16799,7 +16811,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o368"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o936">
+<o:ReferenceJoin Id="o937">
 <a:ObjectID>A8FA4798-0F1E-4D96-A254-77F5D71F6BBD</a:ObjectID>
 <a:CreationDate>1522216380</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16835,7 +16847,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o573"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o937">
+<o:ReferenceJoin Id="o938">
 <a:ObjectID>5026171A-4B51-4B83-A113-4051F1E4F415</a:ObjectID>
 <a:CreationDate>1522220508</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16871,7 +16883,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o938">
+<o:ReferenceJoin Id="o939">
 <a:ObjectID>462222B9-A203-4D60-A353-A168356E3140</a:ObjectID>
 <a:CreationDate>1522220546</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16907,7 +16919,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o321"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o939">
+<o:ReferenceJoin Id="o940">
 <a:ObjectID>BD28F911-4F98-4C9D-9171-E99F60476E2A</a:ObjectID>
 <a:CreationDate>1522224364</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16943,7 +16955,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o940">
+<o:ReferenceJoin Id="o941">
 <a:ObjectID>8D1675C9-7749-4831-A5E6-ACD971AACF57</a:ObjectID>
 <a:CreationDate>1522225874</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -16979,7 +16991,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o941">
+<o:ReferenceJoin Id="o942">
 <a:ObjectID>B30347B3-4138-4EA8-A0F5-EF0D9A34E01F</a:ObjectID>
 <a:CreationDate>1522226077</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17015,7 +17027,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o496"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o942">
+<o:ReferenceJoin Id="o943">
 <a:ObjectID>7D29D8DF-7EF1-4F43-928F-DDAC96A23858</a:ObjectID>
 <a:CreationDate>1522226272</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17051,7 +17063,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o655"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o943">
+<o:ReferenceJoin Id="o944">
 <a:ObjectID>EB0A7FB4-285A-4D5D-BC1D-E9B299069C1F</a:ObjectID>
 <a:CreationDate>1522301998</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17087,7 +17099,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o944">
+<o:ReferenceJoin Id="o945">
 <a:ObjectID>942BBD31-85B8-46EA-893C-CB327C86F5BA</a:ObjectID>
 <a:CreationDate>1522303390</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17123,7 +17135,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o945">
+<o:ReferenceJoin Id="o946">
 <a:ObjectID>1E5174EE-C0B0-4144-98D5-679634DCCAEE</a:ObjectID>
 <a:CreationDate>1522303410</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17159,7 +17171,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o669"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o946">
+<o:ReferenceJoin Id="o947">
 <a:ObjectID>BD55704C-3F36-44CC-90E1-143F097FA894</a:ObjectID>
 <a:CreationDate>1522304178</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17195,7 +17207,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o690"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o947">
+<o:ReferenceJoin Id="o948">
 <a:ObjectID>17EC5CAA-580C-493D-9C2D-2EA3E9732A78</a:ObjectID>
 <a:CreationDate>1522386868</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17231,7 +17243,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o948">
+<o:ReferenceJoin Id="o949">
 <a:ObjectID>F469B162-D88C-42A3-B64C-7B2751A4FCE1</a:ObjectID>
 <a:CreationDate>1522387461</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17267,7 +17279,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o368"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o949">
+<o:ReferenceJoin Id="o950">
 <a:ObjectID>1D18BF30-4375-4618-A1C9-6DC998F248E4</a:ObjectID>
 <a:CreationDate>1522387526</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17303,7 +17315,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o950">
+<o:ReferenceJoin Id="o951">
 <a:ObjectID>183F9969-663E-4842-ABC2-C938F02C05E4</a:ObjectID>
 <a:CreationDate>1522389232</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17339,7 +17351,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o951">
+<o:ReferenceJoin Id="o952">
 <a:ObjectID>AC355266-228D-4333-8E95-D13F2D176DB4</a:ObjectID>
 <a:CreationDate>1522390434</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17375,7 +17387,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o952">
+<o:ReferenceJoin Id="o953">
 <a:ObjectID>3A358827-AE90-4AC6-80E6-CA340D69F7F2</a:ObjectID>
 <a:CreationDate>1522390644</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17411,7 +17423,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o953">
+<o:ReferenceJoin Id="o954">
 <a:ObjectID>B0F12E0B-F2E6-40A6-AD2B-9FE858AAA8BE</a:ObjectID>
 <a:CreationDate>1522391366</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17447,7 +17459,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o735"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o954">
+<o:ReferenceJoin Id="o955">
 <a:ObjectID>F46C48A9-78A1-4C9A-BD75-DE0ED230A76D</a:ObjectID>
 <a:CreationDate>1522391379</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17483,7 +17495,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o955">
+<o:ReferenceJoin Id="o956">
 <a:ObjectID>711AD4D5-212E-4E3B-BB26-DB79C4BE4E52</a:ObjectID>
 <a:CreationDate>1522396648</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17519,7 +17531,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o956">
+<o:ReferenceJoin Id="o957">
 <a:ObjectID>094B7BE5-D0AB-4987-8D74-508A27D3117F</a:ObjectID>
 <a:CreationDate>1522396864</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17555,7 +17567,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o957">
+<o:ReferenceJoin Id="o958">
 <a:ObjectID>8C15D427-62A0-40E7-9B02-84063CC6EB94</a:ObjectID>
 <a:CreationDate>1522659209</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17591,7 +17603,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o814"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o958">
+<o:ReferenceJoin Id="o959">
 <a:ObjectID>043B7E7F-6688-42FD-BECE-3A4CE5A560F2</a:ObjectID>
 <a:CreationDate>1522660753</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17627,7 +17639,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o959">
+<o:ReferenceJoin Id="o960">
 <a:ObjectID>3592DAA0-2C95-48CF-9359-C157A0E27DC3</a:ObjectID>
 <a:CreationDate>1522660820</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17663,7 +17675,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o690"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o960">
+<o:ReferenceJoin Id="o961">
 <a:ObjectID>BEE8D279-8DBF-40B3-899D-5B07570D0AD9</a:ObjectID>
 <a:CreationDate>1522721755</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17699,7 +17711,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o573"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o961">
+<o:ReferenceJoin Id="o962">
 <a:ObjectID>F5D0566A-35C3-4451-9C7D-782BC776C53E</a:ObjectID>
 <a:CreationDate>1522724329</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17735,7 +17747,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o814"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o962">
+<o:ReferenceJoin Id="o963">
 <a:ObjectID>3AA8813B-9363-406A-91DF-4AD16E9C3CCA</a:ObjectID>
 <a:CreationDate>1522725331</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17771,7 +17783,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o814"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o963">
+<o:ReferenceJoin Id="o964">
 <a:ObjectID>DD05624A-7E08-4273-9758-C5EDA1A03134</a:ObjectID>
 <a:CreationDate>1522733188</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17807,7 +17819,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o881"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o964">
+<o:ReferenceJoin Id="o965">
 <a:ObjectID>EBF8A4B9-24B3-4D18-82FD-D12F847328C6</a:ObjectID>
 <a:CreationDate>1522745521</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17843,7 +17855,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o305"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o965">
+<o:ReferenceJoin Id="o966">
 <a:ObjectID>BA7665F0-D173-45C6-AFE8-3C93CF330D79</a:ObjectID>
 <a:CreationDate>1533109970</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17879,7 +17891,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o335"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o966">
+<o:ReferenceJoin Id="o967">
 <a:ObjectID>521484A5-B9C4-477D-8D45-97F7B15D7854</a:ObjectID>
 <a:CreationDate>1533115829</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17915,7 +17927,7 @@ LABL 0 新宋体,8,N</a:FontList>
 <o:Key Ref="o612"/>
 </c:ParentKey>
 <c:Joins>
-<o:ReferenceJoin Id="o967">
+<o:ReferenceJoin Id="o968">
 <a:ObjectID>FCADB7B3-0636-44C7-8AB4-067148971867</a:ObjectID>
 <a:CreationDate>1533115896</a:CreationDate>
 <a:Creator>zhenghong</a:Creator>
@@ -17932,7 +17944,7 @@ LABL 0 新宋体,8,N</a:FontList>
 </o:Reference>
 </c:References>
 <c:DefaultGroups>
-<o:Group Id="o968">
+<o:Group Id="o969">
 <a:ObjectID>48492A0F-63AD-4453-B46B-89915CC87545</a:ObjectID>
 <a:Name>PUBLIC</a:Name>
 <a:Code>PUBLIC</a:Code>
@@ -17943,7 +17955,7 @@ LABL 0 新宋体,8,N</a:FontList>
 </o:Group>
 </c:DefaultGroups>
 <c:TargetModels>
-<o:TargetModel Id="o969">
+<o:TargetModel Id="o970">
 <a:ObjectID>232AA7B8-E743-48F3-9530-102684B229BE</a:ObjectID>
 <a:Name>MySQL 5.0</a:Name>
 <a:Code>MYSQL50</a:Code>

+ 8 - 0
mall-admin/src/main/java/com/macro/mall/controller/SmsCouponController.java

@@ -66,4 +66,12 @@ public class SmsCouponController {
         List<SmsCoupon> couponList = couponService.list(name,type,pageSize,pageNum);
         return new CommonResult().pageSuccess(couponList);
     }
+
+    @ApiOperation("获取单个优惠券的详细信息")
+    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+    @ResponseBody
+    public Object getItem(@PathVariable Long id) {
+        SmsCouponParam couponParam = couponService.getItem(id);
+        return new CommonResult().success(couponParam);
+    }
 }

+ 12 - 0
mall-admin/src/main/java/com/macro/mall/dao/SmsCouponDao.java

@@ -0,0 +1,12 @@
+package com.macro.mall.dao;
+
+import com.macro.mall.dto.SmsCouponParam;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 优惠券管理自定义查询Dao
+ * Created by macro on 2018/8/29.
+ */
+public interface SmsCouponDao {
+    SmsCouponParam getItem(@Param("id") Long id);
+}

+ 6 - 0
mall-admin/src/main/java/com/macro/mall/service/SmsCouponService.java

@@ -33,4 +33,10 @@ public interface SmsCouponService {
      * 分页获取优惠券列表
      */
     List<SmsCoupon> list(String name, Integer type, Integer pageSize, Integer pageNum);
+
+    /**
+     * 获取优惠券详情
+     * @param id 优惠券表id
+     */
+    SmsCouponParam getItem(Long id);
 }

+ 8 - 0
mall-admin/src/main/java/com/macro/mall/service/impl/SmsCouponServiceImpl.java

@@ -1,6 +1,7 @@
 package com.macro.mall.service.impl;
 
 import com.github.pagehelper.PageHelper;
+import com.macro.mall.dao.SmsCouponDao;
 import com.macro.mall.dao.SmsCouponProductCategoryRelationDao;
 import com.macro.mall.dao.SmsCouponProductRelationDao;
 import com.macro.mall.dto.SmsCouponParam;
@@ -31,6 +32,8 @@ public class SmsCouponServiceImpl implements SmsCouponService {
     private SmsCouponProductRelationDao productRelationDao;
     @Autowired
     private SmsCouponProductCategoryRelationDao productCategoryRelationDao;
+    @Autowired
+    private SmsCouponDao couponDao;
     @Override
     public int add(SmsCouponParam couponParam) {
         //插入优惠券表
@@ -112,4 +115,9 @@ public class SmsCouponServiceImpl implements SmsCouponService {
         PageHelper.startPage(pageNum,pageSize);
         return couponMapper.selectByExample(example);
     }
+
+    @Override
+    public SmsCouponParam getItem(Long id) {
+        return couponDao.getItem(id);
+    }
 }

+ 24 - 0
mall-admin/src/main/resources/dao/SmsCouponDao.xml

@@ -0,0 +1,24 @@
+<?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.macro.mall.dao.SmsCouponDao">
+    <resultMap id="couponItemParam" type="com.macro.mall.dto.SmsCouponParam" extends="com.macro.mall.mapper.SmsCouponMapper.BaseResultMap">
+        <collection property="productRelationList" columnPrefix="cpr_" resultMap="com.macro.mall.mapper.SmsCouponProductRelationMapper.BaseResultMap">
+        </collection>
+        <collection property="productCategoryRelationList" columnPrefix="cpcr_" resultMap="com.macro.mall.mapper.SmsCouponProductCategoryRelationMapper.BaseResultMap">
+        </collection>
+    </resultMap>
+    <select id="getItem" resultMap="couponItemParam">
+        SELECT
+            c.*,
+            cpr.id                   cpr_id,
+            cpr.product_id           cpr_product_id,
+            cpcr.id                  cpcr_id,
+            cpcr.product_category_id cpcr_product_category_id
+        FROM
+            sms_coupon c
+            LEFT JOIN sms_coupon_product_relation cpr ON c.id = cpr.coupon_id
+            LEFT JOIN sms_coupon_product_category_relation cpcr ON c.id = cpcr.coupon_id
+        WHERE
+            c.id = #{id}
+    </select>
+</mapper>

+ 16 - 0
mall-mbg/src/main/java/com/macro/mall/model/OmsCartItem.java

@@ -104,6 +104,13 @@ public class OmsCartItem implements Serializable {
      */
     private Integer deleteStatus;
 
+    /**
+     * 商品分类
+     *
+     * @mbggenerated
+     */
+    private Long productCategoryId;
+
     private static final long serialVersionUID = 1L;
 
     public Long getId() {
@@ -242,6 +249,14 @@ public class OmsCartItem implements Serializable {
         this.deleteStatus = deleteStatus;
     }
 
+    public Long getProductCategoryId() {
+        return productCategoryId;
+    }
+
+    public void setProductCategoryId(Long productCategoryId) {
+        this.productCategoryId = productCategoryId;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -265,6 +280,7 @@ public class OmsCartItem implements Serializable {
         sb.append(", createDate=").append(createDate);
         sb.append(", modifyDate=").append(modifyDate);
         sb.append(", deleteStatus=").append(deleteStatus);
+        sb.append(", productCategoryId=").append(productCategoryId);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 60 - 0
mall-mbg/src/main/java/com/macro/mall/model/OmsCartItemExample.java

@@ -1205,6 +1205,66 @@ public class OmsCartItemExample {
             addCriterion("delete_status not between", value1, value2, "deleteStatus");
             return (Criteria) this;
         }
+
+        public Criteria andProductCategoryIdIsNull() {
+            addCriterion("product_category_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdIsNotNull() {
+            addCriterion("product_category_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdEqualTo(Long value) {
+            addCriterion("product_category_id =", value, "productCategoryId");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdNotEqualTo(Long value) {
+            addCriterion("product_category_id <>", value, "productCategoryId");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdGreaterThan(Long value) {
+            addCriterion("product_category_id >", value, "productCategoryId");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("product_category_id >=", value, "productCategoryId");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdLessThan(Long value) {
+            addCriterion("product_category_id <", value, "productCategoryId");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdLessThanOrEqualTo(Long value) {
+            addCriterion("product_category_id <=", value, "productCategoryId");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdIn(List<Long> values) {
+            addCriterion("product_category_id in", values, "productCategoryId");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdNotIn(List<Long> values) {
+            addCriterion("product_category_id not in", values, "productCategoryId");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdBetween(Long value1, Long value2) {
+            addCriterion("product_category_id between", value1, value2, "productCategoryId");
+            return (Criteria) this;
+        }
+
+        public Criteria andProductCategoryIdNotBetween(Long value1, Long value2) {
+            addCriterion("product_category_id not between", value1, value2, "productCategoryId");
+            return (Criteria) this;
+        }
     }
 
     public static class Criteria extends GeneratedCriteria {

+ 20 - 5
mall-mbg/src/main/resources/com/macro/mall/mapper/OmsCartItemMapper.xml

@@ -19,6 +19,7 @@
     <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
     <result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate" />
     <result column="delete_status" jdbcType="INTEGER" property="deleteStatus" />
+    <result column="product_category_id" jdbcType="BIGINT" property="productCategoryId" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <where>
@@ -81,7 +82,7 @@
   <sql id="Base_Column_List">
     id, product_id, product_sku_id, member_id, quantity, price, sp1, sp2, sp3, product_pic, 
     product_name, product_sub_title, product_sku_code, member_nickname, create_date, 
-    modify_date, delete_status
+    modify_date, delete_status, product_category_id
   </sql>
   <select id="selectByExample" parameterType="com.macro.mall.model.OmsCartItemExample" resultMap="BaseResultMap">
     select
@@ -122,13 +123,13 @@
       sp2, sp3, product_pic, 
       product_name, product_sub_title, product_sku_code, 
       member_nickname, create_date, modify_date, 
-      delete_status)
+      delete_status, product_category_id)
     values (#{productId,jdbcType=BIGINT}, #{productSkuId,jdbcType=BIGINT}, #{memberId,jdbcType=BIGINT}, 
       #{quantity,jdbcType=INTEGER}, #{price,jdbcType=DECIMAL}, #{sp1,jdbcType=VARCHAR}, 
       #{sp2,jdbcType=VARCHAR}, #{sp3,jdbcType=VARCHAR}, #{productPic,jdbcType=VARCHAR}, 
       #{productName,jdbcType=VARCHAR}, #{productSubTitle,jdbcType=VARCHAR}, #{productSkuCode,jdbcType=VARCHAR}, 
       #{memberNickname,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, #{modifyDate,jdbcType=TIMESTAMP}, 
-      #{deleteStatus,jdbcType=INTEGER})
+      #{deleteStatus,jdbcType=INTEGER}, #{productCategoryId,jdbcType=BIGINT})
   </insert>
   <insert id="insertSelective" parameterType="com.macro.mall.model.OmsCartItem">
     <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@@ -184,6 +185,9 @@
       <if test="deleteStatus != null">
         delete_status,
       </if>
+      <if test="productCategoryId != null">
+        product_category_id,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="productId != null">
@@ -234,6 +238,9 @@
       <if test="deleteStatus != null">
         #{deleteStatus,jdbcType=INTEGER},
       </if>
+      <if test="productCategoryId != null">
+        #{productCategoryId,jdbcType=BIGINT},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.macro.mall.model.OmsCartItemExample" resultType="java.lang.Integer">
@@ -296,6 +303,9 @@
       <if test="record.deleteStatus != null">
         delete_status = #{record.deleteStatus,jdbcType=INTEGER},
       </if>
+      <if test="record.productCategoryId != null">
+        product_category_id = #{record.productCategoryId,jdbcType=BIGINT},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -319,7 +329,8 @@
       member_nickname = #{record.memberNickname,jdbcType=VARCHAR},
       create_date = #{record.createDate,jdbcType=TIMESTAMP},
       modify_date = #{record.modifyDate,jdbcType=TIMESTAMP},
-      delete_status = #{record.deleteStatus,jdbcType=INTEGER}
+      delete_status = #{record.deleteStatus,jdbcType=INTEGER},
+      product_category_id = #{record.productCategoryId,jdbcType=BIGINT}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -375,6 +386,9 @@
       <if test="deleteStatus != null">
         delete_status = #{deleteStatus,jdbcType=INTEGER},
       </if>
+      <if test="productCategoryId != null">
+        product_category_id = #{productCategoryId,jdbcType=BIGINT},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -395,7 +409,8 @@
       member_nickname = #{memberNickname,jdbcType=VARCHAR},
       create_date = #{createDate,jdbcType=TIMESTAMP},
       modify_date = #{modifyDate,jdbcType=TIMESTAMP},
-      delete_status = #{deleteStatus,jdbcType=INTEGER}
+      delete_status = #{deleteStatus,jdbcType=INTEGER},
+      product_category_id = #{productCategoryId,jdbcType=BIGINT}
     where id = #{id,jdbcType=BIGINT}
   </update>
 </mapper>

+ 61 - 0
mall-portal/src/main/java/com/macro/mall/portal/controller/UmsMemberCouponController.java

@@ -0,0 +1,61 @@
+package com.macro.mall.portal.controller;
+
+import com.macro.mall.model.SmsCouponHistory;
+import com.macro.mall.portal.domain.CartPromotionItem;
+import com.macro.mall.portal.domain.CommonResult;
+import com.macro.mall.portal.domain.SmsCouponHistoryDetail;
+import com.macro.mall.portal.service.OmsCartItemService;
+import com.macro.mall.portal.service.UmsMemberCouponService;
+import com.macro.mall.portal.service.UmsMemberService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 用户优惠券管理Controller
+ * Created by macro on 2018/8/29.
+ */
+@Controller
+@Api(tags = "UmsMemberCouponController", description = "用户优惠券管理")
+@RequestMapping("/member/coupon")
+public class UmsMemberCouponController {
+    @Autowired
+    private UmsMemberCouponService memberCouponService;
+    @Autowired
+    private OmsCartItemService cartItemService;
+    @Autowired
+    private UmsMemberService memberService;
+
+    @ApiOperation("领取指定优惠券")
+    @RequestMapping(value = "/add/{couponId}", method = RequestMethod.POST)
+    @ResponseBody
+    public Object add(@PathVariable Long couponId) {
+        return memberCouponService.add(couponId);
+    }
+
+    @ApiOperation("获取用户优惠券列表")
+    @ApiImplicitParam(name = "useStatus", value = "优惠券筛选类型:0->未使用;1->已使用;2->已过期",
+            allowableValues = "0,1,2", paramType = "query", dataType = "integer")
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    @ResponseBody
+    public Object list(@RequestParam(value = "useStatus", required = false) Integer useStatus) {
+        List<SmsCouponHistory> couponHistoryList = memberCouponService.list(useStatus);
+        return new CommonResult().success(couponHistoryList);
+    }
+
+    @ApiOperation("获取登录会员购物车的相关优惠券")
+    @ApiImplicitParam(name = "type", value = "使用可用:0->不可用;1->可用",
+            defaultValue = "1", allowableValues = "0,1", paramType = "query", dataType = "integer")
+    @RequestMapping(value = "/list/cart/{type}", method = RequestMethod.GET)
+    @ResponseBody
+    public Object listCart(@PathVariable Integer type) {
+        List<CartPromotionItem> cartPromotionItemList = cartItemService.listPromotion(memberService.getCurrentMember().getId());
+        List<SmsCouponHistoryDetail> couponHistoryList = memberCouponService.listCart(cartPromotionItemList, type);
+        return new CommonResult().success(couponHistoryList);
+    }
+}

+ 14 - 0
mall-portal/src/main/java/com/macro/mall/portal/dao/SmsCouponHistoryDao.java

@@ -0,0 +1,14 @@
+package com.macro.mall.portal.dao;
+
+import com.macro.mall.portal.domain.SmsCouponHistoryDetail;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 会员优惠券领取历史自定义Dao
+ * Created by macro on 2018/8/29.
+ */
+public interface SmsCouponHistoryDao {
+    List<SmsCouponHistoryDetail> getDetailList(@Param("memberId") Long memberId);
+}

+ 45 - 0
mall-portal/src/main/java/com/macro/mall/portal/domain/SmsCouponHistoryDetail.java

@@ -0,0 +1,45 @@
+package com.macro.mall.portal.domain;
+
+import com.macro.mall.model.SmsCoupon;
+import com.macro.mall.model.SmsCouponHistory;
+import com.macro.mall.model.SmsCouponProductCategoryRelation;
+import com.macro.mall.model.SmsCouponProductRelation;
+
+import java.util.List;
+
+/**
+ * 优惠券领取历史详情封装
+ * Created by macro on 2018/8/29.
+ */
+public class SmsCouponHistoryDetail extends SmsCouponHistory {
+    //相关优惠券信息
+    private SmsCoupon coupon;
+    //优惠券关联商品
+    private List<SmsCouponProductRelation> productRelationList;
+    //优惠券关联商品分类
+    private List<SmsCouponProductCategoryRelation> categoryRelationList;
+
+    public SmsCoupon getCoupon() {
+        return coupon;
+    }
+
+    public void setCoupon(SmsCoupon coupon) {
+        this.coupon = coupon;
+    }
+
+    public List<SmsCouponProductRelation> getProductRelationList() {
+        return productRelationList;
+    }
+
+    public void setProductRelationList(List<SmsCouponProductRelation> productRelationList) {
+        this.productRelationList = productRelationList;
+    }
+
+    public List<SmsCouponProductCategoryRelation> getCategoryRelationList() {
+        return categoryRelationList;
+    }
+
+    public void setCategoryRelationList(List<SmsCouponProductCategoryRelation> categoryRelationList) {
+        this.categoryRelationList = categoryRelationList;
+    }
+}

+ 32 - 0
mall-portal/src/main/java/com/macro/mall/portal/service/UmsMemberCouponService.java

@@ -0,0 +1,32 @@
+package com.macro.mall.portal.service;
+
+import com.macro.mall.model.SmsCouponHistory;
+import com.macro.mall.portal.domain.CartPromotionItem;
+import com.macro.mall.portal.domain.CommonResult;
+import com.macro.mall.portal.domain.SmsCouponHistoryDetail;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 用户优惠券管理Service
+ * Created by macro on 2018/8/29.
+ */
+public interface UmsMemberCouponService {
+    /**
+     * 会员添加优惠券
+     */
+    @Transactional
+    CommonResult add(Long couponId);
+
+    /**
+     * 获取优惠券列表
+     * @param useStatus 优惠券的使用状态
+     */
+    List<SmsCouponHistory> list(Integer useStatus);
+
+    /**
+     * 根据购物车信息获取可用优惠券
+     */
+    List<SmsCouponHistoryDetail> listCart(List<CartPromotionItem> cartItemList, Integer type);
+}

+ 176 - 0
mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberCouponServiceImpl.java

@@ -0,0 +1,176 @@
+package com.macro.mall.portal.service.impl;
+
+import com.macro.mall.mapper.SmsCouponHistoryMapper;
+import com.macro.mall.mapper.SmsCouponMapper;
+import com.macro.mall.model.*;
+import com.macro.mall.portal.dao.SmsCouponHistoryDao;
+import com.macro.mall.portal.domain.CartPromotionItem;
+import com.macro.mall.portal.domain.CommonResult;
+import com.macro.mall.portal.domain.SmsCouponHistoryDetail;
+import com.macro.mall.portal.service.UmsMemberCouponService;
+import com.macro.mall.portal.service.UmsMemberService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 会员优惠券管理Service实现类
+ * Created by macro on 2018/8/29.
+ */
+@Service
+public class UmsMemberCouponServiceImpl implements UmsMemberCouponService {
+    @Autowired
+    private UmsMemberService memberService;
+    @Autowired
+    private SmsCouponMapper couponMapper;
+    @Autowired
+    private SmsCouponHistoryMapper couponHistoryMapper;
+    @Autowired
+    private SmsCouponHistoryDao couponHistoryDao;
+    @Override
+    public CommonResult add(Long couponId) {
+        UmsMember currentMember = memberService.getCurrentMember();
+        //获取优惠券信息,判断数量
+        SmsCoupon coupon = couponMapper.selectByPrimaryKey(couponId);
+        if(coupon==null){
+            return new CommonResult().failed("优惠券不存在");
+        }
+        if(coupon.getCount()<=0){
+            return new CommonResult().failed("优惠券已经领完了");
+        }
+        Date now = new Date();
+        if(now.before(coupon.getEnableTime())){
+            return new CommonResult().failed("优惠券还没到领取时间");
+        }
+        //判断用户领取的优惠券数量是否超过限制
+        SmsCouponHistoryExample couponHistoryExample = new SmsCouponHistoryExample();
+        couponHistoryExample.createCriteria().andCouponIdEqualTo(couponId).andMemberIdEqualTo(currentMember.getId());
+        int count = couponHistoryMapper.countByExample(couponHistoryExample);
+        if(count>=coupon.getPerLimit()){
+            return new CommonResult().failed("您已经领取过该优惠券");
+        }
+        //生成领取优惠券历史
+        SmsCouponHistory couponHistory = new SmsCouponHistory();
+        couponHistory.setCouponId(couponId);
+        couponHistory.setCouponCode(coupon.getCode());
+        couponHistory.setCreateTime(now);
+        couponHistory.setMemberId(currentMember.getId());
+        couponHistory.setMemberNickname(currentMember.getNickname());
+        //主动领取
+        couponHistory.setGetType(1);
+        //未使用
+        couponHistory.setUseStatus(0);
+        couponHistoryMapper.insert(couponHistory);
+        //修改优惠券表的数量、领取数量
+        coupon.setCount(coupon.getCount()-1);
+        coupon.setReceiveCount(coupon.getReceiveCount()==null?1:coupon.getReceiveCount()+1);
+        couponMapper.updateByPrimaryKey(coupon);
+        return new CommonResult().success("领取成功",null);
+    }
+
+    @Override
+    public List<SmsCouponHistory> list(Integer useStatus) {
+        UmsMember currentMember = memberService.getCurrentMember();
+        SmsCouponHistoryExample couponHistoryExample=new SmsCouponHistoryExample();
+        SmsCouponHistoryExample.Criteria criteria = couponHistoryExample.createCriteria();
+        criteria.andMemberIdEqualTo(currentMember.getId());
+        if(useStatus!=null){
+            criteria.andUseStatusEqualTo(useStatus);
+        }
+        return couponHistoryMapper.selectByExample(couponHistoryExample);
+    }
+
+    @Override
+    public List<SmsCouponHistoryDetail> listCart(List<CartPromotionItem> cartItemList, Integer type) {
+        UmsMember currentMember = memberService.getCurrentMember();
+        Date now = new Date();
+        //获取该用户所有优惠券
+        List<SmsCouponHistoryDetail> allList = couponHistoryDao.getDetailList(currentMember.getId());
+        //根据优惠券使用类型来判断优惠券是否可用
+        List<SmsCouponHistoryDetail> enableList = new ArrayList<>();
+        List<SmsCouponHistoryDetail> disableList = new ArrayList<>();
+        for (SmsCouponHistoryDetail couponHistoryDetail : allList) {
+            Integer useType = couponHistoryDetail.getCoupon().getUseType();
+            BigDecimal minPoint = couponHistoryDetail.getCoupon().getMinPoint();
+            Date endTime = couponHistoryDetail.getCoupon().getEndTime();
+            if(useType.equals(0)){
+                //0->全场通用
+                //判断是否满足优惠起点
+                //计算购物车商品的总价
+                BigDecimal totalAmount = calcTotalAmount(cartItemList);
+                if(now.before(endTime)&&totalAmount.subtract(minPoint).intValue()>=0){
+                    enableList.add(couponHistoryDetail);
+                }else{
+                    disableList.add(couponHistoryDetail);
+                }
+            }else if(useType.equals(1)){
+                //1->指定分类
+                //计算指定分类商品的总价
+                List<Long> productCategoryIds = new ArrayList<>();
+                for (SmsCouponProductCategoryRelation categoryRelation : couponHistoryDetail.getCategoryRelationList()) {
+                    productCategoryIds.add(categoryRelation.getProductCategoryId());
+                }
+                BigDecimal totalAmount = calcTotalAmountByproductCategoryId(cartItemList,productCategoryIds);
+                if(now.before(endTime)&&totalAmount.intValue()>0&&totalAmount.subtract(minPoint).intValue()>=0){
+                    enableList.add(couponHistoryDetail);
+                }else{
+                    disableList.add(couponHistoryDetail);
+                }
+            }else if(useType.equals(2)){
+                //2->指定商品
+                //计算指定商品的总价
+                List<Long> productIds = new ArrayList<>();
+                for (SmsCouponProductRelation productRelation : couponHistoryDetail.getProductRelationList()) {
+                    productIds.add(productRelation.getProductId());
+                }
+                BigDecimal totalAmount = calcTotalAmountByProductId(cartItemList,productIds);
+                if(now.before(endTime)&&totalAmount.intValue()>0&&totalAmount.subtract(minPoint).intValue()>=0){
+                    enableList.add(couponHistoryDetail);
+                }else{
+                    disableList.add(couponHistoryDetail);
+                }
+            }
+        }
+        if(type.equals(1)){
+            return enableList;
+        }else{
+            return disableList;
+        }
+    }
+
+    private BigDecimal calcTotalAmount(List<CartPromotionItem> cartItemList) {
+        BigDecimal total = new BigDecimal("0");
+        for (CartPromotionItem item : cartItemList) {
+            BigDecimal realPrice = item.getPrice().subtract(item.getReduceAmount());
+            total=total.add(realPrice.multiply(new BigDecimal(item.getQuantity())));
+        }
+        return total;
+    }
+
+    private BigDecimal calcTotalAmountByproductCategoryId(List<CartPromotionItem> cartItemList,List<Long> productCategoryIds) {
+        BigDecimal total = new BigDecimal("0");
+        for (CartPromotionItem item : cartItemList) {
+            if(productCategoryIds.contains(item.getProductCategoryId())){
+                BigDecimal realPrice = item.getPrice().subtract(item.getReduceAmount());
+                total=total.add(realPrice.multiply(new BigDecimal(item.getQuantity())));
+            }
+        }
+        return total;
+    }
+
+    private BigDecimal calcTotalAmountByProductId(List<CartPromotionItem> cartItemList,List<Long> productIds) {
+        BigDecimal total = new BigDecimal("0");
+        for (CartPromotionItem item : cartItemList) {
+            if(productIds.contains(item.getProductId())){
+                BigDecimal realPrice = item.getPrice().subtract(item.getReduceAmount());
+                total=total.add(realPrice.multiply(new BigDecimal(item.getQuantity())));
+            }
+        }
+        return total;
+    }
+
+}

+ 35 - 0
mall-portal/src/main/resources/dao/SmsCouponHistoryDao.xml

@@ -0,0 +1,35 @@
+<?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.macro.mall.portal.dao.SmsCouponHistoryDao">
+    <resultMap id="couponHistoryDetailMap" type="com.macro.mall.portal.domain.SmsCouponHistoryDetail"
+               extends="com.macro.mall.mapper.SmsCouponHistoryMapper.BaseResultMap">
+        <association property="coupon" resultMap="com.macro.mall.mapper.SmsCouponMapper.BaseResultMap" columnPrefix="c_">
+        </association>
+        <collection property="productRelationList" columnPrefix="cpr_" resultMap="com.macro.mall.mapper.SmsCouponProductRelationMapper.BaseResultMap">
+        </collection>
+        <collection property="categoryRelationList" columnPrefix="cpcr_" resultMap="com.macro.mall.mapper.SmsCouponProductCategoryRelationMapper.BaseResultMap">
+        </collection>
+    </resultMap>
+    <select id="getDetailList" resultMap="couponHistoryDetailMap">
+        SELECT
+            ch.*,
+            c.id c_id,
+            c.name c_name,
+            c.amount c_amount,
+            c.min_point c_min_point,
+            c.platform c_platform,
+            c.start_time c_start_time,
+            c.end_time c_end_time,
+            c.note c_note,
+            c.use_type c_use_type,
+            c.type c_type,
+            cpr.id cpr_id,cpr.product_id cpr_product_id,
+            cpcr.id cpcr_id,cpcr.product_category_id cpcr_product_category_id
+        FROM
+            sms_coupon_history ch
+            LEFT JOIN sms_coupon c ON ch.coupon_id = c.id
+            LEFT JOIN sms_coupon_product_relation cpr ON cpr.coupon_id = c.id
+            LEFT JOIN sms_coupon_product_category_relation cpcr ON cpcr.coupon_id = c.id
+        WHERE ch.member_id = #{memberId}
+    </select>
+</mapper>