Commit be1df259 authored by libin's avatar libin

banner 添加字段platform

parent 3fe5d68a
......@@ -105,4 +105,9 @@ public class Banner {
* 位置 banner位置0 所有 1:推荐 2:拍拍 3:短视频 4:问答
*/
private Integer location;
/**
* 平台 0:APP 1:欣欣房车官网 2:滴房车官网
*/
private Integer platform;
}
......@@ -21,20 +21,9 @@ import java.util.List;
@Service
public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
/* @CacheClear(key = RedisKey.CONSTANT_CODE_PREFIX_BANNER)
public void update(Banner banner) {
this.updateSelectiveById(banner);
}
@CacheClear(key = RedisKey.CONSTANT_CODE_PREFIX_BANNER)
public void remove(int id) {
this.deleteById(id);
}*/
public List<BannerVo> findBannerList(Integer type,Integer location) {
public List<BannerVo> findBannerList(Integer type,Integer location,Integer platform) {
List<BannerVo> bannerVos = new ArrayList<>();
List<Banner> banners = mapper.findBannerListByType(type,location);
List<Banner> banners = mapper.findBannerListByType(type,location,platform);
banners.forEach(banner -> {
BannerVo bannerVo = new BannerVo();
bannerVo.setCover(banner.getCover());
......@@ -46,30 +35,14 @@ public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
return bannerVos;
}
/*
*/
/**
* 更改banner信息
* @param banner
* @param userInfo
* @return
*//*
public int update(Banner banner, UserDTO userInfo) {
banner.setUpdName(userInfo.getUsername());
banner.setUpdTime(Instant.now().toEpochMilli());
return mapper.updateByPrimaryKeySelective(banner);
}
*/
/**
* 分页查询banner
* @param pageNo
* @param pageSize
* @return
*/
public PageDataVO<Banner> findBannePage(Integer pageNo, Integer pageSize) {
return PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.findBannerListByisDelOrderByRank(Banner.builder().isDel(0).build()));
public PageDataVO<Banner> findBannePage(Integer pageNo, Integer pageSize,Integer platform) {
return PageDataVO.pageInfo(pageNo, pageSize, () -> mapper.findBannerListByisDelOrderByRank(Banner.builder().isDel(0).platform(platform).build()));
}
/**
......
......@@ -19,10 +19,10 @@ import java.util.List;
@Repository
public interface BannerMapper extends Mapper<Banner> {
@Select("select * from `banner` where is_del=#{isDel} order by rank ASC")
@Select("select * from `banner` where is_del=#{isDel} and `platform`=#{platform} order by rank ASC")
List<Banner> findBannerListByisDelOrderByRank(Banner banner);
List<Banner> findBannerListByType(@Param("type") Integer type,@Param("location") Integer location);
List<Banner> findBannerListByType(@Param("type") Integer type,@Param("location") Integer location,@Param("platform") Integer platform);
}
......@@ -21,19 +21,22 @@ import java.util.List;
@RequestMapping("/banner")
public class BannerController {
@Autowired
private BannerBiz bannerBiz;
@Autowired
private BannerBiz bannerBiz;
/**
*查询banner图
* 查询banner图
*
* @return
*/
@GetMapping("/app/unauth/findBannerlist")
public ObjectRestResponse findBannerlist(@RequestParam("type") Integer type,@RequestParam(required = false,value = "location") Integer location){
if (type==null) {
public ObjectRestResponse findBannerlist(@RequestParam(value = "type") Integer type,
@RequestParam(required = false, value = "location") Integer location,
@RequestParam(value = "platform",required = false,defaultValue = "0") Integer platform) {
if (type == null) {
return ObjectRestResponse.createDefaultFail();
}
List<BannerVo> bannerList = bannerBiz.findBannerList(type,location);
return ObjectRestResponse.succ(bannerList);
List<BannerVo> bannerList = bannerBiz.findBannerList(type, location,platform);
return ObjectRestResponse.succ(bannerList);
}
}
......@@ -67,9 +67,10 @@ public class BannerAdminController {
@ApiImplicitParam(name = "pageSize",paramType = "query",required = false,dataType = "integer",defaultValue = "10")
})
public ObjectRestResponse<PageDataVO> findBannerPage(@RequestParam(name = "pageNo",defaultValue = "0",required = false) Integer pageNo,
@RequestParam(name = "pageSize",defaultValue = "10",required = false) Integer pageSize){
@RequestParam(name = "pageSize",defaultValue = "10",required = false) Integer pageSize,
@RequestParam(name = "platform",defaultValue = "0",required = false) Integer platform){
PageDataVO<Banner> pageDataVO = bannerBiz.findBannePage(pageNo,pageSize);
PageDataVO<Banner> pageDataVO = bannerBiz.findBannePage(pageNo,pageSize,platform);
return ObjectRestResponse.succ(pageDataVO);
}
......
......@@ -15,6 +15,7 @@
<result property="url" column="url"/>
<result property="isDel" column="is_del"/>
<result property="location" column="location"/>
<result property="platform" column="platform"/>
</resultMap>
<select id="findBannerListByType" resultMap="bannerMap">
......@@ -22,6 +23,9 @@
<if test="location != null">
and `location`=#{location}
</if>
<if test="platform != null">
and `platform`=#{platform}
</if>
order by rank asc
</select>
</mapper>
\ No newline at end of file
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