/** * 删除DUpvote * * @author 陈义 * @date 2016-04-09 16:11:18 */ @Override public Integer deleteDUpvote(DUpvoteDto dUpvoteDto) { // TODO Auto-generated method stub if (dUpvoteDto != null && dUpvoteDto.getDupvoteId() != null) { StringBuffer stringBuffer = new StringBuffer(DbType.DELETE.toString()); Map<String, Object> params = new HashMap<String, Object>(); stringBuffer.append(" from " + DUpvote.class.getName() + " a"); stringBuffer.append(" where a.dupvoteId=:uid "); params.put("uid", dUpvoteDto.getDupvoteId()); DUpvote dUpvote = new DUpvote(); BeanUtils.copyProperties(dUpvoteDto, dUpvote); return this.executeHql(stringBuffer.toString(), params); } return 0; }
/** * 更新DUpvote * * @author 陈义 * @date 2016-04-09 16:11:18 */ @Override public Integer updateDUpvote(DUpvoteDto dUpvoteDto) { // TODO Auto-generated method stub if (dUpvoteDto != null && dUpvoteDto.getDupvoteId() != null) { StringBuffer stringBuffer = new StringBuffer(DbType.UPDATE.toString()); String[] fl = new String[] {"uid"}; // 过滤掉的字段 Map<String, Object> map = dUpvoteDto.createSetPropertiesVal(dUpvoteDto, "a", fl); Map<String, Object> params = (Map<String, Object>) map.get(StringUtils.PARAMS); stringBuffer.append(" from " + DUpvote.class.getName() + " a"); stringBuffer.append(map.get(StringUtils.SET_HQL)); stringBuffer.append(" where a.dupvoteId=:uid"); params.put("uid", dUpvoteDto.getDupvoteId()); return this.executeHql(stringBuffer.toString(), params); } return 0; }
/** * 通过id获取DUpvoteDto * * @author 陈义 * @date 2016-04-09 16:11:18 */ @Override public DUpvoteDto getDUpvoteByID(DUpvoteDto dUpvoteDto) { // TODO Auto-generated method stub if (dUpvoteDto != null && dUpvoteDto.getDupvoteId() != null) { StringBuffer stringBuffer = new StringBuffer(); Map<String, Object> params = new HashMap<String, Object>(); stringBuffer.append("from " + DUpvote.class.getName() + " a where a.dupvoteId=:id"); params.put("id", dUpvoteDto.getDupvoteId()); List<DUpvote> list = this.find(stringBuffer.toString(), params); if (list != null && list.size() > 0) { DUpvote t1 = list.get(0); DUpvoteDto dto = new DUpvoteDto(); dto = beanToDto.T1ToD1(t1, dto); return dto; } } return null; }