test:(重构完成正在往完整的效果哪一步发展)
parent
2ca7afc0a7
commit
ca1760e726
|
@ -101,6 +101,8 @@ public class SysRole extends BaseEntity {
|
|||
private Set<String> permissions;
|
||||
|
||||
|
||||
|
||||
|
||||
public SysRole (Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.common.system.remote;
|
|||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
|
@ -33,6 +34,10 @@ public interface RemoteUserService {
|
|||
@PostMapping("/user")
|
||||
public Result add (@Validated @RequestBody SysUser user);
|
||||
|
||||
|
||||
@PostMapping
|
||||
public Result addRole (@Validated @RequestBody SysRole role);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.common.system.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
|
@ -32,6 +33,12 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
return Result.error("获取用户失败:{}", throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result addRole(SysRole role) {
|
||||
return Result.error("获取用户失败:{}", throwable.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package com.muyu.networking.service;
|
||||
|
||||
/** 多数据源
|
||||
* @ClassName
|
||||
* @Author
|
||||
* @Date 2024/4/28 18:46
|
||||
*/
|
||||
public interface DataSourceService {
|
||||
|
||||
void toDefaultDS();
|
||||
|
||||
boolean changeDS(Long datasourceId);
|
||||
}
|
||||
|
||||
//package com.muyu.networking.service;
|
||||
//
|
||||
///** 多数据源
|
||||
// * @ClassName
|
||||
// * @Author
|
||||
// * @Date 2024/4/28 18:46
|
||||
// */
|
||||
//public interface DataSourceService {
|
||||
//
|
||||
// void toDefaultDS();
|
||||
//
|
||||
// boolean changeDS(Long datasourceId);
|
||||
//}
|
||||
//
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.muyu.domain.Enterprise;
|
||||
|
@ -70,12 +71,10 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper,Enterpr
|
|||
// .entId(enterprise.getId())
|
||||
// .build();
|
||||
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserName("admin");
|
||||
if (sysUser.getUserName().equals("admin")){
|
||||
enterprise.setEnterpriseName("admin");
|
||||
if (enterprise.getEnterpriseName().equals("admin")){
|
||||
return enterpriseMapper.selectEnterpriseList(enterprise);
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<Enterprise> lambdaQueryWrapper = new LambdaQueryWrapper<>() {{
|
||||
eq(Enterprise::getId, enterprise.getId());
|
||||
}};
|
||||
|
@ -98,8 +97,9 @@ public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper,Enterpr
|
|||
enterprise.setCreateTime(DateUtils.getNowDate());
|
||||
enterprise.setBusinessLicenseNumber(UUID.randomUUID().toString().replaceAll("-",""));
|
||||
enterprise.setStatus("1");
|
||||
enterprise.setCertification("1");
|
||||
enterprise.setCertification("0");
|
||||
enterprise.setOpenAdd("0");
|
||||
SysRole.builder().roleId(2L).build();
|
||||
SysUser sysUser = SysUser.builder().userName(
|
||||
enterprise.getEnterpriseName())
|
||||
.password("admin")
|
||||
|
|
|
@ -73,7 +73,7 @@ public class SysRoleController extends BaseController {
|
|||
@RequiresPermissions("system:role:add")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody SysRole role) {
|
||||
public Result addRole (@Validated @RequestBody SysRole role) {
|
||||
if (!roleService.checkRoleNameUnique(role)) {
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.muyu.common.datascope.annotation.DataScope;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.SysRole;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.muyu.system.domain.SysPost;
|
||||
import com.muyu.system.domain.SysUserPost;
|
||||
import com.muyu.system.domain.SysUserRole;
|
||||
|
@ -226,6 +227,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysUserRoleMapper sysUserRoleMapper;
|
||||
|
||||
/**
|
||||
* 新增保存用户信息
|
||||
*
|
||||
|
@ -240,6 +244,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
int rows = userMapper.insertUser(user);
|
||||
// 新增用户岗位关联
|
||||
insertUserPost(user);
|
||||
if (2==user.getRoleId()){
|
||||
SysUserRole sysUserRole = new SysUserRole();
|
||||
sysUserRole.setRoleId(2L);
|
||||
sysUserRole.setUserId(user.getUserId());
|
||||
sysUserRoleMapper.insert(sysUserRole);
|
||||
}
|
||||
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
return rows;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<result property="phonenumber" column="phonenumber"/>
|
||||
<result property="sex" column="sex"/>
|
||||
<result property="avatar" column="avatar"/>
|
||||
<result property="entId" column="ent_id"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
|
@ -54,6 +55,7 @@
|
|||
u.email,
|
||||
u.avatar,
|
||||
u.phonenumber,
|
||||
u.ent_id,
|
||||
u.password,
|
||||
u.sex,
|
||||
u.status,
|
||||
|
@ -83,7 +85,7 @@
|
|||
</sql>
|
||||
|
||||
<select id="selectUserList" parameterType="com.muyu.common.system.domain.SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar,u.ent_id, u.password, u.phonenumber, u.sex, u.status,
|
||||
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user
|
||||
u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
|
@ -194,6 +196,7 @@
|
|||
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="entId != null and entId != ''">ent_id,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
|
@ -208,6 +211,7 @@
|
|||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="entId != null and entId != ''">#{ent_id},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
|
@ -226,6 +230,7 @@
|
|||
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="entId != null and entId != ''">ent_id = #{ent_id},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.vehicle.service.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.datasources.SongInfo;
|
||||
import com.muyu.vehicle.mapper.SongMapper;
|
||||
import com.muyu.vehicle.service.SongService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 多数据源
|
||||
* songService业务层处理
|
||||
*
|
||||
* @author
|
||||
* @date 2024-05-16
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SongServiceImpl extends ServiceImpl<SongMapper, SongInfo> implements SongService { // song_info对象 | songService接口
|
||||
|
||||
/**
|
||||
* 查询song列表
|
||||
*
|
||||
* @return song
|
||||
*/
|
||||
@Override // 查询song列表
|
||||
public List<SongInfo> list() { // song_info对象
|
||||
return this.list(new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
}
|
||||
|
3
pom.xml
3
pom.xml
|
@ -215,6 +215,9 @@
|
|||
<module>muyu-visual</module>
|
||||
<module>muyu-modules</module>
|
||||
<module>muyu-common</module>
|
||||
<module>muyu-modules/muyu-vehicle</module>
|
||||
<module>muyu-modules/muyu-vehicle/muyu-vehicle-common</module>
|
||||
<module>muyu-modules/muyu-vehicle/muyu-vehicle-service</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
|
Loading…
Reference in New Issue