Bladeren bron

优化代码

java110 5 jaren geleden
bovenliggende
commit
231c70e09c

+ 37 - 16
java110-bean/src/main/java/com/java110/dto/groupBuyBatch/GroupBuyBatchDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.groupBuyBatch;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -15,11 +16,12 @@ import java.util.Date;
 public class GroupBuyBatchDto extends PageDto implements Serializable {
 
     private String batchEndTime;
-private String batchId;
-private String storeId;
-private String settingId;
-private String batchStartTime;
-private String curBatch;
+    private String batchId;
+    private String storeId;
+    private String settingId;
+    private String batchStartTime;
+    private String curBatch;
+    private String groupBuyName;
 
 
     private Date createTime;
@@ -30,37 +32,48 @@ private String curBatch;
     public String getBatchEndTime() {
         return batchEndTime;
     }
-public void setBatchEndTime(String batchEndTime) {
+
+    public void setBatchEndTime(String batchEndTime) {
         this.batchEndTime = batchEndTime;
     }
-public String getBatchId() {
+
+    public String getBatchId() {
         return batchId;
     }
-public void setBatchId(String batchId) {
+
+    public void setBatchId(String batchId) {
         this.batchId = batchId;
     }
-public String getStoreId() {
+
+    public String getStoreId() {
         return storeId;
     }
-public void setStoreId(String storeId) {
+
+    public void setStoreId(String storeId) {
         this.storeId = storeId;
     }
-public String getSettingId() {
+
+    public String getSettingId() {
         return settingId;
     }
-public void setSettingId(String settingId) {
+
+    public void setSettingId(String settingId) {
         this.settingId = settingId;
     }
-public String getBatchStartTime() {
+
+    public String getBatchStartTime() {
         return batchStartTime;
     }
-public void setBatchStartTime(String batchStartTime) {
+
+    public void setBatchStartTime(String batchStartTime) {
         this.batchStartTime = batchStartTime;
     }
-public String getCurBatch() {
+
+    public String getCurBatch() {
         return curBatch;
     }
-public void setCurBatch(String curBatch) {
+
+    public void setCurBatch(String curBatch) {
         this.curBatch = curBatch;
     }
 
@@ -80,4 +93,12 @@ public void setCurBatch(String curBatch) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String getGroupBuyName() {
+        return groupBuyName;
+    }
+
+    public void setGroupBuyName(String groupBuyName) {
+        this.groupBuyName = groupBuyName;
+    }
 }

+ 84 - 86
java110-db/src/main/resources/mapper/goods/GroupBuyBatchServiceDaoImplMapper.xml

@@ -5,111 +5,109 @@
 <mapper namespace="groupBuyBatchServiceDaoImpl">
 
 
-
-
-
     <!-- 保存拼团批次信息 add by wuxw 2018-07-03 -->
     <insert id="saveGroupBuyBatchInfo" parameterType="Map">
         insert into group_buy_batch(
-batch_end_time,batch_id,store_id,setting_id,batch_start_time,cur_batch
-) values (
-#{batchEndTime},#{batchId},#{storeId},#{settingId},#{batchStartTime},#{curBatch}
-)
+        batch_end_time,batch_id,store_id,setting_id,batch_start_time,cur_batch
+        ) values (
+        #{batchEndTime},#{batchId},#{storeId},#{settingId},#{batchStartTime},#{curBatch}
+        )
     </insert>
 
 
-
     <!-- 查询拼团批次信息 add by wuxw 2018-07-03 -->
     <select id="getGroupBuyBatchInfo" parameterType="Map" resultType="Map">
-        select  t.batch_end_time,t.batch_end_time batchEndTime,t.status_cd,t.status_cd statusCd,t.batch_id,t.batch_id batchId,t.store_id,t.store_id storeId,t.setting_id,t.setting_id settingId,t.batch_start_time,t.batch_start_time batchStartTime,t.cur_batch,t.cur_batch curBatch 
-from group_buy_batch t 
-where 1 =1 
-<if test="batchEndTime !=null and batchEndTime != ''">
-   and t.batch_end_time= #{batchEndTime}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="batchId !=null and batchId != ''">
-   and t.batch_id= #{batchId}
-</if> 
-<if test="storeId !=null and storeId != ''">
-   and t.store_id= #{storeId}
-</if> 
-<if test="settingId !=null and settingId != ''">
-   and t.setting_id= #{settingId}
-</if> 
-<if test="batchStartTime !=null and batchStartTime != ''">
-   and t.batch_start_time= #{batchStartTime}
-</if> 
-<if test="curBatch !=null and curBatch != ''">
-   and t.cur_batch= #{curBatch}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.batch_end_time,t.batch_end_time batchEndTime,t.status_cd,t.status_cd statusCd,t.batch_id,t.batch_id
+        batchId,t.store_id,t.store_id storeId,t.setting_id,t.setting_id settingId,t.batch_start_time,t.batch_start_time
+        batchStartTime,t.cur_batch,t.cur_batch curBatch,t.create_time createName,gbs.group_buy_name groupBuyName
+        from group_buy_batch t
+        left join group_buy_setting gbs on t.setting_id = gbs.setting_id and t.store_id = gbs.store_id and gbs.status_cd = '0'
+        where 1 =1
+        <if test="batchEndTime !=null and batchEndTime != ''">
+            and t.batch_end_time= #{batchEndTime}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="batchId !=null and batchId != ''">
+            and t.batch_id= #{batchId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="settingId !=null and settingId != ''">
+            and t.setting_id= #{settingId}
+        </if>
+        <if test="batchStartTime !=null and batchStartTime != ''">
+            and t.batch_start_time= #{batchStartTime}
+        </if>
+        <if test="curBatch !=null and curBatch != ''">
+            and t.cur_batch= #{curBatch}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改拼团批次信息 add by wuxw 2018-07-03 -->
     <update id="updateGroupBuyBatchInfo" parameterType="Map">
-        update  group_buy_batch t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="batchEndTime !=null and batchEndTime != ''">
-, t.batch_end_time= #{batchEndTime}
-</if> 
-<if test="storeId !=null and storeId != ''">
-, t.store_id= #{storeId}
-</if> 
-<if test="settingId !=null and settingId != ''">
-, t.setting_id= #{settingId}
-</if> 
-<if test="batchStartTime !=null and batchStartTime != ''">
-, t.batch_start_time= #{batchStartTime}
-</if> 
-<if test="curBatch !=null and curBatch != ''">
-, t.cur_batch= #{curBatch}
-</if> 
- where 1=1 <if test="batchId !=null and batchId != ''">
-and t.batch_id= #{batchId}
-</if> 
+        update group_buy_batch t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="batchEndTime !=null and batchEndTime != ''">
+            , t.batch_end_time= #{batchEndTime}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            , t.store_id= #{storeId}
+        </if>
+        <if test="settingId !=null and settingId != ''">
+            , t.setting_id= #{settingId}
+        </if>
+        <if test="batchStartTime !=null and batchStartTime != ''">
+            , t.batch_start_time= #{batchStartTime}
+        </if>
+        <if test="curBatch !=null and curBatch != ''">
+            , t.cur_batch= #{curBatch}
+        </if>
+        where 1=1
+        <if test="batchId !=null and batchId != ''">
+            and t.batch_id= #{batchId}
+        </if>
 
     </update>
 
     <!-- 查询拼团批次数量 add by wuxw 2018-07-03 -->
-     <select id="queryGroupBuyBatchsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from group_buy_batch t 
-where 1 =1 
-<if test="batchEndTime !=null and batchEndTime != ''">
-   and t.batch_end_time= #{batchEndTime}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="batchId !=null and batchId != ''">
-   and t.batch_id= #{batchId}
-</if> 
-<if test="storeId !=null and storeId != ''">
-   and t.store_id= #{storeId}
-</if> 
-<if test="settingId !=null and settingId != ''">
-   and t.setting_id= #{settingId}
-</if> 
-<if test="batchStartTime !=null and batchStartTime != ''">
-   and t.batch_start_time= #{batchStartTime}
-</if> 
-<if test="curBatch !=null and curBatch != ''">
-   and t.cur_batch= #{curBatch}
-</if> 
+    <select id="queryGroupBuyBatchsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from group_buy_batch t
+        where 1 =1
+        <if test="batchEndTime !=null and batchEndTime != ''">
+            and t.batch_end_time= #{batchEndTime}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="batchId !=null and batchId != ''">
+            and t.batch_id= #{batchId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="settingId !=null and settingId != ''">
+            and t.setting_id= #{settingId}
+        </if>
+        <if test="batchStartTime !=null and batchStartTime != ''">
+            and t.batch_start_time= #{batchStartTime}
+        </if>
+        <if test="curBatch !=null and curBatch != ''">
+            and t.cur_batch= #{curBatch}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 2 - 0
service-goods/src/main/java/com/java110/goods/api/GroupBuyApi.java

@@ -540,12 +540,14 @@ public class GroupBuyApi {
      */
     @RequestMapping(value = "/queryGroupBuyBatch", method = RequestMethod.GET)
     public ResponseEntity<String> queryGroupBuyBatch(@RequestHeader(value = "store-id") String storeId,
+                                                     @RequestParam(value = "batchId") String batchId,
                                                      @RequestParam(value = "page") int page,
                                                      @RequestParam(value = "row") int row) {
         GroupBuyBatchDto groupBuyBatchDto = new GroupBuyBatchDto();
         groupBuyBatchDto.setPage(page);
         groupBuyBatchDto.setRow(row);
         groupBuyBatchDto.setStoreId(storeId);
+        groupBuyBatchDto.setBatchId(batchId);
         return getGroupBuyBatchBMOImpl.get(groupBuyBatchDto);
     }
 }