@@ -14,6 +14,8 @@ import java.util.List; | |||
@Mapper | |||
public interface ClientUserRoleMapper { | |||
int insert(ClientUserRolePo clientUserRolePo); | |||
int batchInsert(List<ClientUserRolePo> list); | |||
int updateUserClientRole(ClientUserRolePo clientUserRolePo); |
@@ -177,7 +177,14 @@ public class ClientUserServiceImpl implements ClientUserSevice { | |||
.setClientId(dto.getClientId()) | |||
.setRoleId(dto.getRoleId()); | |||
clientUserRolePo.setUpdateUser(loginUser.getUserId()); | |||
clientUserRoleMapper.updateUserClientRole(clientUserRolePo); | |||
if(clientUserRoleMapper.updateUserClientRole(clientUserRolePo) == 0){ | |||
ClientUserRolePo insert = new ClientUserRolePo(); | |||
insert.setUserId(userPo.getId()) | |||
.setClientId(dto.getClientId()) | |||
.setRoleId(dto.getRoleId()) | |||
.setCreateUser(loginUser.getUserId()); | |||
clientUserRoleMapper.insert(insert); | |||
} | |||
} | |||
return JsonResult.success(true); | |||
} |
@@ -10,6 +10,11 @@ | |||
</foreach > | |||
</insert> | |||
<insert id="insert" parameterType="com.tuoheng.model.po.ClientUserRolePo"> | |||
insert into t_client_user_role (user_id, client_id, role_id, create_user) | |||
VALUES (#{userId}, #{clientId}, #{roleId}, #{createUser}) | |||
</insert> | |||
<update id="updateUserClientRole" parameterType="com.tuoheng.model.po.ClientUserRolePo"> | |||
update t_client_user_role | |||
<set> |