Commit d44b90ac authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/dev' into jrz_dev

parents 8bb649df 74099990
......@@ -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);
}
}
......@@ -21,22 +21,23 @@ import org.springframework.web.bind.annotation.*;
*/
@RestController
@RequestMapping("/admin/banner")
@Api(value = "banner后台接口",tags = "banner后台接口")
@Api(value = "banner后台接口", tags = "banner后台接口")
public class BannerAdminController {
@Autowired
private BannerBiz bannerBiz;
@Autowired
private BannerBiz bannerBiz;
/**
* 修改
*
* @param banner
* @return
*/
@PutMapping
@ApiOperation(value = "banner修改",notes = "修改")
public ObjectRestResponse<Banner> update(@RequestBody Banner banner, UserDTO userInfo){
int effectRows = bannerBiz.save(banner,userInfo);
if (effectRows>0){
@ApiOperation(value = "banner修改", notes = "修改")
public ObjectRestResponse<Banner> update(@RequestBody Banner banner, UserDTO userInfo) {
int effectRows = bannerBiz.save(banner, userInfo);
if (effectRows > 0) {
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail();
......@@ -44,47 +45,51 @@ public class BannerAdminController {
/**
* 根据id查询banner
*
* @param id
* @return
*/
@GetMapping("/{id}")
@ApiOperation(value = "根据id查询banner图",notes = "根据id查询banner图")
public ObjectRestResponse<Banner> findBannerById(@PathVariable Integer id){
@ApiOperation(value = "根据id查询banner图", notes = "根据id查询banner图")
public ObjectRestResponse<Banner> findBannerById(@PathVariable Integer id) {
Banner Banner = bannerBiz.selectById(id);
return ObjectRestResponse.succ(Banner);
}
/**
* 分页查询banner
*
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/page")
@ApiOperation(value = "banner分页查询",notes = "banner分页查询")
@ApiOperation(value = "banner分页查询", notes = "banner分页查询")
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "pageNo",paramType = "query",required = false,dataType = "integer",defaultValue = "0"),
@ApiImplicitParam(name = "pageSize",paramType = "query",required = false,dataType = "integer",defaultValue = "10")
@ApiImplicitParam(name = "pageNo", paramType = "query", required = false, dataType = "integer", defaultValue = "0"),
@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){
public ObjectRestResponse<PageDataVO> findBannerPage(@RequestParam(name = "pageNo", defaultValue = "0", required = false) Integer pageNo,
@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);
}
/**
* 保存banner
*
* @param banner
* @return
*/
@ApiOperation(value = "banner保存",notes = "banner保存")
@ApiOperation(value = "banner保存", notes = "banner保存")
@PostMapping
public ObjectRestResponse<Void> saveBanner(@RequestBody Banner banner,UserDTO userDTO){
public ObjectRestResponse<Void> saveBanner(@RequestBody Banner banner, UserDTO userDTO) {
banner.setIsDel(0);
int effectRows = bannerBiz.save(banner,userDTO);
if (effectRows>0){
int effectRows = bannerBiz.save(banner, userDTO);
if (effectRows > 0) {
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail();
......@@ -93,14 +98,15 @@ public class BannerAdminController {
/**
* 逻辑删除
*
* @param id
* @return
*/
@DeleteMapping("/{id}")
@ApiOperation(value = "banner逻辑删除",notes = "banner逻辑删除")
public ObjectRestResponse<Void> deleteBannerById(@PathVariable Integer id,UserDTO userDTO){
int effectRows = bannerBiz.updateBannerStatus(id,1,userDTO);
if (effectRows>0){
@ApiOperation(value = "banner逻辑删除", notes = "banner逻辑删除")
public ObjectRestResponse<Void> deleteBannerById(@PathVariable Integer id, UserDTO userDTO) {
int effectRows = bannerBiz.updateBannerStatus(id, 1, userDTO);
if (effectRows > 0) {
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail();
......@@ -108,11 +114,12 @@ public class BannerAdminController {
/**
* 真实删除
*
* @param id
* @return
*/
@DeleteMapping("/del/{id}")
public ObjectRestResponse<Void> deleteReallyBannerById(@PathVariable(value = "id") Integer id){
public ObjectRestResponse<Void> deleteReallyBannerById(@PathVariable(value = "id") Integer id) {
bannerBiz.deleteById(id);
return ObjectRestResponse.succ();
}
......
......@@ -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
......@@ -3,11 +3,13 @@ package com.xxfc.platform.uccn.biz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.util.RandomUtil;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.uccn.dto.SummitActivityFindDTO;
import com.xxfc.platform.uccn.dto.SummitActivitySaveDTO;
import com.xxfc.platform.uccn.entity.SummitActivity;
import com.xxfc.platform.uccn.mapper.SummitActivityMapper;
import com.xxfc.platform.uccn.vo.SummitActivityAdminVo;
import com.xxfc.platform.uccn.vo.SummitActivityDetailVo;
import com.xxfc.platform.uccn.vo.SummitActivityVo;
......@@ -15,10 +17,6 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import com.xxfc.platform.uccn.entity.SummitActivity;
import com.xxfc.platform.uccn.mapper.SummitActivityMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import tk.mybatis.mapper.entity.Example;
import java.time.Instant;
......@@ -75,9 +73,7 @@ public class SummitActivityBiz extends BaseBiz<SummitActivityMapper, SummitActiv
criteria.andLike("title", String.format("%%%s%%", summitActivityFindDTO.getTitle()));
}
criteria.andEqualTo("isDel", 0);
/* if (Objects.nonNull(summitActivityFindDTO.getStartTime()) && Objects.nonNull(summitActivityFindDTO.getEndTime())){
criteria.andBetween("")
}*/
PageDataVO<SummitActivity> pageDataVO = PageDataVO.pageInfo(summitActivityFindDTO.getPage(), summitActivityFindDTO.getLimit(), () -> mapper.selectByExample(example));
List<SummitActivity> data = pageDataVO.getData();
if (CollectionUtils.isEmpty(data)) {
......
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