| | |
| | | |
| | | |
| | | @PostMapping("saveRZStep") |
| | | @ApiOperation(value = "保存数据",notes = "step参数 1 2 对应实验步骤1、2 ") |
| | | @ApiOperation(value = "保存数据",notes = "step参数 1 2 对应实验步骤1、2 不需要传value的参数 保存时间saveTime、状态status、设备类型deviceId、note") |
| | | public Response addExperimentWindingStep1(@RequestBody List<ExperimentWindingStep1> windingStep1s){ |
| | | |
| | | return service.addExperimentWindingStep1(windingStep1s); |
| | |
| | | public interface ExperimentWindingStep1Mapper extends CustomMapper<ExperimentWindingStep1>{ |
| | | int deleteByPrimaryKey(Integer id); |
| | | |
| | | int insert(ExperimentWindingStep1 record); |
| | | |
| | | int insertSelective(ExperimentWindingStep1 record); |
| | | |
| | | ExperimentWindingStep1 selectByPrimaryKey(Integer id); |
| | |
| | | public Response<Object> addExperimentWindingStep1(List<ExperimentWindingStep1> list) { |
| | | Boolean flag = true; |
| | | if (list != null) { |
| | | Experiment experiment = null; |
| | | try { |
| | | ExperimentWindingStep1 step1 = list.get(0); |
| | | QueryWrapper<Experiment> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("id", step1.getExperimentId()); |
| | | experiment = mapper.selectOne(wrapper); |
| | | if (experiment == null) { |
| | | return new Response().setMsg(0, "添加失败,试验编号不存在"); |
| | | }else { |
| | | System.out.println("wrapper = " + wrapper); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return new Response().setMsg(0, "添加失败"); |
| | | } |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | ExperimentWindingStep1 experimentWindingStep1 = list.get(i); |
| | | experimentWindingStep1.setSaveTime(new Date()); |
| | | experimentWindingStep1.setDeviceId(experiment.getDeviceId());//存设备类型 |
| | | list.set(i, experimentWindingStep1); |
| | | } |
| | | } |
| | |
| | | delete from tb_experiment_winding_step1 |
| | | where experiment_id = #{experimentId,jdbcType=INTEGER} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.whyc.pojo.ExperimentWindingStep1"> |
| | | insert into tb_experiment_winding_step1 (id, winding, electric_current, |
| | | vol, resistance, temperature, |
| | | save_time, experiment_id, `status`, |
| | | note) |
| | | values (#{id,jdbcType=INTEGER}, #{winding,jdbcType=VARCHAR}, #{electricCurrent,jdbcType=FLOAT}, |
| | | #{vol,jdbcType=FLOAT}, #{resistance,jdbcType=FLOAT}, #{temperature,jdbcType=FLOAT}, |
| | | #{saveTime,jdbcType=TIMESTAMP}, #{experimentId,jdbcType=VARCHAR}, #{status,jdbcType=BOOLEAN}, |
| | | #{note,jdbcType=VARCHAR}) |
| | | </insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.whyc.pojo.ExperimentWindingStep1"> |
| | | insert into tb_experiment_winding_step1 |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |