Commit de134b1b authored by shangtx's avatar shangtx

feat: 轮播图跳转

parent cb70febf
package com.onsiteservice.admin.controller.banner;
import com.onsiteservice.common.annotation.user.CurrentUserId;
import com.onsiteservice.entity.banner.Banner;
import com.onsiteservice.admin.service.banner.BannerService;
......@@ -51,8 +52,8 @@ public class BannerController {
@ApiOperation(value = "新增或修改", notes = "作者: 商天翔")
@PostMapping("/save-or-update")
public Result saveOrUpdate(@RequestBody @NonNull @Validated Banner banner) {
return success(bannerService.saveOrUpdate(banner), banner.getId() == null ? "新增成功" : "修改成功");
public Result saveOrUpdate(@RequestBody @NonNull @Validated Banner banner, @CurrentUserId Long userId) {
return success(bannerService.saveOrUpdate(banner, userId), banner.getId() == null ? "新增成功" : "修改成功");
}
@PutMapping("/enable")
......
package com.onsiteservice.admin.service.banner;
import com.onsiteservice.dao.util.EntityUtils;
import com.onsiteservice.entity.banner.Banner;
import com.onsiteservice.dao.mapper.banner.BannerMapper;
import com.onsiteservice.admin.mapper.banner.BannerBizMapper;
......@@ -43,11 +44,13 @@ public class BannerService extends AbstractMapper<Banner> {
/**
* 保存或更新方法
*/
public int saveOrUpdate(Banner banner) {
public int saveOrUpdate(Banner banner, Long userId) {
if (banner.getId() == null) {
EntityUtils.insert(banner, userId);
return this.insertSelective(banner);
} else {
return this.updateByPrimaryKeySelective(banner);
EntityUtils.update(banner, userId);
return this.updateByPrimaryKeySelectiveForce(banner, List.of("mpArticle"));
}
}
......
......@@ -35,10 +35,14 @@ public class Banner implements Serializable {
@ApiModelProperty("图片地址")
private String url;
@Column(name = "mp_article")
@ApiModelProperty("文章连接")
private String mpArticle;
/**
* 跳转类型 0 不跳转 1 图片 ,其他业务
*/
@ApiModelProperty("跳转类型 0 不跳转 1 图片 ,其他业务")
@ApiModelProperty("跳转类型 0 不跳转 1 图片 2 文章")
private Integer type;
/**
......
......@@ -19,9 +19,12 @@ public class BannerVO {
@ApiModelProperty("图片地址")
private String url;
@ApiModelProperty("跳转类型 0 不跳转 1 图片 ,其他业务")
@ApiModelProperty("跳转类型 0 不跳转 1 图片 ,2 文章")
private Integer type;
@ApiModelProperty("文章链接")
private String mpArticle;
@ApiModelProperty("跳转内容 如果是图片存url如果是资讯存id")
private String target;
......
......@@ -93,7 +93,7 @@ public class WechatNotifyController {
}
} catch (Exception e) {
log.error("notify() Exception exception:{}", e.getMessage());
log.error("notify() Exception exception:", e);
e.printStackTrace();
}
}
......
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