Merge remote-tracking branch 'origin/master'

highway
wws 1 year ago
commit 73ed0f121c

@ -72,7 +72,13 @@ public class SysFactoryController extends BaseController {
@Log(title = "工厂模型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysFactory sysFactory) {
return toAjax(sysFactoryService.insertSysFactory(sysFactory));
if (sysFactoryService.checkFactoryCodeUnique(sysFactory)) {
return AjaxResult.error("组织编码已存在!");
}else if(sysFactoryService.checkFactoryNameUnique(sysFactory)){
return AjaxResult.error("组织名称已存在!");
}else{
return toAjax(sysFactoryService.insertSysFactory(sysFactory));
}
}
/**

@ -60,4 +60,8 @@ public interface SysFactoryMapper {
public int deleteSysFactoryByFactoryIds(Long[] factoryIds);
public List<SysFactory> getWorkCenterList(SysFactory sysFactory);
//新增判断
String checkFactoryNameUnique(SysFactory sysFactory);
String checkFactoryCodeUnique(SysFactory sysFactory);
}

@ -60,4 +60,8 @@ public interface ISysFactoryService {
//好
List<SysFactory> getWorkCenterList(SysFactory sysFactory);
//新增 判断逻辑
boolean checkFactoryCodeUnique(SysFactory sysFactory);
boolean checkFactoryNameUnique(SysFactory sysFactory);
}

@ -110,4 +110,36 @@ public class SysFactoryServiceImpl implements ISysFactoryService {
return sysFactoryMapper.getWorkCenterList(sysFactory);
}
/**
*
*
* @return
*/
@Override
@DS("#header.poolName")
public boolean checkFactoryCodeUnique(SysFactory sysFactory) {
String area = sysFactoryMapper.checkFactoryCodeUnique(sysFactory);
if(area == null){
return false;
}else{
return true;
}
}
/**
*
*
* @return
*/
@Override
@DS("#header.poolName")
public boolean checkFactoryNameUnique(SysFactory sysFactory) {
String desc = sysFactoryMapper.checkFactoryNameUnique(sysFactory);
if(desc== null){
return false;
}else{
return true;
}
}
}

@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="factoryName != null and factoryName != ''"> and factory_name like concat('%', #{factoryName}, '%')</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code like concat('%', #{factoryCode}, '%')</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="leader != null and leader != ''"> and leader = #{leader}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
@ -118,4 +119,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from sys_factory
</select>
<select id="checkFactoryCodeUnique" parameterType="SysFactory" resultType ="java.lang.String">
select factory_code
from sys_factory
where factory_code = #{factoryCode}
</select>
<select id="checkFactoryNameUnique" parameterType="SysFactory" resultType ="java.lang.String">
select factory_name
from sys_factory
where factory_name = #{factoryName}
</select>
</mapper>
Loading…
Cancel
Save