修改分组管理页面,新增羊只分组页面
This commit is contained in:
parent
134f3fcf40
commit
cc7fe61125
@ -94,4 +94,11 @@ public class BasSheepGroupController extends BaseController
|
||||
return toAjax(basSheepGroupService.deleteBasSheepGroupByGroupIds(groupIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('group_management:group_management:list')")
|
||||
@GetMapping("/leaf")
|
||||
public AjaxResult selectLeafNodes() {
|
||||
List<BasSheepGroup> leafNodes = basSheepGroupService.selectLeafNodes();
|
||||
return success(leafNodes);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,104 @@
|
||||
package com.zhyc.module.fileManagement.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.fileManagement.domain.BasSheepGroupMapping;
|
||||
import com.zhyc.module.fileManagement.service.IBasSheepGroupMappingService;
|
||||
import com.zhyc.common.utils.poi.ExcelUtil;
|
||||
import com.zhyc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 羊只分组关联Controller
|
||||
*
|
||||
* @author wyt
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sheep_grouping/sheep_grouping")
|
||||
public class BasSheepGroupMappingController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBasSheepGroupMappingService basSheepGroupMappingService;
|
||||
|
||||
/**
|
||||
* 查询羊只分组关联列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BasSheepGroupMapping basSheepGroupMapping)
|
||||
{
|
||||
startPage();
|
||||
List<BasSheepGroupMapping> list = basSheepGroupMappingService.selectBasSheepGroupMappingList(basSheepGroupMapping);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出羊只分组关联列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:export')")
|
||||
@Log(title = "羊只分组关联", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BasSheepGroupMapping basSheepGroupMapping)
|
||||
{
|
||||
List<BasSheepGroupMapping> list = basSheepGroupMappingService.selectBasSheepGroupMappingList(basSheepGroupMapping);
|
||||
ExcelUtil<BasSheepGroupMapping> util = new ExcelUtil<BasSheepGroupMapping>(BasSheepGroupMapping.class);
|
||||
util.exportExcel(response, list, "羊只分组关联数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取羊只分组关联详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(basSheepGroupMappingService.selectBasSheepGroupMappingById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增羊只分组关联
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:add')")
|
||||
@Log(title = "羊只分组关联", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BasSheepGroupMapping basSheepGroupMapping)
|
||||
{
|
||||
return toAjax(basSheepGroupMappingService.insertBasSheepGroupMapping(basSheepGroupMapping));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改羊只分组关联
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:edit')")
|
||||
@Log(title = "羊只分组关联", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BasSheepGroupMapping basSheepGroupMapping)
|
||||
{
|
||||
return toAjax(basSheepGroupMappingService.updateBasSheepGroupMapping(basSheepGroupMapping));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除羊只分组关联
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sheep_grouping:sheep_grouping:remove')")
|
||||
@Log(title = "羊只分组关联", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(basSheepGroupMappingService.deleteBasSheepGroupMappingByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.zhyc.module.fileManagement.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.BaseEntity;
|
||||
|
||||
/**
|
||||
* 羊只分组关联对象 bas_sheep_group_mapping
|
||||
*
|
||||
* @author wyt
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
public class BasSheepGroupMapping extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
@Excel(name = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/** 羊只ID */
|
||||
@Excel(name = "羊只ID")
|
||||
private Long sheepId;
|
||||
|
||||
/** 分组ID */
|
||||
@Excel(name = "分组ID")
|
||||
private Long groupId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setSheepId(Long sheepId)
|
||||
{
|
||||
this.sheepId = sheepId;
|
||||
}
|
||||
|
||||
public Long getSheepId()
|
||||
{
|
||||
return sheepId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId)
|
||||
{
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public Long getGroupId()
|
||||
{
|
||||
return groupId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("sheepId", getSheepId())
|
||||
.append("groupId", getGroupId())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -60,4 +60,6 @@ public interface BasSheepGroupMapper
|
||||
*/
|
||||
public int deleteBasSheepGroupByGroupIds(Long[] groupIds);
|
||||
|
||||
List<BasSheepGroup> selectLeafNodes();
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
package com.zhyc.module.fileManagement.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping;
|
||||
|
||||
/**
|
||||
* 羊只分组关联Mapper接口
|
||||
*
|
||||
* @author wyt
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
public interface BasSheepGroupMappingMapper
|
||||
{
|
||||
/**
|
||||
* 查询羊只分组关联
|
||||
*
|
||||
* @param id 羊只分组关联主键
|
||||
* @return 羊只分组关联
|
||||
*/
|
||||
public BasSheepGroupMapping selectBasSheepGroupMappingById(Long id);
|
||||
|
||||
/**
|
||||
* 查询羊只分组关联列表
|
||||
*
|
||||
* @param basSheepGroupMapping 羊只分组关联
|
||||
* @return 羊只分组关联集合
|
||||
*/
|
||||
public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping);
|
||||
|
||||
/**
|
||||
* 新增羊只分组关联
|
||||
*
|
||||
* @param basSheepGroupMapping 羊只分组关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasSheepGroupMapping(BasSheepGroupMapping basSheepGroupMapping);
|
||||
|
||||
/**
|
||||
* 修改羊只分组关联
|
||||
*
|
||||
* @param basSheepGroupMapping 羊只分组关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasSheepGroupMapping(BasSheepGroupMapping basSheepGroupMapping);
|
||||
|
||||
/**
|
||||
* 删除羊只分组关联
|
||||
*
|
||||
* @param id 羊只分组关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasSheepGroupMappingById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除羊只分组关联
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasSheepGroupMappingByIds(Long[] ids);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.zhyc.module.fileManagement.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping;
|
||||
|
||||
/**
|
||||
* 羊只分组关联Service接口
|
||||
*
|
||||
* @author wyt
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
public interface IBasSheepGroupMappingService
|
||||
{
|
||||
/**
|
||||
* 查询羊只分组关联
|
||||
*
|
||||
* @param id 羊只分组关联主键
|
||||
* @return 羊只分组关联
|
||||
*/
|
||||
public BasSheepGroupMapping selectBasSheepGroupMappingById(Long id);
|
||||
|
||||
/**
|
||||
* 查询羊只分组关联列表
|
||||
*
|
||||
* @param basSheepGroupMapping 羊只分组关联
|
||||
* @return 羊只分组关联集合
|
||||
*/
|
||||
public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping);
|
||||
|
||||
/**
|
||||
* 新增羊只分组关联
|
||||
*
|
||||
* @param basSheepGroupMapping 羊只分组关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBasSheepGroupMapping(BasSheepGroupMapping basSheepGroupMapping);
|
||||
|
||||
/**
|
||||
* 修改羊只分组关联
|
||||
*
|
||||
* @param basSheepGroupMapping 羊只分组关联
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBasSheepGroupMapping(BasSheepGroupMapping basSheepGroupMapping);
|
||||
|
||||
/**
|
||||
* 批量删除羊只分组关联
|
||||
*
|
||||
* @param ids 需要删除的羊只分组关联主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasSheepGroupMappingByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除羊只分组关联信息
|
||||
*
|
||||
* @param id 羊只分组关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasSheepGroupMappingById(Long id);
|
||||
|
||||
|
||||
}
|
@ -60,5 +60,5 @@ public interface IBasSheepGroupService
|
||||
*/
|
||||
public int deleteBasSheepGroupByGroupId(Long groupId);
|
||||
|
||||
|
||||
List<BasSheepGroup> selectLeafNodes();
|
||||
}
|
||||
|
@ -0,0 +1,96 @@
|
||||
package com.zhyc.module.fileManagement.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.zhyc.module.fileManagement.mapper.BasSheepGroupMappingMapper;
|
||||
import com.zhyc.module.fileManagement.domain.BasSheepGroupMapping;
|
||||
import com.zhyc.module.fileManagement.service.IBasSheepGroupMappingService;
|
||||
|
||||
/**
|
||||
* 羊只分组关联Service业务层处理
|
||||
*
|
||||
* @author wyt
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
@Service
|
||||
public class BasSheepGroupMappingServiceImpl implements IBasSheepGroupMappingService
|
||||
{
|
||||
@Autowired
|
||||
private BasSheepGroupMappingMapper basSheepGroupMappingMapper;
|
||||
|
||||
/**
|
||||
* 查询羊只分组关联
|
||||
*
|
||||
* @param id 羊只分组关联主键
|
||||
* @return 羊只分组关联
|
||||
*/
|
||||
@Override
|
||||
public BasSheepGroupMapping selectBasSheepGroupMappingById(Long id)
|
||||
{
|
||||
return basSheepGroupMappingMapper.selectBasSheepGroupMappingById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询羊只分组关联列表
|
||||
*
|
||||
* @param basSheepGroupMapping 羊只分组关联
|
||||
* @return 羊只分组关联
|
||||
*/
|
||||
@Override
|
||||
public List<BasSheepGroupMapping> selectBasSheepGroupMappingList(BasSheepGroupMapping basSheepGroupMapping)
|
||||
{
|
||||
return basSheepGroupMappingMapper.selectBasSheepGroupMappingList(basSheepGroupMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增羊只分组关联
|
||||
*
|
||||
* @param basSheepGroupMapping 羊只分组关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBasSheepGroupMapping(BasSheepGroupMapping basSheepGroupMapping)
|
||||
{
|
||||
return basSheepGroupMappingMapper.insertBasSheepGroupMapping(basSheepGroupMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改羊只分组关联
|
||||
*
|
||||
* @param basSheepGroupMapping 羊只分组关联
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBasSheepGroupMapping(BasSheepGroupMapping basSheepGroupMapping)
|
||||
{
|
||||
return basSheepGroupMappingMapper.updateBasSheepGroupMapping(basSheepGroupMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除羊只分组关联
|
||||
*
|
||||
* @param ids 需要删除的羊只分组关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasSheepGroupMappingByIds(Long[] ids)
|
||||
{
|
||||
return basSheepGroupMappingMapper.deleteBasSheepGroupMappingByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除羊只分组关联信息
|
||||
*
|
||||
* @param id 羊只分组关联主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasSheepGroupMappingById(Long id)
|
||||
{
|
||||
return basSheepGroupMappingMapper.deleteBasSheepGroupMappingById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -108,4 +108,16 @@ public class BasSheepGroupServiceImpl implements IBasSheepGroupService
|
||||
{
|
||||
return basSheepGroupMapper.deleteBasSheepGroupByGroupId(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasSheepGroup> selectLeafNodes() {
|
||||
List<BasSheepGroup> leafNodes = basSheepGroupMapper.selectLeafNodes();
|
||||
// 如果 ancestorNames 需要格式化,可以复用已有的逻辑
|
||||
leafNodes.forEach(group -> {
|
||||
if (group.getAncestorNames() != null) {
|
||||
group.setAncestorNames(group.getAncestorNames().replace(",", " / "));
|
||||
}
|
||||
});
|
||||
return leafNodes;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,80 @@
|
||||
This XML file does not appear to have any style information associated with it. The document tree is shown below.
|
||||
<mapper namespace="com.zhyc.module.fileManagement.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="ancestorNames" column="ancestor_names"/>
|
||||
<result property="isLeaf" column="is_leaf"/>
|
||||
<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> -->
|
||||
<!-- 修改基础查询语句 -->
|
||||
<sql id="selectBasSheepGroupVo">
|
||||
SELECT g.group_id, g.parent_id, g.group_name, g.ancestors, g.status, g.create_by, g.create_time, g.update_by, g.update_time,
|
||||
<!-- 新增祖先名称查询 -->
|
||||
(SELECT GROUP_CONCAT(parent.group_name ORDER BY FIND_IN_SET(parent.group_id, g.ancestors)) FROM bas_sheep_group parent WHERE FIND_IN_SET(parent.group_id, g.ancestors) > 0 ) AS ancestor_names, (CASE WHEN (SELECT COUNT(1) FROM bas_sheep_group child WHERE child.parent_id = g.group_id) > 0 THEN 0 ELSE 1 END) AS is_leaf FROM bas_sheep_group g
|
||||
</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>
|
||||
ORDER BY g.group_id
|
||||
<!-- 确保正确排序 -->
|
||||
</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>
|
@ -50,6 +50,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>ORDER BY g.group_id <!-- 确保正确排序 -->
|
||||
</select>
|
||||
|
||||
<select id="selectLeafNodes" resultMap="BasSheepGroupResult">
|
||||
SELECT g.group_id,
|
||||
g.parent_id,
|
||||
g.group_name,
|
||||
g.ancestors,
|
||||
g.status,
|
||||
g.create_by,
|
||||
g.create_time,
|
||||
g.update_by,
|
||||
g.update_time,
|
||||
(SELECT GROUP_CONCAT(parent.group_name ORDER BY FIND_IN_SET(parent.group_id, g.ancestors))
|
||||
FROM bas_sheep_group parent
|
||||
WHERE FIND_IN_SET(parent.group_id, g.ancestors) > 0) AS ancestor_names,
|
||||
(CASE WHEN (SELECT COUNT(1)
|
||||
FROM bas_sheep_group child
|
||||
WHERE child.parent_id = g.group_id) > 0 THEN 0 ELSE 1 END) AS is_leaf
|
||||
FROM bas_sheep_group g
|
||||
WHERE g.status = '0'
|
||||
HAVING is_leaf = 1
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepGroupByGroupId" parameterType="Long" resultMap="BasSheepGroupResult">
|
||||
<include refid="selectBasSheepGroupVo"/>
|
||||
where group_id = #{groupId}
|
||||
|
@ -0,0 +1,61 @@
|
||||
<?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.fileManagement.mapper.BasSheepGroupMappingMapper">
|
||||
|
||||
<resultMap type="BasSheepGroupMapping" id="BasSheepGroupMappingResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sheepId" column="sheep_id" />
|
||||
<result property="groupId" column="group_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBasSheepGroupMappingVo">
|
||||
select id, sheep_id, group_id from bas_sheep_group_mapping
|
||||
</sql>
|
||||
|
||||
<select id="selectBasSheepGroupMappingList" parameterType="BasSheepGroupMapping" resultMap="BasSheepGroupMappingResult">
|
||||
<include refid="selectBasSheepGroupMappingVo"/>
|
||||
<where>
|
||||
<if test="sheepId != null "> and sheep_id = #{sheepId}</if>
|
||||
<if test="groupId != null "> and group_id = #{groupId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBasSheepGroupMappingById" parameterType="Long" resultMap="BasSheepGroupMappingResult">
|
||||
<include refid="selectBasSheepGroupMappingVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBasSheepGroupMapping" parameterType="BasSheepGroupMapping" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into bas_sheep_group_mapping
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id,</if>
|
||||
<if test="groupId != null">group_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="sheepId != null">#{sheepId},</if>
|
||||
<if test="groupId != null">#{groupId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBasSheepGroupMapping" parameterType="BasSheepGroupMapping">
|
||||
update bas_sheep_group_mapping
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sheepId != null">sheep_id = #{sheepId},</if>
|
||||
<if test="groupId != null">group_id = #{groupId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasSheepGroupMappingById" parameterType="Long">
|
||||
delete from bas_sheep_group_mapping where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBasSheepGroupMappingByIds" parameterType="String">
|
||||
delete from bas_sheep_group_mapping where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user