错误类型:
Optional long parameter 'appResourcesId' is not present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.
配置文件:
<delete id="deleteMany" parameterType="com.lanyuan.util.PartnerAppResourceObject">
DELETE FROM ly_partner_app_resources where ly_partner_app_resources.id in (
select a.id from (
select ly_partner_app_resources.id from ly_partner_app_resources,ly_app_resources
where ly_partner_app_resources.appResourcesId=ly_app_resources.id and 1=1
<if test="appStatus != null and appStatus != ''">
and ly_app_resources.appStatus=#{appStatus}
</if>
<if test="appId != null and appId != ''">
and ly_partner_app_resources.appId=#{appId}
</if>
<if test="appResourcesId != null and appResourcesId != ''">
and ly_partner_app_resources.appResourcesId=#{appResourcesId}
</if>
)a
)
</delete>
parameterType="com.lanyuan.util.PartnerAppResourceObject"> :
private String appStatus;
private String appId;
private Integer appResourcesId;
Controller中:
@ResponseBody
@RequestMapping("deleteBysdkid")
public String deleteBysdkid(Model model,String appStatus,String appId,int appResourcesId) throws Exception {
PartnerAppResourceObject partnerAppResourceObject=new PartnerAppResourceObject();
partnerAppResourceObject.setAppStatus(appStatus);
partnerAppResourceObject.setAppId(appId);
partnerAppResourceObject.setAppResourcesId(appResourcesId);
partnerAppResourcesMapper.deleteMany(partnerAppResourceObject);
return "success";
}
解决方法:
将int appResourcesId 改为Integer appResourcesId ,问题解决