From d072664a40aca31ce854f544df9a3999cf0fe20a Mon Sep 17 00:00:00 2001 From: "382696293@qq.com" <382696293@qq.com> Date: Wed, 24 Jan 2024 11:14:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=AA=E5=99=A8=E7=AE=A1=E7=90=86-=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=B0=8F=E7=A8=8B=E5=BA=8F/=E4=BC=81=E5=BE=AE?= =?UTF-8?q?=E5=8F=AF=E8=A7=81=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/domain/entity/WxInstrumentTag.java | 99 ++++++++++++++++ .../core/domain/req/WxInstrumentTagReq.java | 63 ++++++++++ .../core/mapper/WxInstrumentTagMapper.java | 65 +++++++++++ .../mapper/WxInstrumentTagMapper.xml | 83 +++++++++++++ .../controller/WxInstrumentTagController.java | 65 +++++++++++ .../service/IWxInstrumentTagService.java | 65 +++++++++++ .../impl/WxInstrumentTagServiceImpl.java | 110 ++++++++++++++++++ flossom-ui/src/api/system/instrument.js | 16 +++ 8 files changed, 566 insertions(+) create mode 100644 flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentTag.java create mode 100644 flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxInstrumentTagReq.java create mode 100644 flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentTagMapper.java create mode 100644 flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentTagMapper.xml create mode 100644 flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxInstrumentTagController.java create mode 100644 flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxInstrumentTagService.java create mode 100644 flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentTagServiceImpl.java diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentTag.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentTag.java new file mode 100644 index 0000000..59d6d0d --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/entity/WxInstrumentTag.java @@ -0,0 +1,99 @@ +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_tag + * + * @author flossom + * @date 2024-01-24 + */ +public class WxInstrumentTag extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 仪器ID + */ + @Excel(name = "仪器ID") + private Long instrumentId; + + /** + * 标签id + */ + @Excel(name = "标签id") + private Long tagId; + + /** + * 标签类型:1小程序标签 2外部标签 + */ + @Excel(name = "标签类型:1小程序标签 2外部标签") + private Integer type; + + /** + * 状态(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 setTagId(Long tagId) { + this.tagId = tagId; + } + + public Long getTagId() { + return tagId; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getType() { + return type; + } + + 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("tagId", getTagId()) + .append("type", getType()) + .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/domain/req/WxInstrumentTagReq.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxInstrumentTagReq.java new file mode 100644 index 0000000..8f7fbde --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/domain/req/WxInstrumentTagReq.java @@ -0,0 +1,63 @@ +package com.flossom.common.core.domain.req; + +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; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.List; + +/** + * 仪器标签关联请求对象 + * + * @author flossom + * @date 2024-01-24 + */ +public class WxInstrumentTagReq { + + /** + * 仪器ID + */ + @NotNull(message = "请选择仪器") + private Long instrumentId; + + /** + * 标签id + */ + @NotNull(message = "请选择标签") + @Size(min = 1, message = "请选择标签") + private List tagIdList; + + /** + * 标签类型:1小程序标签 2外部标签 + */ + @NotNull(message = "请输入标签类型") + private Integer type; + + public void setInstrumentId(Long instrumentId) { + this.instrumentId = instrumentId; + } + + public Long getInstrumentId() { + return instrumentId; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getType() { + return type; + } + + public List getTagIdList() { + return tagIdList; + } + + public void setTagIdList(List tagIdList) { + this.tagIdList = tagIdList; + } +} diff --git a/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentTagMapper.java b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentTagMapper.java new file mode 100644 index 0000000..00c2663 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/java/com/flossom/common/core/mapper/WxInstrumentTagMapper.java @@ -0,0 +1,65 @@ +package com.flossom.common.core.mapper; + +import com.flossom.common.core.domain.entity.WxInstrumentTag; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +/** + * 仪器标签关联Mapper接口 + * + * @author flossom + * @date 2024-01-24 + */ +public interface WxInstrumentTagMapper { + /** + * 查询仪器标签关联 + * + * @param id 仪器标签关联主键 + * @return 仪器标签关联 + */ + public WxInstrumentTag selectWxInstrumentTagById(Long id); + + /** + * 查询仪器标签关联列表 + * + * @param wxInstrumentTag 仪器标签关联 + * @return 仪器标签关联集合 + */ + public List selectWxInstrumentTagList(WxInstrumentTag wxInstrumentTag); + + /** + * 新增仪器标签关联 + * + * @param wxInstrumentTag 仪器标签关联 + * @return 结果 + */ + public int insertWxInstrumentTag(WxInstrumentTag wxInstrumentTag); + + /** + * 修改仪器标签关联 + * + * @param wxInstrumentTag 仪器标签关联 + * @return 结果 + */ + public int updateWxInstrumentTag(WxInstrumentTag wxInstrumentTag); + + /** + * 删除仪器标签关联 + * + * @param id 仪器标签关联主键 + * @return 结果 + */ + public int deleteWxInstrumentTagById(Long id); + + /** + * 批量删除仪器标签关联 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWxInstrumentTagByIds(Long[] ids); + + public int deleteByInstrumentIdAndType(@Param("instrumentId") Long instrumentId, @Param("type") Integer type); +} diff --git a/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentTagMapper.xml b/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentTagMapper.xml new file mode 100644 index 0000000..6797432 --- /dev/null +++ b/flossom-common/flossom-common-core/src/main/resources/mapper/WxInstrumentTagMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + select id, instrument_id, tag_id, type, status, create_by, create_time from wx_instrument_tag + + + + + + + + insert into wx_instrument_tag + + instrument_id, + tag_id, + type, + status, + create_by, + create_time, + + + #{instrumentId}, + #{tagId}, + #{type}, + #{status}, + #{createBy}, + #{createTime}, + + + + + update wx_instrument_tag + + instrument_id = #{instrumentId}, + tag_id = #{tagId}, + type = #{type}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from wx_instrument_tag where id = #{id} + + + + delete from wx_instrument_tag where instrument_id = #{instrumentId} and type = #{type} + + + + delete from wx_instrument_tag where id in + + #{id} + + + \ No newline at end of file diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxInstrumentTagController.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxInstrumentTagController.java new file mode 100644 index 0000000..acab449 --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/controller/WxInstrumentTagController.java @@ -0,0 +1,65 @@ +package com.flossom.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.flossom.common.core.domain.entity.WxInstrumentTag; +import com.flossom.common.core.domain.req.WxInstrumentTagReq; +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.IWxInstrumentTagService; + +/** + * 仪器标签关联Controller + * + * @author flossom + * @date 2024-01-24 + */ +@RestController +@RequestMapping("/instrumentTag") +public class WxInstrumentTagController extends BaseController { + + @Autowired + private IWxInstrumentTagService wxInstrumentTagService; + + /** + * 查询仪器标签关联列表 + */ + @RequiresPermissions("system:tag:list") + @GetMapping("/list") + public AjaxResult list(WxInstrumentTag wxInstrumentTag) { + return AjaxResult.success(wxInstrumentTagService.selectWxInstrumentTagList(wxInstrumentTag)); + } + + /** + * 新增仪器标签关联 + */ + @PostMapping("/add") + public AjaxResult addInstrumentTag(@RequestBody WxInstrumentTagReq wxInstrumentTagReq) { + return toAjax(wxInstrumentTagService.addInstrumentTag(wxInstrumentTagReq)); + } + + /** + * 删除仪器标签关联 + */ + @RequiresPermissions("system:tag:remove") + @Log(title = "仪器标签关联", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(wxInstrumentTagService.deleteWxInstrumentTagByIds(ids)); + } +} diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxInstrumentTagService.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxInstrumentTagService.java new file mode 100644 index 0000000..0fb7301 --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/IWxInstrumentTagService.java @@ -0,0 +1,65 @@ +package com.flossom.system.service; + +import com.flossom.common.core.domain.entity.WxInstrumentTag; +import com.flossom.common.core.domain.req.WxInstrumentTagReq; + +import java.util.List; + + +/** + * 仪器标签关联Service接口 + * + * @author flossom + * @date 2024-01-24 + */ +public interface IWxInstrumentTagService { + /** + * 查询仪器标签关联 + * + * @param id 仪器标签关联主键 + * @return 仪器标签关联 + */ + public WxInstrumentTag selectWxInstrumentTagById(Long id); + + /** + * 查询仪器标签关联列表 + * + * @param wxInstrumentTag 仪器标签关联 + * @return 仪器标签关联集合 + */ + public List selectWxInstrumentTagList(WxInstrumentTag wxInstrumentTag); + + /** + * 新增仪器标签关联 + * + * @param wxInstrumentTag 仪器标签关联 + * @return 结果 + */ + public int insertWxInstrumentTag(WxInstrumentTag wxInstrumentTag); + + /** + * 修改仪器标签关联 + * + * @param wxInstrumentTag 仪器标签关联 + * @return 结果 + */ + public int updateWxInstrumentTag(WxInstrumentTag wxInstrumentTag); + + /** + * 批量删除仪器标签关联 + * + * @param ids 需要删除的仪器标签关联主键集合 + * @return 结果 + */ + public int deleteWxInstrumentTagByIds(Long[] ids); + + /** + * 删除仪器标签关联信息 + * + * @param id 仪器标签关联主键 + * @return 结果 + */ + public int deleteWxInstrumentTagById(Long id); + + int addInstrumentTag(WxInstrumentTagReq wxInstrumentTagReq); +} diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentTagServiceImpl.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentTagServiceImpl.java new file mode 100644 index 0000000..b51d504 --- /dev/null +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxInstrumentTagServiceImpl.java @@ -0,0 +1,110 @@ +package com.flossom.system.service.impl; + +import java.util.List; + +import com.flossom.common.core.domain.entity.WxInstrumentTag; +import com.flossom.common.core.domain.req.WxInstrumentTagReq; +import com.flossom.common.core.mapper.WxInstrumentTagMapper; +import com.flossom.common.core.utils.DateUtils; +import com.flossom.common.core.utils.bean.BeanUtils; +import com.flossom.common.security.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.flossom.system.service.IWxInstrumentTagService; + +/** + * 仪器标签关联Service业务层处理 + * + * @author flossom + * @date 2024-01-24 + */ +@Service +public class WxInstrumentTagServiceImpl implements IWxInstrumentTagService { + + @Autowired + private WxInstrumentTagMapper wxInstrumentTagMapper; + + /** + * 查询仪器标签关联 + * + * @param id 仪器标签关联主键 + * @return 仪器标签关联 + */ + @Override + public WxInstrumentTag selectWxInstrumentTagById(Long id) { + return wxInstrumentTagMapper.selectWxInstrumentTagById(id); + } + + /** + * 查询仪器标签关联列表 + * + * @param wxInstrumentTag 仪器标签关联 + * @return 仪器标签关联 + */ + @Override + public List selectWxInstrumentTagList(WxInstrumentTag wxInstrumentTag) { + return wxInstrumentTagMapper.selectWxInstrumentTagList(wxInstrumentTag); + } + + /** + * 新增仪器标签关联 + * + * @param wxInstrumentTag 仪器标签关联 + * @return 结果 + */ + @Override + public int insertWxInstrumentTag(WxInstrumentTag wxInstrumentTag) { + wxInstrumentTag.setCreateTime(DateUtils.getNowDate()); + return wxInstrumentTagMapper.insertWxInstrumentTag(wxInstrumentTag); + } + + /** + * 修改仪器标签关联 + * + * @param wxInstrumentTag 仪器标签关联 + * @return 结果 + */ + @Override + public int updateWxInstrumentTag(WxInstrumentTag wxInstrumentTag) { + return wxInstrumentTagMapper.updateWxInstrumentTag(wxInstrumentTag); + } + + /** + * 批量删除仪器标签关联 + * + * @param ids 需要删除的仪器标签关联主键 + * @return 结果 + */ + @Override + public int deleteWxInstrumentTagByIds(Long[] ids) { + return wxInstrumentTagMapper.deleteWxInstrumentTagByIds(ids); + } + + /** + * 删除仪器标签关联信息 + * + * @param id 仪器标签关联主键 + * @return 结果 + */ + @Override + public int deleteWxInstrumentTagById(Long id) { + return wxInstrumentTagMapper.deleteWxInstrumentTagById(id); + } + + @Override + public int addInstrumentTag(WxInstrumentTagReq wxInstrumentTagReq) { + List tagIdList = wxInstrumentTagReq.getTagIdList(); + if (tagIdList != null && tagIdList.size() > 0) { + wxInstrumentTagMapper.deleteByInstrumentIdAndType(wxInstrumentTagReq.getInstrumentId(), wxInstrumentTagReq.getType()); + for (Long tagId : tagIdList) { + WxInstrumentTag wxInstrumentTag = new WxInstrumentTag(); + BeanUtils.copyBeanProp(wxInstrumentTag, wxInstrumentTagReq); + wxInstrumentTag.setTagId(tagId); + wxInstrumentTag.setCreateBy(SecurityUtils.getLoginUser().getUsername()); + wxInstrumentTag.setCreateTime(DateUtils.getNowDate()); + wxInstrumentTagMapper.insertWxInstrumentTag(wxInstrumentTag); + } + } + return tagIdList.size(); + } +} diff --git a/flossom-ui/src/api/system/instrument.js b/flossom-ui/src/api/system/instrument.js index c4024c0..f911792 100644 --- a/flossom-ui/src/api/system/instrument.js +++ b/flossom-ui/src/api/system/instrument.js @@ -144,4 +144,20 @@ export function listAllMode(query) { } +// 新增仪器标签关联 +export function addInstrumentTag(data) { + return request({ + url: '/system/instrumentTag/add', + method: 'post', + data: data + }) +} +// 查询仪器标签关联列表 +export function listInstrumentTag(query) { + return request({ + url: '/system/instrumentTag/list', + method: 'get', + params: query + }) +}