Compare commits

...

2 Commits

Author SHA1 Message Date
wyt
9671eeabc3 Merge remote-tracking branch 'origin/main' 2025-07-14 17:56:50 +08:00
wyt
fde0282952 分组管理页面功能修改 2025-07-14 17:56:35 +08:00
6 changed files with 479 additions and 0 deletions

View File

@ -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<BasSheepGroup> 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<BasSheepGroup> list = basSheepGroupService.selectBasSheepGroupList(basSheepGroup);
ExcelUtil<BasSheepGroup> util = new ExcelUtil<BasSheepGroup>(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));
}
}

View File

@ -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();
}
}

View File

@ -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<BasSheepGroup> 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);
}

View File

@ -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<BasSheepGroup> 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);
}

View File

@ -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<BasSheepGroup> 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);
}
}

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhyc.module.group_management.mapper.BasSheepGroupMapper">
<resultMap type="BasSheepGroup" id="BasSheepGroupResult">
<result property="groupId" column="group_id" />
<result property="parentId" column="parent_id" />
<result property="groupName" column="group_name" />
<result property="ancestors" column="ancestors" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectBasSheepGroupVo">
select group_id, parent_id, group_name, ancestors, status, create_by, create_time, update_by, update_time from bas_sheep_group
</sql>
<select id="selectBasSheepGroupList" parameterType="BasSheepGroup" resultMap="BasSheepGroupResult">
<include refid="selectBasSheepGroupVo"/>
<where>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectBasSheepGroupByGroupId" parameterType="Long" resultMap="BasSheepGroupResult">
<include refid="selectBasSheepGroupVo"/>
where group_id = #{groupId}
</select>
<insert id="insertBasSheepGroup" parameterType="BasSheepGroup" useGeneratedKeys="true" keyProperty="groupId">
insert into bas_sheep_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="groupName != null and groupName != ''">group_name,</if>
<if test="ancestors != null">ancestors,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="groupName != null and groupName != ''">#{groupName},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateBasSheepGroup" parameterType="BasSheepGroup">
update bas_sheep_group
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where group_id = #{groupId}
</update>
<delete id="deleteBasSheepGroupByGroupId" parameterType="Long">
delete from bas_sheep_group where group_id = #{groupId}
</delete>
<delete id="deleteBasSheepGroupByGroupIds" parameterType="String">
delete from bas_sheep_group where group_id in
<foreach item="groupId" collection="array" open="(" separator="," close=")">
#{groupId}
</foreach>
</delete>
</mapper>