我有以下代码:
try {
MapSqlParameterSource parameters = new MapSqlParameterSource();
parameters.addValue("ids", year);
return this.template.getJdbcOperations().query(
"SELECT * FROM INCOME WHERE PROVNUM=? AND FISCALDATE IN ( :ids )", this.rowMapper, parameters);
} catch (EmptyResultDataAccessException ex) {
return null;
}
Run Code Online (Sandbox Code Playgroud)
但我无法发送PROVNUM的值.怎么做?
需要帮助,谢谢.
我有一点问题,希望你能帮助我.我在MongoDB中有下一个数组结构:
{
"_id":ObjectId("4e43cf96e7c7914b87d2e0ff"),
"list" :[
{
"id" : ObjectId("4e43cf96e62883ee06000002"),
"user_name" : "login",
"comments" : [ ] //insert here new data
},
{
"id" : ObjectId("4e43cf96e62883ee06000003"),
"user_name" : "login",
"comments" : [ ]
}
]
}
Run Code Online (Sandbox Code Playgroud)
我想通过"list.id"向评论中插入新数据.但我尝试这样:
$post_id = "4e43cf96e62883ee06000002";
$this->connection->user->feed->update(
array ('list.id' => new MongoId($post_id) ),
array ('$push' => array ('list'=>array('comments'=>$data ) ))
)
Run Code Online (Sandbox Code Playgroud)
但是该代码在结构中创建了新字段,但没有向字段'comments'添加数据:
{
"_id":ObjectId("4e43cf96e7c7914b87d2e0ff"),
"list" :[
{
"id" : ObjectId("4e43cf96e62883ee06000002"),
"user_name" : "login",
"comments" : [ ] //insert here new data
},
{
"id" : ObjectId("4e43cf96e62883ee06000003"),
"user_name" …Run Code Online (Sandbox Code Playgroud)