diff --git a/src/com/engine/salary/biz/SysSalaryItemBiz.java b/src/com/engine/salary/biz/SysSalaryItemBiz.java
index 4ff63dac4..19ed10802 100644
--- a/src/com/engine/salary/biz/SysSalaryItemBiz.java
+++ b/src/com/engine/salary/biz/SysSalaryItemBiz.java
@@ -38,4 +38,14 @@ public class SysSalaryItemBiz {
sqlSession.close();
}
}
+
+ public SysSalaryItemPO selectOneByName(String name) {
+ SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
+ try {
+ SysSalaryItemMapper mapper = sqlSession.getMapper(SysSalaryItemMapper.class);
+ return mapper.selectOneByName(name);
+ } finally {
+ sqlSession.close();
+ }
+ }
}
diff --git a/src/com/engine/salary/mapper/salaryitem/SysSalaryItemMapper.java b/src/com/engine/salary/mapper/salaryitem/SysSalaryItemMapper.java
index f210fe344..baf9716cb 100644
--- a/src/com/engine/salary/mapper/salaryitem/SysSalaryItemMapper.java
+++ b/src/com/engine/salary/mapper/salaryitem/SysSalaryItemMapper.java
@@ -1,7 +1,6 @@
package com.engine.salary.mapper.salaryitem;
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
-import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@@ -62,5 +61,6 @@ public interface SysSalaryItemMapper {
* @return 返回影响行数
*/
int delete(SysSalaryItemPO SysSalaryItemPO);
-
+
+ SysSalaryItemPO selectOneByName(String name);
}
\ No newline at end of file
diff --git a/src/com/engine/salary/mapper/salaryitem/SysSalaryItemMapper.xml b/src/com/engine/salary/mapper/salaryitem/SysSalaryItemMapper.xml
index ed5027616..f8faf9c90 100644
--- a/src/com/engine/salary/mapper/salaryitem/SysSalaryItemMapper.xml
+++ b/src/com/engine/salary/mapper/salaryitem/SysSalaryItemMapper.xml
@@ -609,5 +609,12 @@
AND delete_type = 0
+
+
\ No newline at end of file
diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java
index 248ab4b6b..3c78cef40 100644
--- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java
+++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java
@@ -140,27 +140,27 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
.sorted(new Comparator() {
@Override
public int compare(SalaryItemPO o1, SalaryItemPO o2) {
- if(o1 == null)
+ if (o1 == null)
return 1;
- if(o2 == null)
+ if (o2 == null)
return -1;
- if(o1 == null && o2 == null)
+ if (o1 == null && o2 == null)
return 0;
- if(o1.getSortedIndex() == null && o2.getSortedIndex() == null){
- Integer systemType1=o1.getSystemType();
- Integer systemType2=o2.getSystemType();
- if(systemType1 == null)
- systemType1=0;
- if(systemType2 == null)
- systemType2=0;
+ if (o1.getSortedIndex() == null && o2.getSortedIndex() == null) {
+ Integer systemType1 = o1.getSystemType();
+ Integer systemType2 = o2.getSystemType();
+ if (systemType1 == null)
+ systemType1 = 0;
+ if (systemType2 == null)
+ systemType2 = 0;
return systemType1.compareTo(systemType2);
- }else{
- Integer sortedIndex1=o1.getSortedIndex();
- Integer sortedIndex2=o2.getSortedIndex();
- if(sortedIndex1 == null)
- sortedIndex1=0;
- if(sortedIndex2 == null)
- sortedIndex2=0;
+ } else {
+ Integer sortedIndex1 = o1.getSortedIndex();
+ Integer sortedIndex2 = o2.getSortedIndex();
+ if (sortedIndex1 == null)
+ sortedIndex1 = 0;
+ if (sortedIndex2 == null)
+ sortedIndex2 = 0;
return sortedIndex2.compareTo(sortedIndex1);
}
}
@@ -203,8 +203,8 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98326, "薪资项目名称已存在,请重新命名"));
}
// 名称不能和已有的系统薪资项目重名
- List sysSalaryItemPOS = sysSalaryItemBiz.listSome(SysSalaryItemPO.builder().name(saveParam.getName()).build());
- if (CollectionUtils.isNotEmpty(sysSalaryItemPOS)) {
+ SysSalaryItemPO sysSalaryItem = sysSalaryItemBiz.selectOneByName(saveParam.getName());
+ if (sysSalaryItem != null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98328, "自定义薪资项目的名称不能和系统薪资项目的名称重名"));
}
SalaryItemPO salaryItemPO = SalaryItemBO.convert2SalaryItemPO(saveParam, (long) user.getUID());