新增类型去除收尾空格

This commit is contained in:
sxu 2024-12-24 11:32:37 +08:00
parent 83f0d8f432
commit 7fdd39a617
1 changed files with 1 additions and 1 deletions

View File

@ -64,6 +64,7 @@ public class MaTypeServiceImpl implements ITypeService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int insertMaType(MaType maType) { public int insertMaType(MaType maType) {
maType.setTypeName(maType.getTypeName().trim());
Long parentId = maType.getParentId(); Long parentId = maType.getParentId();
MaType maType1 = maTypeMapper.selectMaTypeByTypeId(parentId); MaType maType1 = maTypeMapper.selectMaTypeByTypeId(parentId);
String level = maType1.getLevel(); String level = maType1.getLevel();
@ -71,7 +72,6 @@ public class MaTypeServiceImpl implements ITypeService {
maType.setCreateTime(DateUtils.getNowDate()); maType.setCreateTime(DateUtils.getNowDate());
int i = maTypeMapper.insertType(maType); int i = maTypeMapper.insertType(maType);
//根据类型名称判重 //根据类型名称判重
maType.setTypeName(maType.getTypeName().trim());
if (maType.getTypeName() != null && maType.getParentId() != null) { if (maType.getTypeName() != null && maType.getParentId() != null) {
int num = maTypeMapper.getMaType(maType); int num = maTypeMapper.getMaType(maType);
if (num > 1) { if (num > 1) {