删除标签id的时候,同时删除用户绑定的标签信息

master
elliott 2 years ago
parent 487738f53a
commit 7d66332417

@ -1,5 +1,6 @@
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;
@ -30,9 +31,11 @@ public class SysTag extends BaseEntity
private String ancestors;
/** 标签名称 */
@Excel(name = "标签名称")
private String tagName;
/** 显示顺序 */
@Excel(name = "排序顺序")
private Integer orderNum;
/** 负责人 */
@ -45,6 +48,7 @@ public class SysTag extends BaseEntity
private String email;
/** 标签状态:0正常,1停用 */
@Excel(name = "标签状态:0正常,1停用")
private String status;
/** 标签状态:1小程序标签,2企微标签 */

@ -53,6 +53,14 @@ public interface WxUserTagMapper {
*/
public int deleteWxUserTagById(Long id);
/**
*
*
* @param tagId
* @return
*/
public int deleteWxUserTagByTagId(Long tagId);
/**
*
*

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.flossom.common.core.mapper.WxUserTagMapper">
<resultMap type="WxUserTag" id="WxUserTagResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWxUserTagList" parameterType="WxUserTag" resultMap="WxUserTagResult">
<include refid="selectWxUserTagVo"/>
<where>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="tagName != null and tagName != ''"> and tag_name like concat('%', #{tagName}, '%')</if>
<if test="tagId != null "> and tag_id = #{tagId}</if>
@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectWxUserTagById" parameterType="Long" resultMap="WxUserTagResult">
<include refid="selectWxUserTagVo"/>
where id = #{id}
@ -107,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteWxUserTagByIds" parameterType="String">
delete from wx_user_tag where id in
delete from wx_user_tag where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
@ -131,4 +131,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteWxUserTagByUserId">
delete from wx_user_tag where user_id = #{userId}
</delete>
</mapper>
<delete id="deleteWxUserTagByTagId">
delete from wx_user_tag where tag_id = #{tagId}
</delete>
</mapper>

@ -2,9 +2,11 @@ package com.flossom.system.controller;
import com.flossom.common.core.constant.UserConstants;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.SysFiringInfo;
import com.flossom.common.core.domain.entity.SysDept;
import com.flossom.common.core.domain.entity.SysTag;
import com.flossom.common.core.utils.StringUtils;
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.log.annotation.Log;
@ -13,11 +15,13 @@ import com.flossom.common.security.annotation.RequiresPermissions;
import com.flossom.common.security.utils.SecurityUtils;
import com.flossom.system.service.ISysDeptService;
import com.flossom.system.service.ISysTagService;
import com.flossom.system.service.IWxUserTagService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@ -30,6 +34,8 @@ import java.util.List;
public class SysTagController extends BaseController {
@Autowired
private ISysTagService tagService;
@Autowired
private IWxUserTagService wxUserTagService;
/**
*
@ -106,6 +112,8 @@ public class SysTagController extends BaseController {
if (tagService.hasChildByDeptId(id)) {
return warn("存在下级标签,不允许删除");
}
wxUserTagService.deleteWxUserTagByTagId(id);
// 删除用户标签
// if (tagService.checkDeptExistUser(id))
// {
// return warn("标签存在用户,不允许删除");
@ -143,4 +151,17 @@ public class SysTagController extends BaseController {
public R getWecomTags() {
return R.ok(tagService.getWecomTags());
}
/**
*
*/
@RequiresPermissions("system:tagInfo:export")
@Log(title = "标签信息数据信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysTag tag)
{
List<SysTag> list = tagService.selectDeptList(tag);
ExcelUtil<SysTag> util = new ExcelUtil<SysTag>(SysTag.class);
util.exportExcel(response, list, "标签信息数据");
}
}

@ -58,4 +58,12 @@ public interface IWxUserTagService {
* @return
*/
public int deleteWxUserTagById(Long id);
/**
*
*
* @param tagId
* @return
*/
public int deleteWxUserTagByTagId(Long tagId);
}

@ -87,4 +87,9 @@ public class WxUserTagServiceImpl implements IWxUserTagService {
public int deleteWxUserTagById(Long id) {
return wxUserTagMapper.deleteWxUserTagById(id);
}
@Override
public int deleteWxUserTagByTagId(Long tagId) {
return wxUserTagMapper.deleteWxUserTagByTagId(tagId);
}
}

@ -1,6 +1,6 @@
import request from '@/utils/request'
// 查询部门列表
// 查询标签列表
export function listDept(query) {
return request({
url: '/system/tagInfo/list',
@ -9,7 +9,7 @@ export function listDept(query) {
})
}
// 查询部门列表(排除节点)
// 查询标签列表(排除节点)
export function listDeptExcludeChild(deptId) {
return request({
url: '/system/tagInfo/list/exclude/' + deptId,
@ -17,7 +17,7 @@ export function listDeptExcludeChild(deptId) {
})
}
// 查询部门详细
// 查询标签详细
export function getDept(deptId) {
return request({
url: '/system/tagInfo/' + deptId,
@ -25,7 +25,7 @@ export function getDept(deptId) {
})
}
// 新增部门
// 新增标签
export function addDept(data) {
return request({
url: '/system/tagInfo',
@ -34,7 +34,7 @@ export function addDept(data) {
})
}
// 修改部门
// 修改标签
export function updateDept(data) {
return request({
url: '/system/tagInfo',
@ -43,7 +43,7 @@ export function updateDept(data) {
})
}
// 删除部门
// 删除标签
export function delDept(deptId) {
return request({
url: '/system/tagInfo/' + deptId,
@ -51,7 +51,7 @@ export function delDept(deptId) {
})
}
// 查询部门下拉树结构
// 查询标签下拉树结构
export function tagTreeSelect(query) {
return request({
url: '/system/tagInfo/tagTree',

@ -36,6 +36,16 @@
<!-- v-hasPermi="['system:dept:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:tagInfo:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
@ -330,6 +340,12 @@ export default {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/tagInfo/export', {
...this.queryParams
}, `info_${new Date().getTime()}.xlsx`)
}
}
};

@ -96,7 +96,7 @@
<el-table-column label="用户编号" align="center" prop="userNumber" />
<el-table-column label="用户手机号码" align="center" prop="userPhone" />
<el-table-column label="用户留言" align="center" prop="messageInfo" />
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
<el-table-column label="提交时间" align="center" prop="createTime" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime,'{y}-{m}-{d} {h}:{i}') }}</span>
</template>

@ -143,13 +143,11 @@
</template>
</el-table-column>
<el-table-column label="消息内容" align="center" prop="messageContent" />
<el-table-column label="更新人" align="center" prop="updateBy" />
<el-table-column label="更新时间" align="center" prop="createTime" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime,'{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime,'{y}-{m}-{d} {h}:{i}') }}</span>
@ -232,8 +230,8 @@
<el-form-item label="标题" prop="messageTitle">
<el-input v-model="form.messageTitle" placeholder="请输入消息标题" />
</el-form-item>
<el-form-item label="消息内容">
<editor v-model="form.messageContent" :min-height="192"/>
<el-form-item label="消息内容" prop="messageContent">
<el-input type="" v-model="form.messageContent"type="textarea" :rows="5"/>
</el-form-item>
<el-row>
<el-col :span="24">
@ -340,6 +338,36 @@ export default {
form: {},
//
rules: {
messageType: [
{ required: true, message: "类型不能为空", trigger: "blur" }
],
messageTitle: [
{ required: true, message: "消息标题不能为空", trigger: "blur" }
],
messageContent: [
{ required: true, message: "消息内容不能为空", trigger: "blur" }
],
type: [
{ required: true, message: "跳转类型不能为空", trigger: "blur" }
],
link: [
{ required: true, message: "参数不能为空", trigger: "blur" }
],
redirectAppid: [
{ required: true, message: "APPID不能为空", trigger: "blur" }
],
linkParams: [
{ required: true, message: "跳转参数不能为空", trigger: "blur" }
],
redirectUrl: [
{ required: true, message: "页面链接不能为空", trigger: "blur" }
],
videoNo: [
{ required: true, message: "视频号ID不能为空", trigger: "blur" }
],
feedId: [
{ required: true, message: "视频号feedId不能为空", trigger: "blur" }
],
}
};
},

@ -26,6 +26,16 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:tagInfo:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
@ -316,6 +326,12 @@ export default {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/tagInfo/export', {
...this.queryParams
}, `info_${new Date().getTime()}.xlsx`)
}
}
};

Loading…
Cancel
Save