提交 7171b266 编写于 作者: rushui.chen's avatar rushui.chen

20200106 注册用户角色处理

上级 63cc12d6
package com.pica.cloud.permission.permission.client;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.permission.permission.entity.PUserRole;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* Created on 2020/1/6 10:53
* author:crs
* Description:UseRoleClient
*/
@FeignClient(name = "13501-pica-cloud-permission")
public interface UseRoleClient {
/**
* 注册用户角色
*
* @param pUserRole
* @return
*/
@PostMapping("/permission/role/register")
PicaResponse postUserRole(@RequestBody PUserRole pUserRole);
}
package com.pica.cloud.permission.permission.entity;
import java.util.Date;
public class PUserRole {
private Integer id;
private Integer systemId;
private Integer userRoleId;
private Integer userId;
private Integer userType;
private String param1;
private String param2;
private String param3;
private String param4;
private String param5;
private Integer status;
private Integer deleteFlag;
private Integer creatId;
private Date creatTime;
private Integer modifyId;
private Date modifyTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSystemId() {
return systemId;
}
public void setSystemId(Integer systemId) {
this.systemId = systemId;
}
public Integer getUserRoleId() {
return userRoleId;
}
public void setUserRoleId(Integer userRoleId) {
this.userRoleId = userRoleId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
public String getParam1() {
return param1;
}
public void setParam1(String param1) {
this.param1 = param1 == null ? null : param1.trim();
}
public String getParam2() {
return param2;
}
public void setParam2(String param2) {
this.param2 = param2 == null ? null : param2.trim();
}
public String getParam3() {
return param3;
}
public void setParam3(String param3) {
this.param3 = param3 == null ? null : param3.trim();
}
public String getParam4() {
return param4;
}
public void setParam4(String param4) {
this.param4 = param4 == null ? null : param4.trim();
}
public String getParam5() {
return param5;
}
public void setParam5(String param5) {
this.param5 = param5 == null ? null : param5.trim();
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getCreatId() {
return creatId;
}
public void setCreatId(Integer creatId) {
this.creatId = creatId;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public Integer getModifyId() {
return modifyId;
}
public void setModifyId(Integer modifyId) {
this.modifyId = modifyId;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
}
\ No newline at end of file
package com.pica.cloud.permission.permission.server.controller;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.permission.permission.server.entity.PUserRole;
import com.pica.cloud.permission.permission.server.service.IUseRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created on 2020/1/6 10:31
* author:crs
* Description:注册用户角色
*/
@RestController
@RequestMapping("/role")
public class UseRoleController {
@Autowired
private IUseRoleService iUseRoleService;
@PostMapping("/register")
public PicaResponse postUserRole(@RequestBody PUserRole pUserRole) {
iUseRoleService.postRegisterRole(pUserRole);
return PicaResponse.toResponse();
}
}
package com.pica.cloud.permission.permission.server.entity;
import java.util.Date;
public class PUserRole {
private Integer id;
private Integer systemId;
private Integer userRoleId;
private Integer userId;
private Integer userType;
private String param1;
private String param2;
private String param3;
private String param4;
private String param5;
private Integer status;
private Integer deleteFlag;
private Integer creatId;
private Date creatTime;
private Integer modifyId;
private Date modifyTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSystemId() {
return systemId;
}
public void setSystemId(Integer systemId) {
this.systemId = systemId;
}
public Integer getUserRoleId() {
return userRoleId;
}
public void setUserRoleId(Integer userRoleId) {
this.userRoleId = userRoleId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getUserType() {
return userType;
}
public void setUserType(Integer userType) {
this.userType = userType;
}
public String getParam1() {
return param1;
}
public void setParam1(String param1) {
this.param1 = param1 == null ? null : param1.trim();
}
public String getParam2() {
return param2;
}
public void setParam2(String param2) {
this.param2 = param2 == null ? null : param2.trim();
}
public String getParam3() {
return param3;
}
public void setParam3(String param3) {
this.param3 = param3 == null ? null : param3.trim();
}
public String getParam4() {
return param4;
}
public void setParam4(String param4) {
this.param4 = param4 == null ? null : param4.trim();
}
public String getParam5() {
return param5;
}
public void setParam5(String param5) {
this.param5 = param5 == null ? null : param5.trim();
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
public Integer getCreatId() {
return creatId;
}
public void setCreatId(Integer creatId) {
this.creatId = creatId;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public Integer getModifyId() {
return modifyId;
}
public void setModifyId(Integer modifyId) {
this.modifyId = modifyId;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
}
\ No newline at end of file
package com.pica.cloud.permission.permission.server.mapper;
import com.pica.cloud.permission.permission.server.entity.PUserRole;
public interface PUserRoleMapper {
int deleteByPrimaryKey(Integer id);
int insert(PUserRole record);
int insertSelective(PUserRole record);
PUserRole selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PUserRole record);
int updateByPrimaryKey(PUserRole record);
}
\ No newline at end of file
package com.pica.cloud.permission.permission.server.service;
import com.pica.cloud.permission.permission.server.entity.PUserRole;
/**
* Created on 2020/1/6 10:44
* author:crs
* Description:IUseRoleService
*/
public interface IUseRoleService {
/**
* 插入注册用户的角色
*
* @param pUserRole
*/
void postRegisterRole(PUserRole pUserRole);
}
package com.pica.cloud.permission.permission.server.service.impl;
import com.pica.cloud.permission.permission.server.entity.PUserRole;
import com.pica.cloud.permission.permission.server.mapper.PUserRoleMapper;
import com.pica.cloud.permission.permission.server.service.IUseRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created on 2020/1/6 10:45
* author:crs
* Description:UseRoleServiceImpl
*/
@Service
public class UseRoleServiceImpl implements IUseRoleService {
@Autowired
private PUserRoleMapper pUserRoleMapper;
@Override
public void postRegisterRole(PUserRole pUserRole) {
pUserRoleMapper.insertSelective(pUserRole);
}
}
<?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.pica.cloud.permission.permission.server.mapper.PUserRoleMapper" >
<resultMap id="BaseResultMap" type="com.pica.cloud.permission.permission.server.entity.PUserRole" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="system_id" property="systemId" jdbcType="INTEGER" />
<result column="user_role_id" property="userRoleId" jdbcType="INTEGER" />
<result column="user_id" property="userId" jdbcType="INTEGER" />
<result column="user_type" property="userType" jdbcType="INTEGER" />
<result column="param_1" property="param1" jdbcType="VARCHAR" />
<result column="param_2" property="param2" jdbcType="VARCHAR" />
<result column="param_3" property="param3" jdbcType="VARCHAR" />
<result column="param_4" property="param4" jdbcType="VARCHAR" />
<result column="param_5" property="param5" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER" />
<result column="creat_id" property="creatId" jdbcType="INTEGER" />
<result column="creat_time" property="creatTime" jdbcType="TIMESTAMP" />
<result column="modify_id" property="modifyId" jdbcType="INTEGER" />
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, system_id, user_role_id, user_id, user_type, param_1, param_2, param_3, param_4,
param_5, status, delete_flag, creat_id, creat_time, modify_id, modify_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from p_user_role_mapping
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from p_user_role_mapping
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.permission.permission.server.entity.PUserRole" >
insert into p_user_role_mapping (id, system_id, user_role_id,
user_id, user_type, param_1,
param_2, param_3, param_4,
param_5, status, delete_flag,
creat_id, creat_time, modify_id,
modify_time)
values (#{id,jdbcType=INTEGER}, #{systemId,jdbcType=INTEGER}, #{userRoleId,jdbcType=INTEGER},
#{userId,jdbcType=INTEGER}, #{userType,jdbcType=INTEGER}, #{param1,jdbcType=VARCHAR},
#{param2,jdbcType=VARCHAR}, #{param3,jdbcType=VARCHAR}, #{param4,jdbcType=VARCHAR},
#{param5,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{deleteFlag,jdbcType=INTEGER},
#{creatId,jdbcType=INTEGER}, #{creatTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=INTEGER},
#{modifyTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.permission.permission.server.entity.PUserRole" >
insert into p_user_role_mapping
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="systemId != null" >
system_id,
</if>
<if test="userRoleId != null" >
user_role_id,
</if>
<if test="userId != null" >
user_id,
</if>
<if test="userType != null" >
user_type,
</if>
<if test="param1 != null" >
param_1,
</if>
<if test="param2 != null" >
param_2,
</if>
<if test="param3 != null" >
param_3,
</if>
<if test="param4 != null" >
param_4,
</if>
<if test="param5 != null" >
param_5,
</if>
<if test="status != null" >
status,
</if>
<if test="deleteFlag != null" >
delete_flag,
</if>
<if test="creatId != null" >
creat_id,
</if>
<if test="creatTime != null" >
creat_time,
</if>
<if test="modifyId != null" >
modify_id,
</if>
<if test="modifyTime != null" >
modify_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="systemId != null" >
#{systemId,jdbcType=INTEGER},
</if>
<if test="userRoleId != null" >
#{userRoleId,jdbcType=INTEGER},
</if>
<if test="userId != null" >
#{userId,jdbcType=INTEGER},
</if>
<if test="userType != null" >
#{userType,jdbcType=INTEGER},
</if>
<if test="param1 != null" >
#{param1,jdbcType=VARCHAR},
</if>
<if test="param2 != null" >
#{param2,jdbcType=VARCHAR},
</if>
<if test="param3 != null" >
#{param3,jdbcType=VARCHAR},
</if>
<if test="param4 != null" >
#{param4,jdbcType=VARCHAR},
</if>
<if test="param5 != null" >
#{param5,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
<if test="deleteFlag != null" >
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="creatId != null" >
#{creatId,jdbcType=INTEGER},
</if>
<if test="creatTime != null" >
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null" >
#{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null" >
#{modifyTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.permission.permission.server.entity.PUserRole" >
update p_user_role_mapping
<set >
<if test="systemId != null" >
system_id = #{systemId,jdbcType=INTEGER},
</if>
<if test="userRoleId != null" >
user_role_id = #{userRoleId,jdbcType=INTEGER},
</if>
<if test="userId != null" >
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="userType != null" >
user_type = #{userType,jdbcType=INTEGER},
</if>
<if test="param1 != null" >
param_1 = #{param1,jdbcType=VARCHAR},
</if>
<if test="param2 != null" >
param_2 = #{param2,jdbcType=VARCHAR},
</if>
<if test="param3 != null" >
param_3 = #{param3,jdbcType=VARCHAR},
</if>
<if test="param4 != null" >
param_4 = #{param4,jdbcType=VARCHAR},
</if>
<if test="param5 != null" >
param_5 = #{param5,jdbcType=VARCHAR},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="deleteFlag != null" >
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="creatId != null" >
creat_id = #{creatId,jdbcType=INTEGER},
</if>
<if test="creatTime != null" >
creat_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="modifyId != null" >
modify_id = #{modifyId,jdbcType=INTEGER},
</if>
<if test="modifyTime != null" >
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.permission.permission.server.entity.PUserRole" >
update p_user_role_mapping
set system_id = #{systemId,jdbcType=INTEGER},
user_role_id = #{userRoleId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
user_type = #{userType,jdbcType=INTEGER},
param_1 = #{param1,jdbcType=VARCHAR},
param_2 = #{param2,jdbcType=VARCHAR},
param_3 = #{param3,jdbcType=VARCHAR},
param_4 = #{param4,jdbcType=VARCHAR},
param_5 = #{param5,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
creat_id = #{creatId,jdbcType=INTEGER},
creat_time = #{creatTime,jdbcType=TIMESTAMP},
modify_id = #{modifyId,jdbcType=INTEGER},
modify_time = #{modifyTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册