@Override public List<Tasks> find(Tasks entity) { String sql = "select * from tasks where (createUserId=? or execUserId=?) and lastUpdateTime>? "; Object[] obj = new Object[] {entity.getCreateUserId(), entity.getExecUserId(), entity.getLastUpdateTime()}; return getJdbcTemplate().query(sql, obj, new CommonRowMapper<Tasks>(Tasks.class)); }
@Override public int delete(Tasks entity) { String sql = "delete tasks where taskId=?"; Object[] obj = new Object[] {entity.getTaskId()}; return getJdbcTemplate().update(sql, obj); }
@Override public int update(Tasks entity) { String sql = "update tasks set taskName=?,taskType=?,taskDesc=?,weight=?,startTime=?,endTime=?,flag=?,completeness=?,lastUpdateTime=now() where taskId=?"; Object[] obj = new Object[] { entity.getTaskName(), entity.getTaskType(), entity.getTaskDesc(), entity.getWeight(), entity.getStartTime(), entity.getEndTime(), entity.getFlag(), entity.getCompleteness(), entity.getTaskId() }; return getJdbcTemplate().update(sql, obj); }
@Override public int add(Tasks entity) { String sql = "insert into tasks (pId,taskName,taskType,taskDesc,weight,startTime,endTime,flag,completeness,createUserId,createName,execUserId,execName,roleType,createTime,lastUpdateTime,note,note1,note2,note3,note4,note5,note6) " + "values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,now(),now(),?,?,?,?,?,?,?)"; Object[] obj = new Object[] { entity.getpId(), entity.getTaskName(), entity.getTaskType(), entity.getTaskDesc(), entity.getWeight(), entity.getStartTime(), entity.getEndTime(), entity.getFlag(), entity.getCompleteness(), entity.getCreateUserId(), entity.getCreateName(), entity.getExecUserId(), entity.getExecName(), entity.getRoleType(), entity.getNote(), entity.getNote1(), entity.getNote2(), entity.getNote3(), entity.getNote4(), entity.getNote5(), entity.getNote6() }; return getJdbcTemplate().update(sql, obj); }