From 92781f6c053932cec4c5d2dd4de131067045c1a7 Mon Sep 17 00:00:00 2001 From: wangxy <1356089412@qq.com> Date: Tue, 13 Aug 2024 17:00:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=9C=BA=E6=89=80=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/manager/TdPlaceManager.java | 39 +++++++ .../controller/place/TdPlaceController.java | 108 +++++++++++++++++- .../system/mapper/place/TdPlaceMapper.java | 4 + .../system/service/place/TdPlaceService.java | 6 + .../place/impl/TdPlaceServiceImpl.java | 11 ++ .../resources/mapper/system/TdPlaceMapper.xml | 9 ++ 6 files changed, 176 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/TdPlaceManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/TdPlaceManager.java index 6625314..95afe8c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/TdPlaceManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/TdPlaceManager.java @@ -1,9 +1,16 @@ package com.ruoyi.web.controller.manager; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.text.CharSequenceUtil; +import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.system.domain.place.TdPlace; import com.ruoyi.system.service.place.TdPlaceService; import org.springframework.stereotype.Component; import javax.annotation.Resource; +import java.util.Arrays; +import java.util.Date; +import java.util.List; /** * packageName com.ruoyi.web.controller.manager @@ -19,4 +26,36 @@ public class TdPlaceManager { @Resource private TdPlaceService placeService; + + + public List selectTdPlaceList(TdPlace tdPlace) { + return placeService.selectTdPlaceList(tdPlace); + } + + + + public boolean saveOrUpdate(TdPlace tdPlace) { + if (CharSequenceUtil.isNotBlank(tdPlace.getId())) { + tdPlace.setUpdateBy(ShiroUtils.getSysUser().getLoginName()); + tdPlace.setUpdateTime(new Date()); + } else { + tdPlace.setCreateBy(ShiroUtils.getSysUser().getLoginName()); + tdPlace.setCreateTime(new Date()); + } + return placeService.saveOrUpdate(tdPlace); + } + + + public TdPlace selectTdPlace(String id) { + return placeService.getById(id); + } + + public boolean deletedPlaceByids(String ids) { + List list = Arrays.asList(Convert.toStrArray(ids)); + return placeService.removeByIds(list); + } + + public List selectList() { + return placeService.lambdaQuery().list(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/place/TdPlaceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/place/TdPlaceController.java index da23b54..790aad9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/place/TdPlaceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/place/TdPlaceController.java @@ -1,11 +1,19 @@ package com.ruoyi.web.controller.place; +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.system.domain.place.TdPlace; import com.ruoyi.web.controller.manager.TdPlaceManager; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.List; /** * packageName com.ruoyi.web.controller.place @@ -20,8 +28,106 @@ import javax.annotation.Resource; @RequestMapping("/system/place") public class TdPlaceController extends BaseController { + + private String prefix = "system/place"; + @Resource private TdPlaceManager placeManager; + @RequiresPermissions("system:place:view") + @GetMapping() + public String tdmeeting() { + return prefix + "/place"; + } + + /** + * 场所列表 + */ + @RequiresPermissions("system:place:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(TdPlace tdPlace) { + startPage(); + List tdPlaces = placeManager.selectTdPlaceList(tdPlace); + return getDataTable(tdPlaces); + } + + + /** + * 新增场所 + */ + @GetMapping("/add") + public String add() { + return prefix + "/add"; + } + + /** + * 新增场所 + */ + @RequiresPermissions("system:place:add") + @Log(title = "涉密场所", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(TdPlace tdPlace) { + return toAjax(placeManager.saveOrUpdate(tdPlace)); + } + + /** + * 修改场所 + */ + @RequiresPermissions("system:place:edit") + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") String id, ModelMap mmap) { + TdPlace tdPlace = placeManager.selectTdPlace(id); + mmap.put("tdPlace", tdPlace); + return prefix + "/edit"; + } + + /** + * 修改会议 + */ + @RequiresPermissions("system:place:edit") + @Log(title = "涉密场所", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(TdPlace tdPlace) { + return toAjax(placeManager.saveOrUpdate(tdPlace)); + } + + /** + * 详情场所 + */ + @RequiresPermissions("system:place:detail") + @GetMapping("/detail/{id}") + public String detail(@PathVariable("id") String id, ModelMap mmap) { + TdPlace tdPlace = placeManager.selectTdPlace(id); + mmap.put("tdPlace", tdPlace); + return prefix + "/detail"; + } + + /** + * 删除场所 + */ + @RequiresPermissions("system:place:remove") + @Log(title = "涉密场所", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) { + return toAjax(placeManager.deletedPlaceByids(ids)); + } + + /** + * + * 查询所有场所 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @PostMapping("/getList") + @ResponseBody + public AjaxResult getList() { + return AjaxResult.success(placeManager.selectList()); + } + + + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/place/TdPlaceMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/place/TdPlaceMapper.java index 0e976a8..16e877f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/place/TdPlaceMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/place/TdPlaceMapper.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.system.domain.place.TdPlace; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * @author 13560 * @description 针对表【td_place(涉密场所)】的数据库操作Mapper @@ -13,6 +15,8 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface TdPlaceMapper extends BaseMapper { + public List selectTdPlaceList(TdPlace tdPlace); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/place/TdPlaceService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/place/TdPlaceService.java index 5a6f352..3e6606b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/place/TdPlaceService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/place/TdPlaceService.java @@ -1,8 +1,11 @@ package com.ruoyi.system.service.place; import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.system.domain.TdMeeting; import com.ruoyi.system.domain.place.TdPlace; +import java.util.List; + /** * @author 13560 * @description 针对表【td_place(涉密场所)】的数据库操作Service @@ -10,4 +13,7 @@ import com.ruoyi.system.domain.place.TdPlace; */ public interface TdPlaceService extends IService { + + public List selectTdPlaceList(TdPlace tdPlace); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/place/impl/TdPlaceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/place/impl/TdPlaceServiceImpl.java index 6fa7f77..6e23020 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/place/impl/TdPlaceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/place/impl/TdPlaceServiceImpl.java @@ -2,10 +2,14 @@ package com.ruoyi.system.service.place.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.system.domain.place.TdPlace; +import com.ruoyi.system.mapper.TdMeetingMapper; import com.ruoyi.system.mapper.place.TdPlaceMapper; import com.ruoyi.system.service.place.TdPlaceService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.List; + /** * @author 13560 * @description 针对表【td_place(涉密场所)】的数据库操作Service实现 @@ -15,6 +19,13 @@ import org.springframework.stereotype.Service; public class TdPlaceServiceImpl extends ServiceImpl implements TdPlaceService { + @Resource + private TdPlaceMapper placeMapper; + + @Override + public List selectTdPlaceList(TdPlace tdPlace) { + return placeMapper.selectTdPlaceList(tdPlace); + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/TdPlaceMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TdPlaceMapper.xml index 3423469..f32cfa9 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TdPlaceMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TdPlaceMapper.xml @@ -20,4 +20,13 @@ create_by,create_time,update_by, update_time,remark +