29 changed files with 367 additions and 75 deletions
@ -0,0 +1,24 @@ |
|||
package com.yxt.supervise.cyf.api.flowmeterinformation; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import com.yxt.common.core.domain.EntityWithId; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/5/4 14:26 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "流量计信息", description = "流量计信息") |
|||
@TableName("flowmeter_information") |
|||
public class FlowmeterInformation extends BaseEntity { |
|||
//原油名称
|
|||
private String name; |
|||
//原油编号
|
|||
private String number; |
|||
//原油code
|
|||
private String code; |
|||
private String tankSid; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.yxt.supervise.cyf.api.flowmeterinformation; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/5/4 14:29 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "流量计信息 视图数据对象", description = "流量计信息 视图数据对象") |
|||
public class FlowmeterInformationDetailsVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
//流量计名称
|
|||
private String name; |
|||
//流量计编号
|
|||
private String number; |
|||
//流量计code
|
|||
private String code; |
|||
private String tankSid; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.yxt.supervise.cyf.api.flowmeterinformation; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/5/4 14:28 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "流量计信息 数据传输对象", description = "流量计信息 数据传输对象") |
|||
public class FlowmeterInformationDto implements Dto { |
|||
private String id; |
|||
private String sid; |
|||
//流量计名称
|
|||
private String name; |
|||
//流量计编号
|
|||
private String number; |
|||
//流量计code
|
|||
private String code; |
|||
private String tankSid; |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.yxt.supervise.cyf.api.flowmeterinformation; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/5/4 14:29 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "流量计信息 查询条件", description = "流量计信息 查询条件") |
|||
public class FlowmeterInformationQuery implements Query { |
|||
private String id; |
|||
private String sid; |
|||
//流量计名称
|
|||
private String name; |
|||
//流量计编号
|
|||
private String number; |
|||
//流量计code
|
|||
private String code; |
|||
private String tankSid; |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.yxt.supervise.cyf.api.flowmeterinformation; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/5/4 14:28 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "流量计信息 视图数据详情", description = "流量计信息 视图数据详情") |
|||
public class FlowmeterInformationVo implements Vo { |
|||
private String id; |
|||
private String sid; |
|||
|
|||
//流量计名称
|
|||
private String name; |
|||
//流量计编号
|
|||
private String number; |
|||
//流量计code
|
|||
private String code; |
|||
//油罐sid
|
|||
private String tankSid; |
|||
private String tankNumber; |
|||
private String crudeName; |
|||
private String crudeNumber; |
|||
|
|||
} |
@ -0,0 +1,31 @@ |
|||
package com.yxt.supervise.cyf.biz.flowmeterinformation; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import com.yxt.supervise.cyf.api.flowmeterinformation.FlowmeterInformation; |
|||
import com.yxt.supervise.cyf.api.flowmeterinformation.FlowmeterInformationVo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.apache.ibatis.annotations.Select; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/5/4 14:37 |
|||
*/ |
|||
@Mapper |
|||
public interface FlowmeterInformationMapper extends BaseMapper<FlowmeterInformation> { |
|||
IPage<FlowmeterInformationVo> selectPageVo(IPage<FlowmeterInformation> page, @Param(Constants.WRAPPER) Wrapper<FlowmeterInformation> qw); |
|||
@Select(" SELECT" + |
|||
" *,t.number as tankNumber,c.name as crdueName,c.number as crudeNumber" + |
|||
" FROM" + |
|||
" flowmeter_information f" + |
|||
" left join tank_information t on t.sid=f.tankSid" + |
|||
" left join crude_oil_type_information c on c.sid=t.crudeSid ") |
|||
List<FlowmeterInformationVo> flowmeterList(); |
|||
@Select("select f.*,t.number as tankNumber from flowmeter_information f left join tank_information t on t.sid=f.tankSid where f.sid=#{sid}") |
|||
FlowmeterInformationVo getFlowmeterBySid(@Param("sid")String sid); |
|||
} |
@ -0,0 +1,18 @@ |
|||
<?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.yxt.supervise.cyf.biz.flowmeterinformation.FlowmeterInformationMapper"> |
|||
<!-- <where> ${ew.sqlSegment} </where>--> |
|||
<!-- ${ew.customSqlSegment} --> |
|||
<select id="selectPageVo" resultType="com.yxt.supervise.cyf.api.flowmeterinformation.FlowmeterInformationVo"> |
|||
SELECT |
|||
f.*,t.number as tankNumber,c.name as crudeName,c.number as crudeNumber-- |
|||
FROM |
|||
flowmeter_information f |
|||
left join tank_information t on t.sid=f.tankSid |
|||
left join crude_oil_type_information c on c.sid=t.crudeSid |
|||
<where> |
|||
${ew.sqlSegment} |
|||
</where> |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,61 @@ |
|||
package com.yxt.supervise.cyf.biz.flowmeterinformation; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.supervise.cyf.api.flowmeterinformation.FlowmeterInformationDto; |
|||
import com.yxt.supervise.cyf.api.flowmeterinformation.FlowmeterInformationQuery; |
|||
import com.yxt.supervise.cyf.api.flowmeterinformation.FlowmeterInformationVo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/5/4 14:38 |
|||
*/ |
|||
@Api(tags = "流量计信息") |
|||
@RestController |
|||
@RequestMapping("cyf/flowmeter") |
|||
public class FlowmeterInformationRest { |
|||
@Autowired |
|||
FlowmeterInformationService FlowmeterInformationService; |
|||
|
|||
@ApiOperation("根据条件分页查询数据的列表") |
|||
@PostMapping("/listPage") |
|||
public ResultBean<PagerVo<FlowmeterInformationVo>> listPage(@RequestBody PagerQuery<FlowmeterInformationQuery> pq) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
PagerVo<FlowmeterInformationVo> pv = FlowmeterInformationService.listPageVo(pq); |
|||
return rb.success().setData(pv); |
|||
} |
|||
@ApiOperation("根据条件分页查询数据的列表") |
|||
@PostMapping("/flowmeterList") |
|||
public ResultBean<PagerVo<FlowmeterInformationVo>> flowmeterList() { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
List<FlowmeterInformationVo> pv = FlowmeterInformationService.flowmeterList(); |
|||
return rb.success().setData(pv); |
|||
} |
|||
@ApiOperation("新增") |
|||
@PostMapping("/save") |
|||
public ResultBean save (@RequestBody FlowmeterInformationDto dto){ |
|||
return FlowmeterInformationService.save(dto); |
|||
} |
|||
@ApiOperation("修改") |
|||
@PostMapping("/update") |
|||
public ResultBean update (@RequestBody FlowmeterInformationDto dto){ |
|||
return FlowmeterInformationService.update(dto); |
|||
} |
|||
@ApiOperation("根据sid查询") |
|||
@GetMapping("/getTankBySid/{sid}") |
|||
public ResultBean getTankBySid(@PathVariable String sid){ |
|||
return FlowmeterInformationService.getTankBySid(sid); |
|||
} |
|||
@ApiOperation("删除") |
|||
@DeleteMapping("/delete/{sid}") |
|||
public ResultBean delete(@PathVariable String sid ){ |
|||
return FlowmeterInformationService.del(sid); |
|||
} |
|||
} |
@ -0,0 +1,62 @@ |
|||
package com.yxt.supervise.cyf.biz.flowmeterinformation; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import com.yxt.supervise.cyf.api.flowmeterinformation.FlowmeterInformation; |
|||
import com.yxt.supervise.cyf.api.flowmeterinformation.FlowmeterInformationDto; |
|||
import com.yxt.supervise.cyf.api.flowmeterinformation.FlowmeterInformationQuery; |
|||
import com.yxt.supervise.cyf.api.flowmeterinformation.FlowmeterInformationVo; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author wangpengfei |
|||
* @date 2023/5/4 14:37 |
|||
*/ |
|||
@Service |
|||
public class FlowmeterInformationService extends MybatisBaseService<FlowmeterInformationMapper, FlowmeterInformation> { |
|||
|
|||
|
|||
public PagerVo<FlowmeterInformationVo> listPageVo(PagerQuery<FlowmeterInformationQuery> pq) { |
|||
FlowmeterInformationQuery query = pq.getParams(); |
|||
QueryWrapper<FlowmeterInformation> qw = new QueryWrapper<>(); |
|||
IPage<FlowmeterInformation> page = PagerUtil.queryToPage(pq); |
|||
IPage<FlowmeterInformationVo> pagging = baseMapper.selectPageVo(page, qw); |
|||
PagerVo<FlowmeterInformationVo> p = PagerUtil.pageToVo(pagging, null); |
|||
return p; |
|||
} |
|||
public List<FlowmeterInformationVo> flowmeterList() { |
|||
return baseMapper.flowmeterList(); |
|||
} |
|||
public ResultBean save(FlowmeterInformationDto dto){ |
|||
ResultBean rb=new ResultBean(); |
|||
FlowmeterInformation entity=new FlowmeterInformation(); |
|||
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|||
baseMapper.insert(entity); |
|||
return rb.success().setMsg("新增成功"); |
|||
} |
|||
public ResultBean update (FlowmeterInformationDto dto){ |
|||
ResultBean rb=new ResultBean(); |
|||
FlowmeterInformation entity=fetchBySid(dto.getSid()); |
|||
BeanUtil.copyProperties(dto, entity, "id","sid"); |
|||
baseMapper.updateById(entity); |
|||
return rb.success().setMsg("修改成功"); |
|||
} |
|||
public ResultBean getTankBySid(String sid){ |
|||
ResultBean rb=new ResultBean(); |
|||
FlowmeterInformationVo FlowmeterInformation=baseMapper.getFlowmeterBySid(sid); |
|||
return rb.success().setData(FlowmeterInformation); |
|||
} |
|||
public ResultBean del(String sid){ |
|||
ResultBean rb=new ResultBean(); |
|||
baseMapper.delete(new QueryWrapper<FlowmeterInformation>().eq("sid",sid)); |
|||
return rb.success().setMsg("删除成功"); |
|||
} |
|||
} |
Loading…
Reference in new issue