37 changed files with 1467 additions and 2 deletions
@ -0,0 +1,27 @@ |
|||||
|
package com.yxt.supervise.cyf.api.supplierinformation; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:26 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "供应商信息", description = "供应商信息") |
||||
|
@TableName("supplier_information") |
||||
|
public class SupplierInformation extends BaseEntity { |
||||
|
//供应商编号
|
||||
|
private String supplierNumber; |
||||
|
//供应商名称
|
||||
|
private String supplierName; |
||||
|
//供应商code
|
||||
|
private String supplierCode; |
||||
|
//联系人
|
||||
|
private String contacts; |
||||
|
//
|
||||
|
private String telephone; |
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.yxt.supervise.cyf.api.supplierinformation; |
||||
|
|
||||
|
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 SupplierInformationDetailsVo implements Vo { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
|
||||
|
//供应商编号
|
||||
|
private String supplierNumber; |
||||
|
//供应商名称
|
||||
|
private String supplierName; |
||||
|
//供应商code
|
||||
|
private String supplierCode; |
||||
|
//联系人
|
||||
|
private String contacts; |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.yxt.supervise.cyf.api.supplierinformation; |
||||
|
|
||||
|
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 SupplierInformationDto implements Dto { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
|
||||
|
//供应商编号
|
||||
|
private String supplierNumber; |
||||
|
//供应商名称
|
||||
|
private String supplierName; |
||||
|
//供应商code
|
||||
|
private String supplierCode; |
||||
|
//联系人
|
||||
|
private String contacts; |
||||
|
//
|
||||
|
private String telephone; |
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.yxt.supervise.cyf.api.supplierinformation; |
||||
|
|
||||
|
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 SupplierInformationQuery implements Query { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
|
||||
|
//供应商编号
|
||||
|
private String supplierNumber; |
||||
|
//供应商名称
|
||||
|
private String supplierName; |
||||
|
//供应商code
|
||||
|
private String supplierCode; |
||||
|
//联系人
|
||||
|
private String contacts; |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.yxt.supervise.cyf.api.supplierinformation; |
||||
|
|
||||
|
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 SupplierInformationVo implements Vo { |
||||
|
private String id; |
||||
|
private String sid; |
||||
|
|
||||
|
//供应商编号
|
||||
|
private String supplierNumber; |
||||
|
//供应商名称
|
||||
|
private String supplierName; |
||||
|
//供应商code
|
||||
|
private String supplierCode; |
||||
|
//联系人
|
||||
|
private String contacts; |
||||
|
//联系电话
|
||||
|
private String telephone; |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoilinventoryrecord; |
||||
|
|
||||
|
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.crudeoilinventoryrecord.CrudeOilInventoryRecord; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilinventoryrecord.CrudeOilInventoryRecordVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CrudeOilInventoryRecordAppMapper extends BaseMapper<CrudeOilInventoryRecord> { |
||||
|
IPage<CrudeOilInventoryRecordVo> selectPageVo(IPage<CrudeOilInventoryRecord> page, @Param(Constants.WRAPPER) Wrapper<CrudeOilInventoryRecord> qw); |
||||
|
@Select("select *,t.number as tankNumber from crude_oil_inventory_record left join tank_information t on t.sid =c.tankSid where sid=#{sid}") |
||||
|
CrudeOilInventoryRecord getCrudeBySid(@Param("sid")String sid); |
||||
|
void insertCrudeOilFiles(List<Map<String, String>> maps); |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
<?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.app.crudeoilinventoryrecord.CrudeOilInventoryRecordAppMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.supervise.cyf.api.crudeoilinventoryrecord.CrudeOilInventoryRecordVo"> |
||||
|
SELECT |
||||
|
*,t.number as tankNumber |
||||
|
FROM |
||||
|
crude_oil_inventory_record c |
||||
|
left join tank_information t on t.sid =c.tankSid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<insert id="insertCrudeOilFiles"> |
||||
|
insert into crude_oil_record_file (sid, url, mainSid) values |
||||
|
<foreach collection="list" item="item" index="index" separator=","> |
||||
|
( |
||||
|
#{item.sid,jdbcType=VARCHAR}, |
||||
|
#{item.url,jdbcType=VARCHAR}, |
||||
|
#{item.mainSid,jdbcType=VARCHAR} |
||||
|
) |
||||
|
</foreach> |
||||
|
</insert> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,39 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoilinventoryrecord; |
||||
|
|
||||
|
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.crudeoilinventoryrecord.CrudeOilInventoryRecordDto; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilinventoryrecord.CrudeOilInventoryRecordQuery; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilinventoryrecord.CrudeOilInventoryRecordVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:38 |
||||
|
*/ |
||||
|
@Api(tags = "原油库存记录信息") |
||||
|
@RestController |
||||
|
@RequestMapping("cyf/app/crudeinventory") |
||||
|
public class CrudeOilInventoryRecordAppRest { |
||||
|
@Autowired |
||||
|
CrudeOilInventoryRecordAppService CrudeOilInventoryRecordService; |
||||
|
@ApiOperation("根据条件分页查询数据的列表") |
||||
|
@PostMapping("/listPage") |
||||
|
public ResultBean<PagerVo<CrudeOilInventoryRecordVo>> listPage(@RequestBody PagerQuery<CrudeOilInventoryRecordQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<CrudeOilInventoryRecordVo> pv = CrudeOilInventoryRecordService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("新增") |
||||
|
@PostMapping("/save") |
||||
|
public ResultBean save (@RequestBody CrudeOilInventoryRecordDto dto){ |
||||
|
return CrudeOilInventoryRecordService.save(dto); |
||||
|
} |
||||
|
} |
@ -0,0 +1,96 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoilinventoryrecord; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
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.crudeoilinventoryrecord.CrudeOilInventoryRecord; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilinventoryrecord.CrudeOilInventoryRecordDto; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilinventoryrecord.CrudeOilInventoryRecordQuery; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilinventoryrecord.CrudeOilInventoryRecordVo; |
||||
|
import com.yxt.supervise.cyf.api.tankinformation.TankInformation; |
||||
|
import com.yxt.supervise.cyf.app.tankinformation.TankInformationAppMapper; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CrudeOilInventoryRecordAppService extends MybatisBaseService<CrudeOilInventoryRecordAppMapper, CrudeOilInventoryRecord> { |
||||
|
@Autowired |
||||
|
TankInformationAppMapper tankInformationMapper; |
||||
|
|
||||
|
public PagerVo<CrudeOilInventoryRecordVo> listPageVo(PagerQuery<CrudeOilInventoryRecordQuery> pq) { |
||||
|
CrudeOilInventoryRecordQuery query = pq.getParams(); |
||||
|
QueryWrapper<CrudeOilInventoryRecord> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(query.getDate())) { |
||||
|
qw.eq("STR_TO_DATE(c.recordDate,'%Y-%m-%d')", query.getDate()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getNumber())) { |
||||
|
qw.like("t.number", query.getNumber()); |
||||
|
} |
||||
|
IPage<CrudeOilInventoryRecord> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<CrudeOilInventoryRecordVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<CrudeOilInventoryRecordVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
@Transactional |
||||
|
public ResultBean save(CrudeOilInventoryRecordDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
CrudeOilInventoryRecord entity=new CrudeOilInventoryRecord(); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
Date curDate = new Date(); |
||||
|
String dfmt = DateUtil.format(curDate, "yyyy-MM-dd"); |
||||
|
TankInformation tank=tankInformationMapper.getTankBySid(dto.getTankSid()); |
||||
|
entity.setRecordDate(dfmt); |
||||
|
entity.setExistingInventory(dto.getHeight()*tank.getBottomArea()*tank.getDensity()); |
||||
|
String [] file=dto.getCrudeOilRecordFile(); |
||||
|
if(file!=null){ |
||||
|
List<Map<String,String>> maps=new ArrayList<>(); |
||||
|
for(String s:file){ |
||||
|
Map<String,String>m=new HashMap<>(); |
||||
|
m.put("mainSid",entity.getSid()); |
||||
|
m.put("url",s); |
||||
|
m.put("sid", UUID.randomUUID().toString()); |
||||
|
maps.add(m); |
||||
|
} |
||||
|
if(maps.size()>0){ |
||||
|
baseMapper.insertCrudeOilFiles(maps); |
||||
|
} |
||||
|
} |
||||
|
baseMapper.insert(entity); |
||||
|
//油罐每日填写信息修改
|
||||
|
tank.setExistingInventory(dto.getHeight()*tank.getBottomArea()*tank.getDensity()); |
||||
|
tankInformationMapper.updateById(tank); |
||||
|
return rb.success().setMsg("新增成功"); |
||||
|
} |
||||
|
public ResultBean update (CrudeOilInventoryRecordDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
String dtoSid = dto.getSid(); |
||||
|
CrudeOilInventoryRecord entity=fetchBySid(dtoSid); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
baseMapper.updateById(entity); |
||||
|
return rb.success().setMsg("修改成功"); |
||||
|
} |
||||
|
public ResultBean getCrudeBySid(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
CrudeOilInventoryRecord CrudeOilInventoryRecord=baseMapper.getCrudeBySid(sid); |
||||
|
return rb.success().setData(CrudeOilInventoryRecord); |
||||
|
} |
||||
|
public ResultBean del(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
baseMapper.delete(new QueryWrapper<CrudeOilInventoryRecord>().eq("sid",sid)); |
||||
|
return rb.success().setMsg("删除成功"); |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoiloutbound; |
||||
|
|
||||
|
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.crudeoiloutbound.CrudeOilOutbound; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiloutbound.CrudeOilOutboundVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CrudeOilOutboundAppMapper extends BaseMapper<CrudeOilOutbound> { |
||||
|
IPage<CrudeOilOutboundVo> selectPageVo(IPage<CrudeOilOutbound> page, @Param(Constants.WRAPPER) Wrapper<CrudeOilOutbound> qw); |
||||
|
@Select("select * from crude_oil_outbound where sid=#{sid}") |
||||
|
CrudeOilOutbound getCrudeBySid(@Param("sid")String sid); |
||||
|
void insertCrudeOilFiles(List<Map<String, String>> maps); |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
<?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.app.crudeoiloutbound.CrudeOilOutboundAppMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.supervise.cyf.api.crudeoiloutbound.CrudeOilOutboundVo"> |
||||
|
SELECT |
||||
|
*,t.number as tankNumber,i.number as crudeNumber,i.name as crudeName,t.inventory as inventory,f.number as flowmeterNumber ,f.name as flowmeterName |
||||
|
FROM |
||||
|
crude_oil_outbound c |
||||
|
left join tank_information t on t.sid =c.tankSid |
||||
|
left join crude_oil_type_information i on i.sid =t.crudeSid |
||||
|
left join flowmeter_information f on f.sid =t.flowmeterSid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<insert id="insertCrudeOilFiles"> |
||||
|
insert into crude_oil_outbound_file (sid, url, mainSid) values |
||||
|
<foreach collection="list" item="item" index="index" separator=","> |
||||
|
( |
||||
|
#{item.sid,jdbcType=VARCHAR}, |
||||
|
#{item.url,jdbcType=VARCHAR}, |
||||
|
#{item.mainSid,jdbcType=VARCHAR} |
||||
|
) |
||||
|
</foreach> |
||||
|
</insert> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,43 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoiloutbound; |
||||
|
|
||||
|
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.crudeoiloutbound.CrudeOilOutboundDto; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiloutbound.CrudeOilOutboundQuery; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiloutbound.CrudeOilOutboundVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:38 |
||||
|
*/ |
||||
|
@Api(tags = "出库信息") |
||||
|
@RestController |
||||
|
@RequestMapping("cyf/app/crudeoutbound") |
||||
|
public class CrudeOilOutboundAppRest { |
||||
|
@Autowired |
||||
|
CrudeOilOutboundAppService CrudeOilOutboundService; |
||||
|
|
||||
|
@ApiOperation("根据条件分页查询数据的列表") |
||||
|
@PostMapping("/listPage") |
||||
|
public ResultBean<PagerVo<CrudeOilOutboundVo>> listPage(@RequestBody PagerQuery<CrudeOilOutboundQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<CrudeOilOutboundVo> pv = CrudeOilOutboundService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("新增") |
||||
|
@PostMapping("/save") |
||||
|
public ResultBean save (@RequestBody CrudeOilOutboundDto dto){ |
||||
|
return CrudeOilOutboundService.save(dto); |
||||
|
} |
||||
|
@ApiOperation("根据sid查询") |
||||
|
@GetMapping("/getCrudeBySid/{sid}") |
||||
|
public ResultBean getTankBySid(@PathVariable String sid){ |
||||
|
return CrudeOilOutboundService.getCrudeBySid(sid); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,97 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoiloutbound; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
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.crudeoiloutbound.CrudeOilOutbound; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiloutbound.CrudeOilOutboundDto; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiloutbound.CrudeOilOutboundQuery; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiloutbound.CrudeOilOutboundVo; |
||||
|
import com.yxt.supervise.cyf.api.tankinformation.TankInformation; |
||||
|
import com.yxt.supervise.cyf.app.flowmeterinformation.FlowmeterInformationAppMapper; |
||||
|
import com.yxt.supervise.cyf.app.tankinformation.TankInformationAppMapper; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CrudeOilOutboundAppService extends MybatisBaseService<CrudeOilOutboundAppMapper, CrudeOilOutbound> { |
||||
|
@Autowired |
||||
|
TankInformationAppMapper tankInformationMapper; |
||||
|
@Autowired |
||||
|
FlowmeterInformationAppMapper flowmeterInformationMapper; |
||||
|
|
||||
|
public PagerVo<CrudeOilOutboundVo> listPageVo(PagerQuery<CrudeOilOutboundQuery> pq) { |
||||
|
CrudeOilOutboundQuery query = pq.getParams(); |
||||
|
QueryWrapper<CrudeOilOutbound> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(query.getDate())) { |
||||
|
qw.eq("STR_TO_DATE(c.deliveryDate,'%Y-%m-%d')", query.getDate()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getContractNumber())) { |
||||
|
qw.like("c.salesContractNumber", query.getContractNumber()); |
||||
|
} |
||||
|
IPage<CrudeOilOutbound> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<CrudeOilOutboundVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<CrudeOilOutboundVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
@Transactional |
||||
|
public ResultBean save(CrudeOilOutboundDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
CrudeOilOutbound entity=new CrudeOilOutbound(); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
Date curDate = new Date(); |
||||
|
String dfmt = DateUtil.format(curDate, "yyyy-MM-dd"); |
||||
|
entity.setDeliveryDate(dfmt); |
||||
|
String [] file=dto.getCrudeOilOutboundFiles(); |
||||
|
if(file!=null){ |
||||
|
List<Map<String,String>> maps=new ArrayList<>(); |
||||
|
for(String s:file){ |
||||
|
Map<String,String>m=new HashMap<>(); |
||||
|
m.put("mainSid",entity.getSid()); |
||||
|
m.put("url",s); |
||||
|
m.put("sid", UUID.randomUUID().toString()); |
||||
|
maps.add(m); |
||||
|
} |
||||
|
if(maps.size()>0){ |
||||
|
baseMapper.insertCrudeOilFiles(maps); |
||||
|
} |
||||
|
} |
||||
|
baseMapper.insert(entity); |
||||
|
TankInformation tank=tankInformationMapper.getTankBySid(dto.getTankSid()); |
||||
|
tank.setInventory(tank.getInventory()-dto.getWeight()); |
||||
|
tankInformationMapper.updateById(tank); |
||||
|
return rb.success().setMsg("新增成功"); |
||||
|
} |
||||
|
public ResultBean update (CrudeOilOutboundDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
String dtoSid = dto.getSid(); |
||||
|
CrudeOilOutbound entity=fetchBySid(dtoSid); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
baseMapper.updateById(entity); |
||||
|
return rb.success().setMsg("修改成功"); |
||||
|
} |
||||
|
public ResultBean getCrudeBySid(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
CrudeOilOutbound CrudeOilOutbound=baseMapper.getCrudeBySid(sid); |
||||
|
return rb.success().setData(CrudeOilOutbound); |
||||
|
} |
||||
|
public ResultBean del(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
baseMapper.delete(new QueryWrapper<CrudeOilOutbound>().eq("sid",sid)); |
||||
|
return rb.success().setMsg("删除成功"); |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoilstorage; |
||||
|
|
||||
|
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.crudeoilstorage.CrudeOilStorage; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilstorage.CrudeOilStorageVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface CrudeOilStorageAppMapper extends BaseMapper<CrudeOilStorage> { |
||||
|
IPage<CrudeOilStorageVo> selectPageVo(IPage<CrudeOilStorage> page, @Param(Constants.WRAPPER) Wrapper<CrudeOilStorage> qw); |
||||
|
@Select("select * from crude_oil_type_information where sid=#{sid}") |
||||
|
CrudeOilStorage getCrudeBySid(@Param("sid")String sid); |
||||
|
void insertCrudeOilFiles(List<Map<String, String>> maps); |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
<?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.app.crudeoilstorage.CrudeOilStorageAppMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.supervise.cyf.api.crudeoilstorage.CrudeOilStorageVo"> |
||||
|
SELECT |
||||
|
*,t.number as tankNumber,i.number as crudeNumber,i.name as crudeName,t.inventory as inventory |
||||
|
FROM |
||||
|
crude_oil_storage c |
||||
|
left join tank_information t on t.sid=c.tankSid |
||||
|
left join crude_oil_type_information i on i.sid =t.crudeSid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<insert id="insertCrudeOilFiles"> |
||||
|
insert into crude_oil_storage_file (sid, url, mainSid) values |
||||
|
<foreach collection="list" item="item" index="index" separator=","> |
||||
|
( |
||||
|
#{item.sid,jdbcType=VARCHAR}, |
||||
|
#{item.url,jdbcType=VARCHAR}, |
||||
|
#{item.mainSid,jdbcType=VARCHAR} |
||||
|
) |
||||
|
</foreach> |
||||
|
</insert> |
||||
|
</mapper> |
@ -0,0 +1,44 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoilstorage; |
||||
|
|
||||
|
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.crudeoilstorage.CrudeOilStorageDto; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilstorage.CrudeOilStorageQuery; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilstorage.CrudeOilStorageVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:38 |
||||
|
*/ |
||||
|
@Api(tags = "入库信息") |
||||
|
@RestController |
||||
|
@RequestMapping("cyf/app/crudestorage") |
||||
|
public class CrudeOilStorageAppRest { |
||||
|
@Autowired |
||||
|
CrudeOilStorageAppService CrudeOilStorageService; |
||||
|
|
||||
|
@ApiOperation("根据条件分页查询数据的列表") |
||||
|
@PostMapping("/listPage") |
||||
|
public ResultBean<PagerVo<CrudeOilStorageVo>> listPage(@RequestBody PagerQuery<CrudeOilStorageQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<CrudeOilStorageVo> pv = CrudeOilStorageService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("新增") |
||||
|
@PostMapping("/save") |
||||
|
public ResultBean save (@RequestBody CrudeOilStorageDto dto){ |
||||
|
return CrudeOilStorageService.save(dto); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("根据sid查询") |
||||
|
@GetMapping("/getCrudeBySid/{sid}") |
||||
|
public ResultBean getCrudeBySid(@PathVariable String sid){ |
||||
|
return CrudeOilStorageService.getCrudeBySid(sid); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,99 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoilstorage; |
||||
|
|
||||
|
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.crudeoilstorage.CrudeOilStorage; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilstorage.CrudeOilStorageDto; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilstorage.CrudeOilStorageQuery; |
||||
|
import com.yxt.supervise.cyf.api.crudeoilstorage.CrudeOilStorageVo; |
||||
|
import com.yxt.supervise.cyf.api.tankinformation.TankInformation; |
||||
|
import com.yxt.supervise.cyf.app.tankinformation.TankInformationAppMapper; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CrudeOilStorageAppService extends MybatisBaseService<CrudeOilStorageAppMapper, CrudeOilStorage> { |
||||
|
@Autowired |
||||
|
TankInformationAppMapper tankInformationMapper; |
||||
|
|
||||
|
public PagerVo<CrudeOilStorageVo> listPageVo(PagerQuery<CrudeOilStorageQuery> pq) { |
||||
|
CrudeOilStorageQuery query = pq.getParams(); |
||||
|
QueryWrapper<CrudeOilStorage> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(query.getDate())) { |
||||
|
qw.eq("STR_TO_DATE(c.warehousingDate,'%Y-%m-%d')", query.getDate()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getContractNumber())) { |
||||
|
qw.like("c.contractNumber", query.getContractNumber()); |
||||
|
} |
||||
|
IPage<CrudeOilStorage> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<CrudeOilStorageVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<CrudeOilStorageVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
@Transactional |
||||
|
public ResultBean save(CrudeOilStorageDto dto){ |
||||
|
|
||||
|
ResultBean rb=new ResultBean(); |
||||
|
CrudeOilStorage entity=new CrudeOilStorage(); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
String [] file=dto.getCrudeOilStorageFile(); |
||||
|
if(file!=null){ |
||||
|
List<Map<String,String>> maps=new ArrayList<>(); |
||||
|
for(String s:file){ |
||||
|
Map<String,String>m=new HashMap<>(); |
||||
|
m.put("mainSid",entity.getSid()); |
||||
|
m.put("url",s); |
||||
|
m.put("sid", UUID.randomUUID().toString()); |
||||
|
maps.add(m); |
||||
|
} |
||||
|
if(maps.size()>0){ |
||||
|
baseMapper.insertCrudeOilFiles(maps); |
||||
|
} |
||||
|
} |
||||
|
baseMapper.insert(entity); |
||||
|
//油罐库存增加
|
||||
|
TankInformation tank=tankInformationMapper.getTankBySid(dto.getTankSid()); |
||||
|
//第一次入库/出库的时候用初始库存减去要出入的数量 给总库存
|
||||
|
// if(tank.getLockVersion().equals(0)){
|
||||
|
// tank.setInventory(tank.getInitialInventory()+dto.getWeight());
|
||||
|
// tank.setLockVersion(tank.getLockVersion()+1);
|
||||
|
// }else{
|
||||
|
// tank.setInventory(tank.getInventory()+dto.getWeight());
|
||||
|
// }
|
||||
|
tank.setInventory(tank.getInventory()+dto.getWeight()); |
||||
|
tankInformationMapper.updateById(tank); |
||||
|
return rb.success().setMsg("新增成功"); |
||||
|
} |
||||
|
public ResultBean update (CrudeOilStorageDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
String dtoSid = dto.getSid(); |
||||
|
CrudeOilStorage entity=fetchBySid(dtoSid); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
baseMapper.updateById(entity); |
||||
|
return rb.success().setMsg("修改成功"); |
||||
|
} |
||||
|
public ResultBean getCrudeBySid(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
CrudeOilStorage CrudeOilStorage=baseMapper.getCrudeBySid(sid); |
||||
|
return rb.success().setData(CrudeOilStorage); |
||||
|
} |
||||
|
public ResultBean del(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
baseMapper.delete(new QueryWrapper<CrudeOilStorage>().eq("sid",sid)); |
||||
|
return rb.success().setMsg("删除成功"); |
||||
|
} |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoiltypeinformation; |
||||
|
|
||||
|
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.crudeoiltypeinformation.CrudeOilTypeInformation; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiltypeinformation.CrudeOilTypeInformationVo; |
||||
|
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 CrudeOilTypeInformationAppMapper extends BaseMapper<CrudeOilTypeInformation> { |
||||
|
IPage<CrudeOilTypeInformationVo> selectPageVo(IPage<CrudeOilTypeInformation> page, @Param(Constants.WRAPPER) Wrapper<CrudeOilTypeInformation> qw); |
||||
|
@Select("select * from crude_oil_type_information") |
||||
|
List<CrudeOilTypeInformationVo> crudeList(); |
||||
|
|
||||
|
|
||||
|
@Select("select * from crude_oil_type_information where sid=#{sid}") |
||||
|
CrudeOilTypeInformation getCrudeBySid(@Param("sid")String sid); |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
<?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.app.crudeoiltypeinformation.CrudeOilTypeInformationAppMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.supervise.cyf.api.crudeoiltypeinformation.CrudeOilTypeInformationVo"> |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
crude_oil_type_information |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,61 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoiltypeinformation; |
||||
|
|
||||
|
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.crudeoiltypeinformation.CrudeOilTypeInformationDto; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiltypeinformation.CrudeOilTypeInformationQuery; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiltypeinformation.CrudeOilTypeInformationVo; |
||||
|
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/app/crudeinfo") |
||||
|
public class CrudeOilTypeInformationAppRest { |
||||
|
@Autowired |
||||
|
CrudeOilTypeInformationAppService CrudeOilTypeInformationService; |
||||
|
|
||||
|
@ApiOperation("根据条件分页查询数据的列表") |
||||
|
@PostMapping("/listPage") |
||||
|
public ResultBean<PagerVo<CrudeOilTypeInformationVo>> listPage(@RequestBody PagerQuery<CrudeOilTypeInformationQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<CrudeOilTypeInformationVo> pv = CrudeOilTypeInformationService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("查询数据的列表") |
||||
|
@PostMapping("/list") |
||||
|
public ResultBean<PagerVo<CrudeOilTypeInformationVo>> crudeList() { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<CrudeOilTypeInformationVo> pv = CrudeOilTypeInformationService.crudeList(); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("新增") |
||||
|
@PostMapping("/save") |
||||
|
public ResultBean save (@RequestBody CrudeOilTypeInformationDto dto){ |
||||
|
return CrudeOilTypeInformationService.save(dto); |
||||
|
} |
||||
|
@ApiOperation("修改") |
||||
|
@PostMapping("/update") |
||||
|
public ResultBean update (@RequestBody CrudeOilTypeInformationDto dto){ |
||||
|
return CrudeOilTypeInformationService.update(dto); |
||||
|
} |
||||
|
@ApiOperation("根据sid查询") |
||||
|
@GetMapping("/getCrudeBySid/{sid}") |
||||
|
public ResultBean getTankBySid(@PathVariable String sid){ |
||||
|
return CrudeOilTypeInformationService.getCrudeBySid(sid); |
||||
|
} |
||||
|
@ApiOperation("删除") |
||||
|
@DeleteMapping("/delete/{sid}") |
||||
|
public ResultBean delete(@PathVariable String sid ){ |
||||
|
return CrudeOilTypeInformationService.del(sid); |
||||
|
} |
||||
|
} |
@ -0,0 +1,78 @@ |
|||||
|
package com.yxt.supervise.cyf.app.crudeoiltypeinformation; |
||||
|
|
||||
|
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.base.utils.StringUtils; |
||||
|
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.crudeoiltypeinformation.CrudeOilTypeInformation; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiltypeinformation.CrudeOilTypeInformationDto; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiltypeinformation.CrudeOilTypeInformationQuery; |
||||
|
import com.yxt.supervise.cyf.api.crudeoiltypeinformation.CrudeOilTypeInformationVo; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CrudeOilTypeInformationAppService extends MybatisBaseService<CrudeOilTypeInformationAppMapper, CrudeOilTypeInformation> { |
||||
|
|
||||
|
|
||||
|
public PagerVo<CrudeOilTypeInformationVo> listPageVo(PagerQuery<CrudeOilTypeInformationQuery> pq) { |
||||
|
CrudeOilTypeInformationQuery query = pq.getParams(); |
||||
|
|
||||
|
QueryWrapper<CrudeOilTypeInformation> qw = new QueryWrapper<>(); |
||||
|
if(StringUtils.isNotBlank(query.getName())){ |
||||
|
qw.like("name",query.getName()); |
||||
|
} |
||||
|
IPage<CrudeOilTypeInformation> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<CrudeOilTypeInformationVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<CrudeOilTypeInformationVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
public List<CrudeOilTypeInformationVo> crudeList() { |
||||
|
return baseMapper.crudeList(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public ResultBean save(CrudeOilTypeInformationDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
CrudeOilTypeInformation number=baseMapper.selectOne(new QueryWrapper<CrudeOilTypeInformation>().eq("number",dto.getNumber())); |
||||
|
if(number!=null){ |
||||
|
return rb.setMsg("油类编号重复"); |
||||
|
} |
||||
|
CrudeOilTypeInformation name=baseMapper.selectOne(new QueryWrapper<CrudeOilTypeInformation>().eq("name",dto.getNumber())); |
||||
|
if(name!=null){ |
||||
|
return rb.setMsg("油类重复"); |
||||
|
} |
||||
|
CrudeOilTypeInformation entity=new CrudeOilTypeInformation(); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
baseMapper.insert(entity); |
||||
|
return rb.success().setMsg("新增成功"); |
||||
|
} |
||||
|
public ResultBean update (CrudeOilTypeInformationDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
String dtoSid = dto.getSid(); |
||||
|
CrudeOilTypeInformation entity=fetchBySid(dtoSid); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
baseMapper.updateById(entity); |
||||
|
return rb.success().setMsg("修改成功"); |
||||
|
} |
||||
|
public ResultBean getCrudeBySid(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
CrudeOilTypeInformation CrudeOilTypeInformation=baseMapper.getCrudeBySid(sid); |
||||
|
return rb.success().setData(CrudeOilTypeInformation); |
||||
|
} |
||||
|
public ResultBean del(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
baseMapper.delete(new QueryWrapper<CrudeOilTypeInformation>().eq("sid",sid)); |
||||
|
return rb.success().setMsg("删除成功"); |
||||
|
} |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.yxt.supervise.cyf.app.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 FlowmeterInformationAppMapper 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.app.flowmeterinformation.FlowmeterInformationAppMapper"> |
||||
|
<!-- <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.app.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/app/flowmeter") |
||||
|
public class FlowmeterInformationAppRest { |
||||
|
@Autowired |
||||
|
FlowmeterInformationAppService 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,66 @@ |
|||||
|
package com.yxt.supervise.cyf.app.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.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class FlowmeterInformationAppService extends MybatisBaseService<FlowmeterInformationAppMapper, FlowmeterInformation> { |
||||
|
|
||||
|
|
||||
|
public PagerVo<FlowmeterInformationVo> listPageVo(PagerQuery<FlowmeterInformationQuery> pq) { |
||||
|
FlowmeterInformationQuery query = pq.getParams(); |
||||
|
QueryWrapper<FlowmeterInformation> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(query.getName())) { |
||||
|
qw.like("f.name", query.getName()); |
||||
|
} |
||||
|
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("删除成功"); |
||||
|
} |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
package com.yxt.supervise.cyf.app.tankinformation; |
||||
|
|
||||
|
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.tankinformation.TankInformation; |
||||
|
import com.yxt.supervise.cyf.api.tankinformation.TankInformationVo; |
||||
|
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 TankInformationAppMapper extends BaseMapper<TankInformation> { |
||||
|
IPage<TankInformationVo> selectPageVo(IPage<TankInformation> page, @Param(Constants.WRAPPER) Wrapper<TankInformation> qw); |
||||
|
@Select("SELECT\n" + |
||||
|
"\tt.*,\n" + |
||||
|
"\tc.NAME AS crudeName,\n" + |
||||
|
"\tc.number AS crudeNumber,\n" + |
||||
|
"\tf.name as flowmeterName,\n" + |
||||
|
"\tf.number as flowmeterNumber\n" + |
||||
|
"FROM\n" + |
||||
|
"\ttank_information t\n" + |
||||
|
"\tLEFT JOIN crude_oil_type_information c ON c.sid = t.crudeSid\n" + |
||||
|
"\tleft join flowmeter_information f on f.sid =t.flowmeterSid ") |
||||
|
List<TankInformationVo> tankList(); |
||||
|
@Select("select * from tank_information where sid=#{sid}") |
||||
|
TankInformation getTankBySid(@Param("sid")String sid); |
||||
|
|
||||
|
@Select("select *,f.name as flowmeterName,f.number as flowmeterNumber from tank_information t left join flowmeter_information f on f.sid=t.flowmeterSid where crudeSid=#{crudeSid} ") |
||||
|
List<TankInformationVo> listByType(@Param("crudeSid") String crudeSid); |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
<?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.app.tankinformation.TankInformationAppMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.supervise.cyf.api.tankinformation.TankInformationVo"> |
||||
|
SELECT |
||||
|
*,c.name as crudeName,c.number as crudeNumber, |
||||
|
f.name as flowmeterName, |
||||
|
f.number as flowmeterNumber |
||||
|
FROM |
||||
|
tank_information t |
||||
|
left join crude_oil_type_information c on c.sid=t.crudeSid |
||||
|
left join flowmeter_information f on f.sid =t.flowmeterSid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,69 @@ |
|||||
|
package com.yxt.supervise.cyf.app.tankinformation; |
||||
|
|
||||
|
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.tankinformation.TankInformationDto; |
||||
|
import com.yxt.supervise.cyf.api.tankinformation.TankInformationQuery; |
||||
|
import com.yxt.supervise.cyf.api.tankinformation.TankInformationVo; |
||||
|
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/app/tankinfo") |
||||
|
public class TankInformationAppRest { |
||||
|
@Autowired |
||||
|
TankInformationAppService tankInformationService; |
||||
|
|
||||
|
@ApiOperation("根据条件分页查询数据的列表") |
||||
|
@PostMapping("/listPage") |
||||
|
public ResultBean<PagerVo<TankInformationVo>> listPage(@RequestBody PagerQuery<TankInformationQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<TankInformationVo> pv = tankInformationService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("根据条件分页查询数据的列表") |
||||
|
@PostMapping("/tankList") |
||||
|
public ResultBean<PagerVo<TankInformationVo>> listPage() { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<TankInformationVo> pv = tankInformationService.tankList(); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("新增") |
||||
|
@PostMapping("/save") |
||||
|
public ResultBean save (@RequestBody TankInformationDto dto){ |
||||
|
return tankInformationService.save(dto); |
||||
|
} |
||||
|
@ApiOperation("修改") |
||||
|
@PostMapping("/update") |
||||
|
public ResultBean update (@RequestBody TankInformationDto dto){ |
||||
|
return tankInformationService.update(dto); |
||||
|
} |
||||
|
@ApiOperation("根据sid查询") |
||||
|
@GetMapping("/getTankBySid/{sid}") |
||||
|
public ResultBean getTankBySid(@PathVariable String sid){ |
||||
|
return tankInformationService.getTankBySid(sid); |
||||
|
} |
||||
|
@ApiOperation("删除") |
||||
|
@DeleteMapping("/delete/{sid}") |
||||
|
public ResultBean delete(@PathVariable String sid ){ |
||||
|
return tankInformationService.del(sid); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("根据原油种类查询数据的列表") |
||||
|
@GetMapping("/listByType/{crudeSid}") |
||||
|
public ResultBean<PagerVo<TankInformationVo>> listByType(@PathVariable String crudeSid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<TankInformationVo> pv = tankInformationService.listByType(crudeSid); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
package com.yxt.supervise.cyf.app.tankinformation; |
||||
|
|
||||
|
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.tankinformation.TankInformation; |
||||
|
import com.yxt.supervise.cyf.api.tankinformation.TankInformationDto; |
||||
|
import com.yxt.supervise.cyf.api.tankinformation.TankInformationQuery; |
||||
|
import com.yxt.supervise.cyf.api.tankinformation.TankInformationVo; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class TankInformationAppService extends MybatisBaseService<TankInformationAppMapper, TankInformation> { |
||||
|
|
||||
|
|
||||
|
public PagerVo<TankInformationVo> listPageVo(PagerQuery<TankInformationQuery> pq) { |
||||
|
TankInformationQuery query = pq.getParams(); |
||||
|
QueryWrapper<TankInformation> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(query.getNumber())) { |
||||
|
qw.like("t.number", query.getNumber()); |
||||
|
} |
||||
|
IPage<TankInformation> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<TankInformationVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<TankInformationVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
public List<TankInformationVo> tankList() { |
||||
|
return baseMapper.tankList(); |
||||
|
} |
||||
|
public List<TankInformationVo> listByType(String crudeSid) { |
||||
|
return baseMapper.listByType(crudeSid); |
||||
|
} |
||||
|
public ResultBean save(TankInformationDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
TankInformation entity=new TankInformation(); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
entity.setInventory(dto.getInitialInventory()); |
||||
|
baseMapper.insert(entity); |
||||
|
return rb.success().setMsg("新增成功"); |
||||
|
} |
||||
|
public ResultBean update (TankInformationDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
String dtoSid = dto.getSid(); |
||||
|
TankInformation entity=fetchBySid(dtoSid); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
baseMapper.updateById(entity); |
||||
|
return rb.success().setMsg("修改成功"); |
||||
|
} |
||||
|
public ResultBean getTankBySid(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
TankInformation tankInformation=baseMapper.getTankBySid(sid); |
||||
|
return rb.success().setData(tankInformation); |
||||
|
} |
||||
|
public ResultBean del(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
baseMapper.delete(new QueryWrapper<TankInformation>().eq("sid",sid)); |
||||
|
return rb.success().setMsg("删除成功"); |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.yxt.supervise.cyf.biz.supplierinformation; |
||||
|
|
||||
|
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.supplierinformation.SupplierInformation; |
||||
|
import com.yxt.supervise.cyf.api.supplierinformation.SupplierInformationVo; |
||||
|
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 SupplierInformationMapper extends BaseMapper<SupplierInformation> { |
||||
|
IPage<SupplierInformationVo> selectPageVo(IPage<SupplierInformation> page, @Param(Constants.WRAPPER) Wrapper<SupplierInformation> qw); |
||||
|
@Select("select * from supplier_information") |
||||
|
List<SupplierInformationVo> supplierList(); |
||||
|
@Select("select * from supplier_information where sid=#{sid}") |
||||
|
SupplierInformation getSupplierBySid(@Param("sid")String sid); |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
<?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.supplierinformation.SupplierInformationMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.supervise.cyf.api.supplierinformation.SupplierInformationVo"> |
||||
|
SELECT |
||||
|
* |
||||
|
FROM |
||||
|
supplier_information |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,61 @@ |
|||||
|
package com.yxt.supervise.cyf.biz.supplierinformation; |
||||
|
|
||||
|
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.supplierinformation.SupplierInformationDto; |
||||
|
import com.yxt.supervise.cyf.api.supplierinformation.SupplierInformationQuery; |
||||
|
import com.yxt.supervise.cyf.api.supplierinformation.SupplierInformationVo; |
||||
|
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/supplier") |
||||
|
public class SupplierInformationRest { |
||||
|
@Autowired |
||||
|
SupplierInformationService RawSupplierInformationService; |
||||
|
|
||||
|
@ApiOperation("根据条件分页查询数据的列表") |
||||
|
@PostMapping("/listPage") |
||||
|
public ResultBean<PagerVo<SupplierInformationVo>> listPage(@RequestBody PagerQuery<SupplierInformationQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<SupplierInformationVo> pv = RawSupplierInformationService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("查询数据的列表") |
||||
|
@PostMapping("/supplierList") |
||||
|
public ResultBean<PagerVo<SupplierInformationVo>> typeList() { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SupplierInformationVo> pv = RawSupplierInformationService.supplierList(); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
@ApiOperation("新增") |
||||
|
@PostMapping("/save") |
||||
|
public ResultBean save (@RequestBody SupplierInformationDto dto){ |
||||
|
return RawSupplierInformationService.save(dto); |
||||
|
} |
||||
|
@ApiOperation("修改") |
||||
|
@PostMapping("/update") |
||||
|
public ResultBean update (@RequestBody SupplierInformationDto dto){ |
||||
|
return RawSupplierInformationService.update(dto); |
||||
|
} |
||||
|
@ApiOperation("根据sid查询") |
||||
|
@GetMapping("/getSupplierBySid/{sid}") |
||||
|
public ResultBean getSupplierBySid(@PathVariable String sid){ |
||||
|
return RawSupplierInformationService.getSupplierBySid(sid); |
||||
|
} |
||||
|
@ApiOperation("删除") |
||||
|
@DeleteMapping("/delete/{sid}") |
||||
|
public ResultBean delete(@PathVariable String sid ){ |
||||
|
return RawSupplierInformationService.del(sid); |
||||
|
} |
||||
|
} |
@ -0,0 +1,70 @@ |
|||||
|
package com.yxt.supervise.cyf.biz.supplierinformation; |
||||
|
|
||||
|
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.base.utils.StringUtils; |
||||
|
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.supplierinformation.SupplierInformation; |
||||
|
import com.yxt.supervise.cyf.api.supplierinformation.SupplierInformationDto; |
||||
|
import com.yxt.supervise.cyf.api.supplierinformation.SupplierInformationQuery; |
||||
|
import com.yxt.supervise.cyf.api.supplierinformation.SupplierInformationVo; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/5/4 14:37 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SupplierInformationService extends MybatisBaseService<SupplierInformationMapper, SupplierInformation> { |
||||
|
|
||||
|
|
||||
|
public PagerVo<SupplierInformationVo> listPageVo(PagerQuery<SupplierInformationQuery> pq) { |
||||
|
SupplierInformationQuery query = pq.getParams(); |
||||
|
QueryWrapper<SupplierInformation> qw = new QueryWrapper<>(); |
||||
|
if(StringUtils.isNotBlank(query.getSupplierName())){ |
||||
|
qw.like("supplierName",query.getSupplierName()); |
||||
|
} |
||||
|
if(StringUtils.isNotBlank(query.getSupplierCode())){ |
||||
|
qw.like("supplierCode",query.getSupplierCode()); |
||||
|
} |
||||
|
IPage<SupplierInformation> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SupplierInformationVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<SupplierInformationVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
public List<SupplierInformationVo> supplierList() { |
||||
|
return baseMapper.supplierList(); |
||||
|
} |
||||
|
public ResultBean save(SupplierInformationDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
SupplierInformation entity=new SupplierInformation(); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
baseMapper.insert(entity); |
||||
|
return rb.success().setMsg("新增成功"); |
||||
|
} |
||||
|
public ResultBean update (SupplierInformationDto dto){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
String dtoSid = dto.getSid(); |
||||
|
SupplierInformation entity=fetchBySid(dtoSid); |
||||
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
||||
|
baseMapper.updateById(entity); |
||||
|
return rb.success().setMsg("修改成功"); |
||||
|
} |
||||
|
public ResultBean getSupplierBySid(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
SupplierInformation RawSupplierInformation=baseMapper.getSupplierBySid(sid); |
||||
|
return rb.success().setData(RawSupplierInformation); |
||||
|
} |
||||
|
public ResultBean del(String sid){ |
||||
|
ResultBean rb=new ResultBean(); |
||||
|
baseMapper.delete(new QueryWrapper<SupplierInformation>().eq("sid",sid)); |
||||
|
return rb.success().setMsg("删除成功"); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue