67,550
社区成员




create PROCEDURE get_redbag_name(in p_id int ,out p_name VARCHAR(50))
begin
select name from qb_redbag_ticket where id = p_id into p_name ;
end ;
<select id="findById" statementType="CALLABLE" parameterMap="homeVO">
{call get_redbag_name(?,?)}
</select>
<parameterMap type="map" id="homeVO">
<parameter property="p_id" jdbcType="INTEGER" mode="IN"/>
<parameter property="p_name" jdbcType="VARCHAR" mode="OUT"/>
</parameterMap>
public List<Map> findById(Map pram);
public void findById(Map pram){
setDb(0, MASTER);
redbagTicketDao.findById(pram);
}
public void findById(Map bo){
redbagTicketBiz.findById(bo);
System.out.println(bo.get("p_name"));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@RequestMapping(value = "/findById", method = RequestMethod.POST)
public Map queryRd(@RequestBody Map bo) {
log.debug("查询红包lname--" + JSON.toJSONString(bo));
try {
LinkedHashMap linkedHashMap = new LinkedHashMap();
redbagTicketService.findById(bo);
return super.returnSuccessInfo(linkedHashMap);
} catch (Exception e) {
log.error("异常信息- 查询红包name--系统异常:" + JSON.toJSONString(bo), e);
return super.returnFailtrueInfo(e);
}
}
@Test
public void findById(){
uri = "http://localhost:8080/front.onigiri/redbag/findById";
Map map = new HashMap<>();
map.put("p_id", 198898);
map.put("p_name", "");
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.parseMediaType("application/json; charset=utf-8"));
headers.set("Accept-Charset", "UTF-8");
HttpEntity entity = new HttpEntity(JSON.toJSONString(map),headers);
ResponseEntity response = restTemplate.exchange(uri,HttpMethod.POST, entity, Map.class);
LinkedHashMap responseMap = (LinkedHashMap)response.getBody();
System.out.print(responseMap);
assertTrue(true);
}
grant select,insert,update,delete on fantuan.* to root@'localhost' identified by 'xxx';
grant execute on procedure fantuan.get_redbag_name to root@'localhost' identified by 'xxx';
grant select on mysql.proc to root@'localhost' identified by 'xxx';
FLUSH PRIVILEGES ;
[SQL]call get_redbag_name(11);
[Err] 1318 - Incorrect number of arguments for PROCEDURE fantuan.get_redbag_name; expected 2, got 1
完整的信息? 没太理解。
这个就是springmvc项目,然后写了test案例,调用接口。