重构标签结构 修复瀑布流加载数据显示
This commit is contained in:
parent
b3c887cf88
commit
2ff53faf5a
@ -1,175 +0,0 @@
|
|||||||
package com.ruoyi.web.controller.yunbookmark;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
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.ruoyi.common.annotation.Log;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
|
||||||
import com.ruoyi.bookmark.domain.SqUserTag;
|
|
||||||
import com.ruoyi.bookmark.service.ISqUserTagService;
|
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签管理Controller
|
|
||||||
*
|
|
||||||
* @author wang
|
|
||||||
* @date 2020-09-04
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/usertag/tag")
|
|
||||||
public class SqUserTagController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private ISqUserTagService sqUserTagService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用戶获取标签
|
|
||||||
*/
|
|
||||||
|
|
||||||
@GetMapping(value = "/selectTagByUserID")
|
|
||||||
public AjaxResult selectSqUserTagByUserId()
|
|
||||||
{
|
|
||||||
SysUser sysUser=getAuthUser();
|
|
||||||
startPage();
|
|
||||||
List<Map<String,Object>> map = sqUserTagService.selectSqUserTagByUserId(sysUser.getUserId());
|
|
||||||
return AjaxResult.success(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户删除标签
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:tag:remove')")
|
|
||||||
@Log(title = "标签管理", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/userRemoveByid/{ids}")
|
|
||||||
public AjaxResult userRemoveByid(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
SysUser sysUser=getAuthUser();
|
|
||||||
return toAjax(sqUserTagService.userRemoveByid(ids,sysUser.getUserId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户新增标签
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:tag:add')")
|
|
||||||
@Log(title = "标签管理", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping(value = "/SqUserTagAdd")
|
|
||||||
public AjaxResult SqUserTagAdd(@RequestBody SqUserTag sqUserTag) {
|
|
||||||
SysUser sysUser = getAuthUser();
|
|
||||||
sqUserTag.setUserId(sysUser.getUserId());
|
|
||||||
//检测标签是否已经存在
|
|
||||||
int i = sqUserTagService.selectCountByName(sqUserTag.getTagName(), sysUser.getUserId());
|
|
||||||
if (i > 0) {
|
|
||||||
return AjaxResult.error("新增标签'" + sqUserTag.getTagName() + "'失败,该标签已存在");
|
|
||||||
}
|
|
||||||
return toAjax(sqUserTagService.insertSqUserTagAdd(sqUserTag));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户修改标签
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:tag:edit')")
|
|
||||||
@Log(title = "标签管理", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping(value = "/SqUserTagEdit")
|
|
||||||
public AjaxResult SqUserTagEdit(@RequestBody SqUserTag sqUserTag) {
|
|
||||||
SysUser sysUser = getAuthUser();
|
|
||||||
//检测操作的是否自己的标签
|
|
||||||
SqUserTag tag = sqUserTagService.selectSqUserTagById(sqUserTag.getId());
|
|
||||||
if (!tag.getUserId().equals(sysUser.getUserId())) {
|
|
||||||
return AjaxResult.error("修改失败,检测到异常操作已被系统记录!");
|
|
||||||
}
|
|
||||||
//检测标签是否已经存在
|
|
||||||
int i = sqUserTagService.selectCountByName(sqUserTag.getTagName(), sysUser.getUserId());
|
|
||||||
if (i > 0) {
|
|
||||||
return AjaxResult.error("修改标签【" +tag.getTagName()+"】为【"+ sqUserTag.getTagName() + "】失败,标签【"+sqUserTag.getTagName()+"】已存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
//做一次数据初始化 防止用户传入的 注入的数据
|
|
||||||
tag.setTagName(sqUserTag.getTagName());
|
|
||||||
tag.setIorder(sqUserTag.getIorder());
|
|
||||||
return toAjax(sqUserTagService.updateSqUserTagEdit(tag));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询标签管理列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:tag:list')")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo list(SqUserTag sqUserTag)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<SqUserTag> list = sqUserTagService.selectSqUserTagList(sqUserTag);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出标签管理列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:tag:export')")
|
|
||||||
@Log(title = "标签管理", businessType = BusinessType.EXPORT)
|
|
||||||
@GetMapping("/export")
|
|
||||||
public AjaxResult export(SqUserTag sqUserTag)
|
|
||||||
{
|
|
||||||
List<SqUserTag> list = sqUserTagService.selectSqUserTagList(sqUserTag);
|
|
||||||
ExcelUtil<SqUserTag> util = new ExcelUtil<SqUserTag>(SqUserTag.class);
|
|
||||||
return util.exportExcel(list, "tag");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取标签管理详细信息
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:tag:query')")
|
|
||||||
@GetMapping(value = "/{id}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
||||||
{
|
|
||||||
return AjaxResult.success(sqUserTagService.selectSqUserTagById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增标签管理
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:tag:add')")
|
|
||||||
@Log(title = "标签管理", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody SqUserTag sqUserTag)
|
|
||||||
{
|
|
||||||
return toAjax(sqUserTagService.insertSqUserTag(sqUserTag));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改标签管理
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:tag:edit')")
|
|
||||||
@Log(title = "标签管理", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody SqUserTag sqUserTag)
|
|
||||||
{
|
|
||||||
return toAjax(sqUserTagService.updateSqUserTag(sqUserTag));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标签管理
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:tag:remove')")
|
|
||||||
@Log(title = "标签管理", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
|
||||||
{
|
|
||||||
return toAjax(sqUserTagService.deleteSqUserTagByIds(ids));
|
|
||||||
}
|
|
||||||
}
|
|
@ -351,6 +351,7 @@
|
|||||||
|
|
||||||
/**滚动监控**/
|
/**滚动监控**/
|
||||||
load() {
|
load() {
|
||||||
|
|
||||||
//判断是否加载了所有数据
|
//判断是否加载了所有数据
|
||||||
this.queryParams.pageNum=this.queryParams.pageNum+1;
|
this.queryParams.pageNum=this.queryParams.pageNum+1;
|
||||||
// 2 15 26
|
// 2 15 26
|
||||||
@ -368,7 +369,8 @@
|
|||||||
setTimeout(() =>{
|
setTimeout(() =>{
|
||||||
selectBymenuIdUserID(this.queryParams).then(response => {
|
selectBymenuIdUserID(this.queryParams).then(response => {
|
||||||
if (response.rows.length!=0 && response.code == 200) {
|
if (response.rows.length!=0 && response.code == 200) {
|
||||||
this.bookmarkList = this.bookmarkList.concat(this.bookmarkList, response.rows);
|
console.log("response.rows"+response.rows)
|
||||||
|
this.bookmarkList = this.bookmarkList.concat( response.rows);
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.listloading = false
|
this.listloading = false
|
||||||
} else {
|
} else {
|
||||||
@ -654,7 +656,7 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: #acd7ff;
|
background-color: #acd7ff;
|
||||||
right: 0;
|
right: 0;
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.editlist {
|
.editlist {
|
||||||
|
@ -215,8 +215,8 @@
|
|||||||
:autosize="{minRows: 3, maxRows:4}" :style="{width: '100%'}"></el-input>
|
:autosize="{minRows: 3, maxRows:4}" :style="{width: '100%'}"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item prop="menuId">
|
<el-form-item prop="parentId">
|
||||||
<div class="labelname">所属目录</div>
|
<div class="labelname">分类菜单</div>
|
||||||
<treeselect class="menutreeselect" v-model="form.menuId" :options="menuOptions" :normalizer="normalizer" />
|
<treeselect class="menutreeselect" v-model="form.menuId" :options="menuOptions" :normalizer="normalizer" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.ruoyi.bookmark.domain;
|
package com.ruoyi.bookmark.domain;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
@ -18,6 +21,9 @@ import java.util.Date;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
* @date 2020-09-05
|
* @date 2020-09-05
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
@Table(name="sq_tag")
|
@Table(name="sq_tag")
|
||||||
public class SqTag
|
public class SqTag
|
||||||
{
|
{
|
||||||
@ -58,94 +64,20 @@ public class SqTag
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|
||||||
|
/** 标签的字体颜色 */
|
||||||
|
@Excel(name = "标签的字体颜色")
|
||||||
|
@Column(name = "is_fontColor")
|
||||||
|
private String isFontColor;
|
||||||
|
|
||||||
|
/** 标签的背景颜色 */
|
||||||
|
@Excel(name = "标签的背景颜色")
|
||||||
|
@Column(name = "is_bgColor")
|
||||||
|
private String isBgColor;
|
||||||
|
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Column(name = "create_time")
|
@Column(name = "create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
public void setIcount(Integer icount)
|
|
||||||
{
|
|
||||||
this.icount = icount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getIcount()
|
|
||||||
{
|
|
||||||
return icount;
|
|
||||||
}
|
|
||||||
public void setUserId(Long userId)
|
|
||||||
{
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getUserId()
|
|
||||||
{
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
public void setTagType(String tagType)
|
|
||||||
{
|
|
||||||
this.tagType = tagType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTagType()
|
|
||||||
{
|
|
||||||
return tagType;
|
|
||||||
}
|
|
||||||
public void setUrl(String url)
|
|
||||||
{
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl()
|
|
||||||
{
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
public void setStatus(Integer status)
|
|
||||||
{
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getStatus()
|
|
||||||
{
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("name", getName())
|
|
||||||
.append("icount", getIcount())
|
|
||||||
.append("userId", getUserId())
|
|
||||||
.append("tagType", getTagType())
|
|
||||||
.append("url", getUrl())
|
|
||||||
.append("status", getStatus())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,130 +0,0 @@
|
|||||||
package com.ruoyi.bookmark.domain;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签管理对象 sq_user_tag
|
|
||||||
*
|
|
||||||
* @author wang
|
|
||||||
* @date 2020-09-04
|
|
||||||
*/
|
|
||||||
@Table(name="sq_user_tag")
|
|
||||||
public class SqUserTag extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** ID */
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(generator = "JDBC")//此处加上注解
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 用户ID */
|
|
||||||
@Excel(name = "用户ID")
|
|
||||||
@Column(name = "user_id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/** 书签ID */
|
|
||||||
@Excel(name = "书签ID")
|
|
||||||
@Column(name = "tag_id")
|
|
||||||
private Long tagId;
|
|
||||||
|
|
||||||
/** 书签排序 */
|
|
||||||
@Excel(name = "书签名字")
|
|
||||||
@Column(name = "tag_name")
|
|
||||||
private String tagName;
|
|
||||||
|
|
||||||
/** 书签引用的数量 */
|
|
||||||
@Excel(name = "书签引用的数量")
|
|
||||||
@Column(name = "icount")
|
|
||||||
private Integer icount;
|
|
||||||
|
|
||||||
/** 书签排序 */
|
|
||||||
@Excel(name = "书签排序")
|
|
||||||
@Column(name = "iorder")
|
|
||||||
private Integer iorder;
|
|
||||||
|
|
||||||
|
|
||||||
public String getTagName() {
|
|
||||||
return tagName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTagName(String tagName) {
|
|
||||||
this.tagName = tagName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setUserId(Long userId)
|
|
||||||
{
|
|
||||||
this.userId = userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getUserId()
|
|
||||||
{
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
public void setTagId(Long tagId)
|
|
||||||
{
|
|
||||||
this.tagId = tagId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getTagId()
|
|
||||||
{
|
|
||||||
return tagId;
|
|
||||||
}
|
|
||||||
public void setIcount(Integer icount)
|
|
||||||
{
|
|
||||||
this.icount = icount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getIcount()
|
|
||||||
{
|
|
||||||
return icount;
|
|
||||||
}
|
|
||||||
public void setIorder(Integer iorder)
|
|
||||||
{
|
|
||||||
this.iorder = iorder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getIorder()
|
|
||||||
{
|
|
||||||
return iorder;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("userId", getUserId())
|
|
||||||
.append("tagId", getTagId())
|
|
||||||
.append("icount", getIcount())
|
|
||||||
.append("iorder", getIorder())
|
|
||||||
.append("tagName", getTagName())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
public SqUserTag(){
|
|
||||||
|
|
||||||
}
|
|
||||||
public SqUserTag(Long userId, Long tagId){
|
|
||||||
this.userId=userId;
|
|
||||||
this.tagId = tagId;
|
|
||||||
this.icount=1;
|
|
||||||
this.iorder=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,110 +0,0 @@
|
|||||||
package com.ruoyi.bookmark.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ruoyi.bookmark.domain.SqTag;
|
|
||||||
import com.ruoyi.bookmark.domain.SqUserTag;
|
|
||||||
import com.ruoyi.common.mybatisMapper.MyMapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签管理Mapper接口
|
|
||||||
*
|
|
||||||
* @author wang
|
|
||||||
* @date 2020-09-04
|
|
||||||
*/
|
|
||||||
public interface SqUserTagMapper extends MyMapper<SqUserTag>
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量减少用戶 标签引用的 数量 -1
|
|
||||||
*
|
|
||||||
* @param tags 标签串
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateCountReduce(@Param("tags")Long[] tags, @Param("userId")Long userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量添加 用戶 标签引用的 数量 +1
|
|
||||||
*
|
|
||||||
* @param tags 标签串
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateCountAdd(@Param("tags")Long[] tags, @Param("userId")Long userId);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*通过用户userID查用户的所有标签
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public List<Map<String,Object>> selectSqUserTagByUserId(Long userId);
|
|
||||||
/**
|
|
||||||
* 查询标签管理
|
|
||||||
*
|
|
||||||
* @param id 标签管理ID
|
|
||||||
* @return 标签管理
|
|
||||||
*/
|
|
||||||
public SqUserTag selectSqUserTagById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询标签管理列表
|
|
||||||
*
|
|
||||||
* @param sqUserTag 标签管理
|
|
||||||
* @return 标签管理集合
|
|
||||||
*/
|
|
||||||
public List<SqUserTag> selectSqUserTagList(SqUserTag sqUserTag);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增标签管理
|
|
||||||
*
|
|
||||||
* @param sqUserTag 标签管理
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertSqUserTag(SqUserTag sqUserTag);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改标签管理
|
|
||||||
*
|
|
||||||
* @param sqUserTag 标签管理
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateSqUserTag(SqUserTag sqUserTag);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标签管理
|
|
||||||
*
|
|
||||||
* @param id 标签管理ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteSqUserTagById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除标签管理
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的数据ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteSqUserTagByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标签管理信息
|
|
||||||
*
|
|
||||||
* @param ids 书签标签ID串
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int userRemoveByid(@Param("ids")Long[] ids, @Param("userId")Long userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过标签名字查看是否存在
|
|
||||||
*
|
|
||||||
* @param name String
|
|
||||||
* @param userId Long
|
|
||||||
* @return 数量
|
|
||||||
*/
|
|
||||||
public int selectCountByName(@Param("name")String name,@Param("userId")Long userId);
|
|
||||||
}
|
|
@ -1,128 +0,0 @@
|
|||||||
package com.ruoyi.bookmark.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.ruoyi.bookmark.domain.SqUserTag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签管理Service接口
|
|
||||||
*
|
|
||||||
* @author wang
|
|
||||||
* @date 2020-09-04
|
|
||||||
*/
|
|
||||||
public interface ISqUserTagService
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量减少用戶 标签引用的 数量 -1
|
|
||||||
*
|
|
||||||
* @param tags 标签串
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateCountReduce(Long[] tags,Long userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量添加 用戶 标签引用的 数量 +1
|
|
||||||
*
|
|
||||||
* @param tags 标签串
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateCountAdd(Long[] tags,Long userId);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*通过用户userID查用户的所有标签
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
public List<Map<String,Object>> selectSqUserTagByUserId(Long userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询标签管理
|
|
||||||
*
|
|
||||||
* @param id 标签管理ID
|
|
||||||
* @return 标签管理
|
|
||||||
*/
|
|
||||||
public SqUserTag selectSqUserTagById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询标签管理列表
|
|
||||||
*
|
|
||||||
* @param sqUserTag 标签管理
|
|
||||||
* @return 标签管理集合
|
|
||||||
*/
|
|
||||||
public List<SqUserTag> selectSqUserTagList(SqUserTag sqUserTag);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增标签管理
|
|
||||||
*
|
|
||||||
* @param sqUserTag 标签管理
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertSqUserTag(SqUserTag sqUserTag);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改标签管理
|
|
||||||
*
|
|
||||||
* @param sqUserTag 标签管理
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateSqUserTag(SqUserTag sqUserTag);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除标签管理
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的标签管理ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteSqUserTagByIds(Long[] ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标签管理信息
|
|
||||||
*
|
|
||||||
* @param id 标签管理ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteSqUserTagById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标签管理信息
|
|
||||||
*
|
|
||||||
* @param ids 书签标签ID串
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int userRemoveByid(Long[] ids, Long userId);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户添加标签
|
|
||||||
*
|
|
||||||
* @param sqUserTag
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
int insertSqUserTagAdd(SqUserTag sqUserTag);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户修改标签
|
|
||||||
*
|
|
||||||
* @param sqUserTag
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
int updateSqUserTagEdit(SqUserTag sqUserTag);
|
|
||||||
/**
|
|
||||||
* 查询用户 是否已经有此标签
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* @param userId
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
int selectCountByName(String name,Long userId);
|
|
||||||
}
|
|
@ -1,22 +1,16 @@
|
|||||||
package com.ruoyi.bookmark.service.impl;
|
package com.ruoyi.bookmark.service.impl;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.ruoyi.bookmark.domain.SqBookmarkTag;
|
import com.ruoyi.bookmark.domain.SqBookmarkTag;
|
||||||
import com.ruoyi.bookmark.domain.SqTag;
|
|
||||||
import com.ruoyi.bookmark.domain.SqUserTag;
|
|
||||||
import com.ruoyi.bookmark.mapper.SqBookmarkTagMapper;
|
import com.ruoyi.bookmark.mapper.SqBookmarkTagMapper;
|
||||||
import com.ruoyi.bookmark.mapper.SqTagMapper;
|
import com.ruoyi.bookmark.mapper.SqTagMapper;
|
||||||
import com.ruoyi.bookmark.mapper.SqUserTagMapper;
|
|
||||||
import com.ruoyi.bookmark.service.ISqTagService;
|
import com.ruoyi.bookmark.service.ISqTagService;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
|
||||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
|
||||||
import org.apache.commons.beanutils.ConvertUtils;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -24,9 +18,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import com.ruoyi.bookmark.mapper.SqBookmarkMapper;
|
import com.ruoyi.bookmark.mapper.SqBookmarkMapper;
|
||||||
import com.ruoyi.bookmark.domain.SqBookmark;
|
import com.ruoyi.bookmark.domain.SqBookmark;
|
||||||
import com.ruoyi.bookmark.service.ISqBookmarkService;
|
import com.ruoyi.bookmark.service.ISqBookmarkService;
|
||||||
import sun.dc.pr.PRError;
|
|
||||||
|
|
||||||
import javax.print.DocFlavor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 书签管理Service业务层处理
|
* 书签管理Service业务层处理
|
||||||
@ -47,8 +39,7 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SqTagMapper sqTagMapper;
|
private SqTagMapper sqTagMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SqUserTagMapper sqUserTagMapper;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISqTagService iSqTagService;
|
private ISqTagService iSqTagService;
|
||||||
|
|
||||||
@ -103,14 +94,14 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
|
|||||||
@Override
|
@Override
|
||||||
public int insertSqBookmark(SqBookmark sqBookmark)
|
public int insertSqBookmark(SqBookmark sqBookmark)
|
||||||
{
|
{
|
||||||
sqBookmark.setCreateTime(DateUtil.date(System.currentTimeMillis()));
|
|
||||||
int i= sqBookmarkMapper.insertUseGeneratedKeys(sqBookmark);
|
int i= sqBookmarkMapper.insertSqBookmark(sqBookmark);
|
||||||
//传入的标签
|
//传入的标签
|
||||||
List<Map<String, Object>> listmap = sqBookmark.getSqTags();
|
List<Map<String, Object>> listmap = sqBookmark.getSqTags();
|
||||||
if (listmap==null||listmap.isEmpty()||listmap.size()==0){
|
if (listmap==null||listmap.isEmpty()||listmap.size()==0){
|
||||||
return sqBookmarkMapper.insertSqBookmark(sqBookmark);
|
return i;
|
||||||
}
|
}
|
||||||
String addtag="";
|
|
||||||
//给文章添加标签
|
//给文章添加标签
|
||||||
HashMap<Long,Long> bookmarkTag=new HashMap<Long,Long>();
|
HashMap<Long,Long> bookmarkTag=new HashMap<Long,Long>();
|
||||||
//文章添加书签
|
//文章添加书签
|
||||||
@ -122,14 +113,18 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
|
|||||||
if (Integer.parseInt(String.valueOf(map.get("tagId"))) < 0) {
|
if (Integer.parseInt(String.valueOf(map.get("tagId"))) < 0) {
|
||||||
Map<String, Object> tagmap = iSqTagService.addtag(String.valueOf(map.get("name")), sqBookmark.getUserid());
|
Map<String, Object> tagmap = iSqTagService.addtag(String.valueOf(map.get("name")), sqBookmark.getUserid());
|
||||||
for (Map.Entry<String, Object> tag : tagmap.entrySet()) {
|
for (Map.Entry<String, Object> tag : tagmap.entrySet()) {
|
||||||
addtag += tagmap.get("tagId").toString();
|
bookmarkTag.put(Long.valueOf(tagmap.get("tagId").toString()),sqBookmark.getBookmarkId());
|
||||||
map.put("tagId", tagmap.get("tagId"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
//原本就有的 标签
|
||||||
bookmarkTag.put(Long.valueOf(map.get("tagId").toString()),sqBookmark.getBookmarkId());
|
bookmarkTag.put(Long.valueOf(map.get("tagId").toString()),sqBookmark.getBookmarkId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//删除之前的标签
|
||||||
|
SqBookmarkTag sqBookmarkTag=new SqBookmarkTag();
|
||||||
|
sqBookmarkTag.setBookmarkId(sqBookmark.getBookmarkId());
|
||||||
|
sqBookmarkTagMapper.delete(sqBookmarkTag);
|
||||||
//给文章添加书签
|
//给文章添加书签
|
||||||
for (Map.Entry<Long,Long> tag:bookmarkTag.entrySet()){
|
for (Map.Entry<Long,Long> tag:bookmarkTag.entrySet()){
|
||||||
bookamrktag.setBookmarkId(tag.getValue());
|
bookamrktag.setBookmarkId(tag.getValue());
|
||||||
@ -137,13 +132,7 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
|
|||||||
sqBookmarkTagMapper.insertSqBookmarkTag(bookamrktag);
|
sqBookmarkTagMapper.insertSqBookmarkTag(bookamrktag);
|
||||||
}
|
}
|
||||||
|
|
||||||
//个人标签引用数量 批量+1
|
|
||||||
if (!addtag.equals("") && addtag.length()>0) {
|
|
||||||
addtag=addtag.substring(0,addtag.length()-1);
|
|
||||||
String[] add = addtag.split(",");
|
|
||||||
Long[] num = (Long[]) ConvertUtils.convert(add,Long.class);
|
|
||||||
sqUserTagMapper.updateCountReduce(num, sqBookmark.getUserid());
|
|
||||||
}
|
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -156,41 +145,41 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateSqBookmark(SqBookmark sqBookmark) {
|
public int updateSqBookmark(SqBookmark sqBookmark) {
|
||||||
//删除的书签ID
|
// //删除的书签ID
|
||||||
String deletetag = "";
|
// String deletetag = "";
|
||||||
//新增的书签ID
|
// //新增的书签ID
|
||||||
String addtag = "";
|
// String addtag = "";
|
||||||
//传入的标签
|
//传入的标签
|
||||||
|
int i =sqBookmarkMapper.updateSqBookmark(sqBookmark);
|
||||||
List<Map<String, Object>> listmap = sqBookmark.getSqTags();
|
List<Map<String, Object>> listmap = sqBookmark.getSqTags();
|
||||||
if (listmap==null||listmap.isEmpty()||listmap.size()==0){
|
if (listmap==null||listmap.isEmpty()||listmap.size()==0){
|
||||||
return sqBookmarkMapper.updateSqBookmark(sqBookmark);
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//给文章添加标签
|
//给文章添加标签
|
||||||
HashMap<Long,Long> bookmarkTag=new HashMap<Long,Long>();
|
HashMap<Long,Long> bookmarkTag=new HashMap<Long,Long>();
|
||||||
//文章添加书签
|
//文章添加书签
|
||||||
SqBookmarkTag bookamrktag = new SqBookmarkTag();
|
SqBookmarkTag bookamrktag = new SqBookmarkTag();
|
||||||
int i = 0;
|
|
||||||
for (Map<String, Object> map : listmap) {
|
for (Map<String, Object> map : listmap) {
|
||||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
//新增书签
|
//新增书签
|
||||||
if (Integer.parseInt(String.valueOf(map.get("tagId"))) < 0) {
|
if (Integer.parseInt(String.valueOf(map.get("tagId"))) < 0) {
|
||||||
Map<String, Object> tagmap = iSqTagService.addtag(String.valueOf(map.get("name")), sqBookmark.getUserid());
|
Map<String, Object> tagmap = iSqTagService.addtag(String.valueOf(map.get("name")), sqBookmark.getUserid());
|
||||||
for (Map.Entry<String, Object> tag : tagmap.entrySet()) {
|
for (Map.Entry<String, Object> tag : tagmap.entrySet()) {
|
||||||
addtag += tagmap.get("tagId").toString();
|
bookmarkTag.put(Long.valueOf(tagmap.get("tagId").toString()),sqBookmark.getBookmarkId());
|
||||||
map.put("tagId", tagmap.get("tagId"));
|
|
||||||
}
|
}
|
||||||
}
|
}else {
|
||||||
//删除书签
|
//原本就有的 标签
|
||||||
if (!String.valueOf(map.get("name")).equals("TAGDELETE")) {
|
|
||||||
bookmarkTag.put(Long.valueOf(map.get("tagId").toString()),sqBookmark.getBookmarkId());
|
bookmarkTag.put(Long.valueOf(map.get("tagId").toString()),sqBookmark.getBookmarkId());
|
||||||
} else {
|
|
||||||
deletetag += map.get("tagId").toString() + ",";
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//删除书签 现在的所有标签
|
//删除之前的标签
|
||||||
SqBookmarkTag sqBookmarkTag = new SqBookmarkTag();
|
SqBookmarkTag sqBookmarkTag=new SqBookmarkTag();
|
||||||
sqBookmarkTag.setBookmarkId(sqBookmark.getBookmarkId());
|
sqBookmarkTag.setBookmarkId(sqBookmark.getBookmarkId());
|
||||||
sqBookmarkTagMapper.delete(sqBookmarkTag);
|
sqBookmarkTagMapper.delete(sqBookmarkTag);
|
||||||
|
|
||||||
@ -201,22 +190,8 @@ public class SqBookmarkServiceImpl implements ISqBookmarkService
|
|||||||
sqBookmarkTagMapper.insertSqBookmarkTag(bookamrktag);
|
sqBookmarkTagMapper.insertSqBookmarkTag(bookamrktag);
|
||||||
}
|
}
|
||||||
|
|
||||||
//个人标签引用数量 批量-1
|
|
||||||
if (!deletetag.equals("") && deletetag.length()>0) {
|
|
||||||
deletetag=deletetag.substring(0,deletetag.length()-1);
|
|
||||||
String[] tagreduce = deletetag.split(",");
|
|
||||||
Long[] num = (Long[]) ConvertUtils.convert(tagreduce,Long.class);
|
|
||||||
sqUserTagMapper.updateCountReduce(num, sqBookmark.getUserid());
|
|
||||||
}
|
|
||||||
//个人标签引用数量 批量+1
|
|
||||||
if (!addtag.equals("") && addtag.length()>0) {
|
|
||||||
addtag=addtag.substring(0,addtag.length()-1);
|
|
||||||
String[] add = addtag.split(",");
|
|
||||||
Long[] num = (Long[]) ConvertUtils.convert(add,Long.class);
|
|
||||||
sqUserTagMapper.updateCountAdd(num, sqBookmark.getUserid());
|
|
||||||
}
|
|
||||||
|
|
||||||
return sqBookmarkMapper.updateSqBookmark(sqBookmark);
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package com.ruoyi.bookmark.service.impl;
|
package com.ruoyi.bookmark.service.impl;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.github.wujun234.uid.UidGenerator;
|
|
||||||
import com.ruoyi.bookmark.domain.SqUserTag;
|
|
||||||
import com.ruoyi.bookmark.mapper.SqUserTagMapper;
|
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -33,8 +30,7 @@ public class SqTagServiceImpl implements ISqTagService
|
|||||||
public static Logger logger = LoggerFactory.getLogger(SqTagServiceImpl.class);
|
public static Logger logger = LoggerFactory.getLogger(SqTagServiceImpl.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
private SqTagMapper sqTagMapper;
|
private SqTagMapper sqTagMapper;
|
||||||
@Autowired
|
|
||||||
private SqUserTagMapper sqUserTagMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询书签_标签
|
* 查询书签_标签
|
||||||
@ -117,60 +113,28 @@ public class SqTagServiceImpl implements ISqTagService
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> addtag(String tagName,Long userId){
|
public Map<String,Object> addtag(String tagName,Long userId) {
|
||||||
Map<String,Object> map=new HashMap<>();
|
Map<String,Object> map=new HashMap<>();
|
||||||
|
//创建新的标签 返回id给map
|
||||||
//创建新的标签 返回id给map 并且添加用户的个人书签记录
|
|
||||||
//1.新增标签
|
|
||||||
//1.1查询书签是否存在
|
//1.1查询书签是否存在
|
||||||
SqTag sqTag=new SqTag();
|
SqTag sqTag=new SqTag();
|
||||||
SqUserTag sqUserTag =new SqUserTag();
|
|
||||||
sqTag.setName(tagName);
|
sqTag.setName(tagName);
|
||||||
|
sqTag.setUserId(userId);
|
||||||
List<SqTag> taglist=sqTagMapper.selectSqTagList(sqTag);
|
List<SqTag> taglist=sqTagMapper.selectSqTagList(sqTag);
|
||||||
//存在返回ID
|
//存在返回ID
|
||||||
if (taglist!=null&&!taglist.isEmpty()){
|
if (taglist!=null&&!taglist.isEmpty()){
|
||||||
map.put("tagId",taglist.get(0).getId());
|
map.put("tagId",taglist.get(0).getId());
|
||||||
logger.debug("传入的新标签 tagid="+taglist.get(0).getId());
|
|
||||||
//添加到用戶个人书签里面去
|
|
||||||
//1.用户是否已经有这个书签记录了
|
|
||||||
sqUserTag.setUserId(userId);
|
|
||||||
sqUserTag.setTagId(taglist.get(0).getId());
|
|
||||||
|
|
||||||
List<SqUserTag> sqUserTags = sqUserTagMapper.selectSqUserTagList(sqUserTag);
|
|
||||||
|
|
||||||
if (sqUserTags!=null&&!sqUserTags.isEmpty()){
|
|
||||||
map.put("tagId",sqUserTags.get(0).getTagId().toString());
|
|
||||||
}else {
|
|
||||||
sqUserTag.setIcount(1);
|
|
||||||
sqUserTag.setIorder(1);
|
|
||||||
sqUserTag.setTagName(tagName);
|
|
||||||
sqUserTagMapper.insertSqUserTag(sqUserTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
//不存在 >>创建 返回ID
|
//不存在 >>创建 返回ID
|
||||||
|
|
||||||
sqTag.setUserId(userId);
|
|
||||||
sqTag.setTagType("P");
|
|
||||||
sqTag.setIcount(1);
|
|
||||||
sqTag.setStatus(0);
|
|
||||||
sqTag.setCreateTime(DateUtils.getNowDate());
|
|
||||||
sqTagMapper.insertSqTag(sqTag);
|
sqTagMapper.insertSqTag(sqTag);
|
||||||
logger.debug("传入的新标签 tagid="+sqTag.getId());
|
logger.debug("传入的新标签 tagid="+sqTag.getId());
|
||||||
map.put("tagId",sqTag.getId());
|
map.put("tagId",sqTag.getId());
|
||||||
//添加到用戶个人书签里面去
|
|
||||||
sqUserTag.setUserId(userId);
|
|
||||||
sqUserTag.setTagId(Long.valueOf(sqTag.getId()));
|
|
||||||
sqUserTag.setTagName(sqTag.getName());
|
|
||||||
sqUserTag.setIcount(1);
|
|
||||||
sqUserTag.setIorder(1);
|
|
||||||
sqUserTagMapper.insertSqUserTag(sqUserTag);
|
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,250 +0,0 @@
|
|||||||
package com.ruoyi.bookmark.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import com.github.wujun234.uid.UidGenerator;
|
|
||||||
import com.ruoyi.bookmark.domain.SqTag;
|
|
||||||
import com.ruoyi.bookmark.mapper.SqBookmarkMapper;
|
|
||||||
import com.ruoyi.bookmark.mapper.SqTagMapper;
|
|
||||||
import com.ruoyi.common.utils.YunConstant;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.ruoyi.bookmark.mapper.SqUserTagMapper;
|
|
||||||
import com.ruoyi.bookmark.domain.SqUserTag;
|
|
||||||
import com.ruoyi.bookmark.service.ISqUserTagService;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签管理Service业务层处理
|
|
||||||
*
|
|
||||||
* @author wang
|
|
||||||
* @date 2020-09-04
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class SqUserTagServiceImpl implements ISqUserTagService
|
|
||||||
{
|
|
||||||
public final static Logger logger = LoggerFactory.getLogger(SqUserTagServiceImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SqUserTagMapper sqUserTagMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SqTagMapper sqTagMapper;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量减少用戶 标签引用的 数量 -1
|
|
||||||
*
|
|
||||||
* @param tags 标签串
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateCountReduce(Long[] tags,Long userId){
|
|
||||||
return sqUserTagMapper.updateCountReduce(tags,userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量添加 用戶 标签引用的 数量 +1
|
|
||||||
*
|
|
||||||
* @param tags 标签串
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateCountAdd(Long[] tags,Long userId){
|
|
||||||
return sqUserTagMapper.updateCountAdd(tags,userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*通过用户userID查用户的所有标签
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Map<String,Object>>selectSqUserTagByUserId(Long userId){
|
|
||||||
return sqUserTagMapper.selectSqUserTagByUserId(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询标签管理
|
|
||||||
*
|
|
||||||
* @param id 标签管理ID
|
|
||||||
* @return 标签管理
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SqUserTag selectSqUserTagById(Long id)
|
|
||||||
{
|
|
||||||
return sqUserTagMapper.selectSqUserTagById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询标签管理列表
|
|
||||||
*
|
|
||||||
* @param sqUserTag 标签管理
|
|
||||||
* @return 标签管理
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<SqUserTag> selectSqUserTagList(SqUserTag sqUserTag)
|
|
||||||
{
|
|
||||||
return sqUserTagMapper.selectSqUserTagList(sqUserTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增标签管理
|
|
||||||
*
|
|
||||||
* @param sqUserTag 标签管理
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertSqUserTag(SqUserTag sqUserTag)
|
|
||||||
{
|
|
||||||
return sqUserTagMapper.insertSqUserTag(sqUserTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改标签管理
|
|
||||||
*
|
|
||||||
* @param sqUserTag 标签管理
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateSqUserTag(SqUserTag sqUserTag)
|
|
||||||
{
|
|
||||||
return sqUserTagMapper.updateSqUserTag(sqUserTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除标签管理
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的标签管理ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteSqUserTagByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return sqUserTagMapper.deleteSqUserTagByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标签管理信息
|
|
||||||
*
|
|
||||||
* @param id 标签管理ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteSqUserTagById(Long id)
|
|
||||||
{
|
|
||||||
return sqUserTagMapper.deleteSqUserTagById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标签管理信息
|
|
||||||
*
|
|
||||||
* @param ids 书签标签ID串
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int userRemoveByid(Long[] ids, Long userId) {
|
|
||||||
return sqUserTagMapper.userRemoveByid(ids,userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description 用户添加标签
|
|
||||||
* @Author wanghao
|
|
||||||
* @Date 2020/09/16 20:00
|
|
||||||
* @Param [sqUserTag]
|
|
||||||
* @Return int
|
|
||||||
* @Exception
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertSqUserTagAdd(SqUserTag sqUserTag) {
|
|
||||||
|
|
||||||
List<SqTag> sqtag = sqTagMapper.selectCountByName(sqUserTag.getTagName());
|
|
||||||
if (sqtag!=null&&!sqtag.isEmpty()){
|
|
||||||
sqUserTag.setTagId(sqtag.get(0).getId());
|
|
||||||
sqUserTag.setTagName(sqtag.get(0).getName());
|
|
||||||
sqUserTag.setIcount(1);
|
|
||||||
}else {
|
|
||||||
SqTag sqTag=new SqTag();
|
|
||||||
sqTag.setName(sqUserTag.getTagName());
|
|
||||||
sqTag.setIcount(1);
|
|
||||||
sqTag.setUserId(sqUserTag.getUserId());
|
|
||||||
sqTag.setTagType(YunConstant.KEY_TAGS_PERSON);
|
|
||||||
sqTag.setStatus(0);
|
|
||||||
sqTag.setCreateTime(DateUtil.date(System.currentTimeMillis()));
|
|
||||||
sqTagMapper.insertSqTag(sqTag);
|
|
||||||
//创建新的标签后
|
|
||||||
logger.debug("创建新标签ID:"+sqTag.getId()+"name:"+sqUserTag.getTagName());
|
|
||||||
sqUserTag.setTagId(sqTag.getId());
|
|
||||||
sqUserTag.setTagName(sqUserTag.getTagName());
|
|
||||||
sqUserTag.setIcount(1);
|
|
||||||
}
|
|
||||||
return sqUserTagMapper.insertSqUserTag(sqUserTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*用户修改书签
|
|
||||||
*
|
|
||||||
* @param sqUserTag
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateSqUserTagEdit(SqUserTag sqUserTag) {
|
|
||||||
//修改前的tagid
|
|
||||||
Long tagId =sqUserTag.getTagId();
|
|
||||||
logger.debug("修改前的tagid:"+tagId);
|
|
||||||
|
|
||||||
List<SqTag> sqtag = sqTagMapper.selectCountByName(sqUserTag.getTagName());
|
|
||||||
if (sqtag!=null&&!sqtag.isEmpty()){
|
|
||||||
sqUserTag.setTagId(sqtag.get(0).getId());
|
|
||||||
logger.debug("修改后的tagid:"+sqtag.get(0).getId());
|
|
||||||
}else {
|
|
||||||
SqTag sqTag=new SqTag();
|
|
||||||
sqTag.setName(sqUserTag.getTagName());
|
|
||||||
sqTag.setIcount(1);
|
|
||||||
sqTag.setUserId(sqUserTag.getUserId());
|
|
||||||
sqTag.setTagType(YunConstant.KEY_TAGS_PERSON);
|
|
||||||
sqTag.setStatus(0);
|
|
||||||
sqTag.setCreateTime(DateUtil.date(System.currentTimeMillis()));
|
|
||||||
sqTagMapper.insertSqTag(sqTag);
|
|
||||||
logger.debug("修改后的tagid:"+sqTag.getId());
|
|
||||||
sqUserTag.setTagId(sqTag.getId());
|
|
||||||
}
|
|
||||||
//修改在正在使用该标签的 对应引用书签
|
|
||||||
sqTagMapper.updateBookmarkTagIdByTagId(tagId,sqUserTag.getTagId(),sqUserTag.getUserId());
|
|
||||||
|
|
||||||
return sqUserTagMapper.updateSqUserTag(sqUserTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过标签名字查看是否存在
|
|
||||||
*
|
|
||||||
* @param name String
|
|
||||||
* @param userId Long
|
|
||||||
* @return 数量
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int selectCountByName(String name, Long userId) {
|
|
||||||
return sqUserTagMapper.selectCountByName(name,userId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -123,6 +123,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="selectBymenuIdUserID" parameterType="SqBookmark" resultMap="SqBookmarkResult">
|
<select id="selectBymenuIdUserID" parameterType="SqBookmark" resultMap="SqBookmarkResult">
|
||||||
<include refid="selectSqBookmarkVo"/>
|
<include refid="selectSqBookmarkVo"/>
|
||||||
where menu_id = #{menuID} and userid=#{userID}
|
where menu_id = #{menuID} and userid=#{userID} order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -12,11 +12,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="tagType" column="tag_type" />
|
<result property="tagType" column="tag_type" />
|
||||||
<result property="url" column="url" />
|
<result property="url" column="url" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
|
<result property="isFontColor" column="is_font_color" />
|
||||||
|
<result property="isBgColor" column="is_bg_color" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectSqTagVo">
|
<sql id="selectSqTagVo">
|
||||||
select id, name, icount, user_Id, tag_type, url, status, create_time from sq_tag
|
select id, name, icount,is_font_color, is_bg_color, user_Id, tag_type, url, status, create_time from sq_tag
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectSqTagList" parameterType="SqTag" resultMap="SqTagResult">
|
<select id="selectSqTagList" parameterType="SqTag" resultMap="SqTagResult">
|
||||||
@ -25,6 +27,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||||
<if test="icount != null "> and icount = #{icount}</if>
|
<if test="icount != null "> and icount = #{icount}</if>
|
||||||
<if test="userId != null "> and user_Id = #{userId}</if>
|
<if test="userId != null "> and user_Id = #{userId}</if>
|
||||||
|
<if test="isFontColor != null and isFontColor != ''"> and is_font_color = #{isFontColor}</if>
|
||||||
|
<if test="isBgColor != null and isBgColor != ''"> and is_bg_color = #{isBgColor}</if>
|
||||||
<if test="tagType != null and tagType != ''"> and tag_type = #{tagType}</if>
|
<if test="tagType != null and tagType != ''"> and tag_type = #{tagType}</if>
|
||||||
<if test="url != null and url != ''"> and url = #{url}</if>
|
<if test="url != null and url != ''"> and url = #{url}</if>
|
||||||
<if test="status != null "> and status = #{status}</if>
|
<if test="status != null "> and status = #{status}</if>
|
||||||
@ -45,6 +49,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="tagType != null">tag_type,</if>
|
<if test="tagType != null">tag_type,</if>
|
||||||
<if test="url != null">url,</if>
|
<if test="url != null">url,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
|
<if test="isFontColor != null">is_font_color,</if>
|
||||||
|
<if test="isBgColor != null">is_bg_color,</if>
|
||||||
create_time
|
create_time
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
@ -54,6 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="tagType != null">#{tagType},</if>
|
<if test="tagType != null">#{tagType},</if>
|
||||||
<if test="url != null">#{url},</if>
|
<if test="url != null">#{url},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="isFontColor != null">#{isFontColor},</if>
|
||||||
|
<if test="isBgColor != null">#{isBgColor},</if>
|
||||||
now()
|
now()
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
@ -67,6 +75,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="tagType != null">tag_type = #{tagType},</if>
|
<if test="tagType != null">tag_type = #{tagType},</if>
|
||||||
<if test="url != null">url = #{url},</if>
|
<if test="url != null">url = #{url},</if>
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="isFontColor != null">is_font_color = #{isFontColor},</if>
|
||||||
|
<if test="isBgColor != null">is_bg_color = #{isBgColor},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
|
@ -1,115 +0,0 @@
|
|||||||
<?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.ruoyi.bookmark.mapper.SqUserTagMapper">
|
|
||||||
|
|
||||||
<resultMap type="SqUserTag" id="SqUserTagResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="userId" column="user_id" />
|
|
||||||
<result property="tagId" column="tag_id" />
|
|
||||||
<result property="icount" column="icount" />
|
|
||||||
<result property="iorder" column="iorder" />
|
|
||||||
<result property="tagName" column="tag_name" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectSqUserTagVo">
|
|
||||||
select id, user_id, tag_id,tag_name,icount, iorder from sq_user_tag
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectSqUserTagList" parameterType="SqUserTag" resultMap="SqUserTagResult">
|
|
||||||
<include refid="selectSqUserTagVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="userId != null "> and user_id = #{userId}</if>
|
|
||||||
<if test="tagId != null "> and tag_id = #{tagId}</if>
|
|
||||||
<if test="icount != null "> and icount = #{icount}</if>
|
|
||||||
<if test="iorder != null "> and iorder = #{iorder}</if>
|
|
||||||
<if test="tagName != null "> and tagName = #{tagName}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectSqUserTagById" parameterType="Long" resultMap="SqUserTagResult">
|
|
||||||
<include refid="selectSqUserTagVo"/>
|
|
||||||
where id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertSqUserTag" parameterType="SqUserTag" useGeneratedKeys="true" keyProperty="id">
|
|
||||||
insert into sq_user_tag
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="userId != null">user_id,</if>
|
|
||||||
<if test="tagId != null">tag_id,</if>
|
|
||||||
<if test="icount != null">icount,</if>
|
|
||||||
<if test="iorder != null">iorder,</if>
|
|
||||||
<if test="tagName != null ">tag_name,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="userId != null">#{userId},</if>
|
|
||||||
<if test="tagId != null">#{tagId},</if>
|
|
||||||
<if test="icount != null">#{icount},</if>
|
|
||||||
<if test="iorder != null">#{iorder},</if>
|
|
||||||
<if test="tagName != null ">#{tagName},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateSqUserTag" parameterType="SqUserTag">
|
|
||||||
update sq_user_tag
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="userId != null">user_id = #{userId},</if>
|
|
||||||
<if test="tagId != null">tag_id = #{tagId},</if>
|
|
||||||
<if test="icount != null">icount = #{icount},</if>
|
|
||||||
<if test="iorder != null">iorder = #{iorder},</if>
|
|
||||||
<if test="tagName != null">tag_name = #{tagName},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteSqUserTagById" parameterType="Long">
|
|
||||||
delete from sq_user_tag where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteSqUserTagByIds" parameterType="String">
|
|
||||||
delete from sq_user_tag where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="userRemoveByid" parameterType="String">
|
|
||||||
delete from sq_user_tag where id in
|
|
||||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
and user_id=#{userId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<select id="selectSqUserTagByUserId" parameterType="Long" resultType="java.util.Map">
|
|
||||||
SELECT u.id,u.user_id as userId,u.tag_id as tagId ,u.icount,u.iorder,t.name
|
|
||||||
from sq_user_tag AS u,sq_tag as t
|
|
||||||
WHERE
|
|
||||||
u.tag_id=t.id
|
|
||||||
AND
|
|
||||||
t.tag_type='P'
|
|
||||||
AND
|
|
||||||
u.user_id = 1
|
|
||||||
ORDER BY u.iorder
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<update id="updateCountReduce" >
|
|
||||||
<foreach item="tagId" collection="tags" separator=";" >
|
|
||||||
update sq_user_tag set icount=icount-1 WHERE user_id=#{userId} and tag_id = #{tagId}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="updateCountAdd" >
|
|
||||||
<foreach item="tagId" collection="tags" separator=";" >
|
|
||||||
update sq_user_tag set icount=icount+1 WHERE user_id=#{userId} and tag_id = #{tagId}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectCountByName" parameterType="SqUserTag" resultType="int">
|
|
||||||
select count(*) from sq_tag where name=#{name} and user_id=#{userId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
Loading…
x
Reference in New Issue
Block a user