仪器管理-设置小程序/企微可见标签

master
382696293@qq.com 2 years ago
parent e72876bca4
commit d072664a40

@ -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();
}
}

@ -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<Long> 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<Long> getTagIdList() {
return tagIdList;
}
public void setTagIdList(List<Long> tagIdList) {
this.tagIdList = tagIdList;
}
}

@ -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<WxInstrumentTag> 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);
}

@ -0,0 +1,83 @@
<?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.flossom.common.core.mapper.WxInstrumentTagMapper">
<resultMap type="WxInstrumentTag" id="WxInstrumentTagResult">
<result property="id" column="id" />
<result property="instrumentId" column="instrument_id" />
<result property="tagId" column="tag_id" />
<result property="type" column="type" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWxInstrumentTagVo">
select id, instrument_id, tag_id, type, status, create_by, create_time from wx_instrument_tag
</sql>
<select id="selectWxInstrumentTagList" parameterType="WxInstrumentTag" resultMap="WxInstrumentTagResult">
<include refid="selectWxInstrumentTagVo"/>
<where>
<if test="instrumentId != null "> and instrument_id = #{instrumentId}</if>
<if test="tagId != null "> and tag_id = #{tagId}</if>
<if test="type != null "> and type = #{type}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxInstrumentTagById" parameterType="Long" resultMap="WxInstrumentTagResult">
<include refid="selectWxInstrumentTagVo"/>
where id = #{id}
</select>
<insert id="insertWxInstrumentTag" parameterType="WxInstrumentTag" useGeneratedKeys="true" keyProperty="id">
insert into wx_instrument_tag
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="instrumentId != null">instrument_id,</if>
<if test="tagId != null">tag_id,</if>
<if test="type != null">type,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="instrumentId != null">#{instrumentId},</if>
<if test="tagId != null">#{tagId},</if>
<if test="type != null">#{type},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWxInstrumentTag" parameterType="WxInstrumentTag">
update wx_instrument_tag
<trim prefix="SET" suffixOverrides=",">
<if test="instrumentId != null">instrument_id = #{instrumentId},</if>
<if test="tagId != null">tag_id = #{tagId},</if>
<if test="type != null">type = #{type},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWxInstrumentTagById" parameterType="Long">
delete from wx_instrument_tag where id = #{id}
</delete>
<delete id="deleteByInstrumentIdAndType">
delete from wx_instrument_tag where instrument_id = #{instrumentId} and type = #{type}
</delete>
<delete id="deleteWxInstrumentTagByIds" parameterType="String">
delete from wx_instrument_tag where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -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));
}
}

@ -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<WxInstrumentTag> 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);
}

@ -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<WxInstrumentTag> 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<Long> 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();
}
}

@ -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
})
}

Loading…
Cancel
Save