Merge remote-tracking branch 'origin/feature/1.8.0-uniapp' into feature/1.8.0-uniapp
This commit is contained in:
commit
c6e901ebd9
|
@ -15,12 +15,10 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "管理后台 - Banner管理")
|
||||
@Api(tags = "管理后台 - Banner 管理")
|
||||
@RestController
|
||||
@RequestMapping("/market/banner")
|
||||
@Validated
|
||||
|
@ -30,14 +28,14 @@ public class BannerController {
|
|||
private BannerService bannerService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建banner")
|
||||
@ApiOperation("创建 Banner")
|
||||
@PreAuthorize("@ss.hasPermission('market:banner:create')")
|
||||
public CommonResult<Long> createBanner(@Valid @RequestBody BannerCreateReqVO createReqVO) {
|
||||
return success(bannerService.createBanner(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新banner")
|
||||
@ApiOperation("更新 Banner")
|
||||
@PreAuthorize("@ss.hasPermission('market:banner:update')")
|
||||
public CommonResult<Boolean> updateBanner(@Valid @RequestBody BannerUpdateReqVO updateReqVO) {
|
||||
bannerService.updateBanner(updateReqVO);
|
||||
|
@ -45,7 +43,7 @@ public class BannerController {
|
|||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除banner")
|
||||
@ApiOperation("删除 Banner")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('market:banner:delete')")
|
||||
public CommonResult<Boolean> deleteBanner(@RequestParam("id") Long id) {
|
||||
|
@ -54,7 +52,7 @@ public class BannerController {
|
|||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得banner")
|
||||
@ApiOperation("获得 Banner")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('market:banner:query')")
|
||||
public CommonResult<BannerRespVO> getBanner(@RequestParam("id") Long id) {
|
||||
|
@ -62,30 +60,12 @@ public class BannerController {
|
|||
return success(BannerConvert.INSTANCE.convert(banner));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得banner列表")
|
||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
||||
@PreAuthorize("@ss.hasPermission('market:banner:query')")
|
||||
public CommonResult<List<BannerRespVO>> getBannerList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<BannerDO> list = bannerService.getBannerList(ids);
|
||||
return success(BannerConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得Banner分页")
|
||||
@ApiOperation("获得 Banner 分页")
|
||||
@PreAuthorize("@ss.hasPermission('market:banner:query')")
|
||||
public CommonResult<PageResult<BannerRespVO>> getBannerPage(@Valid BannerPageReqVO pageVO) {
|
||||
PageResult<BannerDO> pageResult = bannerService.getBannerPage(pageVO);
|
||||
return success(BannerConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/update-status")
|
||||
@ApiOperation("Banner上下架")
|
||||
@PreAuthorize("@ss.hasPermission('market:banner:update')")
|
||||
public CommonResult<Boolean> updateBannerStatus(@Valid @RequestBody BannerUpdateStatusReqVO reqVO) {
|
||||
bannerService.updateBannerStatus(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import lombok.Data;
|
|||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* Banner Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
* Banner Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
* @author xia
|
||||
*/
|
||||
@Data
|
||||
|
@ -21,24 +21,16 @@ public class BannerBaseVO {
|
|||
|
||||
@ApiModelProperty(value = "跳转链接", required = true)
|
||||
@NotNull(message = "跳转链接不能为空")
|
||||
/**
|
||||
* 跳转链接
|
||||
*/
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(value = "图片地址", required = true)
|
||||
@NotNull(message = "图片地址不能为空")
|
||||
/**
|
||||
* 图片链接
|
||||
*/
|
||||
private String picUrl;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "排序", required = true)
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true)
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(CommonStatusEnum.class)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package cn.iocoder.yudao.module.market.controller.admin.banner.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -19,9 +17,8 @@ import javax.validation.constraints.NotNull;
|
|||
@ToString(callSuper = true)
|
||||
public class BannerUpdateReqVO extends BannerBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "banner编号", required = true)
|
||||
@NotNull(message = "banner编号不能为空")
|
||||
@ApiModelProperty(value = "banner 编号", required = true)
|
||||
@NotNull(message = "banner 编号不能为空")
|
||||
private Long id;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
package cn.iocoder.yudao.module.market.controller.admin.banner.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Copyright: 南京淘点网络科技有限公司
|
||||
* @author: wangxia
|
||||
*/
|
||||
@Data
|
||||
public class BannerUpdateStatusReqVO {
|
||||
|
||||
@ApiModelProperty(value = "banner编号", required = true)
|
||||
@NotNull(message = "banner编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true)
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(CommonStatusEnum.class)
|
||||
private Integer status;
|
||||
}
|
|
@ -27,9 +27,11 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|||
@Validated
|
||||
public class AppBannerController {
|
||||
|
||||
// TODO @xia:使用 @Resource 哈
|
||||
@Autowired
|
||||
private BannerService bannerService;
|
||||
|
||||
// TODO @xia:新建一个 AppBannerRespVO,只返回必要的字段。status 要过滤下。然后 sort 下结果
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得banner列表")
|
||||
@PreAuthorize("@ss.hasPermission('market:banner:query')")
|
||||
|
|
|
@ -4,22 +4,20 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerCreateReqVO;
|
||||
import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerPageReqVO;
|
||||
import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerUpdateStatusReqVO;
|
||||
import cn.iocoder.yudao.module.market.dal.dataobject.banner.BannerDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 首页Banner Service 接口
|
||||
* 首页 Banner Service 接口
|
||||
*
|
||||
* @author xia
|
||||
*/
|
||||
public interface BannerService {
|
||||
|
||||
/**
|
||||
* 创建Banner
|
||||
* 创建 Banner
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
|
@ -27,21 +25,21 @@ public interface BannerService {
|
|||
Long createBanner(@Valid BannerCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新Banner
|
||||
* 更新 Banner
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateBanner(@Valid BannerUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除Banner
|
||||
* 删除 Banner
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteBanner(Long id);
|
||||
|
||||
/**
|
||||
* 获得Banner
|
||||
* 获得 Banner
|
||||
*
|
||||
* @param id 编号
|
||||
* @return Banner
|
||||
|
@ -49,26 +47,17 @@ public interface BannerService {
|
|||
BannerDO getBanner(Long id);
|
||||
|
||||
/**
|
||||
* 获得Banner列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return Banner列表
|
||||
*/
|
||||
List<BannerDO> getBannerList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得所有Banner列表
|
||||
* 获得所有 Banner列表
|
||||
* @return Banner列表
|
||||
*/
|
||||
List<BannerDO> getBannerList();
|
||||
|
||||
/**
|
||||
* 获得Banner分页
|
||||
* 获得 Banner 分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return Banner分页
|
||||
*/
|
||||
PageResult<BannerDO> getBannerPage(BannerPageReqVO pageReqVO);
|
||||
|
||||
void updateBannerStatus(BannerUpdateStatusReqVO reqVO);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerCreateReqVO;
|
||||
import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerPageReqVO;
|
||||
import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.market.controller.admin.banner.vo.BannerUpdateStatusReqVO;
|
||||
import cn.iocoder.yudao.module.market.convert.banner.BannerConvert;
|
||||
import cn.iocoder.yudao.module.market.dal.dataobject.banner.BannerDO;
|
||||
import cn.iocoder.yudao.module.market.dal.mysql.banner.BannerMapper;
|
||||
|
@ -12,11 +11,10 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.market.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.market.enums.ErrorCodeConstants.BANNER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 首页banner 实现类
|
||||
|
@ -67,11 +65,6 @@ public class BannerServiceImpl implements BannerService {
|
|||
return bannerMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BannerDO> getBannerList(Collection<Long> ids) {
|
||||
return bannerMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BannerDO> getBannerList() {
|
||||
return bannerMapper.selectList();
|
||||
|
@ -82,13 +75,4 @@ public class BannerServiceImpl implements BannerService {
|
|||
return bannerMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBannerStatus(BannerUpdateStatusReqVO updateStatusReqVO) {
|
||||
// 校验是否可以更新
|
||||
this.validateBannerExists(updateStatusReqVO.getId());
|
||||
// 更新状态
|
||||
BannerDO updateObj = BannerConvert.INSTANCE.convert(updateStatusReqVO);
|
||||
bannerMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,12 +29,6 @@
|
|||
v-hasPermi="['market:banner:create']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"-->
|
||||
<!-- :loading="exportLoading"-->
|
||||
<!-- v-hasPermi="['market:banner:export']">导出-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
|
@ -258,23 +252,6 @@ export default {
|
|||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
// 处理查询参数
|
||||
let params = {...this.queryParams};
|
||||
params.pageNo = undefined;
|
||||
params.pageSize = undefined;
|
||||
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||
// 执行导出
|
||||
this.$modal.confirm('是否确认导出所有Banner数据项?').then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportBannerExcel(params);
|
||||
}).then(response => {
|
||||
this.$download.excel(response, "Banner.xls");
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue