Commit d2f67389 by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-platform-auth into developer
parents c9523adb ddb32657
......@@ -66,6 +66,11 @@ public class TabSysUser {
*/
private Integer loginType = 0;
/**
* 1:自动生成 2:自定义密码
*/
private Integer passwordType;
public Integer getUserId() {
return userId;
}
......@@ -161,4 +166,12 @@ public class TabSysUser {
public void setLoginType(Integer loginType) {
this.loginType = loginType;
}
public Integer getPasswordType() {
return passwordType;
}
public void setPasswordType(Integer passwordType) {
this.passwordType = passwordType;
}
}
\ No newline at end of file
......@@ -56,7 +56,7 @@ public class UserServiceImpl implements UserService {
@Override
public TabSysUser getUserByEnterpriseId(Integer enterpriseId) {
return null;
return tabSysUserMapper.selectByEnterpriseId(enterpriseId);
}
@Override
......
......@@ -150,6 +150,10 @@ public class UserApiServiceImpl implements UserApiService {
if (tabUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户ID输入有误,无此数据");
}
//删除角色关联
userRoleService.deleteByUserId(userId);
//删除资源关联
userResourceService.deleteByUserId(userId);
userService.delete(userId);
return ServiceResponse.success();
}
......@@ -157,7 +161,7 @@ public class UserApiServiceImpl implements UserApiService {
@Override
public ServiceResponse<UserDTO> getUserByEnterpriseId(Integer enterpriseId) {
TabSysUser tabUser = userService.getUserByEnterpriseId(enterpriseId);
if (enterpriseId == null) {
if (tabUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "商户ID输入有误");
}
return ServiceResponse.success(EntityUtil.changeEntityNew(UserDTO.class, tabUser));
......
......@@ -14,10 +14,11 @@
<result column="phone_area_code" jdbcType="VARCHAR" property="phoneAreaCode" />
<result column="user_group_ids" jdbcType="VARCHAR" property="userGroupIds" />
<result column="login_type" jdbcType="INTEGER" property="loginType" />
<result column="password_type" jdbcType="INTEGER" property="passwordType" />
</resultMap>
<sql id="Base_Column_List">
user_id, user_name, phone_number, password, super_admin, status, create_time, update_time,
enterprise_id, phone_area_code, user_group_ids, login_type
enterprise_id, phone_area_code, user_group_ids, login_type, password_type
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
......@@ -33,12 +34,13 @@
insert into tab_sys_user (user_id, user_name, phone_number,
password, super_admin, status,
create_time, update_time, enterprise_id,
phone_area_code, user_group_ids, login_type
phone_area_code, user_group_ids, login_type, password_type
)
values (#{userId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{superAdmin,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{enterpriseId,jdbcType=INTEGER},
#{phoneAreaCode,jdbcType=VARCHAR}, #{userGroupIds,jdbcType=VARCHAR}, #{loginType,jdbcType=INTEGER}
#{phoneAreaCode,jdbcType=VARCHAR}, #{userGroupIds,jdbcType=VARCHAR}, #{loginType,jdbcType=INTEGER},
#{passwordType,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabSysUser">
......@@ -80,6 +82,9 @@
<if test="loginType != null">
login_type,
</if>
<if test="passwordType != null">
password_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
......@@ -118,6 +123,9 @@
<if test="loginType != null">
#{loginType,jdbcType=INTEGER},
</if>
<if test="passwordType != null">
#{passwordType,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabSysUser">
......@@ -156,6 +164,9 @@
<if test="loginType != null">
login_type = #{loginType,jdbcType=INTEGER},
</if>
<if test="passwordType != null">
password_type = #{passwordType,jdbcType=INTEGER},
</if>
</set>
where user_id = #{userId,jdbcType=INTEGER}
</update>
......@@ -171,7 +182,8 @@
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
phone_area_code = #{phoneAreaCode,jdbcType=VARCHAR},
user_group_ids = #{userGroupIds,jdbcType=VARCHAR},
login_type = #{loginType,jdbcType=INTEGER}
login_type = #{loginType,jdbcType=INTEGER},
password_type = #{passwordType,jdbcType=INTEGER}
where user_id = #{userId,jdbcType=INTEGER}
</update>
......
package com.gic.auth.web.controller;
import com.gic.auth.service.MenuApiService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.MenuDTO;
import com.gic.auth.dto.RoleDTO;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.qo.RoleListQO;
import com.gic.auth.service.MenuApiService;
import com.gic.auth.service.RoleApiService;
import com.gic.auth.service.UserApiService;
import com.gic.auth.web.vo.RoleDetailVO;
import com.gic.auth.web.vo.RoleSelectVO;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
......@@ -22,6 +29,8 @@ public class RoleController {
private RoleApiService roleApiService;
@Autowired
private MenuApiService menuApiService;
@Autowired
private UserApiService userApiService;
@RequestMapping("/get-detail")
public RestResponse getDetail(Integer id) {
......@@ -56,4 +65,22 @@ public class RoleController {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
return ResultControllerUtils.commonResult(roleApiService.listRole(enterpriseId), RoleSelectVO.class);
}
@RequestMapping("/list-menu")
public RestResponse listMenu() {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
ServiceResponse<UserDTO> userResponse = userApiService.getUserByEnterpriseId(enterpriseId);
if (userResponse.isSuccess()) {
UserDTO admin = userResponse.getResult();
Integer userId = admin.getUserId();
ServiceResponse<List<MenuDTO>> menuResponse = menuApiService.getSuperAdminMenu(userId, enterpriseId);
if (menuResponse.isSuccess()) {
return RestResponse.success(menuResponse.getResult());
} else {
return EnterpriseRestResponse.failure(menuResponse);
}
} else {
return EnterpriseRestResponse.failure(userResponse);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment