Commit 2e8ec319 authored by youjj's avatar youjj

添加旅游标签和banner图

parent e300a0bd
......@@ -64,6 +64,11 @@ public class TourBanner implements Serializable {
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除,0否,1是")
private Integer isDel;
@Column(name = "rank")
@ApiModelProperty(value = "排序")
private Integer rank;
}
......@@ -14,4 +14,6 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class TourBannerBiz extends BaseBiz<TourBannerMapper,TourBanner> {
}
\ No newline at end of file
......@@ -15,4 +15,5 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class TourGoodTagBiz extends BaseBiz<TourGoodTagMapper,TourGoodTag> {
}
\ No newline at end of file
package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourBanner;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* 首页banner图
*
......@@ -10,6 +14,9 @@ import tk.mybatis.mapper.common.Mapper;
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Repository
public interface TourBannerMapper extends Mapper<TourBanner> {
@Select("select * from tour_banner where is_del=#{isDel} order by rank ASC")
List<TourBanner> findBannerListByisDelOrderByRank(TourBanner banner);
}
package com.xxfc.platform.tour.mapper;
import com.xxfc.platform.tour.entity.TourTag;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* 旅游路线标签
*
......@@ -10,6 +14,8 @@ import tk.mybatis.mapper.common.Mapper;
* @email nishijjo@qq.com
* @date 2019-06-06 11:41:51
*/
@Repository
public interface TourTagMapper extends Mapper<TourTag> {
@Select("select * from tour_tag where is_del=#{isDel} and is_hot=#{isHot} order by rank ASC")
List<TourTag> findHotListTag(TourTag tag);
}
package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.common.msg.ListRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourBannerBiz;
import com.xxfc.platform.tour.entity.TourBanner;
import com.xxfc.platform.tour.service.TourBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* banner图
*/
@RestController
@RequestMapping("tourBanner")
public class TourBannerController extends BaseController<TourBannerBiz,TourBanner> {
@Autowired
private TourBannerService bannerService;
/**
*查询banner图
* @return
*/
@GetMapping("findBannerlist")
public ListRestResponse findBannerlist(){
List<TourBanner> bannerList = bannerService.findBannerList();
return new ListRestResponse().result(bannerList).count(bannerList.size());
}
}
\ No newline at end of file
package com.xxfc.platform.tour.rest;
import com.github.wxiaoqi.security.common.msg.ListRestResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.tour.biz.TourGoodTagBiz;
import com.xxfc.platform.tour.biz.TourTagBiz;
import com.xxfc.platform.tour.entity.TourTag;
import com.xxfc.platform.tour.service.TourTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("tourTag")
public class TourTagController extends BaseController<TourTagBiz,TourTag> {
@Autowired
private TourTagService tagService;
@GetMapping("/app/unauth/hotTag")
public ListRestResponse getHotTag(){
List<TourTag> hotTag = tagService.getHotTag();
return new ListRestResponse().result(hotTag).count(hotTag.size());
}
}
\ No newline at end of file
package com.xxfc.platform.tour.service;
import com.github.wxiaoqi.security.common.service.impl.BaseServiceImpl;
import com.xxfc.platform.tour.entity.TourBanner;
import com.xxfc.platform.tour.mapper.TourBannerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Administrator
*/
@Service
public class TourBannerService extends BaseServiceImpl<TourBannerMapper,TourBanner> {
@Autowired
private TourBannerMapper bannerMapper;
@Autowired
private RedisTemplate redisTemplate;
public List<TourBanner> findBannerList() {
TourBanner banner = new TourBanner();
banner.setIsDel(0);
List<TourBanner> bannerList = (List<TourBanner>) redisTemplate.opsForValue().get("homeBanner");
if (bannerList==null||bannerList.size()==0) {
bannerList = bannerMapper.findBannerListByisDelOrderByRank(banner);
redisTemplate.opsForValue().set("homeBanner",bannerList);
}
return bannerList;
}
}
package com.xxfc.platform.tour.service;
import com.xxfc.platform.tour.biz.TourTagBiz;
import com.xxfc.platform.tour.entity.TourTag;
import com.xxfc.platform.tour.mapper.TourTagMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TourTagService {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private TourTagBiz tagBiz;
@Autowired
private TourTagMapper tagMapper;
public List<TourTag> getHotTag() {
List<TourTag> hotTagList = (List<TourTag>) redisTemplate.opsForValue().get("hotTag");
if (hotTagList==null||hotTagList.size()==0) {
TourTag tag = new TourTag();
tag.setIsDel(0);
tag.setIsHot(1);
List<TourTag> tagList=tagMapper.findHotListTag(tag);
redisTemplate.opsForValue().set("hotTag",tagList);
}
return hotTagList;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment