Authored by 匡佳华

促销活动: 添加活动筛选状态

... ... @@ -53,12 +53,13 @@ public class PromotionServiceImpl implements IPromotionService {
if(req.getStatus() != null && req.getStatus() == -1){
req.setStatus(null);
}
int count = activityMapper.selectCountByCondition(req);
int currentTime = DateUtil.getCurrentTimeSeconds();
int count = activityMapper.selectCountByCondition(req, currentTime);
if(count == 0){
log.warn("getPromotionList with total is 0,req:{}",req);
return new PageResponseBO<>();
}
List<PromotionActivity> promotionActivities = activityMapper.selectListByPage(req);
List<PromotionActivity> promotionActivities = activityMapper.selectListByPage(req, currentTime);
//构建返回
List<PromotionActivityListRspBo> rspList = new ArrayList<>();
for(PromotionActivity activity : promotionActivities){
... ...
... ... @@ -17,9 +17,9 @@ public interface PromotionActivityMapper {
int updateByPrimaryKey(PromotionActivity record);
int selectCountByCondition(@Param("record") PromotionActivityReq record);
int selectCountByCondition(@Param("record") PromotionActivityReq record, @Param("currentTime") Integer currentTime);
List<PromotionActivity> selectListByPage(@Param("record") PromotionActivityReq record);
List<PromotionActivity> selectListByPage(@Param("record") PromotionActivityReq record, @Param("currentTime") Integer currentTime);
PromotionActivity selectActivityWithinTime(@Param("startTime") Integer startTime, @Param("endTime") Integer endTime, @Param("activityId") Integer activityId);
}
\ No newline at end of file
... ...
... ... @@ -89,8 +89,27 @@
<if test="record.activityName != null" >
<![CDATA[ AND instr(activity_name ,#{record.activityName}) > 0 ]]>
</if>
<if test="record.status != null" >
and status = #{record.status,jdbcType=INTEGER}
<if test="record.status != null">
<if test="record.status == 4">
<!--已关闭-->
and status= 2
</if>
<if test="record.status == 3">
<!--已结束-->
and end_time <![CDATA[< ]]> #{currentTime}
and status != 2
</if>
<if test="record.status == 2">
<!--进行中-->
and start_time <![CDATA[<= ]]> #{currentTime}
and end_time >= #{currentTime}
and status != 2
</if>
<if test="record.status == 1">
<!--未开始-->
and start_time > #{currentTime}
and status != 2
</if>
</if>
</select>
... ... @@ -105,8 +124,27 @@
<if test="record.activityName != null" >
<![CDATA[ AND instr(activity_name ,#{record.activityName}) > 0 ]]>
</if>
<if test="record.status != null" >
and status = #{record.status,jdbcType=INTEGER}
<if test="record.status != null">
<if test="record.status == 4">
<!--已关闭-->
and status= 2
</if>
<if test="record.status == 3">
<!--已结束-->
and end_time <![CDATA[< ]]> #{currentTime}
and status != 2
</if>
<if test="record.status == 2">
<!--进行中-->
and start_time <![CDATA[<= ]]> #{currentTime}
and end_time >= #{currentTime}
and status != 2
</if>
<if test="record.status == 1">
<!--未开始-->
and start_time > #{currentTime}
and status != 2
</if>
</if>
order by id desc
limit #{record.start},#{record.size}
... ...
... ... @@ -34,8 +34,10 @@
<label>状态:</label>
<select id="status" class="easyui-combobox" name="status" style="width:150px;" data-options="prompt:'状态',panelHeight:80">
<option value="1">开启</option>
<option value="2">关闭</option>
<option value="1">未开始</option>
<option value="2">进行中</option>
<option value="3">已结束</option>
<option value="4">已关闭</option>
</select>
<a id="searchBtn" class="btn-info">筛选</a>
<a id="allBtn" class="btn-success">全部</a>
... ... @@ -51,6 +53,11 @@
<script>
$(function() {
$("#status").combobox({
editable: false,
panelHeight : 130
});
$('#status').combobox('clear');
$('#allBtn').linkbutton({
... ...