Commit 281f6731 authored by libin's avatar libin

banner

parent 1e5cdaaa
......@@ -100,4 +100,9 @@ public class Banner {
@Column(name = "type")
@ApiModelProperty(value = "banner类型")
private Integer type;
/**
* 位置 banner位置0 所有 1:推荐 2:拍拍 3:短视频 4:问答
*/
private Integer location;
}
......@@ -32,9 +32,9 @@ public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
this.deleteById(id);
}*/
public List<BannerVo> findBannerList(Integer type) {
public List<BannerVo> findBannerList(Integer type,Integer location) {
List<BannerVo> bannerVos = new ArrayList<>();
List<Banner> banners = mapper.findBannerListByType(type);
List<Banner> banners = mapper.findBannerListByType(type,location);
banners.forEach(banner -> {
BannerVo bannerVo = new BannerVo();
bannerVo.setCover(banner.getCover());
......
package com.xxfc.platform.app.mapper;
import com.xxfc.platform.app.entity.Banner;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
......@@ -22,6 +23,6 @@ public interface BannerMapper extends Mapper<Banner> {
List<Banner> findBannerListByisDelOrderByRank(Banner banner);
@Select("select * from `banner` where `is_del`=0 and `type`=#{type} order by rank asc ")
List<Banner> findBannerListByType(Integer type);
List<Banner> findBannerListByType(@Param("type") Integer type,@Param("location") Integer location);
}
......@@ -29,11 +29,11 @@ public class BannerController {
* @return
*/
@GetMapping("/app/unauth/findBannerlist")
public ObjectRestResponse findBannerlist(@RequestParam("type") Integer type){
public ObjectRestResponse findBannerlist(@RequestParam("type") Integer type,@RequestParam(required = false,value = "location") Integer location){
if (type==null) {
return ObjectRestResponse.createDefaultFail();
}
List<BannerVo> bannerList = bannerBiz.findBannerList(type);
List<BannerVo> bannerList = bannerBiz.findBannerList(type,location);
return ObjectRestResponse.succ(bannerList);
}
}
<?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.xxfc.platform.tour.mapper.TourBannerMapper">
<mapper namespace="com.xxfc.platform.app.mapper.BannerMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.app.entity.Banner" id="bannerMap">
......@@ -14,6 +14,14 @@
<result property="updTime" column="upd_time"/>
<result property="url" column="url"/>
<result property="isDel" column="is_del"/>
<result property="location" column="location"/>
</resultMap>
<select id="findBannerListByType">
select * from `banner` where `is_del`=0 and `type`=#{type}
<if test="location != null">
and `location`=#{location}
</if>
order by rank asc
</select>
</mapper>
\ No newline at end of file
......@@ -12,6 +12,7 @@ import com.xxfc.platform.campsite.mapper.CampsiteShopTagMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.time.Instant;
import java.util.List;
......@@ -76,4 +77,12 @@ public class CampsiteShopTagBiz extends BaseBiz<CampsiteShopTagMapper,CampsiteSh
}
return effectRows;
}
public boolean checkTagHashBindByTagId(Integer tagId){
Example example = new Example(CampsiteShopTag.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("",tagId);
List<CampsiteShopTag> shopTags = mapper.selectByExample(example);
return shopTags==null?false:shopTags.size()>0?true:false;
}
}
\ No newline at end of file
......@@ -2,12 +2,13 @@ package com.xxfc.platform.campsite.biz;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.sun.org.apache.regexp.internal.RE;
import com.xxfc.platform.campsite.dto.CampsiteTagListDTO;
import com.xxfc.platform.campsite.vo.CampsiteTagListVo;
import com.xxfc.platform.campsite.vo.CampsiteTagVo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xxfc.platform.campsite.entity.CampsiteTag;
......@@ -26,6 +27,9 @@ import java.util.List;
*/
@Service
public class CampsiteTagBiz extends BaseBiz<CampsiteTagMapper,CampsiteTag> {
@Autowired
private CampsiteShopTagBiz campsiteShopTagBiz;
/**
* 查询营地列表
......@@ -46,7 +50,11 @@ public class CampsiteTagBiz extends BaseBiz<CampsiteTagMapper,CampsiteTag> {
* @return
*/
public int updateCampsiteTagStatus(Integer tagId) {
return mapper.updateCampsiteTagStatusById(tagId,1);
boolean isBinding = campsiteShopTagBiz.checkTagHashBindByTagId(tagId);
if (isBinding){
throw new BaseException("该类型标签已经被占用",400);
}
return mapper.updateCampsiteTagStatusById(tagId,1);
}
/**
......@@ -74,6 +82,7 @@ public class CampsiteTagBiz extends BaseBiz<CampsiteTagMapper,CampsiteTag> {
* @return
*/
public int updateCampsiteTagIsSearchStatus(Integer id, Integer status) {
return mapper.updateCampsiteTagIsearchStatusById(id,status);
}
......
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