去除appId依赖
This commit is contained in:
parent
0f5828d47d
commit
8f6ff12dfb
|
@ -85,7 +85,6 @@ public class CategoryAction extends BaseAction {
|
|||
@RequestMapping("/list")
|
||||
@ResponseBody
|
||||
public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) {
|
||||
category.setAppId(BasicUtil.getAppId());
|
||||
BasicUtil.startPage();
|
||||
List categoryList = categoryBiz.query(category);
|
||||
return ResultData.build().success(new EUListBean(categoryList,(int) BasicUtil.endPage(categoryList).getTotal()));
|
||||
|
@ -112,7 +111,6 @@ public class CategoryAction extends BaseAction {
|
|||
if(category.getId()==null) {
|
||||
return ResultData.build().error();
|
||||
}
|
||||
category.setAppId(BasicUtil.getAppId());
|
||||
CategoryEntity _category = (CategoryEntity)categoryBiz.getById(category.getId());
|
||||
return ResultData.build().success(_category);
|
||||
}
|
||||
|
@ -170,7 +168,6 @@ public class CategoryAction extends BaseAction {
|
|||
}
|
||||
//获取拼音
|
||||
|
||||
category.setAppId(BasicUtil.getAppId());
|
||||
categoryBiz.saveEntity(category);
|
||||
return ResultData.build().success(category);
|
||||
}
|
||||
|
@ -244,7 +241,6 @@ public class CategoryAction extends BaseAction {
|
|||
String pingYin = PinYinUtil.getPingYin(category.getCategoryTitle());
|
||||
CategoryEntity categoryEntity=new CategoryEntity();
|
||||
categoryEntity.setCategoryPinyin(pingYin);
|
||||
categoryEntity.setAppId(BasicUtil.getAppId());
|
||||
CategoryEntity categoryBizEntity = (CategoryEntity)categoryBiz.getEntity(categoryEntity);
|
||||
category.setCategoryPinyin(pingYin);
|
||||
//如果存在此拼音栏目则拼接上id
|
||||
|
@ -254,14 +250,12 @@ public class CategoryAction extends BaseAction {
|
|||
//判断是否选择子级为所属栏目
|
||||
CategoryEntity _category = new CategoryEntity();
|
||||
_category.setCategoryParentId(category.getId());
|
||||
_category.setAppId(BasicUtil.getAppId());
|
||||
List<CategoryEntity> categoryList = categoryBiz.queryChilds(_category);
|
||||
for(CategoryEntity item:categoryList){
|
||||
if(item.getId().equals(category.getCategoryId())){
|
||||
return ResultData.build().error(getResString("cannot.select.child"));
|
||||
}
|
||||
}
|
||||
category.setAppId(BasicUtil.getAppId());
|
||||
categoryBiz.updateEntity(category);
|
||||
return ResultData.build().success(category);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,6 @@ public class ContentAction extends BaseAction {
|
|||
@RequestMapping("/list")
|
||||
@ResponseBody
|
||||
public ResultData list(@ModelAttribute @ApiIgnore ContentEntity content, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) {
|
||||
content.setAppId(BasicUtil.getAppId());
|
||||
BasicUtil.startPage();
|
||||
List contentList = contentBiz.query(content);
|
||||
return ResultData.build().success(new EUListBean(contentList,(int) BasicUtil.endPage(contentList).getTotal()));
|
||||
|
@ -114,7 +113,6 @@ public class ContentAction extends BaseAction {
|
|||
if(content.getId()==null) {
|
||||
return ResultData.build().error();
|
||||
}
|
||||
content.setAppId(BasicUtil.getAppId());
|
||||
ContentEntity _content = contentBiz.getById(content.getId());
|
||||
return ResultData.build().success(_content);
|
||||
}
|
||||
|
@ -172,7 +170,6 @@ public class ContentAction extends BaseAction {
|
|||
if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){
|
||||
return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200"));
|
||||
}
|
||||
content.setAppId(BasicUtil.getAppId());
|
||||
contentBiz.save(content);
|
||||
return ResultData.build().success(content);
|
||||
}
|
||||
|
@ -247,7 +244,6 @@ public class ContentAction extends BaseAction {
|
|||
if(!StringUtil.checkLength(content.getContentUrl()+"", 0, 200)){
|
||||
return ResultData.build().error(getResString("err.length", this.getResString("content.url"), "0", "200"));
|
||||
}
|
||||
content.setAppId(BasicUtil.getAppId());
|
||||
contentBiz.updateEntity(content);
|
||||
return ResultData.build().success(content);
|
||||
}
|
||||
|
|
|
@ -161,12 +161,10 @@ public class GeneraterAction extends BaseAction {
|
|||
if (CategoryId>0) {
|
||||
CategoryEntity categoryEntity = new CategoryEntity();
|
||||
categoryEntity.setId(CategoryId+"");
|
||||
categoryEntity.setAppId(app.getAppId());
|
||||
columns = categoryBiz.queryChilds(categoryEntity);
|
||||
} else {
|
||||
// 获取所有的内容管理栏目
|
||||
CategoryEntity categoryEntity=new CategoryEntity();
|
||||
categoryEntity.setAppId(app.getAppId());
|
||||
columns = categoryBiz.query(categoryEntity);
|
||||
}
|
||||
List<CategoryBean> articleIdList = null;
|
||||
|
|
|
@ -74,7 +74,6 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
|
|||
String pingYin = PinYinUtil.getPingYin(categoryEntity.getCategoryTitle());
|
||||
CategoryEntity category=new CategoryEntity();
|
||||
category.setCategoryPinyin(pingYin);
|
||||
category.setAppId(BasicUtil.getAppId());
|
||||
Object categoryBizEntity = getEntity(category);
|
||||
setParentId(categoryEntity);
|
||||
categoryEntity.setCategoryPinyin(pingYin);
|
||||
|
@ -147,7 +146,6 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
|
|||
String pingYin = PinYinUtil.getPingYin(entity.getCategoryTitle());
|
||||
CategoryEntity category=new CategoryEntity();
|
||||
category.setCategoryPinyin(pingYin);
|
||||
category.setAppId(BasicUtil.getAppId());
|
||||
CategoryEntity categoryBizEntity = (CategoryEntity)getEntity(category);
|
||||
//拼音存在则拼接id
|
||||
if(categoryBizEntity!=null&&!categoryBizEntity.getId().equals(entity.getId())){
|
||||
|
|
|
@ -58,7 +58,6 @@ public class ContentBizImpl extends BaseBizImpl<IContentDao, ContentEntity> impl
|
|||
|
||||
@Override
|
||||
public List<CategoryBean> queryIdsByCategoryIdForParser(ContentBean contentBean) {
|
||||
contentBean.setAppId(BasicUtil.getAppId());
|
||||
return this.contentDao.queryIdsByCategoryIdForParser(contentBean);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
<if test="mdiyModelId != null and mdiyModelId != ''">mdiy_model_id,</if>
|
||||
<if test="categoryDatetime != null">category_datetime,</if>
|
||||
<if test="categoryManagerId != null">category_manager_id,</if>
|
||||
<if test="appId != null">app_id,</if>
|
||||
<if test="dictId != null">dict_id,</if>
|
||||
<if test="categoryFlag != null">category_flag,</if>
|
||||
<if test="categoryPath != null and categoryPath != ''">category_path,</if>
|
||||
|
@ -75,7 +74,6 @@
|
|||
<if test="mdiyModelId != null and mdiyModelId != ''">#{mdiyModelId},</if>
|
||||
<if test="categoryDatetime != null">#{categoryDatetime},</if>
|
||||
<if test="categoryManagerId != null">#{categoryManagerId},</if>
|
||||
<if test="appId != null">#{appId},</if>
|
||||
<if test="dictId != null">#{dictId},</if>
|
||||
<if test="categoryFlag != null ">#{categoryFlag},</if>
|
||||
<if test="categoryPath != null and categoryPath != ''">#{categoryPath},</if>
|
||||
|
@ -107,7 +105,6 @@
|
|||
<if test="mdiyModelId != null and mdiyModelId != ''">mdiy_model_id=#{mdiyModelId},</if>
|
||||
<if test="categoryDatetime != null">category_datetime=#{categoryDatetime},</if>
|
||||
<if test="categoryManagerId != null">category_manager_id=#{categoryManagerId},</if>
|
||||
<if test="appId != null">app_id=#{appId},</if>
|
||||
<if test="dictId != null">dict_id=#{dictId},</if>
|
||||
<if test="categoryFlag != null ">category_flag=#{categoryFlag},</if>
|
||||
<if test="categoryPath != null and categoryPath != ''">category_path=#{categoryPath},</if>
|
||||
|
@ -143,7 +140,6 @@
|
|||
<if test="mdiyModelId != null and mdiyModelId != ''">and mdiy_model_id=#{mdiyModelId}</if>
|
||||
<if test="categoryDatetime != null"> and category_datetime=#{categoryDatetime} </if>
|
||||
<if test="categoryManagerId != null"> and category_manager_id=#{categoryManagerId} </if>
|
||||
<if test="appId != null"> and app_id=#{appId} </if>
|
||||
<if test="dictId != null"> and dict_id=#{dictId} </if>
|
||||
<if test="categoryFlag != null and categoryFlag != ''">and category_flag=#{categoryFlag}</if>
|
||||
<if test="categoryPath != null and categoryPath != ''">and category_path=#{categoryPath}</if>
|
||||
|
@ -170,9 +166,7 @@
|
|||
<select id="queryChildren" resultMap="resultMap">
|
||||
select * from cms_category
|
||||
<where>
|
||||
<if test="appId > 0">
|
||||
and app_id=#{appId}
|
||||
</if>
|
||||
|
||||
<if test="dictId > 0">
|
||||
and dict_id=#{dictId}
|
||||
</if>
|
||||
|
@ -228,7 +222,6 @@
|
|||
<if test="mdiyModelId != null and mdiyModelId != ''"> and mdiy_model_id=#{mdiyModelId}</if>
|
||||
<if test="categoryDatetime != null"> and category_datetime=#{categoryDatetime} </if>
|
||||
<if test="categoryManagerId != null"> and category_manager_id=#{categoryManagerId} </if>
|
||||
<if test="appId != null"> and app_id=#{appId} </if>
|
||||
<if test="dictId != null"> and dict_id=#{dictId} </if>
|
||||
<if test="categoryFlag != null and categoryFlag != ''"> and category_flag=#{categoryFlag}</if>
|
||||
<if test="categoryPath != null and categoryPath != ''"> and category_path=#{categoryPath}</if>
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
<result column="content_url" property="contentUrl" /><!--文章跳转链接地址 -->
|
||||
<result column="static_url" property="staticUrl" /><!--静态地址 -->
|
||||
<result column="content_hit" property="contentHit" /><!--点击次数 -->
|
||||
<result column="app_id" property="appId" /><!--文章管理的应用id -->
|
||||
<result column="create_by" property="createBy" /><!--创建人 -->
|
||||
<result column="create_date" property="createDate" /><!--创建时间 -->
|
||||
<result column="update_by" property="updateBy" /><!--修改人 -->
|
||||
|
@ -67,7 +66,6 @@
|
|||
<result column="mdiy_model_id" property="mdiyModelId" /><!--栏目管理的内容模型id -->
|
||||
<result column="category_datetime" property="categoryDatetime" /><!--类别发布时间 -->
|
||||
<result column="category_manager_id" property="categoryManagerId" /><!--发布用户id -->
|
||||
<result column="app_id" property="appId" /><!--应用编号 -->
|
||||
<result column="dict_id" property="dictId" /><!--字典对应编号 -->
|
||||
<result column="category_flag" property="categoryFlag" /><!--栏目属性 -->
|
||||
<result column="category_path" property="categoryPath" /><!--栏目路径 -->
|
||||
|
@ -98,7 +96,6 @@
|
|||
<if test="contentDetails != null and contentDetails != ''">content_details,</if>
|
||||
<if test="contentUrl != null and contentUrl != ''">content_url,</if>
|
||||
<if test="contentHit != null">content_hit,</if>
|
||||
<if test="appId != null">app_id,</if>
|
||||
<if test="createBy > 0">create_by,</if>
|
||||
<if test="createDate != null">create_date,</if>
|
||||
<if test="updateBy > 0">update_by,</if>
|
||||
|
@ -120,7 +117,6 @@
|
|||
<if test="contentDetails != null and contentDetails != ''">#{contentDetails},</if>
|
||||
<if test="contentUrl != null and contentUrl != ''">#{contentUrl},</if>
|
||||
<if test="contentHit != null">#{contentHit},</if>
|
||||
<if test="appId != null">#{appId},</if>
|
||||
<if test="createBy > 0">#{createBy},</if>
|
||||
<if test="createDate != null">#{createDate},</if>
|
||||
<if test="updateBy > 0">#{updateBy},</if>
|
||||
|
@ -147,7 +143,6 @@
|
|||
<if test="contentDetails != null ">content_details=#{contentDetails},</if>
|
||||
<if test="contentUrl != null and contentUrl != ''">content_url=#{contentUrl},</if>
|
||||
<if test="contentHit != null">content_hit=#{contentHit},</if>
|
||||
<if test="appId != null">app_id=#{appId},</if>
|
||||
<if test="createBy > 0">create_by=#{createBy},</if>
|
||||
<if test="createDate != null">create_date=#{createDate},</if>
|
||||
<if test="updateBy > 0">update_by=#{updateBy},</if>
|
||||
|
@ -181,7 +176,6 @@
|
|||
<if test="contentDetails != null and contentDetails != ''">and content_details=#{contentDetails}</if>
|
||||
<if test="contentUrl != null and contentUrl != ''">and content_url=#{contentUrl}</if>
|
||||
<if test="contentHit != null">and content_hit=#{contentHit}</if>
|
||||
<if test="appId != null"> and app_id=#{appId} </if>
|
||||
<if test="createBy > 0"> and create_by=#{createBy} </if>
|
||||
<if test="createDate != null"> and create_date=#{createDate} </if>
|
||||
<if test="updateBy > 0"> and update_by=#{updateBy} </if>
|
||||
|
@ -239,7 +233,6 @@
|
|||
<if test="contentDetails != null and contentDetails != ''"> and content_details=#{contentDetails}</if>
|
||||
<if test="contentUrl != null and contentUrl != ''"> and content_url=#{contentUrl}</if>
|
||||
<if test="contentHit != null"> and content_hit=#{contentHit}</if>
|
||||
<if test="appId != null"> and ct.app_id=#{appId} </if>
|
||||
<if test="createBy > 0"> and ct.create_by=#{createBy} </if>
|
||||
<if test="createDate != null"> and ct.create_date=#{createDate} </if>
|
||||
<if test="updateBy > 0"> and ct.update_by=#{updateBy} </if>
|
||||
|
@ -265,9 +258,7 @@
|
|||
FROM cms_content
|
||||
LEFT JOIN cms_category c ON content_category_id = c.id
|
||||
where cms_content.del=0
|
||||
<if test="appId > 0">
|
||||
and cms_content.app_id = #{appId}
|
||||
</if>
|
||||
|
||||
<!-- 查询子栏目数据 -->
|
||||
<if test="contentCategoryId > 0">
|
||||
and (content_category_id=#{contentCategoryId} or content_category_id in
|
||||
|
@ -312,7 +303,7 @@
|
|||
<if test="tableName!=null and tableName!='' and diyMap!=null">left join ${tableName} d on d.link_id=a.id
|
||||
</if>
|
||||
<where>
|
||||
a.del=0 and a.app_id = #{websiteId}
|
||||
a.del=0
|
||||
<if test="ids!=null and ids!=''">
|
||||
and FIND_IN_SET(content_category_id,#{ids})
|
||||
</if>
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import net.mingsoft.base.entity.BaseEntity;
|
||||
|
@ -84,6 +85,7 @@ private static final long serialVersionUID = 1574925152750L;
|
|||
/**
|
||||
* 应用编号
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer appId;
|
||||
/**
|
||||
* 字典对应编号
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.mingsoft.cms.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import net.mingsoft.base.entity.BaseEntity;
|
||||
|
@ -77,6 +78,7 @@ private static final long serialVersionUID = 1574925152617L;
|
|||
/**
|
||||
* 文章管理的应用id
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer appId;
|
||||
/**
|
||||
* 点击次数
|
||||
|
|
|
@ -27,7 +27,6 @@ public class Upgrade {
|
|||
String pingYin = PinYinUtil.getPingYin(x.getCategoryTitle());
|
||||
CategoryEntity category=new CategoryEntity();
|
||||
category.setCategoryPinyin(pingYin);
|
||||
category.setAppId(BasicUtil.getAppId());
|
||||
CategoryEntity categoryBizEntity = (CategoryEntity)categoryBiz.getEntity(category);
|
||||
x.setCategoryPinyin(pingYin);
|
||||
//拼音存在则拼接id
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package net.mingsoft.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import net.mingsoft.basic.util.BasicUtil;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.LongValue;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class AppHandler implements TenantLineHandler {
|
||||
|
||||
@Value("${ms.mwebsite.tables}")
|
||||
private String[] tables;
|
||||
@Override
|
||||
public Expression getTenantId() {
|
||||
//分页插件处理,会被执行两次,一次查询数量,一次查询结果,当查询到了数量之后当前线程变量就会被赋值,再次startPage就会丢失数量,所以判断拿到了数量就不再startPage
|
||||
Page<Object> localPage = PageHelper.getLocalPage();
|
||||
if(localPage!=null&&localPage.getTotal()==0){
|
||||
PageHelper.clearPage();
|
||||
}
|
||||
int appId = BasicUtil.getAppId();
|
||||
if(localPage!=null&&localPage.getTotal()==0){
|
||||
PageHelper.startPage(localPage.getPageNum(),localPage.getPageSize(),localPage.isCount());
|
||||
PageHelper.orderBy(localPage.getOrderBy());
|
||||
}
|
||||
return new LongValue(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenantIdColumn() {
|
||||
return "app_id";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreTable(String tableName) {
|
||||
return ArrayUtil.isEmpty(tables)|| !ArrayUtil.contains(tables,tableName);
|
||||
}
|
||||
}
|
|
@ -13,7 +13,10 @@ logging:
|
|||
path: log #会在项目的根目录下生成log目录,里面会生成对应的日期目录,日期目录下面生成日志压缩包备份文件,默认按每10M分割一个日志文件,例如:log/2020-01/app-2020-01-03-18.1.log.gz(表示2020年1月3号下午六点的第一个备份),也可以根据实际情况写绝对路径,例如:d:/log
|
||||
|
||||
ms:
|
||||
# scheme: https #解决使用代理服务器代理应用时标签解析域名依旧为http的问题
|
||||
mwebsite:
|
||||
#站群需要appid过滤的表
|
||||
tables: cms_category,cms_content,mdiy_dict,mdiy_model,mdiy_page,people,people_address,role
|
||||
# scheme: https #解决使用代理服务器代理应用时标签解析域名依旧为http的问题
|
||||
swagger:
|
||||
enable: true #启用swagger文档,生产的时候务必关掉 访问地址:http://ip|域名/项目发布名/swagger-ui.html
|
||||
manager:
|
||||
|
|
Loading…
Reference in New Issue