仪器管理-设置小程序/企微可见标签
parent
e72876bca4
commit
d072664a40
@ -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();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue