| | |
| | | import com.whyc.pojo.ExperimentWindingStep1; |
| | | import com.whyc.pojo.ExperimentWindingStep2; |
| | | import com.whyc.pojo.Project; |
| | | import com.whyc.service.ExperimentService; |
| | | import com.whyc.service.WindingExperimentService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | @Autowired |
| | | private WindingExperimentService service; |
| | | @Autowired |
| | | private ExperimentService experimentService; |
| | | |
| | | @GetMapping("experimentId") |
| | | @ApiOperation(value = "查询当前试验编号",notes = "传入的type选择其一:" + |
| | | "绕组:rz,\n" + |
| | | "空载:kz,\n" + |
| | | "负载:fz,\n" + |
| | | "升温:sw,\n" + |
| | | "超速:cs,\n" + |
| | | "空载反电动势:kzfdds,\n" + |
| | | "振动:zd,\n" + |
| | | "耐压:ny,\n" + |
| | | "转动惯量:zdgl,\n") |
| | | public Response getExperimentId(@RequestParam String type){ |
| | | return experimentService.getExperimentId(type); |
| | | } |
| | | |
| | | @GetMapping("getProjectName") |
| | | @ApiOperation(value = "获取实验项目名") |
| | | @ApiOperation(value = "获取实验项目名称") |
| | | public Response<List<Project>> getProjectName(){ |
| | | |
| | | return service.getProjectName(); |
| | |
| | | |
| | | public interface ExperimentMapper extends CustomMapper<Experiment>{ |
| | | List<Experiment> getPage(ExperimentConditionDTO condition); |
| | | int insertmanual(Experiment condition); |
| | | |
| | | } |
| | |
| | | import org.springframework.transaction.TransactionStatus; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | * @return |
| | | */ |
| | | public Response<Object> addWindingExperiment(Experiment experiment) { |
| | | String id = "RZ_"; |
| | | id+=new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); |
| | | experiment.setId(id); |
| | | experiment.setCreateTime(new Date()); |
| | | experiment.setStatus(0); |
| | | experiment.setStatus(1); |
| | | try { |
| | | if (mapper.insertmanual(experiment) > 0) { |
| | | if (mapper.insert(experiment) > 0) { |
| | | return new Response().setMsg(1, "添加成功"); |
| | | } else { |
| | | return new Response().setMsg(0, "添加失败"); |
| | |
| | | and status = 2 |
| | | </select> |
| | | |
| | | |
| | | <insert id="insertmanual" keyColumn="id" keyProperty="id" parameterType="com.whyc.pojo.Experiment" useGeneratedKeys="true"> |
| | | insert into tb_experiment (id,`name`, `type`, project_id, |
| | | device_sn, device_id, rated_power, |
| | | rated_vol, gear_speed_ratio, start_time, |
| | | plan_end_time, actual_end_time, user_id, |
| | | create_time, `status`) |
| | | values (#{id,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{projectId,jdbcType=INTEGER}, |
| | | #{deviceSn,jdbcType=VARCHAR}, #{deviceId,jdbcType=VARCHAR}, #{ratedPower,jdbcType=FLOAT}, |
| | | #{ratedVol,jdbcType=FLOAT}, #{gearSpeedRatio,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, |
| | | #{planEndTime,jdbcType=TIMESTAMP}, #{actualEndTime,jdbcType=TIMESTAMP}, #{userId,jdbcType=INTEGER}, |
| | | #{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=BOOLEAN}) |
| | | </insert> |
| | | </mapper> |