@ -88,9 +88,17 @@ public class EnterpriseInfoController extends BaseController {
enterpriseInfo.setOrganCode(SnowflakeIdUtils.generateIdentification());
String configValue = sysConfigService.selectConfigByKey("web_site");
enterpriseInfo.setWebsiteUrl(configValue + "&organCode=" + enterpriseInfo.getOrganCode());
enterpriseInfo.setStatus(1);
enterpriseInfo.setStatus(0);
enterpriseInfo.setDelFlag(0);
return toAjax(enterpriseInfoService.insertEnterpriseInfo(enterpriseInfo));
int result = enterpriseInfoService.insertEnterpriseInfo(enterpriseInfo);
if(result>0){
return toAjax(result);
}else if(result == -2){
return AjaxResult.error("机构名称已存在");
}else{
}
/**
@ -3,6 +3,7 @@ package com.cjy.enterprise.mapper;
import java.util.List;
import com.cjy.enterprise.domain.EnterpriseInfo;
import com.cjy.enterprise.domain.vo.EnterpriseInfoExtend;
import org.apache.ibatis.annotations.Param;
* 企业信息Mapper接口
@ -69,4 +70,11 @@ public interface EnterpriseInfoMapper
* @return
*/
public int updateFlagListByIds(Long[] ids);
* 查询项目名称是否存在
* @param name
public int selectEnterpriseByOrganName(@Param("name") String name);
@ -80,6 +80,11 @@ public class EnterpriseInfoServiceImpl implements IEnterpriseInfoService {
@Override
public int insertEnterpriseInfo(EnterpriseInfo enterpriseInfo) {
//0. 查询名称是否已存在
boolean isOk = enterpriseInfoMapper.selectEnterpriseByOrganName(enterpriseInfo.getOrganName())>0;
if(isOk){
return -2;
//1. 创建单位
Long deptId = insertOrganDept(enterpriseInfo);
//2. 创建人员
@ -95,6 +95,9 @@
<include refid="selectEnterpriseInfoVo"/>
where id = #{id}
</select>
<select id="selectEnterpriseByOrganName" resultType="java.lang.Integer">
select count(*) from ti_enterprise_info where organ_name =#{name} and del_flag !='2'
<insert id="insertEnterpriseInfo" parameterType="EnterpriseInfo" useGeneratedKeys="true" keyProperty="id">
insert into ti_enterprise_info
@ -90,7 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
<select id="selectDeptListByOrganCode" resultType="com.ruoyi.common.core.domain.entity.SysDept">
<select id="selectDeptListByOrganCode" resultMap="SysDeptResult">
where organ_code=#{organCode} and del_flag != '2'
@ -93,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
<select id="selectRoleListByOrganCode" resultType="com.ruoyi.common.core.domain.entity.SysRole">
<select id="selectRoleListByOrganCode" resultMap="SysRoleResult">
select r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark,r.organ_code
from sys_role r where r.organ_code=#{organCode} and r.del_flag ="0"
@ -146,7 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
<select id="selectUserListByOrganCode" resultType="com.ruoyi.common.core.domain.entity.SysUser">
<select id="selectUserListByOrganCode" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.organ_code
from sys_user u where u.organ_code =#{organCode} and u.del_flag !='2'