这是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来判断用户下载的是哪文件 然后把一些属性拿出来记录一下
就一直报错