登录账号添加场站并赋予该站权限
This commit is contained in:
parent
83783db947
commit
913dce9225
@ -167,7 +167,7 @@ public class XhpcChargingStationController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 添加场点
|
||||
* 添加场站
|
||||
*
|
||||
* @param xhpcChargingStationDto
|
||||
* @return
|
||||
|
||||
@ -261,7 +261,9 @@ public interface XhpcChargingStationMapper {
|
||||
*/
|
||||
Map<String, Object> getLandUser(@Param("userId") Long userId);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加场站数据权限
|
||||
*/
|
||||
void addXhpcUserPrivilege(@Param("userId") Long userId,@Param("chargingStationId") Long chargingStationId);
|
||||
|
||||
}
|
||||
|
||||
@ -595,6 +595,21 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
|
||||
//修改桩和终端的模板id
|
||||
xhpcChargingStationMapper.updateXhpcChargingPile(chargingStationId,rateModelId);
|
||||
xhpcChargingStationMapper.updateXhpcTerminal(chargingStationId,rateModelId);
|
||||
try{
|
||||
//获取登陆用户
|
||||
Long logUserId = SecurityUtils.getUserId();
|
||||
if(logUserId !=1){
|
||||
Map<String, Object> landUser = xhpcChargingStationMapper.getLandUser(logUserId);
|
||||
if(landUser !=null){
|
||||
if(landUser.get("userType") !=null && "02".equals(landUser.get("userType").toString())){
|
||||
xhpcChargingStationMapper.addXhpcUserPrivilege(logUserId,chargingStationId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("添加场站权限失败");
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ -890,4 +890,21 @@
|
||||
select user_id as userId,user_type as userType,operator_id as operatorId from sys_user where user_id =#{userId}
|
||||
</select>
|
||||
|
||||
<insert id="addXhpcUserPrivilege">
|
||||
insert into xhpc_user_privilege(
|
||||
<if test="null != userId and '' != userId">
|
||||
user_id,
|
||||
</if>
|
||||
<if test="null != chargingStationId and '' != chargingStationId">
|
||||
charging_station_id
|
||||
</if>
|
||||
)values(
|
||||
<if test="null != userId and '' != userId">
|
||||
#{userId},
|
||||
</if>
|
||||
<if test="null != chargingStationId and '' != chargingStationId">
|
||||
#{chargingStationId}
|
||||
</if>
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user