rk
7 小时以前 580f4d3c2ca9eee53eee95a4de2f6610b790780a
server/dmmall_service/src/main/java/com/doumee/service/business/impl/SearchHistoryServiceImpl.java
@@ -2,6 +2,7 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.SearchHistoryMapper;
import com.doumee.dao.business.model.SearchHistory;
@@ -13,6 +14,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.yaml.snakeyaml.scanner.Constant;
import java.util.List;
@@ -136,4 +138,27 @@
        QueryWrapper<SearchHistory> wrapper = new QueryWrapper<>(searchHistory);
        return searchHistoryMapper.selectCount(wrapper);
    }
    @Override
    public List<SearchHistory> findListByType(Integer type,Integer memberId) {
        return searchHistoryMapper.selectList(new QueryWrapper<SearchHistory>().lambda()
                .eq(SearchHistory::getIsdeleted, Constants.ZERO)
                .eq(SearchHistory::getMemberId,memberId)
                .eq(SearchHistory::getType,type)
                .last("limit 10")
                .orderByDesc(SearchHistory::getId)
        );
    }
    @Override
    public void cleanHistory(Integer type,Integer memberId) {
        searchHistoryMapper.update(new UpdateWrapper<SearchHistory>().lambda()
                .set(SearchHistory::getIsdeleted, Constants.ONE)
                .eq(SearchHistory::getMemberId,memberId)
                .eq(SearchHistory::getType,type)
        );
    }
}