parent
aac978ed06
commit
51a92151f3
8 changed files with 396 additions and 0 deletions
@ -0,0 +1,181 @@ |
||||
/** |
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com). |
||||
* <p> |
||||
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* <p> |
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
* <p> |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.energy.modules.inspection.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.xkcoding.http.util.StringUtil; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import lombok.AllArgsConstructor; |
||||
import javax.validation.Valid; |
||||
|
||||
import com.dayu.daf.core.mp.support.Condition; |
||||
import com.dayu.daf.core.mp.support.Query; |
||||
import com.dayu.daf.core.tool.api.R; |
||||
import com.dayu.daf.core.tool.utils.Func; |
||||
import org.energy.modules.inspection.entity.InspectionRoute; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.energy.modules.inspection.entity.InspectionObject; |
||||
import org.energy.modules.inspection.vo.InspectionObjectVO; |
||||
import org.energy.modules.inspection.service.IInspectionObjectService; |
||||
import com.dayu.daf.core.boot.ctrl.DafController; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 巡检对象一览 控制器 |
||||
* |
||||
* @author Daf |
||||
* @since 2024-07-11 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/inspection/inspectionobject") |
||||
@Api(value = "巡检对象一览", tags = "巡检对象一览接口") |
||||
public class InspectionObjectController extends DafController { |
||||
|
||||
private IInspectionObjectService inspectionObjectService; |
||||
|
||||
/** |
||||
* 详情 |
||||
*/ |
||||
@GetMapping("/detail") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "详情", notes = "传入inspectionObject") |
||||
public R<InspectionObject> detail(InspectionObject inspectionObject) { |
||||
InspectionObject detail = inspectionObjectService.getOne(Condition.getQueryWrapper(inspectionObject)); |
||||
return R.data(detail); |
||||
} |
||||
|
||||
/** |
||||
* 分页 巡检对象一览 |
||||
*/ |
||||
@GetMapping("/list") |
||||
@ApiOperationSupport(order = 2) |
||||
@ApiOperation(value = "分页", notes = "传入inspectionObject") |
||||
public R<IPage<InspectionObject>> list(InspectionObject inspectionObject, Query query) { |
||||
QueryWrapper<InspectionObject> qw = new QueryWrapper<>(); |
||||
qw.orderByAsc("route_no"); |
||||
if (StringUtil.isNotEmpty(inspectionObject.getObjectNo())) { |
||||
qw.lambda().like(InspectionObject::getObjectNo, inspectionObject.getObjectNo()); |
||||
} |
||||
if (null != inspectionObject.getObjectName()) { |
||||
qw.lambda().eq(InspectionObject::getObjectName, inspectionObject.getObjectName()); |
||||
} |
||||
if (null != inspectionObject.getStation()) { |
||||
qw.lambda().like(InspectionObject::getStation, inspectionObject.getStation()); |
||||
} |
||||
if (StringUtil.isNotEmpty(inspectionObject.getObjectArea())){ |
||||
qw.lambda().like(InspectionObject::getObjectArea, inspectionObject.getObjectArea()); |
||||
} |
||||
if (StringUtil.isNotEmpty(inspectionObject.getKksNo())){ |
||||
qw.lambda().like(InspectionObject::getKksNo, inspectionObject.getKksNo()); |
||||
} |
||||
IPage<InspectionObject> pages = inspectionObjectService.page(Condition.getPage(query), qw); |
||||
return R.data(pages); |
||||
} |
||||
|
||||
/** |
||||
* 自定义分页 巡检对象一览 |
||||
*/ |
||||
@GetMapping("/page") |
||||
@ApiOperationSupport(order = 3) |
||||
@ApiOperation(value = "分页", notes = "传入inspectionObject") |
||||
public R<IPage<InspectionObjectVO>> page(InspectionObjectVO inspectionObject, Query query) { |
||||
IPage<InspectionObjectVO> pages = inspectionObjectService.selectInspectionObjectPage(Condition.getPage(query), inspectionObject); |
||||
return R.data(pages); |
||||
} |
||||
|
||||
/** |
||||
* 新增 巡检对象一览 |
||||
*/ |
||||
@PostMapping("/save") |
||||
@ApiOperationSupport(order = 4) |
||||
@ApiOperation(value = "新增", notes = "传入inspectionObject") |
||||
public R save(@Valid @RequestBody InspectionObject inspectionObject) { |
||||
return R.status(inspectionObjectService.save(inspectionObject)); |
||||
} |
||||
|
||||
/** |
||||
* 修改 巡检对象一览 |
||||
*/ |
||||
@PostMapping("/update") |
||||
@ApiOperationSupport(order = 5) |
||||
@ApiOperation(value = "修改", notes = "传入inspectionObject") |
||||
public R update(@Valid @RequestBody InspectionObject inspectionObject) { |
||||
return R.status(inspectionObjectService.updateById(inspectionObject)); |
||||
} |
||||
|
||||
/** |
||||
* 新增或修改 巡检对象一览 |
||||
*/ |
||||
@PostMapping("/submit") |
||||
@ApiOperationSupport(order = 6) |
||||
@ApiOperation(value = "新增或修改", notes = "传入inspectionObject") |
||||
public R submit(@Valid @RequestBody InspectionObject inspectionObject) { |
||||
return R.status(inspectionObjectService.saveOrUpdate(inspectionObject)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 删除 巡检对象一览 |
||||
*/ |
||||
@PostMapping("/remove") |
||||
@ApiOperationSupport(order = 7) |
||||
@ApiOperation(value = "逻辑删除", notes = "传入ids") |
||||
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
||||
return R.status(inspectionObjectService.deleteLogic(Func.toLongList(ids))); |
||||
} |
||||
/** |
||||
* 生效 |
||||
*/ |
||||
@PostMapping("/takeEffect") |
||||
@ApiOperationSupport(order = 8) |
||||
@ApiOperation(value = "生效", notes = "传入ids") |
||||
public R takeEffect(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
||||
return this.updateInspectionRoute(1,ids); |
||||
} |
||||
|
||||
/** |
||||
* 失效 |
||||
*/ |
||||
@PostMapping("/lapse") |
||||
@ApiOperationSupport(order = 9) |
||||
@ApiOperation(value = "失效", notes = "传入ids") |
||||
public R lapse(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
||||
return this.updateInspectionRoute(0,ids); |
||||
} |
||||
|
||||
/** |
||||
* 生效OR失效 |
||||
*/ |
||||
public R updateInspectionRoute(Integer status, String ids) { |
||||
List<InspectionObject> list = new ArrayList<>(); |
||||
for (String id : ids.split(",")) { |
||||
InspectionObject inspectionObject = new InspectionObject(); |
||||
inspectionObject.setId(Long.parseLong(id)); |
||||
inspectionObject.setIstatus(status); |
||||
list.add(inspectionObject); |
||||
} |
||||
return R.status(inspectionObjectService.updateBatchById(list)); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,18 @@ |
||||
package org.energy.modules.inspection.dto; |
||||
|
||||
import org.energy.modules.inspection.entity.InspectionObject; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
/** |
||||
* 巡检对象一览数据传输对象实体类 |
||||
* |
||||
* @author Daf |
||||
* @since 2024-07-11 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class InspectionObjectDTO extends InspectionObject { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
} |
@ -0,0 +1,72 @@ |
||||
package org.energy.modules.inspection.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.dayu.daf.core.mp.base.BaseEntity; |
||||
import java.io.Serializable; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
|
||||
/** |
||||
* 巡检对象一览实体类 |
||||
* |
||||
* @author Daf |
||||
* @since 2024-07-11 |
||||
*/ |
||||
@Data |
||||
@TableName("i_inspection_object") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@ApiModel(value = "InspectionObject对象", description = "巡检对象一览") |
||||
public class InspectionObject extends BaseEntity { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 主键 |
||||
*/ |
||||
@ApiModelProperty(value = "主键") |
||||
private Long id; |
||||
/** |
||||
* 对象编号 |
||||
*/ |
||||
@ApiModelProperty(value = "对象编号") |
||||
private String objectNo; |
||||
/** |
||||
* 对象名称 |
||||
*/ |
||||
@ApiModelProperty(value = "对象名称") |
||||
private Integer objectName; |
||||
/** |
||||
* 场站 |
||||
*/ |
||||
@ApiModelProperty(value = "场站") |
||||
private Integer station; |
||||
/** |
||||
* 对象状态 |
||||
*/ |
||||
@ApiModelProperty(value = "对象状态") |
||||
private Integer istatus; |
||||
/** |
||||
* 对象类型 |
||||
*/ |
||||
@ApiModelProperty(value = "对象类型") |
||||
private String objectType; |
||||
/** |
||||
* 对象区域 |
||||
*/ |
||||
@ApiModelProperty(value = "对象区域") |
||||
private String objectArea; |
||||
/** |
||||
* KKS编号 |
||||
*/ |
||||
@ApiModelProperty(value = "KKS编号") |
||||
private String kksNo; |
||||
/** |
||||
* 取消原因 |
||||
*/ |
||||
@ApiModelProperty(value = "取消原因") |
||||
private String cancelReason; |
||||
|
||||
|
||||
} |
@ -0,0 +1,26 @@ |
||||
package org.energy.modules.inspection.mapper; |
||||
|
||||
import org.energy.modules.inspection.entity.InspectionObject; |
||||
import org.energy.modules.inspection.vo.InspectionObjectVO; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 巡检对象一览 Mapper 接口 |
||||
* |
||||
* @author Daf |
||||
* @since 2024-07-11 |
||||
*/ |
||||
public interface InspectionObjectMapper extends BaseMapper<InspectionObject> { |
||||
|
||||
/** |
||||
* 自定义分页 |
||||
* |
||||
* @param page |
||||
* @param inspectionObject |
||||
* @return |
||||
*/ |
||||
List<InspectionObjectVO> selectInspectionObjectPage(IPage page, InspectionObjectVO inspectionObject); |
||||
|
||||
} |
@ -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="org.energy.modules.inspection.mapper.InspectionObjectMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="inspectionObjectResultMap" type="org.energy.modules.inspection.entity.InspectionObject"> |
||||
<id column="id" property="id"/> |
||||
<result column="status" property="status"/> |
||||
<result column="create_time" property="createTime"/> |
||||
<result column="create_user" property="createUser"/> |
||||
<result column="update_time" property="updateTime"/> |
||||
<result column="update_user" property="updateUser"/> |
||||
<result column="is_deleted" property="isDeleted"/> |
||||
<result column="object_no" property="objectNo"/> |
||||
<result column="object_name" property="objectName"/> |
||||
<result column="station" property="station"/> |
||||
<result column="istatus" property="istatus"/> |
||||
<result column="object_type" property="objectType"/> |
||||
<result column="object_area" property="objectArea"/> |
||||
<result column="kks_no" property="kksNo"/> |
||||
<result column="cancel_reason" property="cancelReason"/> |
||||
</resultMap> |
||||
|
||||
|
||||
<select id="selectInspectionObjectPage" resultMap="inspectionObjectResultMap"> |
||||
select * from i_inspection_object where is_deleted = 0 |
||||
</select> |
||||
|
||||
</mapper> |
@ -0,0 +1,25 @@ |
||||
package org.energy.modules.inspection.service; |
||||
|
||||
import org.energy.modules.inspection.entity.InspectionObject; |
||||
import org.energy.modules.inspection.vo.InspectionObjectVO; |
||||
import com.dayu.daf.core.mp.base.BaseService; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
||||
/** |
||||
* 巡检对象一览 服务类 |
||||
* |
||||
* @author Daf |
||||
* @since 2024-07-11 |
||||
*/ |
||||
public interface IInspectionObjectService extends BaseService<InspectionObject> { |
||||
|
||||
/** |
||||
* 自定义分页 |
||||
* |
||||
* @param page |
||||
* @param inspectionObject |
||||
* @return |
||||
*/ |
||||
IPage<InspectionObjectVO> selectInspectionObjectPage(IPage<InspectionObjectVO> page, InspectionObjectVO inspectionObject); |
||||
|
||||
} |
@ -0,0 +1,25 @@ |
||||
package org.energy.modules.inspection.service.impl; |
||||
|
||||
import org.energy.modules.inspection.entity.InspectionObject; |
||||
import org.energy.modules.inspection.vo.InspectionObjectVO; |
||||
import org.energy.modules.inspection.mapper.InspectionObjectMapper; |
||||
import org.energy.modules.inspection.service.IInspectionObjectService; |
||||
import com.dayu.daf.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
||||
/** |
||||
* 巡检对象一览 服务实现类 |
||||
* |
||||
* @author Daf |
||||
* @since 2024-07-11 |
||||
*/ |
||||
@Service |
||||
public class InspectionObjectServiceImpl extends BaseServiceImpl<InspectionObjectMapper, InspectionObject> implements IInspectionObjectService { |
||||
|
||||
@Override |
||||
public IPage<InspectionObjectVO> selectInspectionObjectPage(IPage<InspectionObjectVO> page, InspectionObjectVO inspectionObject) { |
||||
return page.setRecords(baseMapper.selectInspectionObjectPage(page, inspectionObject)); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,20 @@ |
||||
package org.energy.modules.inspection.vo; |
||||
|
||||
import org.energy.modules.inspection.entity.InspectionObject; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import io.swagger.annotations.ApiModel; |
||||
|
||||
/** |
||||
* 巡检对象一览视图实体类 |
||||
* |
||||
* @author Daf |
||||
* @since 2024-07-11 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@ApiModel(value = "InspectionObjectVO对象", description = "巡检对象一览") |
||||
public class InspectionObjectVO extends InspectionObject { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
} |
Loading…
Reference in new issue