O 乛
2021-04-02 11:06
采纳率: 25%
浏览 233
已采纳

关于Mapper.xml里写的insert方法 对应的dao方法

这是dao方法  

int insertRecord(CustmoerDownRecordDO custmoerDownRecordDO,String taskType);
}

这是xml

<insert id="insertRecord" parameterType="com.yz.api.pojo.CustomerDownRecordDO">
  insert into custmoer_down_record(task_type,customer_id,file_info_id,
                                   bucket_name,object_name,gmt_create,created_by,gmt_modify)
  values (
           #{taskType},
           #{customer_id},
           #{file_info_id},
           #{bucket_name},
           #{object_name},
           #{gmt_create},
           #{created_by},
           #{gmt_modify}
         )
</insert>

这是service

public int insertRecord(CustmoerDownRecordDO custmoerDownRecord, String taskType) {
    try {
        //记录客户下载文件信息
        FileInfoDO fileInfoMessage = fileInfoDao.select(taskType);
        custmoerDownRecord.setTaskType(taskType);
        custmoerDownRecord.setCustomerId(taskType);
        custmoerDownRecord.setFileInfoId(fileInfoMessage.getId());
        custmoerDownRecord.setBucketName((fileInfoMessage.getBucketName()));
        custmoerDownRecord.setObjectName(fileInfoMessage.getObjectName());
        custmoerDownRecord.setGmtCreate(fileInfoMessage.getGmtCreate());
        custmoerDownRecord.setGmtModify(fileInfoMessage.getGmtModify());
        custmoerDownRecordDao.insertRecord(custmoerDownRecord, taskType);
    }catch(Exception e){
        logger.error("记录用户下载文件异常",e);
        
    }
    return 0;

这是contorller

@Autowired
private ApiService apiService;
@RequestMapping("/api/v1")
public ResultJson selectByType(HttpServletRequest request,
                               HttpServletResponse response)throws Exception{
    String key = request.getHeader(ParamConstants.X_ACCESS_LKEY);
    String task_type = request.getHeader(ParamConstants.TASK_TYPE);
    ResultJson result = null;
    result = ResultJson.ok().data(apiService.selectByType(task_type));
    CustmoerDownRecordDO custmoerDownRecordDO = new CustmoerDownRecordDO();
    apiService.insertRecord(custmoerDownRecordDO,task_type);
    return result;

大概就是我要根据tasktype来判断用户下载的是哪文件 然后把一些属性拿出来记录一下

就一直报错

 

 

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

8条回答 默认 最新

  • 魂兮呀 2021-04-02 11:48
    最佳回答
    CustmoerDownRecordDO   CustomerDownRecordDO 类名错了  错误提示很明显了 
    
    评论
    解决 无用
    打赏 举报
查看更多回答(7条)

相关推荐 更多相似问题