Merge branch 'master' of http://ah.qyyh.net:3000/xiaoe/test
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
package com.test.test.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.test.test.domain.UiElement;
|
||||
import com.test.test.domain.qo.UiElementQO;
|
||||
import com.test.test.service.IUiElementService;
|
||||
import jakarta.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.test.common.annotation.Log;
|
||||
import com.test.common.core.controller.BaseController;
|
||||
import com.test.common.core.domain.AjaxResult;
|
||||
import com.test.common.enums.BusinessType;
|
||||
import com.test.common.utils.poi.ExcelUtil;
|
||||
import com.test.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* ui元素Controller
|
||||
*
|
||||
* @author test
|
||||
* @date 2025-04-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/test/element")
|
||||
public class UiElementController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUiElementService uiElementService;
|
||||
|
||||
/**
|
||||
* 查询ui元素列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:element:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UiElementQO uiElement)
|
||||
{
|
||||
startPage();
|
||||
List<UiElement> list = uiElementService.selectUiElementListNew(uiElement);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取ui元素详细信息
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:element:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(uiElementService.selectUiElementById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增ui元素
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:element:add')")
|
||||
@Log(title = "ui元素", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody UiElement uiElement)
|
||||
{
|
||||
return toAjax(uiElementService.insertUiElement(uiElement));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改ui元素
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:element:edit')")
|
||||
@Log(title = "ui元素", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
public AjaxResult edit(@RequestBody UiElement uiElement)
|
||||
{
|
||||
return toAjax(uiElementService.updateUiElement(uiElement));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除ui元素
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:element:remove')")
|
||||
@Log(title = "ui元素", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("delete/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(uiElementService.deleteUiElementByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 导出ui元素列表
|
||||
// */
|
||||
// @PreAuthorize("@ss.hasPermi('system:element:export')")
|
||||
// @Log(title = "ui元素", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
// public void export(HttpServletResponse response, UiElement uiElement)
|
||||
// {
|
||||
// List<UiElement> list = uiElementService.selectUiElementList(uiElement);
|
||||
// ExcelUtil<UiElement> util = new ExcelUtil<UiElement>(UiElement.class);
|
||||
// util.exportExcel(response, list, "ui元素数据");
|
||||
// }
|
||||
}
|
||||
136
test-test/src/main/java/com/test/test/domain/UiElement.java
Normal file
136
test-test/src/main/java/com/test/test/domain/UiElement.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.test.test.domain;
|
||||
|
||||
import com.test.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.test.common.annotation.Excel;
|
||||
|
||||
/**
|
||||
* ui元素对象 ui_element
|
||||
*
|
||||
* @author test
|
||||
* @date 2025-04-22
|
||||
*/
|
||||
public class UiElement extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** */
|
||||
private Long id;
|
||||
|
||||
/** 组id */
|
||||
@Excel(name = "组id")
|
||||
private Long groupId;
|
||||
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
|
||||
/** 定位类型 id name className tagName linkText partialLinkText css xpath label value index */
|
||||
@Excel(name = "定位类型 id name className tagName linkText partialLinkText css xpath label value index")
|
||||
private String locType;
|
||||
|
||||
/** 元素定位 */
|
||||
@Excel(name = "元素定位")
|
||||
private String elementLoc;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
/** 状态 0正常 1删除 */
|
||||
private String delFlag;
|
||||
|
||||
/** 组路径名称(如"全部元素/测试") */
|
||||
private String groupNamePath;
|
||||
|
||||
// getter和setter
|
||||
public String getGroupNamePath() {
|
||||
return groupNamePath;
|
||||
}
|
||||
|
||||
public void setGroupNamePath(String groupNamePath) {
|
||||
this.groupNamePath = groupNamePath;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setGroupId(Long elementGroupId)
|
||||
{
|
||||
this.groupId = elementGroupId;
|
||||
}
|
||||
|
||||
public Long getGroupId()
|
||||
{
|
||||
return groupId;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setLocType(String locType)
|
||||
{
|
||||
this.locType = locType;
|
||||
}
|
||||
|
||||
public String getLocType()
|
||||
{
|
||||
return locType;
|
||||
}
|
||||
public void setElementLoc(String elementLoc)
|
||||
{
|
||||
this.elementLoc = elementLoc;
|
||||
}
|
||||
|
||||
public String getElementLoc()
|
||||
{
|
||||
return elementLoc;
|
||||
}
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("groupId", getGroupId())
|
||||
.append("name", getName())
|
||||
.append("locType", getLocType())
|
||||
.append("elementLoc", getElementLoc())
|
||||
.append("description", getDescription())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.test.test.domain.qo;
|
||||
|
||||
import com.test.common.annotation.Excel;
|
||||
import com.test.common.core.domain.BaseEntity;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ui元素对象 ui_element
|
||||
*
|
||||
* @author test
|
||||
* @date 2025-04-22
|
||||
*/
|
||||
@Data
|
||||
public class UiElementQO
|
||||
{
|
||||
/** 名称 */
|
||||
private String name;
|
||||
/** 状态 0正常 1删除 */
|
||||
private String delFlag;
|
||||
@NotNull(message = "节点id不能为空")
|
||||
private Long groupId;
|
||||
|
||||
private List<Long> groupIds;
|
||||
|
||||
}
|
||||
@@ -13,6 +13,11 @@ public interface TestGroupMapper
|
||||
*/
|
||||
List<TestGroup> selectTestGroupList(String type);
|
||||
|
||||
/**
|
||||
* 查询节点(文件夹)列表
|
||||
*/
|
||||
TestGroup selectTestGroupById(Long id);
|
||||
|
||||
/**
|
||||
* 查询节点(文件夹)列表
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.test.test.mapper;
|
||||
|
||||
import com.test.test.domain.UiElement;
|
||||
import com.test.test.domain.qo.UiElementQO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ui元素Mapper接口
|
||||
*
|
||||
* @author test
|
||||
* @date 2025-04-22
|
||||
*/
|
||||
public interface UiElementMapper
|
||||
{
|
||||
/**
|
||||
* 查询ui元素
|
||||
*
|
||||
* @param id ui元素主键
|
||||
* @return ui元素
|
||||
*/
|
||||
public UiElement selectUiElementById(Long id);
|
||||
|
||||
/**
|
||||
* 查询ui元素列表
|
||||
*
|
||||
* @param uiElement ui元素
|
||||
* @return ui元素集合
|
||||
*/
|
||||
public List<UiElement> selectUiElementList(UiElement uiElement);
|
||||
|
||||
|
||||
/**
|
||||
* 查询ui元素列表
|
||||
* @param uiElement
|
||||
* @return
|
||||
*/
|
||||
List<UiElement> selectUiElementListNew(UiElementQO uiElement);
|
||||
|
||||
/**
|
||||
* 新增ui元素
|
||||
*
|
||||
* @param uiElement ui元素
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUiElement(UiElement uiElement);
|
||||
|
||||
/**
|
||||
* 修改ui元素
|
||||
*
|
||||
* @param uiElement ui元素
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUiElement(UiElement uiElement);
|
||||
|
||||
/**
|
||||
* 删除ui元素
|
||||
*
|
||||
* @param id ui元素主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUiElementById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除ui元素
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUiElementByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int deleteUiElementByGroupIds(List<Long> ids);
|
||||
}
|
||||
@@ -35,4 +35,18 @@ public interface ITestGroupService {
|
||||
* 删除节点(文件夹)信息
|
||||
*/
|
||||
int deleteTestGroupById(GroupDelectQO qo) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询子节点
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Long> getAllChildIds(Long id);
|
||||
|
||||
/**
|
||||
* 获取模块名
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
String buildGroupPath(Long groupId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.test.test.service;
|
||||
|
||||
import com.test.test.domain.UiElement;
|
||||
import com.test.test.domain.qo.UiElementQO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ui元素Service接口
|
||||
*
|
||||
* @author test
|
||||
* @date 2025-04-22
|
||||
*/
|
||||
public interface IUiElementService
|
||||
{
|
||||
/**
|
||||
* 查询ui元素
|
||||
*
|
||||
* @param id ui元素主键
|
||||
* @return ui元素
|
||||
*/
|
||||
public UiElement selectUiElementById(Long id);
|
||||
|
||||
/**
|
||||
* 查询ui元素列表
|
||||
*
|
||||
* @param uiElement ui元素
|
||||
* @return ui元素集合
|
||||
*/
|
||||
public List<UiElement> selectUiElementList(UiElement uiElement);
|
||||
|
||||
|
||||
/**
|
||||
* 查询ui元素列表
|
||||
*
|
||||
* @param uiElement ui元素
|
||||
* @return ui元素集合
|
||||
*/
|
||||
public List<UiElement> selectUiElementListNew(UiElementQO uiElement);
|
||||
|
||||
/**
|
||||
* 新增ui元素
|
||||
*
|
||||
* @param uiElement ui元素
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUiElement(UiElement uiElement);
|
||||
|
||||
/**
|
||||
* 修改ui元素
|
||||
*
|
||||
* @param uiElement ui元素
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUiElement(UiElement uiElement);
|
||||
|
||||
/**
|
||||
* 批量删除ui元素
|
||||
*
|
||||
* @param ids 需要删除的ui元素主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUiElementByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除ui元素信息
|
||||
*
|
||||
* @param id ui元素主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUiElementById(Long id);
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.test.test.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.test.common.utils.DateUtils;
|
||||
import com.test.common.utils.StringUtils;
|
||||
import com.test.test.domain.qo.GroupDelectQO;
|
||||
import com.test.test.mapper.UiElementMapper;
|
||||
import com.test.test.service.IUiElementService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -30,6 +33,9 @@ public class TestGroupServiceImpl implements ITestGroupService {
|
||||
@Lazy
|
||||
private TestApiServiceImpl testApiServiceImpl;
|
||||
|
||||
@Resource
|
||||
private UiElementMapper uiElementMapper;
|
||||
|
||||
/**
|
||||
* 查询节点(文件夹)列表
|
||||
*/
|
||||
@@ -82,6 +88,9 @@ public class TestGroupServiceImpl implements ITestGroupService {
|
||||
case "task":
|
||||
System.out.println("task");
|
||||
break;
|
||||
case "ui":
|
||||
uiElementMapper.deleteUiElementByGroupIds(idList);
|
||||
break;
|
||||
default:
|
||||
throw new Exception(StringUtils.format("文件夹类型({})非法。 ", qo.getType()));
|
||||
}
|
||||
@@ -98,4 +107,73 @@ public class TestGroupServiceImpl implements ITestGroupService {
|
||||
}
|
||||
return idList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID获取所有子元素ID(包括自身)
|
||||
* @param id 要查询的ID
|
||||
* @return 所有子元素ID集合(包含自身ID)
|
||||
*/
|
||||
public List<Long> getAllChildIds(Long id) {
|
||||
List<TestGroup> allGroups = selectTestGroupList("ui");
|
||||
List<Long> result = new ArrayList<>();
|
||||
|
||||
// 如果传入的是根节点(parentId=0),则查询所有数据
|
||||
if (id != null && id == 0L) {
|
||||
return allGroups.stream()
|
||||
.map(TestGroup::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 添加自身ID
|
||||
result.add(id);
|
||||
// 递归查找子节点
|
||||
findChildrenIds(id, allGroups, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建组路径名称
|
||||
* @param groupId 组ID
|
||||
* @return 如"全部元素/测试"
|
||||
*/
|
||||
public String buildGroupPath(Long groupId) {
|
||||
List<String> names = new ArrayList<>();
|
||||
|
||||
// 递归查找父组
|
||||
Long currentId = groupId;
|
||||
while (currentId != null && currentId != 0L) {
|
||||
TestGroup group = testGroupMapper.selectTestGroupById(currentId);
|
||||
if (group != null) {
|
||||
names.add(group.getName());
|
||||
currentId = group.getParentId();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 反转列表,使父组在前
|
||||
Collections.reverse(names);
|
||||
|
||||
return String.join("/", names);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查找所有子节点ID
|
||||
* @param parentId 父节点ID
|
||||
* @param allGroups 所有数据
|
||||
* @param result 结果集合
|
||||
*/
|
||||
private void findChildrenIds(Long parentId, List<TestGroup> allGroups, List<Long> result) {
|
||||
for (TestGroup group : allGroups) {
|
||||
if (parentId.equals(group.getParentId())) {
|
||||
result.add(group.getId());
|
||||
findChildrenIds(group.getId(), allGroups, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.test.test.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.test.common.utils.DateUtils;
|
||||
import com.test.common.utils.SecurityUtils;
|
||||
import com.test.test.domain.UiElement;
|
||||
import com.test.test.domain.qo.UiElementQO;
|
||||
import com.test.test.mapper.TestGroupMapper;
|
||||
import com.test.test.mapper.UiElementMapper;
|
||||
import com.test.test.service.ITestGroupService;
|
||||
import com.test.test.service.IUiElementService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* ui元素Service业务层处理
|
||||
*
|
||||
* @author test
|
||||
* @date 2025-04-22
|
||||
*/
|
||||
@Service
|
||||
public class UiElementServiceImpl implements IUiElementService
|
||||
{
|
||||
@Resource
|
||||
private UiElementMapper uiElementMapper;
|
||||
@Resource
|
||||
private ITestGroupService testGroupService;
|
||||
|
||||
/**
|
||||
* 查询ui元素
|
||||
*
|
||||
* @param id ui元素主键
|
||||
* @return ui元素
|
||||
*/
|
||||
@Override
|
||||
public UiElement selectUiElementById(Long id)
|
||||
{
|
||||
return uiElementMapper.selectUiElementById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询ui元素列表
|
||||
*
|
||||
* @param uiElement ui元素
|
||||
* @return ui元素
|
||||
*/
|
||||
@Override
|
||||
public List<UiElement> selectUiElementList(UiElement uiElement)
|
||||
{
|
||||
uiElement.setDelFlag("0");
|
||||
return uiElementMapper.selectUiElementList(uiElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UiElement> selectUiElementListNew(UiElementQO uiElement) {
|
||||
uiElement.setDelFlag("0");
|
||||
//这里要递归查询子元素
|
||||
Long groupId = uiElement.getGroupId();
|
||||
List<Long> allChildIds = testGroupService.getAllChildIds(groupId);
|
||||
uiElement.setGroupIds(allChildIds);
|
||||
// 查询元素列表
|
||||
List<UiElement> elements = uiElementMapper.selectUiElementListNew(uiElement);
|
||||
|
||||
// 为每个元素设置groupNamePath
|
||||
for (UiElement element : elements) {
|
||||
String path = testGroupService.buildGroupPath(element.getGroupId());
|
||||
element.setGroupNamePath(path);
|
||||
}
|
||||
|
||||
return elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增ui元素
|
||||
*
|
||||
* @param uiElement ui元素
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUiElement(UiElement uiElement)
|
||||
{
|
||||
uiElement.setDelFlag("0");
|
||||
uiElement.setCreateBy(SecurityUtils.getUsername());
|
||||
uiElement.setCreateTime(DateUtils.getNowDate());
|
||||
uiElement.setUpdateBy(SecurityUtils.getUsername());
|
||||
uiElement.setUpdateTime(DateUtils.getNowDate());
|
||||
return uiElementMapper.insertUiElement(uiElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改ui元素
|
||||
*
|
||||
* @param uiElement ui元素
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUiElement(UiElement uiElement)
|
||||
{
|
||||
uiElement.setUpdateBy(SecurityUtils.getUsername());
|
||||
uiElement.setUpdateTime(DateUtils.getNowDate());
|
||||
return uiElementMapper.updateUiElement(uiElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除ui元素
|
||||
*
|
||||
* @param ids 需要删除的ui元素主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUiElementByIds(Long[] ids)
|
||||
{
|
||||
return uiElementMapper.deleteUiElementByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除ui元素信息
|
||||
*
|
||||
* @param id ui元素主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUiElementById(Long id)
|
||||
{
|
||||
return uiElementMapper.deleteUiElementById(id);
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,13 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTestGroupById" parameterType="Long" resultMap="TestGroupResult">
|
||||
<include refid="selectTestGroupVo"/>
|
||||
<where>
|
||||
id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTestGroupListByParentIds" parameterType="String" resultMap="TestGroupResult">
|
||||
<include refid="selectTestGroupVo"/>
|
||||
<where>
|
||||
|
||||
123
test-test/src/main/resources/mapper/test/UiElementMapper.xml
Normal file
123
test-test/src/main/resources/mapper/test/UiElementMapper.xml
Normal file
@@ -0,0 +1,123 @@
|
||||
<?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.test.test.mapper.UiElementMapper">
|
||||
|
||||
<resultMap type="UiElement" id="UiElementResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="groupId" column="group_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="locType" column="loc_type" />
|
||||
<result property="elementLoc" column="element_loc" />
|
||||
<result property="description" column="description" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUiElementVo">
|
||||
select id, group_id, name, loc_type, element_loc, description, create_by, create_time, update_by, update_time, del_flag from ui_element
|
||||
</sql>
|
||||
|
||||
<select id="selectUiElementListNew" parameterType="UiElementQO" resultMap="UiElementResult">
|
||||
<include refid="selectUiElementVo"/>
|
||||
<where>
|
||||
<!-- 修改group_id条件为IN查询 -->
|
||||
<if test="groupIds != null and groupIds.size() > 0">
|
||||
and group_id in
|
||||
<foreach collection="groupIds" item="groupId" open="(" separator="," close=")">
|
||||
#{groupId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectUiElementList" parameterType="UiElement" resultMap="UiElementResult">
|
||||
<include refid="selectUiElementVo"/>
|
||||
<where>
|
||||
<if test="groupId != null "> and group_id = #{groupId}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="locType != null and locType != ''"> and loc_type = #{locType}</if>
|
||||
<if test="elementLoc != null and elementLoc != ''"> and element_loc = #{elementLoc}</if>
|
||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUiElementById" parameterType="Long" resultMap="UiElementResult">
|
||||
<include refid="selectUiElementVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertUiElement" parameterType="UiElement" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ui_element
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="groupId != null">group_id,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="locType != null">loc_type,</if>
|
||||
<if test="elementLoc != null">element_loc,</if>
|
||||
<if test="description != null">description,</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>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="groupId != null">#{groupId},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="locType != null">#{locType},</if>
|
||||
<if test="elementLoc != null">#{elementLoc},</if>
|
||||
<if test="description != null">#{description},</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>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateUiElement" parameterType="UiElement">
|
||||
update ui_element
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="groupId != null">group_id = #{groupId},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="locType != null">loc_type = #{locType},</if>
|
||||
<if test="elementLoc != null">element_loc = #{elementLoc},</if>
|
||||
<if test="description != null">description = #{description},</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>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUiElementById" parameterType="Long">
|
||||
update ui_element set del_flag = '1' where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUiElementByIds" parameterType="String">
|
||||
update ui_element set del_flag = '1' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteUiElementByGroupIds" parameterType="java.util.List">
|
||||
update ui_element
|
||||
set del_flag = '1'
|
||||
where group_id in
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user