初始化
parent
287c7262f5
commit
35f9ab4545
|
@ -66,7 +66,7 @@ public class TokenController {
|
|||
@PostMapping("register")
|
||||
public Result<?> register (@RequestBody RegisterBody registerBody) {
|
||||
// 用户注册
|
||||
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
|
||||
sysLoginService.register(registerBody);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,11 +7,6 @@ package com.muyu.auth.form;
|
|||
*/
|
||||
public class LoginBody {
|
||||
|
||||
/**
|
||||
* 登录公司名称
|
||||
*/
|
||||
private Integer firmName;
|
||||
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
|
|
|
@ -1,10 +1,35 @@
|
|||
package com.muyu.auth.form;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 用户注册对象
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
public class RegisterBody extends LoginBody {
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class RegisterBody extends LoginBody {
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
private String firmName;
|
||||
/**
|
||||
* 登录人名称
|
||||
*/
|
||||
private String nickName;
|
||||
/**
|
||||
* 公司注册邮箱地址
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* 公司注册手机号
|
||||
*/
|
||||
private String phoneNumber;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.auth.service;
|
||||
|
||||
import com.muyu.auth.form.RegisterBody;
|
||||
import com.muyu.common.core.constant.CacheConstants;
|
||||
import com.muyu.common.core.constant.Constants;
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
|
@ -12,6 +13,8 @@ import com.muyu.common.core.utils.StringUtils;
|
|||
import com.muyu.common.core.utils.ip.IpUtils;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.Firm;
|
||||
import com.muyu.common.system.remote.RemoteFirmService;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
|
@ -27,6 +30,8 @@ import org.springframework.stereotype.Component;
|
|||
public class SysLoginService {
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
@Autowired
|
||||
private RemoteFirmService remoteFirmService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
@ -98,7 +103,9 @@ public class SysLoginService {
|
|||
/**
|
||||
* 注册
|
||||
*/
|
||||
public void register (String username, String password) {
|
||||
public void register (RegisterBody registerBody) {
|
||||
String username = registerBody.getUsername();
|
||||
String password = registerBody.getPassword();
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isAnyBlank(username, password)) {
|
||||
throw new ServiceException("用户/密码必须填写");
|
||||
|
@ -112,11 +119,25 @@ public class SysLoginService {
|
|||
throw new ServiceException("密码长度必须在5到20个字符之间");
|
||||
}
|
||||
|
||||
String firmName = registerBody.getFirmName();
|
||||
Result<Firm> byFirmName = remoteFirmService.findByFirmName(firmName);
|
||||
Firm data = byFirmName.getData();
|
||||
if (null!=data){
|
||||
throw new ServiceException("公司名称已经存在");
|
||||
}
|
||||
|
||||
// 注册用户信息
|
||||
SysUser sysUser = new SysUser();
|
||||
//公司账号
|
||||
sysUser.setUserName(username);
|
||||
sysUser.setNickName(username);
|
||||
//公司邮箱
|
||||
sysUser.setEmail(registerBody.getEmail());
|
||||
//名称
|
||||
sysUser.setNickName(registerBody.getNickName());
|
||||
//公司密码
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
//公司手机号
|
||||
sysUser.setPhonenumber(registerBody.getPhoneNumber());
|
||||
Result<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
||||
|
||||
if (Result.FAIL == registerResult.getCode()) {
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.common.system.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.common.system.domain
|
||||
* @Project:cloud-server-8
|
||||
* @name:Firm
|
||||
* @Date:2024/9/26 19:32
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class Firm {
|
||||
/**
|
||||
* 公司编号
|
||||
*/
|
||||
private Integer firmId;
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
private String firmName;
|
||||
/**
|
||||
* 公司所属数据库
|
||||
*/
|
||||
private String databaseName;
|
||||
}
|
||||
|
|
@ -87,7 +87,10 @@ public class SysUser extends BaseEntity {
|
|||
* 企业ID
|
||||
*/
|
||||
private Integer firmId;
|
||||
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
private String firmname;
|
||||
/**
|
||||
* 所属数据库
|
||||
*/
|
||||
|
@ -125,6 +128,9 @@ public class SysUser extends BaseEntity {
|
|||
})
|
||||
private SysDept dept;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 角色对象
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.common.system.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.Firm;
|
||||
import com.muyu.common.system.remote.factory.RemoteFirmFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.common.system.remote
|
||||
* @Project:cloud-server-8
|
||||
* @name:RemoteFirmService
|
||||
* @Date:2024/9/26 19:35
|
||||
*/
|
||||
@FeignClient(contextId = "remoteFirmService",value = ServiceNameConstants.SYSTEM_SERVICE,fallbackFactory = RemoteFirmFallbackFactory.class)
|
||||
public interface RemoteFirmService {
|
||||
|
||||
@RequestMapping("/firm/findByFirmName/{firmName}")
|
||||
public Result<Firm> findByFirmName(@PathVariable("firmName")String firmName);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.common.system.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.exception.ServiceException;
|
||||
import com.muyu.common.system.domain.Firm;
|
||||
import com.muyu.common.system.remote.RemoteFirmService;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.common.system.remote.factory
|
||||
* @Project:cloud-server-8
|
||||
* @name:RemoteFirmFallbackFactory
|
||||
* @Date:2024/9/26 19:39
|
||||
*/
|
||||
@Component
|
||||
public class RemoteFirmFallbackFactory implements FallbackFactory<RemoteFirmService> {
|
||||
|
||||
@Override
|
||||
public RemoteFirmService create(Throwable cause) {
|
||||
return new RemoteFirmService() {
|
||||
@Override
|
||||
public Result<Firm> findByFirmName(String firmName) {
|
||||
throw new ServiceException(cause.getCause().toString());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
|
||||
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
|
||||
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
|
||||
com.muyu.common.system.remote.factory.RemoteFirmFallbackFactory
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.service.CustomPermissionService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.system.controller
|
||||
* @Project:cloud-server-8
|
||||
* @name:CustomPermissionController
|
||||
* @Date:2024/9/26 23:34
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/custompermission")
|
||||
public class CustomPermissionController {
|
||||
|
||||
@Autowired
|
||||
private CustomPermissionService customPermissionService;
|
||||
|
||||
/**
|
||||
* 自定义权限分配
|
||||
* @param sysUser
|
||||
*/
|
||||
@Operation(summary = "自定义权限分配",description = "自定义权限分配")
|
||||
@PostMapping("/assignPermissionToUser")
|
||||
public void assignPermissionToUser(@RequestBody SysUser sysUser,Long[] roleIds){
|
||||
customPermissionService.assignPermissionToUser(sysUser,roleIds);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.Firm;
|
||||
import com.muyu.system.service.DataBaseCreator;
|
||||
import com.muyu.system.service.FirmService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.system.controller
|
||||
* @Project:cloud-server-8
|
||||
* @name:FirmController
|
||||
* @Date:2024/9/26 19:57
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/firm")
|
||||
@AllArgsConstructor
|
||||
public class FirmController {
|
||||
private final FirmService firmService;
|
||||
|
||||
|
||||
/**
|
||||
* 查找公司名称
|
||||
* @param firmName
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/findByFirmName/{firmName}")
|
||||
@Operation(summary = "根据公司名称,查找公司信息",description = "根据公司名称,查找公司信息")
|
||||
public Result<Firm> findByFirmName(@PathVariable("firmName")String firmName){
|
||||
Firm firmServiceByFirmName = firmService.findByFirmName(firmName);
|
||||
return Result.success(firmServiceByFirmName);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/findFirmList")
|
||||
@Operation(summary = "查找全部公司信息",description = "查找全部公司信息")
|
||||
public Result findFirmList(){
|
||||
return Result.success(firmService.findFirmList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.common.system.domain.Firm;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.system.mapper
|
||||
* @Project:cloud-server-8
|
||||
* @name:FirmMapper
|
||||
* @Date:2024/9/26 20:01
|
||||
*/
|
||||
@Mapper
|
||||
public interface FirmMapper extends BaseMapper<Firm> {
|
||||
|
||||
Firm findByFirmName(@Param("firmName") String firmName);
|
||||
}
|
|
@ -142,4 +142,9 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
|
||||
List<SysUser> companyList();
|
||||
|
||||
/**
|
||||
* 添加公司表信息
|
||||
* @param firmname
|
||||
*/
|
||||
void insertFirm(@Param("firmname") String firmname, @Param("databaseName") String databaseName);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.system.service
|
||||
* @Project:cloud-server-8
|
||||
* @name:CustomPermissionService
|
||||
* @Date:2024/9/26 23:35
|
||||
*/
|
||||
public interface CustomPermissionService {
|
||||
|
||||
/**
|
||||
* 自定义权限分配
|
||||
* @param sysUser
|
||||
*/
|
||||
void assignPermissionToUser(SysUser sysUser,Long[] roleIds);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.system.service
|
||||
* @Project:cloud-server-8
|
||||
* @name:DataBaseCreator
|
||||
* @Date:2024/9/26 20:40
|
||||
*/
|
||||
public interface DataBaseCreator {
|
||||
|
||||
|
||||
String createDatbase(SysUser user);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.system.domain.Firm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.system.service
|
||||
* @Project:cloud-server-8
|
||||
* @name:FirmService
|
||||
* @Date:2024/9/26 20:00
|
||||
*/
|
||||
public interface FirmService extends IService<Firm> {
|
||||
/**
|
||||
* 根据公司名称查询公司信息
|
||||
* @param firmName
|
||||
* @return
|
||||
*/
|
||||
Firm findByFirmName(String firmName);
|
||||
|
||||
/**
|
||||
* 查询公司全部信息
|
||||
* @return
|
||||
*/
|
||||
List<Firm> findFirmList();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.service.CustomPermissionService;
|
||||
import com.muyu.system.service.SysRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.system.service.impl
|
||||
* @Project:cloud-server-8
|
||||
* @name:CustomPermissionServiceImpl
|
||||
* @Date:2024/9/26 23:35
|
||||
*/
|
||||
@Service
|
||||
public class CustomPermissionServiceImpl implements CustomPermissionService {
|
||||
@Autowired
|
||||
private SysUserServiceImpl userService;
|
||||
@Autowired
|
||||
private SysRoleService roleService;
|
||||
|
||||
|
||||
/**
|
||||
* 自定义权限分配
|
||||
* @param sysUser
|
||||
*/
|
||||
@Override
|
||||
public void assignPermissionToUser(SysUser sysUser,Long[] roleIds) {
|
||||
//获取用户
|
||||
SysUser user = userService.selectUserById(sysUser.getUserId());
|
||||
//移除用户所在权限
|
||||
userService.deleteUserById(user.getUserId());
|
||||
//赋予新的角色
|
||||
for (Long roleId:roleIds){
|
||||
SysRole role = roleService.selectRoleById(roleId);
|
||||
if (role!=null){
|
||||
userService.insertUserRole(sysUser.getUserId(), roleIds);
|
||||
}
|
||||
}
|
||||
//更新用户权限缓存
|
||||
userService.updateUser(user);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.system.service.DataBaseCreator;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.system.service.impl
|
||||
* @Project:cloud-server-8
|
||||
* @name:DataBaseCreatorImpl
|
||||
* @Date:2024/9/26 20:40
|
||||
*/
|
||||
@Service
|
||||
public class DataBaseCreatorImpl implements DataBaseCreator {
|
||||
|
||||
|
||||
private static final String DB_URL="jdbc:mysql://159.75.188.178:3306?useSSL=false";
|
||||
private static final String USER="root";
|
||||
private static final String PASS="bwie-8666";
|
||||
|
||||
|
||||
@Override
|
||||
public String createDatbase(SysUser user) {
|
||||
try {
|
||||
Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
|
||||
Statement statement = conn.createStatement();
|
||||
String datbaseName="company"+RandomUtil.randomString(10000);
|
||||
//创建数据库
|
||||
String sql="CREATE DATABASE IF NOT EXISTS "+datbaseName;
|
||||
statement.execute(sql);
|
||||
//使用数据库
|
||||
sql="USE "+datbaseName;
|
||||
statement.execute(sql);
|
||||
//创建表
|
||||
sql="CREATE TABLE user ("+
|
||||
"user_id INT AUTO_INCREMENT PRIMARY KEY,"+
|
||||
"user_name VARCHAR(50) NOT NULL )";
|
||||
statement.execute(sql);
|
||||
return datbaseName;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.system.domain.Firm;
|
||||
import com.muyu.system.mapper.FirmMapper;
|
||||
import com.muyu.system.service.FirmService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:weiran
|
||||
* @Package:com.muyu.system.service.impl
|
||||
* @Project:cloud-server-8
|
||||
* @name:FirmServiceImpl
|
||||
* @Date:2024/9/26 20:00
|
||||
*/
|
||||
@Service
|
||||
public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm> implements FirmService {
|
||||
|
||||
@Autowired
|
||||
private FirmMapper firmMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 根据公司名称查询对应公司信息
|
||||
* @param firmName
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Firm findByFirmName(String firmName) {
|
||||
return firmMapper.findByFirmName(firmName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公司全部信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Firm> findFirmList() {
|
||||
LambdaQueryWrapper<Firm> queryWrapper = new LambdaQueryWrapper<>();
|
||||
List<Firm> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -14,12 +14,14 @@ import com.muyu.system.domain.SysPost;
|
|||
import com.muyu.system.domain.SysUserPost;
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
import com.muyu.system.mapper.*;
|
||||
import com.muyu.system.service.DataBaseCreator;
|
||||
import com.muyu.system.service.SysUserService;
|
||||
import com.muyu.system.service.SysConfigService;
|
||||
import jakarta.validation.Validator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.index.PathBasedRedisIndexDefinition;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
@ -50,6 +52,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
private SysUserPostMapper userPostMapper;
|
||||
@Autowired
|
||||
private SysConfigService configService;
|
||||
@Autowired
|
||||
private DataBaseCreator baseCreator;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
|
@ -254,7 +258,22 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*/
|
||||
@Override
|
||||
public boolean registerUser (SysUser user) {
|
||||
return userMapper.insertUser(user) > 0;
|
||||
//添加用户表
|
||||
int i = userMapper.insertUser(user);
|
||||
//根据新注册的用户创建对应数据库
|
||||
String datbaseName= baseCreator.createDatbase(user);
|
||||
//添加公司名称
|
||||
userMapper.insertFirm(user.getFirmname(),datbaseName);
|
||||
List<SysUser> userList = userMapper.selectUserList(user);
|
||||
Long userId = userList.get(0).getUserId();
|
||||
ArrayList<SysUserRole> list = new ArrayList<>();
|
||||
//将用户和角色进行关联
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(userId);
|
||||
userRole.setRoleId(2L);
|
||||
list.add(userRole);
|
||||
userRoleMapper.batchUserRole(list);
|
||||
return i>0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.muyu.system.mapper.FirmMapper">
|
||||
|
||||
<select id="findByFirmName" resultType="com.muyu.common.system.domain.Firm">
|
||||
select * from firm where firm_name=#{firmName}
|
||||
</select>
|
||||
</mapper>
|
|
@ -222,6 +222,11 @@
|
|||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
<!--添加公司表-->
|
||||
<insert id="insertFirm">
|
||||
INSERT INTO `eight`.`firm` (`firm_id`, `firm_name`, `database_name`)
|
||||
VALUES (0, #{firmname}, #{databaseName});
|
||||
</insert>
|
||||
|
||||
<update id="updateUser" parameterType="com.muyu.common.system.domain.SysUser">
|
||||
update sys_user
|
||||
|
|
Loading…
Reference in New Issue