From ba0282804dea0a6f66c5b5a6167270bb091ba2cd Mon Sep 17 00:00:00 2001 From: wangxy <1356089412@qq.com> Date: Wed, 21 Aug 2024 10:19:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=BD=BD=E4=BD=93=E5=AE=9E=E4=BD=93?= =?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/carrier/CarrierController.java | 108 +++++++++++++++++- .../controller/manager/CarrierManager.java | 43 +++++++ .../system/domain/carrier/TdCarrier.java | 6 + .../mapper/carrier/TdCarrierMapper.java | 5 + .../service/carrier/TdCarrierService.java | 5 + .../carrier/impl/TdCarrierServiceImpl.java | 11 ++ .../mapper/system/TdCarrierMapper.xml | 28 ++++- 7 files changed, 204 insertions(+), 2 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/carrier/CarrierController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/carrier/CarrierController.java index f4fc311..839fde0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/carrier/CarrierController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/carrier/CarrierController.java @@ -1,11 +1,19 @@ package com.ruoyi.web.controller.carrier; +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.carrier.TdCarrier; import com.ruoyi.web.controller.manager.CarrierManager; +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.carrier @@ -20,10 +28,108 @@ import javax.annotation.Resource; @RequestMapping("/system/carrier") public class CarrierController extends BaseController { + + private String prefix = "system/carrier"; + @Resource private CarrierManager carrierManager; + @RequiresPermissions("system:carrier:view") + @GetMapping() + public String carrier() { + return prefix + "/carrier"; + } + + + /** + * 载体列表 + */ + @RequiresPermissions("system:carrier:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(TdCarrier tdCarrier) { + startPage(); + List carriers = carrierManager.selectTdCarrierList(tdCarrier); + return getDataTable(carriers); + } + + /** + * 新增载体 + */ + @GetMapping("/add") + public String add() { + return prefix + "/add"; + } + + /** + * 新增载体 + */ + @RequiresPermissions("system:carrier:add") + @Log(title = "国家秘密载体", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(TdCarrier tdCarrier) { + return toAjax(carrierManager.saveOrUpdate(tdCarrier)); + } + + /** + * 修改场国家秘密载体 + */ + @RequiresPermissions("system:carrier:edit") + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") String id, ModelMap mmap) { + TdCarrier tdCarrier = carrierManager.selectTdCarrier(id); + mmap.put("tdCarrier", tdCarrier); + return prefix + "/edit"; + } + + /** + * 修改国家秘密载体 + */ + @RequiresPermissions("system:carrier:edit") + @Log(title = "国家秘密载体", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(TdCarrier tdCarrier) { + return toAjax(carrierManager.saveOrUpdate(tdCarrier)); + } + + /** + * 详情国家秘密载体 + */ + @RequiresPermissions("system:carrier:detail") + @GetMapping("/detail/{id}") + public String detail(@PathVariable("id") String id, ModelMap mmap) { + TdCarrier tdCarrier = carrierManager.selectTdCarrier(id); + mmap.put("tdCarrier", tdCarrier); + return prefix + "/detail"; + } + + /** + * 删除国家秘密载体 + */ + @RequiresPermissions("system:carrier:remove") + @Log(title = "涉密场所", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) { + return toAjax(carrierManager.deletedTdCarrierByids(ids)); + } + + /** + * 修改状态 + */ + @GetMapping ("/updateStatus/{id}/{status}") + @ResponseBody + public AjaxResult updateStatus(@PathVariable("id") String id,@PathVariable("status") String status) { + return toAjax(carrierManager.updateStatus(id,status)); + } + + + + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/CarrierManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/CarrierManager.java index a75eb97..6de2ba2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/CarrierManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/CarrierManager.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.carrier.TdCarrier; import com.ruoyi.system.service.carrier.TdCarrierService; 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,40 @@ public class CarrierManager { @Resource private TdCarrierService carrierService; + + + public List selectTdCarrierList(TdCarrier tdCarrier) { + return carrierService.selectTdCarrierList(tdCarrier); + } + + + public boolean saveOrUpdate(TdCarrier tdCarrier) { + if (CharSequenceUtil.isNotBlank(tdCarrier.getId())) { + tdCarrier.setUpdateBy(ShiroUtils.getSysUser().getLoginName()); + tdCarrier.setUpdateTime(new Date()); + } else { + tdCarrier.setCreateBy(ShiroUtils.getSysUser().getLoginName()); + tdCarrier.setCreateTime(new Date()); + } + return carrierService.saveOrUpdate(tdCarrier); + } + + + public TdCarrier selectTdCarrier(String id) { + return carrierService.getById(id); + } + + + public boolean deletedTdCarrierByids(String ids) { + List list = Arrays.asList(Convert.toStrArray(ids)); + return carrierService.removeByIds(list); + } + + + public boolean updateStatus(String id,String status) { + return carrierService.lambdaUpdate() + .eq(TdCarrier::getId,id) + .set(TdCarrier::getStatus,status) + .update(); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/carrier/TdCarrier.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/carrier/TdCarrier.java index f28b1f7..e134f23 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/carrier/TdCarrier.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/carrier/TdCarrier.java @@ -28,6 +28,12 @@ public class TdCarrier extends BaseEntity { */ private String carrierCount; + + /** + * 载体名称 + */ + private String carrierName; + /** * 载体类型 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/carrier/TdCarrierMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/carrier/TdCarrierMapper.java index 573b541..587e7f3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/carrier/TdCarrierMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/carrier/TdCarrierMapper.java @@ -3,6 +3,8 @@ package com.ruoyi.system.mapper.carrier; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.system.domain.carrier.TdCarrier; +import java.util.List; + /** * @author 13560 * @description 针对表【td_carrier(载体下发)】的数据库操作Mapper @@ -11,6 +13,9 @@ import com.ruoyi.system.domain.carrier.TdCarrier; */ public interface TdCarrierMapper extends BaseMapper { + + public List selectTdCarrierList(TdCarrier tdCarrier); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/carrier/TdCarrierService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/carrier/TdCarrierService.java index 8e62882..6c46927 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/carrier/TdCarrierService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/carrier/TdCarrierService.java @@ -3,6 +3,8 @@ package com.ruoyi.system.service.carrier; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.system.domain.carrier.TdCarrier; +import java.util.List; + /** * @author 13560 * @description 针对表【td_carrier(载体下发)】的数据库操作Service @@ -10,4 +12,7 @@ import com.ruoyi.system.domain.carrier.TdCarrier; */ public interface TdCarrierService extends IService { + + public List selectTdCarrierList(TdCarrier tdCarrier); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/carrier/impl/TdCarrierServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/carrier/impl/TdCarrierServiceImpl.java index 2df3e2e..fb5dc33 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/carrier/impl/TdCarrierServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/carrier/impl/TdCarrierServiceImpl.java @@ -3,9 +3,13 @@ package com.ruoyi.system.service.carrier.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.system.domain.carrier.TdCarrier; import com.ruoyi.system.mapper.carrier.TdCarrierMapper; +import com.ruoyi.system.mapper.place.TdPlaceMapper; import com.ruoyi.system.service.carrier.TdCarrierService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.List; + /** * @author 13560 * @description 针对表【td_carrier(载体下发)】的数据库操作Service实现 @@ -15,6 +19,13 @@ import org.springframework.stereotype.Service; public class TdCarrierServiceImpl extends ServiceImpl implements TdCarrierService { + @Resource + private TdCarrierMapper carrierMapper; + + @Override + public List selectTdCarrierList(TdCarrier tdCarrier) { + return carrierMapper.selectTdCarrierList(tdCarrier); + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/TdCarrierMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TdCarrierMapper.xml index 1639196..43d1622 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TdCarrierMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TdCarrierMapper.xml @@ -9,6 +9,7 @@ + @@ -54,6 +55,31 @@ maintain_date,destory_depart,destory_user, destory_date,destory_manner,status, create_by,create_time,update_by, - update_time,remark + update_time,remark,carrier_name +