From fde0282952a89a74659c211682a2a41ed83a98dc Mon Sep 17 00:00:00 2001 From: wyt <414651037@qq.com> Date: Mon, 14 Jul 2025 17:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=BB=84=E7=AE=A1=E7=90=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BasSheepGroupController.java | 102 ++++++++++++++++++ .../domain/BasSheepGroup.java | 74 +++++++++++++ .../mapper/BasSheepGroupMapper.java | 61 +++++++++++ .../service/IBasSheepGroupService.java | 61 +++++++++++ .../impl/BasSheepGroupServiceImpl.java | 96 +++++++++++++++++ .../group_management/BasSheepGroupMapper.xml | 85 +++++++++++++++ 6 files changed, 479 insertions(+) create mode 100644 zhyc-module/src/main/java/com/zhyc/module/group_management/controller/BasSheepGroupController.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/group_management/domain/BasSheepGroup.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/group_management/mapper/BasSheepGroupMapper.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/group_management/service/IBasSheepGroupService.java create mode 100644 zhyc-module/src/main/java/com/zhyc/module/group_management/service/impl/BasSheepGroupServiceImpl.java create mode 100644 zhyc-module/src/main/resources/mapper/group_management/BasSheepGroupMapper.xml diff --git a/zhyc-module/src/main/java/com/zhyc/module/group_management/controller/BasSheepGroupController.java b/zhyc-module/src/main/java/com/zhyc/module/group_management/controller/BasSheepGroupController.java new file mode 100644 index 0000000..167dd65 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/group_management/controller/BasSheepGroupController.java @@ -0,0 +1,102 @@ +package com.zhyc.module.group_management.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +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.zhyc.common.annotation.Log; +import com.zhyc.common.core.controller.BaseController; +import com.zhyc.common.core.domain.AjaxResult; +import com.zhyc.common.enums.BusinessType; +import com.zhyc.module.group_management.domain.BasSheepGroup; +import com.zhyc.module.group_management.service.IBasSheepGroupService; +import com.zhyc.common.utils.poi.ExcelUtil; + +/** + * 分组管理Controller + * + * @author wyt + * @date 2025-07-14 + */ +@RestController +@RequestMapping("/group_management/group_management") +public class BasSheepGroupController extends BaseController +{ + @Autowired + private IBasSheepGroupService basSheepGroupService; + + /** + * 查询分组管理列表 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:list')") + @GetMapping("/list") + public AjaxResult list(BasSheepGroup basSheepGroup) + { + List list = basSheepGroupService.selectBasSheepGroupList(basSheepGroup); + return success(list); + } + + /** + * 导出分组管理列表 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:export')") + @Log(title = "分组管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, BasSheepGroup basSheepGroup) + { + List list = basSheepGroupService.selectBasSheepGroupList(basSheepGroup); + ExcelUtil util = new ExcelUtil(BasSheepGroup.class); + util.exportExcel(response, list, "分组管理数据"); + } + + /** + * 获取分组管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:query')") + @GetMapping(value = "/{groupId}") + public AjaxResult getInfo(@PathVariable("groupId") Long groupId) + { + return success(basSheepGroupService.selectBasSheepGroupByGroupId(groupId)); + } + + /** + * 新增分组管理 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:add')") + @Log(title = "分组管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody BasSheepGroup basSheepGroup) + { + return toAjax(basSheepGroupService.insertBasSheepGroup(basSheepGroup)); + } + + /** + * 修改分组管理 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:edit')") + @Log(title = "分组管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody BasSheepGroup basSheepGroup) + { + return toAjax(basSheepGroupService.updateBasSheepGroup(basSheepGroup)); + } + + /** + * 删除分组管理 + */ + @PreAuthorize("@ss.hasPermi('group_management:group_management:remove')") + @Log(title = "分组管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{groupIds}") + public AjaxResult remove(@PathVariable Long[] groupIds) + { + return toAjax(basSheepGroupService.deleteBasSheepGroupByGroupIds(groupIds)); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/group_management/domain/BasSheepGroup.java b/zhyc-module/src/main/java/com/zhyc/module/group_management/domain/BasSheepGroup.java new file mode 100644 index 0000000..09ac54e --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/group_management/domain/BasSheepGroup.java @@ -0,0 +1,74 @@ +package com.zhyc.module.group_management.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.zhyc.common.annotation.Excel; +import com.zhyc.common.core.domain.TreeEntity; + +/** + * 分组管理对象 bas_sheep_group + * + * @author wyt + * @date 2025-07-14 + */ +public class BasSheepGroup extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** 分组ID */ + @Excel(name = "分组ID") + private Long groupId; + + /** 分组名称 */ + @Excel(name = "分组名称") + private String groupName; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String status; + + public void setGroupId(Long groupId) + { + this.groupId = groupId; + } + + public Long getGroupId() + { + return groupId; + } + + public void setGroupName(String groupName) + { + this.groupName = groupName; + } + + public String getGroupName() + { + return groupName; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("groupId", getGroupId()) + .append("parentId", getParentId()) + .append("groupName", getGroupName()) + .append("ancestors", getAncestors()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/group_management/mapper/BasSheepGroupMapper.java b/zhyc-module/src/main/java/com/zhyc/module/group_management/mapper/BasSheepGroupMapper.java new file mode 100644 index 0000000..d3b2bf0 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/group_management/mapper/BasSheepGroupMapper.java @@ -0,0 +1,61 @@ +package com.zhyc.module.group_management.mapper; + +import java.util.List; +import com.zhyc.module.group_management.domain.BasSheepGroup; + +/** + * 分组管理Mapper接口 + * + * @author wyt + * @date 2025-07-14 + */ +public interface BasSheepGroupMapper +{ + /** + * 查询分组管理 + * + * @param groupId 分组管理主键 + * @return 分组管理 + */ + public BasSheepGroup selectBasSheepGroupByGroupId(Long groupId); + + /** + * 查询分组管理列表 + * + * @param basSheepGroup 分组管理 + * @return 分组管理集合 + */ + public List selectBasSheepGroupList(BasSheepGroup basSheepGroup); + + /** + * 新增分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + public int insertBasSheepGroup(BasSheepGroup basSheepGroup); + + /** + * 修改分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + public int updateBasSheepGroup(BasSheepGroup basSheepGroup); + + /** + * 删除分组管理 + * + * @param groupId 分组管理主键 + * @return 结果 + */ + public int deleteBasSheepGroupByGroupId(Long groupId); + + /** + * 批量删除分组管理 + * + * @param groupIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBasSheepGroupByGroupIds(Long[] groupIds); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/group_management/service/IBasSheepGroupService.java b/zhyc-module/src/main/java/com/zhyc/module/group_management/service/IBasSheepGroupService.java new file mode 100644 index 0000000..ec68f13 --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/group_management/service/IBasSheepGroupService.java @@ -0,0 +1,61 @@ +package com.zhyc.module.group_management.service; + +import java.util.List; +import com.zhyc.module.group_management.domain.BasSheepGroup; + +/** + * 分组管理Service接口 + * + * @author wyt + * @date 2025-07-14 + */ +public interface IBasSheepGroupService +{ + /** + * 查询分组管理 + * + * @param groupId 分组管理主键 + * @return 分组管理 + */ + public BasSheepGroup selectBasSheepGroupByGroupId(Long groupId); + + /** + * 查询分组管理列表 + * + * @param basSheepGroup 分组管理 + * @return 分组管理集合 + */ + public List selectBasSheepGroupList(BasSheepGroup basSheepGroup); + + /** + * 新增分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + public int insertBasSheepGroup(BasSheepGroup basSheepGroup); + + /** + * 修改分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + public int updateBasSheepGroup(BasSheepGroup basSheepGroup); + + /** + * 批量删除分组管理 + * + * @param groupIds 需要删除的分组管理主键集合 + * @return 结果 + */ + public int deleteBasSheepGroupByGroupIds(Long[] groupIds); + + /** + * 删除分组管理信息 + * + * @param groupId 分组管理主键 + * @return 结果 + */ + public int deleteBasSheepGroupByGroupId(Long groupId); +} diff --git a/zhyc-module/src/main/java/com/zhyc/module/group_management/service/impl/BasSheepGroupServiceImpl.java b/zhyc-module/src/main/java/com/zhyc/module/group_management/service/impl/BasSheepGroupServiceImpl.java new file mode 100644 index 0000000..9543e9e --- /dev/null +++ b/zhyc-module/src/main/java/com/zhyc/module/group_management/service/impl/BasSheepGroupServiceImpl.java @@ -0,0 +1,96 @@ +package com.zhyc.module.group_management.service.impl; + +import java.util.List; +import com.zhyc.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zhyc.module.group_management.mapper.BasSheepGroupMapper; +import com.zhyc.module.group_management.domain.BasSheepGroup; +import com.zhyc.module.group_management.service.IBasSheepGroupService; + +/** + * 分组管理Service业务层处理 + * + * @author wyt + * @date 2025-07-14 + */ +@Service +public class BasSheepGroupServiceImpl implements IBasSheepGroupService +{ + @Autowired + private BasSheepGroupMapper basSheepGroupMapper; + + /** + * 查询分组管理 + * + * @param groupId 分组管理主键 + * @return 分组管理 + */ + @Override + public BasSheepGroup selectBasSheepGroupByGroupId(Long groupId) + { + return basSheepGroupMapper.selectBasSheepGroupByGroupId(groupId); + } + + /** + * 查询分组管理列表 + * + * @param basSheepGroup 分组管理 + * @return 分组管理 + */ + @Override + public List selectBasSheepGroupList(BasSheepGroup basSheepGroup) + { + return basSheepGroupMapper.selectBasSheepGroupList(basSheepGroup); + } + + /** + * 新增分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + @Override + public int insertBasSheepGroup(BasSheepGroup basSheepGroup) + { + basSheepGroup.setCreateTime(DateUtils.getNowDate()); + return basSheepGroupMapper.insertBasSheepGroup(basSheepGroup); + } + + /** + * 修改分组管理 + * + * @param basSheepGroup 分组管理 + * @return 结果 + */ + @Override + public int updateBasSheepGroup(BasSheepGroup basSheepGroup) + { + basSheepGroup.setUpdateTime(DateUtils.getNowDate()); + return basSheepGroupMapper.updateBasSheepGroup(basSheepGroup); + } + + /** + * 批量删除分组管理 + * + * @param groupIds 需要删除的分组管理主键 + * @return 结果 + */ + @Override + public int deleteBasSheepGroupByGroupIds(Long[] groupIds) + { + return basSheepGroupMapper.deleteBasSheepGroupByGroupIds(groupIds); + } + + /** + * 删除分组管理信息 + * + * @param groupId 分组管理主键 + * @return 结果 + */ + @Override + public int deleteBasSheepGroupByGroupId(Long groupId) + { + return basSheepGroupMapper.deleteBasSheepGroupByGroupId(groupId); + } +} diff --git a/zhyc-module/src/main/resources/mapper/group_management/BasSheepGroupMapper.xml b/zhyc-module/src/main/resources/mapper/group_management/BasSheepGroupMapper.xml new file mode 100644 index 0000000..cf8ba5e --- /dev/null +++ b/zhyc-module/src/main/resources/mapper/group_management/BasSheepGroupMapper.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + select group_id, parent_id, group_name, ancestors, status, create_by, create_time, update_by, update_time from bas_sheep_group + + + + + + + + insert into bas_sheep_group + + parent_id, + group_name, + ancestors, + status, + create_by, + create_time, + update_by, + update_time, + + + #{parentId}, + #{groupName}, + #{ancestors}, + #{status}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update bas_sheep_group + + parent_id = #{parentId}, + group_name = #{groupName}, + ancestors = #{ancestors}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where group_id = #{groupId} + + + + delete from bas_sheep_group where group_id = #{groupId} + + + + delete from bas_sheep_group where group_id in + + #{groupId} + + + \ No newline at end of file