diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentInstructions.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentInstructions.java new file mode 100644 index 0000000..c8aba42 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentInstructions.java @@ -0,0 +1,98 @@ +package com.flossom.common.core.domain.entity; + +import com.flossom.common.core.annotation.Excel; +import com.flossom.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 仪器说明书对象 wx_instrument_instructions + * + * @author flossom + * @date 2024-01-16 + */ +public class WxInstrumentInstructions extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 设备id + */ + @Excel(name = "设备id") + private Long instrumentId; + + /** + * 说明书名称 + */ + @Excel(name = "说明书名称") + private String name; + + /** + * 说明书链接 + */ + @Excel(name = "说明书链接") + private String link; + + /** + * 状态(0正常 1停用) + */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private Long status; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setInstrumentId(Long instrumentId) { + this.instrumentId = instrumentId; + } + + public Long getInstrumentId() { + return instrumentId; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setLink(String link) { + this.link = link; + } + + public String getLink() { + return link; + } + + public void setStatus(Long status) { + this.status = status; + } + + public Long getStatus() { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("instrumentId", getInstrumentId()) + .append("name", getName()) + .append("link", getLink()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentInstructionsMapper.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentInstructionsMapper.java new file mode 100644 index 0000000..7a1b4e0 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentInstructionsMapper.java @@ -0,0 +1,62 @@ +package com.flossom.common.core.mapper; + +import com.flossom.common.core.domain.entity.WxInstrumentInstructions; + +import java.util.List; + + +/** + * 仪器说明书Mapper接口 + * + * @author flossom + * @date 2024-01-16 + */ +public interface WxInstrumentInstructionsMapper { + /** + * 查询仪器说明书 + * + * @param id 仪器说明书主键 + * @return 仪器说明书 + */ + public WxInstrumentInstructions selectWxInstrumentInstructionsById(Long id); + + /** + * 查询仪器说明书列表 + * + * @param wxInstrumentInstructions 仪器说明书 + * @return 仪器说明书集合 + */ + public List selectWxInstrumentInstructionsList(WxInstrumentInstructions wxInstrumentInstructions); + + /** + * 新增仪器说明书 + * + * @param wxInstrumentInstructions 仪器说明书 + * @return 结果 + */ + public int insertWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions); + + /** + * 修改仪器说明书 + * + * @param wxInstrumentInstructions 仪器说明书 + * @return 结果 + */ + public int updateWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions); + + /** + * 删除仪器说明书 + * + * @param id 仪器说明书主键 + * @return 结果 + */ + public int deleteWxInstrumentInstructionsById(Long id); + + /** + * 批量删除仪器说明书 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWxInstrumentInstructionsByIds(Long[] ids); +} diff --git a/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentInstructionsMapper.xml b/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentInstructionsMapper.xml new file mode 100644 index 0000000..7cf35ab --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentInstructionsMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + select id, instrument_id, name, link, status, create_by, create_time from wx_instrument_instructions + + + + + + + + insert into wx_instrument_instructions + + instrument_id, + name, + link, + status, + create_by, + create_time, + + + #{instrumentId}, + #{name}, + #{link}, + #{status}, + #{createBy}, + #{createTime}, + + + + + update wx_instrument_instructions + + instrument_id = #{instrumentId}, + name = #{name}, + link = #{link}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from wx_instrument_instructions where id = #{id} + + + + delete from wx_instrument_instructions where id in + + #{id} + + + \ No newline at end of file diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxInstrumentInstructionsController.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxInstrumentInstructionsController.java new file mode 100644 index 0000000..334622f --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxInstrumentInstructionsController.java @@ -0,0 +1,78 @@ +package com.flossom.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.flossom.common.core.domain.R; +import com.flossom.common.core.domain.entity.WxInstrumentInstructions; +import com.flossom.common.core.utils.poi.ExcelUtil; +import com.flossom.common.core.web.controller.BaseController; +import com.flossom.common.core.web.domain.AjaxResult; +import com.flossom.common.core.web.page.TableDataInfo; +import com.flossom.common.log.annotation.Log; +import com.flossom.common.log.enums.BusinessType; +import com.flossom.common.security.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.flossom.system.service.IWxInstrumentInstructionsService; + +/** + * 仪器说明书Controller + * + * @author flossom + * @date 2024-01-16 + */ +@RestController +@RequestMapping("/instructions") +public class WxInstrumentInstructionsController extends BaseController { + + @Autowired + private IWxInstrumentInstructionsService wxInstrumentInstructionsService; + + /** + * 查询仪器说明书列表 + */ + @GetMapping("/list") + public R list(WxInstrumentInstructions wxInstrumentInstructions) { + return R.ok(wxInstrumentInstructionsService.selectWxInstrumentInstructionsList(wxInstrumentInstructions)); + } + + /** + * 获取仪器说明书详细信息 + */ + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(wxInstrumentInstructionsService.selectWxInstrumentInstructionsById(id)); + } + + /** + * 新增仪器说明书 + */ + @PostMapping + public AjaxResult add(@RequestBody WxInstrumentInstructions wxInstrumentInstructions) { + return toAjax(wxInstrumentInstructionsService.insertWxInstrumentInstructions(wxInstrumentInstructions)); + } + + /** + * 修改仪器说明书 + */ + @PutMapping + public AjaxResult edit(@RequestBody WxInstrumentInstructions wxInstrumentInstructions) { + return toAjax(wxInstrumentInstructionsService.updateWxInstrumentInstructions(wxInstrumentInstructions)); + } + + /** + * 删除仪器说明书 + */ + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(wxInstrumentInstructionsService.deleteWxInstrumentInstructionsByIds(ids)); + } +} diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxInstrumentInstructionsService.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxInstrumentInstructionsService.java new file mode 100644 index 0000000..4da2b03 --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxInstrumentInstructionsService.java @@ -0,0 +1,61 @@ +package com.flossom.system.service; + +import com.flossom.common.core.domain.entity.WxInstrumentInstructions; + +import java.util.List; + +/** + * 仪器说明书Service接口 + * + * @author flossom + * @date 2024-01-16 + */ +public interface IWxInstrumentInstructionsService { + /** + * 查询仪器说明书 + * + * @param id 仪器说明书主键 + * @return 仪器说明书 + */ + public WxInstrumentInstructions selectWxInstrumentInstructionsById(Long id); + + /** + * 查询仪器说明书列表 + * + * @param wxInstrumentInstructions 仪器说明书 + * @return 仪器说明书集合 + */ + public List selectWxInstrumentInstructionsList(WxInstrumentInstructions wxInstrumentInstructions); + + /** + * 新增仪器说明书 + * + * @param wxInstrumentInstructions 仪器说明书 + * @return 结果 + */ + public int insertWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions); + + /** + * 修改仪器说明书 + * + * @param wxInstrumentInstructions 仪器说明书 + * @return 结果 + */ + public int updateWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions); + + /** + * 批量删除仪器说明书 + * + * @param ids 需要删除的仪器说明书主键集合 + * @return 结果 + */ + public int deleteWxInstrumentInstructionsByIds(Long[] ids); + + /** + * 删除仪器说明书信息 + * + * @param id 仪器说明书主键 + * @return 结果 + */ + public int deleteWxInstrumentInstructionsById(Long id); +} diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentInstructionsServiceImpl.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentInstructionsServiceImpl.java new file mode 100644 index 0000000..0f7ea9e --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentInstructionsServiceImpl.java @@ -0,0 +1,90 @@ +package com.flossom.system.service.impl; + +import java.util.List; + +import com.flossom.common.core.domain.entity.WxInstrumentInstructions; +import com.flossom.common.core.mapper.WxInstrumentInstructionsMapper; +import com.flossom.common.core.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.flossom.system.service.IWxInstrumentInstructionsService; + +/** + * 仪器说明书Service业务层处理 + * + * @author flossom + * @date 2024-01-16 + */ +@Service +public class WxInstrumentInstructionsServiceImpl implements IWxInstrumentInstructionsService { + + @Autowired + private WxInstrumentInstructionsMapper wxInstrumentInstructionsMapper; + + /** + * 查询仪器说明书 + * + * @param id 仪器说明书主键 + * @return 仪器说明书 + */ + @Override + public WxInstrumentInstructions selectWxInstrumentInstructionsById(Long id) { + return wxInstrumentInstructionsMapper.selectWxInstrumentInstructionsById(id); + } + + /** + * 查询仪器说明书列表 + * + * @param wxInstrumentInstructions 仪器说明书 + * @return 仪器说明书 + */ + @Override + public List selectWxInstrumentInstructionsList(WxInstrumentInstructions wxInstrumentInstructions) { + return wxInstrumentInstructionsMapper.selectWxInstrumentInstructionsList(wxInstrumentInstructions); + } + + /** + * 新增仪器说明书 + * + * @param wxInstrumentInstructions 仪器说明书 + * @return 结果 + */ + @Override + public int insertWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions) { + wxInstrumentInstructions.setCreateTime(DateUtils.getNowDate()); + return wxInstrumentInstructionsMapper.insertWxInstrumentInstructions(wxInstrumentInstructions); + } + + /** + * 修改仪器说明书 + * + * @param wxInstrumentInstructions 仪器说明书 + * @return 结果 + */ + @Override + public int updateWxInstrumentInstructions(WxInstrumentInstructions wxInstrumentInstructions) { + return wxInstrumentInstructionsMapper.updateWxInstrumentInstructions(wxInstrumentInstructions); + } + + /** + * 批量删除仪器说明书 + * + * @param ids 需要删除的仪器说明书主键 + * @return 结果 + */ + @Override + public int deleteWxInstrumentInstructionsByIds(Long[] ids) { + return wxInstrumentInstructionsMapper.deleteWxInstrumentInstructionsByIds(ids); + } + + /** + * 删除仪器说明书信息 + * + * @param id 仪器说明书主键 + * @return 结果 + */ + @Override + public int deleteWxInstrumentInstructionsById(Long id) { + return wxInstrumentInstructionsMapper.deleteWxInstrumentInstructionsById(id); + } +} diff --git a/flossom-ui/src/api/system/instrument.js b/flossom-ui/src/api/system/instrument.js index 09388e5..1a02129 100644 --- a/flossom-ui/src/api/system/instrument.js +++ b/flossom-ui/src/api/system/instrument.js @@ -99,3 +99,42 @@ export function delRelate(id) { method: 'delete' }) } + +// 查询仪器说明书列表 +export function listInstructions(query) { + return request({ + url: '/system/instructions/list', + method: 'get', + params: query + }) +} + +// 新增仪器说明书 +export function addInstructions(data) { + return request({ + url: '/system/instructions', + method: 'post', + data: data + }) +} + +// 修改仪器说明书 +export function updateInstructions(data) { + return request({ + url: '/system/instructions', + method: 'put', + data: data + }) +} + +// 删除仪器说明书 +export function delInstructions(id) { + return request({ + url: '/system/instructions/' + id, + method: 'delete' + }) +} + + + + diff --git a/flossom-ui/src/views/system/instrument/index.vue b/flossom-ui/src/views/system/instrument/index.vue index 8cdd31f..a0723e9 100644 --- a/flossom-ui/src/views/system/instrument/index.vue +++ b/flossom-ui/src/views/system/instrument/index.vue @@ -172,48 +172,25 @@ class-name="small-padding fixed-width" > @@ -835,12 +812,38 @@ + + + 添加说明书 + + + + + + + + + + + + + @@ -852,7 +855,15 @@ import { addInstrument, updateInstrument, getMiniProgramTagTree, - getWecomTagTree, listRelate, delRelate, updateRelate, addRelate, + getWecomTagTree, + listRelate, + delRelate, + updateRelate, + addRelate, + listInstructions, + delInstructions, + addInstructions, + updateInstructions, } from '@/api/system/instrument' import {getToken} from '@/utils/auth' import Treeselect from '@riophae/vue-treeselect' @@ -1046,6 +1057,12 @@ export default { // 预览弹窗 previewSrc: '', // 预览地址 isPreviewVideo: true, // 预览开关 + /* 仪器说明书 */ + instrumentInstructions: { + visible: false, + instrumentId: null, + instructionList: [] + }, } }, created() { @@ -1645,6 +1662,61 @@ export default { }) } }, + + /* 仪器说明书 */ + addInstrumentInstructionLine() { + this.instrumentInstructions.instructionList.push({ + id: null, + instrumentId: this.instrumentInstructions.instrumentId, + name: null, + link: null, + }) + }, + editInstrumentInstructionVisible(row) { + this.instrumentInstructions.instrumentId = row.id; + // 查询现有的仪器说明书 + listInstructions({ + instrumentId: row.id + }).then((response) => { + if (response.data != null && response.data.length > 0) { + this.instrumentInstructions.instructionList = response.data; + } else { + this.instrumentInstructions.instructionList = [{ + id: null, + instrumentId: this.instrumentInstructions.instrumentId, + name: null, + link: null, + }]; + } + this.instrumentInstructions.visible = true; + }) + }, + delInstrumentInstruction(item) { + // 获取 id,删除关联的仪器说明书 + if (item.row.id != null) { + // 执行删除 + delInstructions(item.row.id).then((response) => { + this.$modal.msgSuccess('删除成功'); + }) + } + this.instrumentInstructions.instructionList.splice(item.$index, 1) + if (this.instrumentInstructions.instructionList.length == 0) { + this.addInstrumentInstructionLine(); + } + }, + saveInstrumentInstruction(item) { + console.log(item) + if (item.id != null) { + updateInstructions(item).then((response) => { + this.$modal.msgSuccess('修改成功'); + }) + } else { + addInstructions(item).then((response) => { + this.$modal.msgSuccess('新增成功'); + }) + } + }, + }, }