Commit 281f6731 authored by libin's avatar libin

banner

parent 1e5cdaaa
...@@ -100,4 +100,9 @@ public class Banner { ...@@ -100,4 +100,9 @@ public class Banner {
@Column(name = "type") @Column(name = "type")
@ApiModelProperty(value = "banner类型") @ApiModelProperty(value = "banner类型")
private Integer type; private Integer type;
/**
* 位置 banner位置0 所有 1:推荐 2:拍拍 3:短视频 4:问答
*/
private Integer location;
} }
...@@ -32,9 +32,9 @@ public class BannerBiz extends BaseBiz<BannerMapper,Banner> { ...@@ -32,9 +32,9 @@ public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
this.deleteById(id); this.deleteById(id);
}*/ }*/
public List<BannerVo> findBannerList(Integer type) { public List<BannerVo> findBannerList(Integer type,Integer location) {
List<BannerVo> bannerVos = new ArrayList<>(); List<BannerVo> bannerVos = new ArrayList<>();
List<Banner> banners = mapper.findBannerListByType(type); List<Banner> banners = mapper.findBannerListByType(type,location);
banners.forEach(banner -> { banners.forEach(banner -> {
BannerVo bannerVo = new BannerVo(); BannerVo bannerVo = new BannerVo();
bannerVo.setCover(banner.getCover()); bannerVo.setCover(banner.getCover());
......
package com.xxfc.platform.app.mapper; package com.xxfc.platform.app.mapper;
import com.xxfc.platform.app.entity.Banner; import com.xxfc.platform.app.entity.Banner;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
...@@ -22,6 +23,6 @@ public interface BannerMapper extends Mapper<Banner> { ...@@ -22,6 +23,6 @@ public interface BannerMapper extends Mapper<Banner> {
List<Banner> findBannerListByisDelOrderByRank(Banner 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 { ...@@ -29,11 +29,11 @@ public class BannerController {
* @return * @return
*/ */
@GetMapping("/app/unauth/findBannerlist") @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) { if (type==null) {
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
} }
List<BannerVo> bannerList = bannerBiz.findBannerList(type); List<BannerVo> bannerList = bannerBiz.findBannerList(type,location);
return ObjectRestResponse.succ(bannerList); return ObjectRestResponse.succ(bannerList);
} }
} }
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <resultMap type="com.xxfc.platform.app.entity.Banner" id="bannerMap">
...@@ -14,6 +14,14 @@ ...@@ -14,6 +14,14 @@
<result property="updTime" column="upd_time"/> <result property="updTime" column="upd_time"/>
<result property="url" column="url"/> <result property="url" column="url"/>
<result property="isDel" column="is_del"/> <result property="isDel" column="is_del"/>
<result property="location" column="location"/>
</resultMap> </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> </mapper>
\ No newline at end of file
...@@ -12,6 +12,7 @@ import com.xxfc.platform.campsite.mapper.CampsiteShopTagMapper; ...@@ -12,6 +12,7 @@ import com.xxfc.platform.campsite.mapper.CampsiteShopTagMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
...@@ -76,4 +77,12 @@ public class CampsiteShopTagBiz extends BaseBiz<CampsiteShopTagMapper,CampsiteSh ...@@ -76,4 +77,12 @@ public class CampsiteShopTagBiz extends BaseBiz<CampsiteShopTagMapper,CampsiteSh
} }
return effectRows; 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; ...@@ -2,12 +2,13 @@ package com.xxfc.platform.campsite.biz;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.vo.PageDataVO; 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.dto.CampsiteTagListDTO;
import com.xxfc.platform.campsite.vo.CampsiteTagListVo; import com.xxfc.platform.campsite.vo.CampsiteTagListVo;
import com.xxfc.platform.campsite.vo.CampsiteTagVo; import com.xxfc.platform.campsite.vo.CampsiteTagVo;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.campsite.entity.CampsiteTag; import com.xxfc.platform.campsite.entity.CampsiteTag;
...@@ -26,6 +27,9 @@ import java.util.List; ...@@ -26,6 +27,9 @@ import java.util.List;
*/ */
@Service @Service
public class CampsiteTagBiz extends BaseBiz<CampsiteTagMapper,CampsiteTag> { public class CampsiteTagBiz extends BaseBiz<CampsiteTagMapper,CampsiteTag> {
@Autowired
private CampsiteShopTagBiz campsiteShopTagBiz;
/** /**
* 查询营地列表 * 查询营地列表
...@@ -46,7 +50,11 @@ public class CampsiteTagBiz extends BaseBiz<CampsiteTagMapper,CampsiteTag> { ...@@ -46,7 +50,11 @@ public class CampsiteTagBiz extends BaseBiz<CampsiteTagMapper,CampsiteTag> {
* @return * @return
*/ */
public int updateCampsiteTagStatus(Integer tagId) { 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> { ...@@ -74,6 +82,7 @@ public class CampsiteTagBiz extends BaseBiz<CampsiteTagMapper,CampsiteTag> {
* @return * @return
*/ */
public int updateCampsiteTagIsSearchStatus(Integer id, Integer status) { public int updateCampsiteTagIsSearchStatus(Integer id, Integer status) {
return mapper.updateCampsiteTagIsearchStatusById(id,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