This commit is contained in:
parent
fa28db9c79
commit
bb6cf386cb
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -609,5 +609,12 @@
|
|||
AND delete_type = 0
|
||||
</delete>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="selectOneByName" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_sys_salary_item t
|
||||
WHERE name = #{name} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -140,27 +140,27 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
.sorted(new Comparator<SalaryItemPO>() {
|
||||
@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<SysSalaryItemPO> 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());
|
||||
|
|
|
|||
Loading…
Reference in New Issue