package com.ard.work.location_note.controller; import java.util.List; import java.io.IOException; import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; import com.ard.common.core.utils.uuid.IdUtils; import com.ard.common.security.service.TokenService; import com.ard.system.api.model.LoginUser; import com.ard.work.location_note.domain.ArdLocationNote; import com.ard.work.location_note.service.IArdLocationNoteService; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Operation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ard.common.log.annotation.Log; import com.ard.common.log.enums.BusinessType; import com.ard.common.security.annotation.RequiresPermissions; import com.ard.common.core.web.controller.BaseController; import com.ard.common.core.web.domain.AjaxResult; import com.ard.common.core.utils.poi.ExcelUtil; import com.ard.common.core.web.page.TableDataInfo; /** * 注记Controller * * @author ruoyi * @date 2025-03-25 */ @Tag(name = "注记") @RestController @RequestMapping("/locationNote") public class ArdLocationNoteController extends BaseController { @Autowired private IArdLocationNoteService ardLocationNoteService; @Resource private TokenService tokenService; /** * 查询注记列表 */ @Operation(summary = "查询注记列表") @RequiresPermissions("location_note:locationNote:list") @GetMapping("/list") public TableDataInfo list(ArdLocationNote ardLocationNote) { LoginUser loginUser = tokenService.getLoginUser(); ardLocationNote.setCreatorDeptId(loginUser.getSysUser().getDeptId().toString()); startPage(); List list = ardLocationNoteService.selectArdLocationNoteList(ardLocationNote); return getDataTable(list); } /** * 导出注记列表 */ @Operation(summary = "导出注记列表") @RequiresPermissions("location_note:locationNote:export") @Log(title = "注记", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ArdLocationNote ardLocationNote) { List list = ardLocationNoteService.selectArdLocationNoteList(ardLocationNote); ExcelUtil util = new ExcelUtil(ArdLocationNote.class); util.exportExcel(response, list, "注记数据"); } /** * 获取注记详细信息 */ @Operation(summary = "获取注记详细信息") @RequiresPermissions("location_note:locationNote:query") @GetMapping(value = "/{areaId}") public AjaxResult getInfo(@PathVariable("areaId") String areaId) { return success(ardLocationNoteService.selectArdLocationNoteByAreaId(areaId)); } /** * 新增注记 */ @Operation(summary = "新增注记") @RequiresPermissions("location_note:locationNote:add") @Log(title = "注记", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ArdLocationNote ardLocationNote) { LoginUser loginUser = tokenService.getLoginUser(); ardLocationNote.setCreatorDeptId(loginUser.getSysUser().getDeptId().toString()); ardLocationNote.setAreaId(IdUtils.simpleUUID()); ardLocationNote.setCreateBy(loginUser.getSysUser().getNickName()); return toAjax(ardLocationNoteService.insertArdLocationNote(ardLocationNote)); } /** * 修改注记 */ @Operation(summary = "修改注记") @RequiresPermissions("location_note:locationNote:edit") @Log(title = "注记", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ArdLocationNote ardLocationNote) { LoginUser loginUser = tokenService.getLoginUser(); ardLocationNote.setUpdateBy(loginUser.getSysUser().getNickName()); return toAjax(ardLocationNoteService.updateArdLocationNote(ardLocationNote)); } /** * 删除注记 */ @Operation(summary = "删除注记") @RequiresPermissions("location_note:locationNote:remove") @Log(title = "注记", businessType = BusinessType.DELETE) @DeleteMapping("/{areaIds}") public AjaxResult remove(@PathVariable String[] areaIds) { return toAjax(ardLocationNoteService.deleteArdLocationNoteByAreaIds(areaIds)); } }