物资类型
This commit is contained in:
parent
c6a1871d38
commit
ba96fddba5
|
|
@ -122,4 +122,6 @@ public interface TypeMapper {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int logicDeleteTypeByTypeIds(Long[] typeIds);
|
int logicDeleteTypeByTypeIds(Long[] typeIds);
|
||||||
|
|
||||||
|
Type queryByName(String typeName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,12 @@ public class TypeServiceImpl implements ITypeService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertType(Type type) {
|
public int insertType(Type type) {
|
||||||
|
//根据类型名称判断,去重
|
||||||
|
Type maType = typeMapper.queryByName(type.getTypeName());
|
||||||
|
if (maType != null && maType.getParentId().equals(type.getParentId())) {
|
||||||
|
throw new RuntimeException("同级下类型名称存在重复!");
|
||||||
|
}
|
||||||
|
type.setLevel(String.valueOf(Integer.parseInt(type.getLevel()) + 1));
|
||||||
type.setCreateTime(DateUtils.getNowDate());
|
type.setCreateTime(DateUtils.getNowDate());
|
||||||
type.setCreateBy(SecurityUtils.getUserId().toString());
|
type.setCreateBy(SecurityUtils.getUserId().toString());
|
||||||
return typeMapper.insertType(type);
|
return typeMapper.insertType(type);
|
||||||
|
|
|
||||||
|
|
@ -435,9 +435,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
and m2.del_flag = '0'
|
and m2.del_flag = '0'
|
||||||
LEFT JOIN ma_type m3 ON m2.parent_id = m3.type_id
|
LEFT JOIN ma_type m3 ON m2.parent_id = m3.type_id
|
||||||
and m3.del_flag = '0'
|
and m3.del_flag = '0'
|
||||||
WHERE m.parent_id = #{typeId} and m.status = '0' and m.del_flag = '0'
|
WHERE m.parent_id = #{typeId} and m.del_flag = '0'
|
||||||
<if test="typeName != null and typeName !=''">
|
<if test="typeName != null and typeName !=''">
|
||||||
AND m.type_name like concat('%',#{typeName},'%')
|
AND m.type_name like concat('%',#{typeName},'%')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="queryByName" resultType="com.bonus.material.ma.domain.Type">
|
||||||
|
select
|
||||||
|
type_id as typeId, parent_id as parentId, type_name as typeName, level as level
|
||||||
|
from ma_type
|
||||||
|
where type_name = #{typeName} and del_flag = '0'
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue