| | |
| | | package com.ruoyi.web.controller.zhang; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | 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.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.domain.ZAutobiography; |
| | | import com.ruoyi.service.ZAutobiographyService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.websocket.server.PathParam; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author ojq |
| | | * @since 2023-03-14 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/zAutobiography") |
| | | public class ZAutobiographyController { |
| | | public class ZAutobiographyController extends BaseController { |
| | | |
| | | @Resource |
| | | ZAutobiographyService zAutobiographyService; |
| | | |
| | | /** |
| | | * 返回关于本用户的所有自传 |
| | | * @return |
| | | */ |
| | | @GetMapping("/all") |
| | | public AjaxResult listAll(){ |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | List<ZAutobiography> zAutobiographys = zAutobiographyService.selectAutobiographyList(userId); |
| | | return AjaxResult.success(zAutobiographys); |
| | | } |
| | | |
| | | /** |
| | | * 返回特定时期的个人自传 |
| | | */ |
| | | @GetMapping("/byTerm") |
| | | public AjaxResult listByTerm(@PathParam("term")String term){ |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | List<ZAutobiography> zAutobiographys=zAutobiographyService.listByTerm(userId,term); |
| | | return AjaxResult.success(zAutobiographys); |
| | | } |
| | | |
| | | // /** |
| | | // * 导出个人自传记录列表 |
| | | // */ |
| | | //// @PreAuthorize("@ss.hasPermi('system:property:export')") |
| | | // @Log(title = "个人自传记录", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, ZAutobiography zAutobiography) |
| | | // { |
| | | // SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | // Long userId = user.getUserId(); |
| | | // |
| | | // List<ZAutobiography> list = zAutobiographyService.selectExperienceList(userId); |
| | | // log.info("导出记录为:{}",list); |
| | | // ExcelUtil<ZAutobiography> util = new ExcelUtil<>(ZAutobiography.class); |
| | | // util.exportExcel(response, list, "个人自传记录数据"); |
| | | // } |
| | | //// |
| | | // |
| | | // /** |
| | | // * 导入个人自传记录列表 |
| | | // */ |
| | | // @Log(title = "用户管理", businessType = BusinessType.IMPORT) |
| | | // @PostMapping("/importData") |
| | | // public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception |
| | | // { |
| | | // SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | // Long userId = user.getUserId(); |
| | | // |
| | | // boolean flag=zAutobiographyService.importExcel(file,userId); |
| | | // if(flag){ |
| | | // return AjaxResult.success("导入数据成功"); |
| | | // } |
| | | // return AjaxResult.error("导入数据失败"); |
| | | // } |
| | | |
| | | /** |
| | | * 新增个人自传记录 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:property:add')") |
| | | @Log(title = "个人自传记录", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ZAutobiography zAutobiography) |
| | | { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | zAutobiography.setUserId(userId); |
| | | return toAjax(zAutobiographyService.save(zAutobiography)); |
| | | } |
| | | |
| | | /** |
| | | * 修改个人自传记录 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:property:edit')") |
| | | @Log(title = "个人自传记录", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ZAutobiography zAutobiography) |
| | | { |
| | | return toAjax(zAutobiographyService.updateById(zAutobiography)); |
| | | } |
| | | // |
| | | /** |
| | | * 批量删除个人自传记录 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:property:remove')") |
| | | @Log(title = "个人自传记录", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | return toAjax(zAutobiographyService.removeByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | } |
| | | |