| | |
| | | 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.core.text.Convert; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.ServletUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.domain.ZExperience; |
| | | import com.ruoyi.service.ZExperienceService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM; |
| | | import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author ojq |
| | | * @since 2023-03-14 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/zExperience") |
| | | public class ZExperienceController { |
| | | public class ZExperienceController extends BaseController { |
| | | |
| | | @Autowired |
| | | private ZExperienceService zExperienceService; |
| | | |
| | | @GetMapping("/all") |
| | | public AjaxResult listAll(){ |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | List<ZExperience> zExperiences = zExperienceService.selectExperienceList(userId); |
| | | return AjaxResult.success(zExperiences); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出个人主要学习工作经历记录列表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:property:export')") |
| | | @Log(title = "个人主要学习工作经历记录", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ZExperience zExperience) |
| | | { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | |
| | | List<ZExperience> list = zExperienceService.selectExperienceList(userId); |
| | | log.info("导出记录为:{}",list); |
| | | ExcelUtil<ZExperience> util = new ExcelUtil<>(ZExperience.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=zExperienceService.importExcel(file,userId); |
| | | if(flag){ |
| | | return AjaxResult.success("导入数据成功"); |
| | | } |
| | | return AjaxResult.error("导入数据失败"); |
| | | } |
| | | |
| | | |
| | | // /** |
| | | // * 获取个人主要学习工作经历记录详细信息 |
| | | // */ |
| | | //// @PreAuthorize("@ss.hasPermi('system:property:query')") |
| | | // @GetMapping(value = "/{id}") |
| | | // public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | // { |
| | | // return success(zExperienceService.getById(id)); |
| | | // } |
| | | // |
| | | /** |
| | | * 新增个人主要学习工作经历记录 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:property:add')") |
| | | @Log(title = "个人主要学习工作经历记录", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ZExperience zExperience) |
| | | { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | zExperience.setUserId(userId); |
| | | return toAjax(zExperienceService.save(zExperience)); |
| | | } |
| | | |
| | | /** |
| | | * 修改个人主要学习工作经历记录 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:property:edit')") |
| | | @Log(title = "个人主要学习工作经历记录", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ZExperience zExperience) |
| | | { |
| | | return toAjax(zExperienceService.updateById(zExperience)); |
| | | } |
| | | // |
| | | /** |
| | | * 批量删除个人主要学习工作经历记录 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:property:remove')") |
| | | @Log(title = "个人主要学习工作经历记录", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | return toAjax(zExperienceService.removeByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | } |
| | | |