Commit 78ae5d1a authored by 耿迪迪's avatar 耿迪迪

Merge branch 'master' of ssh://111.61.77.35:15/gengdidi/gassafety

parents 714b524f 67d63418
package com.zehong.web.controller.deviceInspection;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TInspector;
import com.zehong.system.service.ITInspectorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 巡检员Controller
*
* @author zehong
* @date 2021-07-08
*/
@RestController
@RequestMapping("/deviceInspection/inspector")
public class TInspectorController extends BaseController
{
@Autowired
private ITInspectorService tInspectorService;
/**
* 查询巡检员列表
*/
@PreAuthorize("@ss.hasPermi('deviceInspection:inspector:list')")
@GetMapping("/list")
public TableDataInfo list(TInspector tInspector)
{
startPage();
List<TInspector> list = tInspectorService.selectTInspectorList(tInspector);
return getDataTable(list);
}
/**
* 导出巡检员列表
*/
@PreAuthorize("@ss.hasPermi('deviceInspection:inspector:export')")
@Log(title = "巡检员", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TInspector tInspector)
{
List<TInspector> list = tInspectorService.selectTInspectorList(tInspector);
ExcelUtil<TInspector> util = new ExcelUtil<TInspector>(TInspector.class);
return util.exportExcel(list, "巡检员数据");
}
/**
* 获取巡检员详细信息
*/
@PreAuthorize("@ss.hasPermi('deviceInspection:inspector:query')")
@GetMapping(value = "/{inspectorId}")
public AjaxResult getInfo(@PathVariable("inspectorId") Long inspectorId)
{
return AjaxResult.success(tInspectorService.selectTInspectorById(inspectorId));
}
/**
* 新增巡检员
*/
@PreAuthorize("@ss.hasPermi('deviceInspection:inspector:add')")
@Log(title = "巡检员", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TInspector tInspector)
{
return toAjax(tInspectorService.insertTInspector(tInspector));
}
/**
* 修改巡检员
*/
@PreAuthorize("@ss.hasPermi('deviceInspection:inspector:edit')")
@Log(title = "巡检员", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TInspector tInspector)
{
return toAjax(tInspectorService.updateTInspector(tInspector));
}
/**
* 删除巡检员
*/
@PreAuthorize("@ss.hasPermi('deviceInspection:inspector:remove')")
@Log(title = "巡检员", businessType = BusinessType.DELETE)
@DeleteMapping("/{inspectorIds}")
public AjaxResult remove(@PathVariable Long[] inspectorIds)
{
return toAjax(tInspectorService.deleteTInspectorByIds(inspectorIds));
}
}
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 巡检员对象 t_inspector
*
* @author zehong
* @date 2021-07-08
*/
public class TInspector extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 巡检员id */
private Long inspectorId;
/** 企业id */
@Excel(name = "企业id")
private Long enterpriseId;
/** 姓名 */
@Excel(name = "姓名")
private String name;
/** 电话 */
@Excel(name = "电话")
private String phone;
/** 备注 */
@Excel(name = "备注")
private String remarks;
public void setInspectorId(Long inspectorId)
{
this.inspectorId = inspectorId;
}
public Long getInspectorId()
{
return inspectorId;
}
public void setEnterpriseId(Long enterpriseId)
{
this.enterpriseId = enterpriseId;
}
public Long getEnterpriseId()
{
return enterpriseId;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
public String getRemarks()
{
return remarks;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("inspectorId", getInspectorId())
.append("enterpriseId", getEnterpriseId())
.append("name", getName())
.append("phone", getPhone())
.append("remarks", getRemarks())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TInspector;
/**
* 巡检员Mapper接口
*
* @author zehong
* @date 2021-07-08
*/
public interface TInspectorMapper
{
/**
* 查询巡检员
*
* @param inspectorId 巡检员ID
* @return 巡检员
*/
public TInspector selectTInspectorById(Long inspectorId);
/**
* 查询巡检员列表
*
* @param tInspector 巡检员
* @return 巡检员集合
*/
public List<TInspector> selectTInspectorList(TInspector tInspector);
/**
* 新增巡检员
*
* @param tInspector 巡检员
* @return 结果
*/
public int insertTInspector(TInspector tInspector);
/**
* 修改巡检员
*
* @param tInspector 巡检员
* @return 结果
*/
public int updateTInspector(TInspector tInspector);
/**
* 删除巡检员
*
* @param inspectorId 巡检员ID
* @return 结果
*/
public int deleteTInspectorById(Long inspectorId);
/**
* 批量删除巡检员
*
* @param inspectorIds 需要删除的数据ID
* @return 结果
*/
public int deleteTInspectorByIds(Long[] inspectorIds);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TInspector;
/**
* 巡检员Service接口
*
* @author zehong
* @date 2021-07-08
*/
public interface ITInspectorService
{
/**
* 查询巡检员
*
* @param inspectorId 巡检员ID
* @return 巡检员
*/
public TInspector selectTInspectorById(Long inspectorId);
/**
* 查询巡检员列表
*
* @param tInspector 巡检员
* @return 巡检员集合
*/
public List<TInspector> selectTInspectorList(TInspector tInspector);
/**
* 新增巡检员
*
* @param tInspector 巡检员
* @return 结果
*/
public int insertTInspector(TInspector tInspector);
/**
* 修改巡检员
*
* @param tInspector 巡检员
* @return 结果
*/
public int updateTInspector(TInspector tInspector);
/**
* 批量删除巡检员
*
* @param inspectorIds 需要删除的巡检员ID
* @return 结果
*/
public int deleteTInspectorByIds(Long[] inspectorIds);
/**
* 删除巡检员信息
*
* @param inspectorId 巡检员ID
* @return 结果
*/
public int deleteTInspectorById(Long inspectorId);
}
package com.zehong.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TInspectorMapper;
import com.zehong.system.domain.TInspector;
import com.zehong.system.service.ITInspectorService;
/**
* 巡检员Service业务层处理
*
* @author zehong
* @date 2021-07-08
*/
@Service
public class TInspectorServiceImpl implements ITInspectorService
{
@Autowired
private TInspectorMapper tInspectorMapper;
/**
* 查询巡检员
*
* @param inspectorId 巡检员ID
* @return 巡检员
*/
@Override
public TInspector selectTInspectorById(Long inspectorId)
{
return tInspectorMapper.selectTInspectorById(inspectorId);
}
/**
* 查询巡检员列表
*
* @param tInspector 巡检员
* @return 巡检员
*/
@Override
public List<TInspector> selectTInspectorList(TInspector tInspector)
{
return tInspectorMapper.selectTInspectorList(tInspector);
}
/**
* 新增巡检员
*
* @param tInspector 巡检员
* @return 结果
*/
@Override
public int insertTInspector(TInspector tInspector)
{
return tInspectorMapper.insertTInspector(tInspector);
}
/**
* 修改巡检员
*
* @param tInspector 巡检员
* @return 结果
*/
@Override
public int updateTInspector(TInspector tInspector)
{
return tInspectorMapper.updateTInspector(tInspector);
}
/**
* 批量删除巡检员
*
* @param inspectorIds 需要删除的巡检员ID
* @return 结果
*/
@Override
public int deleteTInspectorByIds(Long[] inspectorIds)
{
return tInspectorMapper.deleteTInspectorByIds(inspectorIds);
}
/**
* 删除巡检员信息
*
* @param inspectorId 巡检员ID
* @return 结果
*/
@Override
public int deleteTInspectorById(Long inspectorId)
{
return tInspectorMapper.deleteTInspectorById(inspectorId);
}
}
<?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.zehong.system.mapper.TInspectorMapper">
<resultMap type="TInspector" id="TInspectorResult">
<result property="inspectorId" column="inspector_id" />
<result property="enterpriseId" column="enterprise_id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="remarks" column="remarks" />
</resultMap>
<sql id="selectTInspectorVo">
select inspector_id, enterprise_id, name, phone, remarks from t_inspector
</sql>
<select id="selectTInspectorList" parameterType="TInspector" resultMap="TInspectorResult">
<include refid="selectTInspectorVo"/>
<where>
<if test="enterpriseId != null "> and enterprise_id = #{enterpriseId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
</where>
</select>
<select id="selectTInspectorById" parameterType="Long" resultMap="TInspectorResult">
<include refid="selectTInspectorVo"/>
where inspector_id = #{inspectorId}
</select>
<insert id="insertTInspector" parameterType="TInspector" useGeneratedKeys="true" keyProperty="inspectorId">
insert into t_inspector
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="enterpriseId != null">enterprise_id,</if>
<if test="name != null">name,</if>
<if test="phone != null">phone,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpriseId != null">#{enterpriseId},</if>
<if test="name != null">#{name},</if>
<if test="phone != null">#{phone},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
<update id="updateTInspector" parameterType="TInspector">
update t_inspector
<trim prefix="SET" suffixOverrides=",">
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
<if test="name != null">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="remarks != null">remarks = #{remarks},</if>
</trim>
where inspector_id = #{inspectorId}
</update>
<delete id="deleteTInspectorById" parameterType="Long">
delete from t_inspector where inspector_id = #{inspectorId}
</delete>
<delete id="deleteTInspectorByIds" parameterType="String">
delete from t_inspector where inspector_id in
<foreach item="inspectorId" collection="array" open="(" separator="," close=")">
#{inspectorId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询巡检员列表
export function listInspector(query) {
return request({
url: '/deviceInspection/inspector/list',
method: 'get',
params: query
})
}
// 查询巡检员详细
export function getInspector(inspectorId) {
return request({
url: '/deviceInspection/inspector/' + inspectorId,
method: 'get'
})
}
// 新增巡检员
export function addInspector(data) {
return request({
url: '/deviceInspection/inspector',
method: 'post',
data: data
})
}
// 修改巡检员
export function updateInspector(data) {
return request({
url: '/deviceInspection/inspector',
method: 'put',
data: data
})
}
// 删除巡检员
export function delInspector(inspectorId) {
return request({
url: '/deviceInspection/inspector/' + inspectorId,
method: 'delete'
})
}
// 导出巡检员
export function exportInspector(query) {
return request({
url: '/deviceInspection/inspector/export',
method: 'get',
params: query
})
}
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入姓名"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入电话"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['device:inspector:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['device:inspector:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['device:inspector:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['device:inspector:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="inspectorList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" align="center" />
<el-table-column label="企业" align="center" prop="enterpriseId" />
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column label="电话" align="center" prop="phone" />
<el-table-column label="备注" align="center" prop="remarks" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['device:inspector:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['device:inspector:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改巡检员对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话" />
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listInspector, getInspector, delInspector, addInspector, updateInspector, exportInspector } from "@/api/deviceInspection/inspector";
export default {
name: "Inspector",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 巡检员表格数据
inspectorList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
enterpriseId: null,
name: null,
phone: null,
remarks: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询巡检员列表 */
getList() {
this.loading = true;
listInspector(this.queryParams).then(response => {
this.inspectorList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
inspectorId: null,
enterpriseId: null,
name: null,
phone: null,
remarks: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.inspectorId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加巡检员";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const inspectorId = row.inspectorId || this.ids
getInspector(inspectorId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改巡检员";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.inspectorId != null) {
updateInspector(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInspector(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const inspectorIds = row.inspectorId || this.ids;
this.$confirm('是否确认删除巡检员编号为"' + inspectorIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delInspector(inspectorIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有巡检员数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportInspector(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>
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