|
@@ -0,0 +1,126 @@
|
|
|
+package com.ruoyi.web.controller.api;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.ruoyi.app.domain.TbProfileImg;
|
|
|
+import com.ruoyi.app.service.ITbProfileImgService;
|
|
|
+import com.ruoyi.common.annotation.Log;
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+import com.ruoyi.common.enums.BusinessType;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 个人详情图片
|
|
|
+ *
|
|
|
+ * @author Alex
|
|
|
+ * @date 2020-11-05
|
|
|
+ */
|
|
|
+@Api(value = "个人详情图片", tags = "个人详情图片")
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+@RestController
|
|
|
+@RequestMapping("/system/profile/img" )
|
|
|
+public class TbProfileImgController extends BaseController {
|
|
|
+
|
|
|
+ private final ITbProfileImgService profileImgService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询个人详情图片列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询个人详情图片分页列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:profile:img:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(TbProfileImg tbProfileImg)
|
|
|
+ {
|
|
|
+ startPage();
|
|
|
+ LambdaQueryWrapper<TbProfileImg> lqw = new LambdaQueryWrapper<TbProfileImg>();
|
|
|
+ if (tbProfileImg.getProfileId() != null){
|
|
|
+ lqw.eq(TbProfileImg::getProfileId ,tbProfileImg.getProfileId());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(tbProfileImg.getUrl())){
|
|
|
+ lqw.eq(TbProfileImg::getUrl ,tbProfileImg.getUrl());
|
|
|
+ }
|
|
|
+ List<TbProfileImg> list = profileImgService.list(lqw);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取个人详情图片详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取个人详情图片详细信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:profile:img:query')" )
|
|
|
+ @GetMapping(value = "/{id}" )
|
|
|
+ public AjaxResult getInfo(@PathVariable("id" ) Long id) {
|
|
|
+ return AjaxResult.success(profileImgService.getById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增个人详情图片
|
|
|
+ */
|
|
|
+ @ApiOperation("新增个人详情图片")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:profile:img:add')" )
|
|
|
+ @Log(title = "个人详情图片" , businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping
|
|
|
+ public AjaxResult add(@RequestBody TbProfileImg tbProfileImg) {
|
|
|
+ return toAjax(profileImgService.save(tbProfileImg) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改个人详情图片
|
|
|
+ */
|
|
|
+ @ApiOperation("修改个人详情图片")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:profile:img:edit')" )
|
|
|
+ @Log(title = "个人详情图片" , businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping
|
|
|
+ public AjaxResult edit(@RequestBody TbProfileImg tbProfileImg) {
|
|
|
+ return toAjax(profileImgService.updateById(tbProfileImg) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除个人详情图片
|
|
|
+ */
|
|
|
+ @ApiOperation("删除多张个人详情图片")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:profile:img:remove')" )
|
|
|
+ @Log(title = "个人详情图片" , businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}" )
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
+ return toAjax(profileImgService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("删除单张个人详情 图片")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:profile:img:remove')" )
|
|
|
+ @Log(title = "个人详情图片" , businessType = BusinessType.DELETE)
|
|
|
+ @ApiImplicitParam(name = "id", value = "图片id",paramType="Long")
|
|
|
+ @GetMapping("/delImg")
|
|
|
+ public AjaxResult delImg(Long id) {
|
|
|
+ if (id == null){
|
|
|
+ return AjaxResult.error("id不能为空");
|
|
|
+ }
|
|
|
+ return toAjax(profileImgService.removeById(id) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("获取个人详情 图片列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:profile:img:list')")
|
|
|
+ @ApiImplicitParam(name = "profileId", value = "详情id",paramType="Long")
|
|
|
+ @GetMapping("/getByProfileId/{profileId}")
|
|
|
+ public AjaxResult listImg(Long profileId) {
|
|
|
+ if (profileId == null){
|
|
|
+ return AjaxResult.error("详情Id不能为空");
|
|
|
+ }
|
|
|
+ List<TbProfileImg> list = profileImgService.list(new LambdaQueryWrapper<TbProfileImg>()
|
|
|
+ .eq(TbProfileImg::getProfileId, profileId)
|
|
|
+ );
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+}
|