@Override
public int updateGoodsIsStops(UpdateGoodsIsStopsReq request, Holder holder) {
NDC.push(request.session.sessionKey);
LOG.begin();
int errorCode = 0;
UpdateGoodsIsStopsResp response = new UpdateGoodsIsStopsResp();
try {
LOG.debug("request: {0}", request);
if (Objects.isNull(request.session) || Objects.isNull(request.session.sessionKey)
|| request.session.sessionKey.isEmpty()) {
throw new ErrorCodeException(ErrorCode.ERR_ARCHIVES_PARAM, "session is empty.");
}
response.errorCode = goodsService.updateGoodsIsStops(request.ids, request.isStop);
} catch (ErrorCodeException e) {
LOG.error(e);
errorCode = e.getErrorCode().value();
} catch (Exception e) {
LOG.error(e);
errorCode = ErrorCode.ERR_ARCHIVES_RUNTIME.value();
} finally {
// If you never call it, then your application is sure to run out of memory.
NDC.remove();
}
holder.setValue(response);
LOG.debug("ret: {0}, response: {1}", errorCode, response);
return errorCode;
}
这是相当于controller层的代码
<update id="updateGoodsIsStops" parameterType="java.util.List">
update dt_ec.goods set is_stop =#{isStop} where goods_id in
<foreach collection="ids" item="item" index="index"
open="(" separator="," close=")">
#{item}
</foreach>
</update>
单元测试以后数据库中有没有改变?,
你是用的ajax访问这个方法吗?
用火狐访问你的项目,f12 点击网络点击你访问的路径,点击参数,截图一下
有没有报错信息?还有就是你打个断点调试下,应该很快就能找出错误。
update dt_ec.goods set is_stop =#{isStop} where goods_id in
open="(" separator="," close=")">
#{item}
看你的sql。parameterType是list。这个list是ids还是isStop+ids?如果是前者,那isStop呢?如果是后者,好像parametrType不可以这样写把?