This paper thoroughly investigates stochastic linear-quadratic optimal
control problems with the Markovian regime switching system, where the
coefficients of the state equation and the weighting matrices of the cost
functional are random. We prove the solvability of the stochastic Riccati
equation under the uniform convexity condition and obtain the closed-loop
representation of the open-loop optimal control using the unique solvability of
the corresponding stochastic Riccati equation. Moreover, by applying It\^{o}'s
formula with jumps, we get a representation of the cost functional on a Hilbert
space, characterized as the adapted solutions of some forward-backward
stochastic differential equations. We show that the necessary condition of the
open-loop optimal control is the convexity of the cost functional, and the
sufficient condition of the open-loop optimal control is the uniform convexity
of the cost functional. In addition, we study the properties of the stochastic
value flow of the stochastic linear-quadratic optimal control problem. Finally,
as an application, we present a continuous-time mean-variance portfolio
selection problem and prove its unique solvability.Comment: 30 pages. arXiv admin note: text overlap with arXiv:1809.0026