Commit 29d30be9 by lijingjing

添加变压器表信息;

parent 477f00c0
package com.patzn.cloud.service.lims.hmhj.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.plugins.Page;
import com.patzn.cloud.commons.api.RestConstants;
import com.patzn.cloud.commons.api.RestResult;
import com.patzn.cloud.commons.controller.ServiceController;
import com.patzn.cloud.service.hmhj.entity.Transformer;
import com.patzn.cloud.service.lims.hmhj.service.ITransformerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* 变压器油基础数据 前端控制器
*
* @author meazty
* @since 2021-08-07
*/
@Api(tags = "变压器油基础数据")
@RestController
@RequestMapping("/v1/transformer")
public class TransformerController extends ServiceController {
@Autowired
private ITransformerService transformerService;
@ApiOperation("分页列表")
@ApiImplicitParams({
@ApiImplicitParam(name = RestConstants.PAGE_PAGE, value = "请求数据的页码", required = true, paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = RestConstants.PAGE_ROWS, value = "每页条数", required = true, paramType = "query", dataTypeClass = Integer.class),
})
@PostMapping("/page")
public RestResult<Page<Transformer>> getPage(Transformer transformer) {
return success(transformerService.page(getPage(), transformer));
}
@ApiOperation("查询 id 信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "主键", required = true, paramType = "path", dataTypeClass = Long.class),
})
@GetMapping("/{id}")
public RestResult<Transformer> get(@PathVariable("id") Long id) {
return success(transformerService.getById(id));
}
@ApiOperation("根据 id 修改信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "主键", required = true, paramType = "path", dataTypeClass = Long.class),
})
@PutMapping("/{id}")
public RestResult<Boolean> edit(@PathVariable("id") Long id, Transformer transformer) {
transformer.setId(id);
return success(transformerService.updateById(transformer));
}
@ApiOperation("添加")
@PostMapping("/")
public RestResult<Boolean> add(Transformer transformer) {
return success(transformerService.save(transformer));
}
@ApiOperation("根据 ids 删除")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "主键列表", required = true, paramType = "query", allowMultiple = true, dataTypeClass = Long.class),
})
@DeleteMapping("/")
public RestResult<Boolean> delete(@RequestParam("ids") List<Long> ids) {
return success(transformerService.removeByIds(ids));
}
}
package com.patzn.cloud.service.lims.hmhj.mapper;
import com.patzn.cloud.service.hmhj.entity.Transformer;
import com.patzn.cloud.commons.mapper.BatchMapper;
/**
* <p>
* 变压器油基础数据 Mapper 接口
* </p>
*
* @author meazty
* @since 2021-08-07
*/
public interface TransformerMapper extends BatchMapper<Transformer> {
}
package com.patzn.cloud.service.lims.hmhj.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.patzn.cloud.commons.service.IBaseService;
import com.patzn.cloud.service.hmhj.entity.Transformer;
import java.util.List;
/**
* 变压器油基础数据 服务类
*
* @author meazty
* @since 2021-08-07
*/
public interface ITransformerService extends IBaseService<Transformer> {
Page<Transformer> page(Page<Transformer> page, Transformer transformer);
boolean removeByIds(List<Long> ids);
}
package com.patzn.cloud.service.lims.hmhj.service.impl;
import com.patzn.cloud.service.hmhj.entity.Transformer;
import com.patzn.cloud.service.lims.hmhj.mapper.TransformerMapper;
import com.patzn.cloud.service.lims.hmhj.service.ITransformerService;
import com.patzn.cloud.commons.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import java.util.List;
/**
* 变压器油基础数据 服务实现类
*
* @author meazty
* @since 2021-08-07
*/
@Service
public class TransformerServiceImpl extends BaseServiceImpl<TransformerMapper, Transformer> implements ITransformerService {
@Override
public Page<Transformer> page(Page<Transformer> page, Transformer transformer) {
Wrapper wrapper = new EntityWrapper<>(transformer);
return this.page(page, wrapper);
}
@Override
public boolean removeByIds(List<Long> ids) {
return baseMapper.deleteBatchIds(ids) > 0;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.patzn.cloud.service.lims.hmhj.mapper.TransformerMapper">
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment