Commit 1cb2ffb7 authored by mingsoft's avatar mingsoft

4.5.5版本发布

parent f239661b
...@@ -32,29 +32,34 @@ import java.net.UnknownHostException; ...@@ -32,29 +32,34 @@ import java.net.UnknownHostException;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.context.support.WebApplicationContextUtils; import org.springframework.web.context.support.WebApplicationContextUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.base.constant.e.BaseEnum; import com.mingsoft.base.constant.e.BaseEnum;
import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.base.entity.ResultJson; import com.mingsoft.base.entity.ResultJson;
import com.mingsoft.base.entity.SessionEntity; import com.mingsoft.base.entity.SessionEntity;
import com.mingsoft.basic.biz.IAppBiz; import com.mingsoft.basic.biz.IAppBiz;
import com.mingsoft.basic.entity.AppEntity; import com.mingsoft.basic.entity.AppEntity;
import com.mingsoft.basic.entity.ModelEntity; import com.mingsoft.basic.entity.ModelEntity;
import com.mingsoft.basic.entity.ModelTemplateEntity; import com.mingsoft.basic.entity.ModelTemplateEntity;
import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.parser.IGeneralParser; import com.mingsoft.parser.IGeneralParser;
import com.mingsoft.parser.IParserRegexConstant; import com.mingsoft.parser.IParserRegexConstant;
import com.mingsoft.util.AESUtil; import com.mingsoft.util.AESUtil;
...@@ -344,7 +349,6 @@ public abstract class BaseAction { ...@@ -344,7 +349,6 @@ public abstract class BaseAction {
cookie.setMaxAge(maxAge); cookie.setMaxAge(maxAge);
response.addCookie(cookie); response.addCookie(cookie);
} }
/** /**
* 输出json数据 * 输出json数据
* @param response HttpServletResponse对象 * @param response HttpServletResponse对象
...@@ -354,8 +358,10 @@ public abstract class BaseAction { ...@@ -354,8 +358,10 @@ public abstract class BaseAction {
* 成功状态,true:成功、false:失败 * 成功状态,true:成功、false:失败
* @param msg * @param msg
* 提示信息 * 提示信息
* @param data
* 数据
*/ */
protected void outJson(HttpServletResponse response, BaseEnum code, boolean flag, String msg) { protected void outJson(HttpServletResponse response, BaseEnum code, boolean flag, String msg, String data) {
try { try {
ResultJson result = new ResultJson(); ResultJson result = new ResultJson();
if (code != null) { if (code != null) {
...@@ -363,6 +369,7 @@ public abstract class BaseAction { ...@@ -363,6 +369,7 @@ public abstract class BaseAction {
} }
result.setResult(flag); result.setResult(flag);
result.setResultMsg(msg); result.setResultMsg(msg);
result.setResultData(data);
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter(); PrintWriter out = response.getWriter();
out.print(JSONObject.toJSON(result)); out.print(JSONObject.toJSON(result));
...@@ -375,6 +382,7 @@ public abstract class BaseAction { ...@@ -375,6 +382,7 @@ public abstract class BaseAction {
} }
} }
/** /**
* 输出json数据 * 输出json数据
* @param response HttpServletResponse对象 * @param response HttpServletResponse对象
...@@ -382,24 +390,11 @@ public abstract class BaseAction { ...@@ -382,24 +390,11 @@ public abstract class BaseAction {
* 模块编号<br/> * 模块编号<br/>
* @param flag * @param flag
* 成功状态,true:成功、false:失败 * 成功状态,true:成功、false:失败
* @param msg
* 提示信息
*/ */
protected void outJson(HttpServletResponse response, BaseEnum code, boolean flag) { protected void outJson(HttpServletResponse response, BaseEnum code, boolean flag, String msg) {
try { this.outJson(response, code, flag, msg, null);
ResultJson result = new ResultJson();
if (code != null) {
result.setCode(code.toString());
}
result.setResult(flag);
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
out.print(JSONObject.toJSON(result));
LOG.debug(JSONObject.toJSON(result));
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
LOG.error(e);
}
} }
/** /**
...@@ -409,32 +404,23 @@ public abstract class BaseAction { ...@@ -409,32 +404,23 @@ public abstract class BaseAction {
* 模块编号<br/> * 模块编号<br/>
* @param flag * @param flag
* 成功状态,true:成功、false:失败 * 成功状态,true:成功、false:失败
* @param msg
* 提示信息
* @param data
* 数据
*/ */
protected void outJson(HttpServletResponse response, BaseEnum code, boolean flag, String msg, String data) { protected void outJson(HttpServletResponse response, BaseEnum code, boolean flag) {
try { this.outJson(response, code, flag, null, null);
ResultJson result = new ResultJson();
if (code != null) {
result.setCode(code.toString());
}
result.setResult(flag);
result.setResultMsg(msg);
result.setResultData(data);
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
out.print(JSONObject.toJSON(result));
LOG.debug(JSONObject.toJSON(result));
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
LOG.error(e);
} }
/**
* 输出json数据
* @param response HttpServletResponse对象
* @param flag
* 成功状态,true:成功、false:失败
*/
protected void outJson(HttpServletResponse response, boolean flag) {
this.outJson(response, null, flag, null, null);
} }
/** /**
* 输出json数据字符串 * 输出json数据字符串
* @param response HttpServletResponse对象 * @param response HttpServletResponse对象
...@@ -454,6 +440,25 @@ public abstract class BaseAction { ...@@ -454,6 +440,25 @@ public abstract class BaseAction {
} }
} }
/**
* 将BaseEntity以json字符串格式输出
* @param response
* @param entity 实体对象
*/
protected void outJson(HttpServletResponse response, BaseEntity entity) {
this.outJson(response, JSONObject.toJSONString(entity));
}
/**
* 将list以json字符串格式输出
* @param response HttpServletResponse对象
* @param list 记录集合
*/
protected void outJson(HttpServletResponse response, List list) {
JSONObject.toJSONString(list);
}
/** /**
* 输出String数据字符串 * 输出String数据字符串
* @param response HttpServletResponse对象 * @param response HttpServletResponse对象
...@@ -571,7 +576,7 @@ public abstract class BaseAction { ...@@ -571,7 +576,7 @@ public abstract class BaseAction {
* @return 返回获取到的字符串 * @return 返回获取到的字符串
*/ */
protected String getResString(String key, String... fullStrs) { protected String getResString(String key, String... fullStrs) {
String temp = Const.RESOURCES.getString(key); String temp = this.getResString(key);
for (int i = 0; i < fullStrs.length; i++) { for (int i = 0; i < fullStrs.length; i++) {
temp = temp.replace("{" + i + "}", fullStrs[i]); temp = temp.replace("{" + i + "}", fullStrs[i]);
} }
...@@ -591,8 +596,7 @@ public abstract class BaseAction { ...@@ -591,8 +596,7 @@ public abstract class BaseAction {
try { try {
temp = rb.getString(key); temp = rb.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
temp = Const.RESOURCES.getString(key); temp = getResString(key);
;
} }
for (int i = 0; i < fullStrs.length; i++) { for (int i = 0; i < fullStrs.length; i++) {
temp = temp.replace("{" + i + "}", fullStrs[i]); temp = temp.replace("{" + i + "}", fullStrs[i]);
...@@ -732,6 +736,10 @@ public abstract class BaseAction { ...@@ -732,6 +736,10 @@ public abstract class BaseAction {
return null; return null;
} }
ResourceBundle rb = ResourceBundle.getBundle(filePath); ResourceBundle rb = ResourceBundle.getBundle(filePath);
return this.getMapByProperties(rb);
}
protected Map<String, String> getMapByProperties(ResourceBundle rb) {
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
Enumeration<String> en = rb.getKeys(); Enumeration<String> en = rb.getKeys();
while (en.hasMoreElements()) { while (en.hasMoreElements()) {
...@@ -751,9 +759,10 @@ public abstract class BaseAction { ...@@ -751,9 +759,10 @@ public abstract class BaseAction {
* @return 返回当期项目物理路径 * @return 返回当期项目物理路径
*/ */
protected String getRealPath(HttpServletRequest request, String filePath) { protected String getRealPath(HttpServletRequest request, String filePath) {
return request.getServletContext().getRealPath("/") + File.separator + filePath; return request.getServletContext().getRealPath("") + File.separator + filePath;
} }
/** /**
* 获取当前模块编号 * 获取当前模块编号
* *
......
#\u5168\u5c40\u9519\u8bef\u4fe1\u606f #\u5168\u5c40\u9519\u8bef\u4fe1\u606f
err=\u7cfb\u7edf\u914d\u7f6e\u9519\u8bef\uff0c\u5c1d\u8bd5\u8fdb\u5165\u540e\u53f0\u7ba1\u7406\u4e2d\u5fc3<a href="ms/login.do">\u540e\u53f0\u767b\u9646</a>\u6216\u53bb\u5b98\u7f51\u793e\u533a\u627e\u627e\u7b54\u6848 <a href="http://ms.ming-soft.com">\u5b98\u65b9\u793e\u533a</a> err=\u60a8\u7684\u64cd\u4f5c\u88ab\u7cfb\u7edf\u62d2\u7edd\uff0c\u8bf7\u8054\u7cfb\u7cfb\u7edf\u7ba1\u7406\u4eba\u5458\uff01
err.empty={0}\u4e0d\u80fd\u4e3a\u7a7a! err.empty={0}\u4e0d\u80fd\u4e3a\u7a7a!
err.error={0}\u9519\u8bef! err.error={0}\u9519\u8bef!
err.length={0}\u957f\u5ea6\u9519\u8bef,\u5fc5\u987b\u5728{1}\uff0c{2}\u4e4b\u95f4! err.length={0}\u957f\u5ea6\u9519\u8bef,\u5fc5\u987b\u5728{1}\uff0c{2}\u4e4b\u95f4!
......
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.base.aop;
import org.apache.log4j.Logger;
/**
* 切面基础
* @author 王天培QQ:78750478
* @version
* 版本号:100-000-000<br/>
* 创建日期:2012-03-15<br/>
* 历史修订:<br/>
*/
public abstract class BaseAdvice {
/*
* log4j日志记录
*/
protected final Logger LOG = Logger.getLogger(this.getClass());
}
\ No newline at end of file
...@@ -23,6 +23,10 @@ package com.mingsoft.base.biz; ...@@ -23,6 +23,10 @@ package com.mingsoft.base.biz;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.mingsoft.base.constant.e.TableEnum;
import com.mingsoft.base.entity.BaseEntity; import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.util.PageUtil; import com.mingsoft.util.PageUtil;
...@@ -36,6 +40,8 @@ import com.mingsoft.util.PageUtil; ...@@ -36,6 +40,8 @@ import com.mingsoft.util.PageUtil;
*/ */
public interface IBaseBiz { public interface IBaseBiz {
/** /**
* 保存 * 保存
* *
...@@ -155,8 +161,17 @@ public interface IBaseBiz { ...@@ -155,8 +161,17 @@ public interface IBaseBiz {
* @param fileds key:字段名称 list[0] 类型 list[1]长度 list[2]默认值 list[3]是否不填 * @param fileds key:字段名称 list[0] 类型 list[1]长度 list[2]默认值 list[3]是否不填
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Deprecated
void alterTable(String table,Map fileds,String type); void alterTable(String table,Map fileds,String type);
/**
* 修改表
* @param table 表名
* @param fileds 修改字段
* @param type 修改类型 @see TableEnum
*/
void alterTable(String table,Map fileds,TableEnum type);
/** /**
* 删除表 * 删除表
* @param table 表名称 * @param table 表名称
......
...@@ -25,6 +25,7 @@ import java.util.List; ...@@ -25,6 +25,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.mingsoft.base.biz.IBaseBiz; import com.mingsoft.base.biz.IBaseBiz;
import com.mingsoft.base.constant.e.TableEnum;
import com.mingsoft.base.dao.IBaseDao; import com.mingsoft.base.dao.IBaseDao;
import com.mingsoft.base.entity.BaseEntity; import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.util.PageUtil; import com.mingsoft.util.PageUtil;
...@@ -40,11 +41,7 @@ import com.mingsoft.util.PageUtil; ...@@ -40,11 +41,7 @@ import com.mingsoft.util.PageUtil;
*/ */
public abstract class BaseBizImpl implements IBaseBiz { public abstract class BaseBizImpl implements IBaseBiz {
/**
* LOG对象
*/
protected final Logger LOG = Logger.getLogger(this.getClass()); protected final Logger LOG = Logger.getLogger(this.getClass());
@Override @Override
public int saveEntity(BaseEntity entity) { public int saveEntity(BaseEntity entity) {
return getDao().saveEntity(entity); return getDao().saveEntity(entity);
...@@ -141,6 +138,11 @@ public abstract class BaseBizImpl implements IBaseBiz { ...@@ -141,6 +138,11 @@ public abstract class BaseBizImpl implements IBaseBiz {
getDao().alterTable(table, fileds,type); getDao().alterTable(table, fileds,type);
} }
public void alterTable(String table, Map fileds,TableEnum type) {
// TODO Auto-generated method stub
getDao().alterTable(table, fileds,type.toString());
}
@Override @Override
public void dropTable(String table) { public void dropTable(String table) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
......
...@@ -58,8 +58,7 @@ public final class Const { ...@@ -58,8 +58,7 @@ public final class Const {
/** /**
* action层对应的国际化资源文件 * action层对应的国际化资源文件
*/ */
public final static ResourceBundle RESOURCES = ResourceBundle public final static ResourceBundle RESOURCES = ResourceBundle.getBundle("com.mingsoft.base.action.resources");
.getBundle("com.mingsoft.base.action.resources");
/** /**
* 默认系统管理员所对应的角色ID为1 * 默认系统管理员所对应的角色ID为1
...@@ -92,6 +91,10 @@ public final class Const { ...@@ -92,6 +91,10 @@ public final class Const {
*/ */
public final static String UTF8 = "utf-8"; public final static String UTF8 = "utf-8";
/**
* 文件路径符
*/
public final static String SEPARATOR ="/";
} }
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.base.constant.e;
/**
* 表字段类型常规定义
*
* @author 会飞的猪
* @version 版本号:100-000-000<br/>
* 创建日期:2016年1月17日<br/>
* 历史修订:<br/>
*/
public enum TableCloumnEnum implements BaseEnum {
VARCHAR(1, "varchar"), TEXT(3, "text"), INT(4, "int"), DATETIME(2, "datetime"), FLOAT(5, "float");
private String obj;
private int id;
TableCloumnEnum(int id, String obj) {
this.obj = obj;
this.id = id;
}
@Override
public int toInt() {
// TODO Auto-generated method stub
return id;
}
public String toString() {
return this.obj.toString();
}
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.base.constant.e;
/**
* 表常规定义
*
* @author 会飞的猪
* @version 版本号:100-000-000<br/>
* 创建日期:2016年1月17日<br/>
* 历史修订:<br/>
*/
public enum TableEnum implements BaseEnum {
ALTER_ADD("add"), ALTER_MODIFY("modify"), ALTER_DROP("drop");
private String obj;
TableEnum(String obj) {
this.obj = obj;
}
@Override
public int toInt() {
// TODO Auto-generated method stub
return 0;
}
public String toString() {
return this.obj.toString();
}
}
\ No newline at end of file
...@@ -70,7 +70,8 @@ ...@@ -70,7 +70,8 @@
<update id="createTable" statementType="STATEMENT"> <update id="createTable" statementType="STATEMENT">
CREATE TABLE `${table}` ( CREATE TABLE `${table}` (
`basicId` int(11) NOT NULL, `basicId` int(11) NOT NULL,
PRIMARY KEY (`basicId`) PRIMARY KEY (`basicId`),
CONSTRAINT `fk_${table}_basicId` FOREIGN KEY (`basicId`) REFERENCES `basic` (`basic_id`) ON DELETE CASCADE
) ENGINE=InnoDB ) ENGINE=InnoDB
AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
</update> </update>
...@@ -82,20 +83,14 @@ ...@@ -82,20 +83,14 @@
<choose> <choose>
<when test="type=='add'"> <when test="type=='add'">
ALTER TABLE ${table} add `${fileds.fieldName}` ${fileds.fieldType} ALTER TABLE ${table} add `${fileds.fieldName}` ${fileds.fieldType}
<if test="fileds.fieldType!='text'"> <if test="fileds.default !=null">default '${fileds.default}'</if>
<if test="fileds.default ==''">default null</if>
<if test="fileds.default !=''">default '${fileds.default}'</if>
</if>
</when> </when>
<when test="type=='modify'"> <when test="type=='modify'">
ALTER TABLE ${table} change `${fileds.fieldOldName}` ALTER TABLE ${table} change `${fileds.fieldOldName}`
`${fileds.fieldName}` ${fileds.fieldType} `${fileds.fieldName}` ${fileds.fieldType}
<if test="fileds.fieldType!='text'"> <if test="fileds.default !=null">default '${fileds.default}'</if>
<if test="fileds.default ==''">default null</if>
<if test="fileds.default !=''">default '${fileds.default}'</if>
</if>
</when> </when>
<when test="type=='drop'"> <when test="type=='drop'">
......
...@@ -28,10 +28,6 @@ import javax.servlet.annotation.WebListener; ...@@ -28,10 +28,6 @@ import javax.servlet.annotation.WebListener;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.web.context.support.WebApplicationContextUtils; import org.springframework.web.context.support.WebApplicationContextUtils;
import com.mingsoft.base.constant.Const; import com.mingsoft.base.constant.Const;
import com.mingsoft.basic.biz.IAppBiz;
import com.mingsoft.basic.entity.AppEntity;
import com.mingsoft.util.FileUtil;
import com.mingsoft.util.StringUtil;
/** /**
* 启动监听 * 启动监听
...@@ -49,7 +45,6 @@ public class StartUpListener implements ServletContextListener { ...@@ -49,7 +45,6 @@ public class StartUpListener implements ServletContextListener {
*/ */
protected final Logger LOG = Logger.getLogger(this.getClass()); protected final Logger LOG = Logger.getLogger(this.getClass());
/** /**
* *
* 监听项目启动,进行初始化 * 监听项目启动,进行初始化
......
...@@ -36,11 +36,11 @@ import com.mingsoft.basic.action.BaseAction; ...@@ -36,11 +36,11 @@ import com.mingsoft.basic.action.BaseAction;
import com.mingsoft.base.entity.BaseEntity; import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.biz.IAppBiz; import com.mingsoft.basic.biz.IAppBiz;
import com.mingsoft.basic.biz.IManagerBiz; import com.mingsoft.basic.biz.IManagerBiz;
import com.mingsoft.basic.entity.AppEntity;
import com.mingsoft.basic.entity.ManagerEntity;
import com.mingsoft.base.constant.CookieConst; import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.ModelCode; import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.base.constant.SessionConst; import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.basic.entity.AppEntity;
import com.mingsoft.basic.entity.ManagerEntity;
import com.mingsoft.parser.IParserRegexConstant; import com.mingsoft.parser.IParserRegexConstant;
import com.mingsoft.util.PageUtil; import com.mingsoft.util.PageUtil;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
...@@ -69,7 +69,34 @@ public class AppAction extends BaseAction{ ...@@ -69,7 +69,34 @@ public class AppAction extends BaseAction{
@Autowired @Autowired
private IManagerBiz managerBiz; private IManagerBiz managerBiz;
/**
* 对系统管理进行的查询站点列表信息
* @param request 请求对象
* @param mode ModelMap实体对象
* @param response 响应对象
* @return 站点列表显示页面
*/
@RequestMapping("/list")
public String queryList(HttpServletRequest request,ModelMap mode,HttpServletResponse response){
ManagerEntity managerSession = (ManagerEntity) getSession(request, SessionConst.MANAGER_ESSION);
int pageNo=1;
//查询总记录数
int recordCount = appBiz.queryCount();
//排序依据字段
String orderBy="app_id";
if(request.getParameter("pageNo")!=null){
pageNo=Integer.parseInt(request.getParameter("pageNo").toString());
}
PageUtil page=new PageUtil(pageNo,100,recordCount,getUrl(request)+"/manager/app/list.do");
//保存cookie值
this.setCookie(request, response, CookieConst.PAGENO_COOKIE, String.valueOf(pageNo));
//分页查询
List<BaseEntity>apps = appBiz.queryByPage(page, orderBy,false);
mode.addAttribute("listApp",apps);
mode.addAttribute("page",page);
mode.addAttribute("managerSession", managerSession);
return "/manager/app/app_list";
}
/** /**
* 根据id删除站点信息 * 根据id删除站点信息
......
...@@ -21,43 +21,47 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技 ...@@ -21,43 +21,47 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技
package com.mingsoft.basic.action; package com.mingsoft.basic.action;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.mingsoft.basic.biz.IMailBiz; import com.mingsoft.basic.biz.IMailBiz;
import com.mingsoft.basic.biz.IMailTemplateBiz; import com.mingsoft.basic.biz.IMailTemplateBiz;
import com.mingsoft.basic.biz.IModelBiz; import com.mingsoft.basic.biz.IModelBiz;
import com.mingsoft.basic.biz.impl.MailTemplateBizImpl; import com.mingsoft.basic.biz.impl.MailTemplateBizImpl;
import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.basic.constant.e.MailEnum; import com.mingsoft.basic.constant.e.MailEnum;
import com.mingsoft.basic.entity.AppEntity; import com.mingsoft.basic.entity.AppEntity;
import com.mingsoft.basic.entity.MailEntity; import com.mingsoft.basic.entity.MailEntity;
import com.mingsoft.basic.entity.MailTemplateEntity; import com.mingsoft.basic.entity.MailTemplateEntity;
import com.mingsoft.basic.entity.ManagerSessionEntity; import com.mingsoft.basic.entity.ManagerSessionEntity;
import com.mingsoft.basic.entity.ModelEntity; import com.mingsoft.basic.entity.ModelEntity;
import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.util.MailUtil; import com.mingsoft.util.MailUtil;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
/** /**
* 基础应用层的父类base * 基础应用层的父类base
*
* @author 成卫雄 * @author 成卫雄
* @version * @version 版本号:100-000-000<br/>
* 版本号:100-000-000<br/>
* 创建日期:2015-7-19<br/> * 创建日期:2015-7-19<br/>
* 历史修订:<br/> * 历史修订:<br/>
*/ */
public class BaseAction extends com.mingsoft.base.action.BaseAction{ public class BaseAction extends com.mingsoft.base.action.BaseAction {
/** /**
* 根据当前的模块获取到当前模块的分类模块信息 * 根据当前的模块获取到当前模块的分类模块信息
* @param request 请求对象 *
* @param request
* 请求对象
* @return 错误返回null,正确返回模块实体对象 * @return 错误返回null,正确返回模块实体对象
*/ */
protected ModelEntity getCategoryModelCode(HttpServletRequest request) { protected ModelEntity getCategoryModelCode(HttpServletRequest request) {
Object obj = this.getSession Object obj = this.getSession(request, SessionConst.MODEL_ID_SESSION);
(request, SessionConst.MODEL_ID_SESSION);
if (StringUtil.isInteger(obj)) { if (StringUtil.isInteger(obj)) {
com.mingsoft.basic.biz.IModelBiz modelBiz = (com.mingsoft.basic.biz.IModelBiz) getBean(request.getServletContext(), "modelBiz"); com.mingsoft.basic.biz.IModelBiz modelBiz = (com.mingsoft.basic.biz.IModelBiz) getBean(
request.getServletContext(), "modelBiz");
return modelBiz.getModel(IModelBiz.CATEGORY_MODEL, Integer.parseInt(obj.toString())); return modelBiz.getModel(IModelBiz.CATEGORY_MODEL, Integer.parseInt(obj.toString()));
} else { } else {
return null; return null;
...@@ -66,13 +70,16 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{ ...@@ -66,13 +70,16 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{
/** /**
* 根据当前的模块获取到当前模块的basic文章模块信息 * 根据当前的模块获取到当前模块的basic文章模块信息
* @param request 请求对象 *
* @param request
* 请求对象
* @return 错误返回null,正确返回模块实体对象 * @return 错误返回null,正确返回模块实体对象
*/ */
protected ModelEntity getBasicModelCode(HttpServletRequest request) { protected ModelEntity getBasicModelCode(HttpServletRequest request) {
Object obj = this.getSession(request, SessionConst.MODEL_ID_SESSION); Object obj = this.getSession(request, SessionConst.MODEL_ID_SESSION);
if (StringUtil.isInteger(obj)) { if (StringUtil.isInteger(obj)) {
com.mingsoft.basic.biz.IModelBiz modelBiz = (com.mingsoft.basic.biz.IModelBiz) getBean(request.getServletContext(), "modelBiz"); com.mingsoft.basic.biz.IModelBiz modelBiz = (com.mingsoft.basic.biz.IModelBiz) getBean(
request.getServletContext(), "modelBiz");
return modelBiz.getModel(IModelBiz.BASIC_MODEL, Integer.parseInt(obj.toString())); return modelBiz.getModel(IModelBiz.BASIC_MODEL, Integer.parseInt(obj.toString()));
} else { } else {
return null; return null;
...@@ -81,7 +88,9 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{ ...@@ -81,7 +88,9 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{
/** /**
* 获得当前应用的邮件服务器 * 获得当前应用的邮件服务器
* @param request 请求对象 *
* @param request
* 请求对象
* @return null 表示没有找到,正确返回邮箱实体对象 * @return null 表示没有找到,正确返回邮箱实体对象
*/ */
protected MailEntity getMail(HttpServletRequest request) { protected MailEntity getMail(HttpServletRequest request) {
...@@ -100,59 +109,81 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{ ...@@ -100,59 +109,81 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{
/** /**
* 发送邮件 * 发送邮件
* @param request 请求对象 *
* @param mailType 邮件类型(MailEntity.TEXT MailEntity.HTML) * @param request
* @param title 标题 * 请求对象
* @param content 内容 * @param mailType
* @param toUser 接收用户 * 邮件类型(MailEntity.TEXT MailEntity.HTML)
* @param title
* 标题
* @param content
* 内容
* @param toUser
* 接收用户
*/ */
protected void sendMail(HttpServletRequest request, MailEnum mailType, String title, String content, String[] toUser) { protected void sendMail(HttpServletRequest request, MailEnum mailType, String title, String content,
String[] toUser) {
MailEntity mail = getMail(request); MailEntity mail = getMail(request);
if (mailType.toInt() == MailEnum.TEXT.toInt()) { if (mailType.toInt() == MailEnum.TEXT.toInt()) {
MailUtil.sendText(mail.getMailServer(), mail.getMailPort(), mail.getMailName(), mail.getMailPassword(), title, content, toUser); MailUtil.sendText(mail.getMailServer(), mail.getMailPort(), mail.getMailName(), mail.getMailPassword(),
title, content, toUser);
} else if (mailType.toInt() == MailEnum.HTML.toInt()) { } else if (mailType.toInt() == MailEnum.HTML.toInt()) {
MailUtil.sendHtml(mail.getMailServer(), mail.getMailPort(), mail.getMailName(), mail.getMailPassword(), title, content, toUser); MailUtil.sendHtml(mail.getMailServer(), mail.getMailPort(), mail.getMailName(), mail.getMailPassword(),
title, content, toUser);
} }
} }
/** /**
* 发送html邮件内容 * 发送html邮件内容
* @param request 请求对象 *
* @param modelCode 模块编码 * @param request
* @param toUser 接收用户邮件地址 * 请求对象
* @param content 发送内容 * @param modelCode
* 模块编码
* @param toUser
* 接收用户邮件地址
* @param content
* 发送内容
*/ */
@Deprecated @Deprecated
protected void sendMail(HttpServletRequest request, String modelCode, String[] toUser,String content) { protected void sendMail(HttpServletRequest request, String modelCode, String[] toUser, String content) {
IMailTemplateBiz mailTemplateBiz = (MailTemplateBizImpl)this.getBean(request.getServletContext(), "mailTemplateBiz"); IMailTemplateBiz mailTemplateBiz = (MailTemplateBizImpl) this.getBean(request.getServletContext(),
"mailTemplateBiz");
int modelId = this.getModelCodeId(request, modelCode); int modelId = this.getModelCodeId(request, modelCode);
MailTemplateEntity mte = mailTemplateBiz.getByAppIdAndModelCode(this.getAppId(request), modelId); MailTemplateEntity mte = mailTemplateBiz.getByAppIdAndModelCode(this.getAppId(request), modelId);
if (mte!=null) { if (mte != null) {
String _content = mte.getMailTemplateContent(); String _content = mte.getMailTemplateContent();
_content = _content.replace("{content}", content); _content = _content.replace("{content}", content);
//如果实体不为空就获取邮箱模板的标题和内容一起发送指定的邮箱地址 // 如果实体不为空就获取邮箱模板的标题和内容一起发送指定的邮箱地址
this.sendMail(request, MailEnum.HTML,mte.getMailTemplateTitle(),_content, toUser); this.sendMail(request, MailEnum.HTML, mte.getMailTemplateTitle(), _content, toUser);
} }
} }
/** /**
* 发送html邮件内容,谨慎使用 * 发送html邮件内容,谨慎使用
* @param request 请求对象 *
* @param modelCodeId 模块编号,一般提供给后台没有对模块进行统一管理的模块 * @param request
* @param toUser 接收用户邮件地址 * 请求对象
* @param modelCodeId
* 模块编号,一般提供给后台没有对模块进行统一管理的模块
* @param toUser
* 接收用户邮件地址
*/ */
protected void sendMail(HttpServletRequest request, int modelCodeId, String[] toUser) { protected void sendMail(HttpServletRequest request, int modelCodeId, String[] toUser) {
IMailTemplateBiz mailTemplateBiz = (MailTemplateBizImpl)this.getBean(request.getServletContext(), "mailTemplateBiz"); IMailTemplateBiz mailTemplateBiz = (MailTemplateBizImpl) this.getBean(request.getServletContext(),
"mailTemplateBiz");
MailTemplateEntity mte = mailTemplateBiz.getByAppIdAndModelCode(this.getAppId(request), modelCodeId); MailTemplateEntity mte = mailTemplateBiz.getByAppIdAndModelCode(this.getAppId(request), modelCodeId);
if (mte!=null) { if (mte != null) {
//如果实体不为空就获取邮箱模板的标题和内容一起发送指定的邮箱地址 // 如果实体不为空就获取邮箱模板的标题和内容一起发送指定的邮箱地址
this.sendMail(request, MailEnum.HTML,mte.getMailTemplateTitle(),mte.getMailTemplateContent(), toUser); this.sendMail(request, MailEnum.HTML, mte.getMailTemplateTitle(), mte.getMailTemplateContent(), toUser);
} }
} }
/** /**
* 获取管理员id,规则:没有父ID就获取自身的ID * 获取管理员id,规则:没有父ID就获取自身的ID
* @param request 请求对象 *
* @param request
* 请求对象
* @return 管理员编号 * @return 管理员编号
*/ */
protected int getManagerId(HttpServletRequest request) { protected int getManagerId(HttpServletRequest request) {
...@@ -168,7 +199,9 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{ ...@@ -168,7 +199,9 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{
/** /**
* 判断当前管理员是否是系统平台管理员 * 判断当前管理员是否是系统平台管理员
* @param request 请求对象 *
* @param request
* 请求对象
* @return true:是系统平台管理员,false:不是系统平台管理员 * @return true:是系统平台管理员,false:不是系统平台管理员
*/ */
protected boolean isSystemManager(HttpServletRequest request) { protected boolean isSystemManager(HttpServletRequest request) {
...@@ -182,12 +215,15 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{ ...@@ -182,12 +215,15 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{
/** /**
* 读取管理员session * 读取管理员session
* @param request 请求对象 *
* @param request
* 请求对象
* @return 获取不到就返回null * @return 获取不到就返回null
*/ */
protected ManagerSessionEntity getManagerBySession(HttpServletRequest request) { protected ManagerSessionEntity getManagerBySession(HttpServletRequest request) {
// 传入用管理员请求,读取管理员的session || super,调用父类的protected属性的getSession方法 // 传入用管理员请求,读取管理员的session || super,调用父类的protected属性的getSession方法
ManagerSessionEntity managerSession = (ManagerSessionEntity) this.getSession(request, SessionConst.MANAGER_ESSION); ManagerSessionEntity managerSession = (ManagerSessionEntity) this.getSession(request,
SessionConst.MANAGER_ESSION);
if (managerSession != null) { if (managerSession != null) {
// 返回管理员的所有信息 // 返回管理员的所有信息
return managerSession; return managerSession;
...@@ -195,4 +231,16 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{ ...@@ -195,4 +231,16 @@ public class BaseAction extends com.mingsoft.base.action.BaseAction{
return null; return null;
} }
@Override
protected String getResString(String key) {
// TODO Auto-generated method stub
String str = "";
try {
str = super.getResString(key);
} catch (MissingResourceException e) {
str = com.mingsoft.basic.constant.Const.RESOURCES.getString(key);
}
return str;
}
} }
\ No newline at end of file
...@@ -36,13 +36,13 @@ import com.alibaba.fastjson.JSONArray; ...@@ -36,13 +36,13 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mingsoft.basic.action.BaseAction; import com.mingsoft.basic.action.BaseAction;
import com.mingsoft.basic.biz.ICategoryBiz; import com.mingsoft.basic.biz.ICategoryBiz;
import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.basic.entity.AppEntity; import com.mingsoft.basic.entity.AppEntity;
import com.mingsoft.basic.entity.CategoryEntity; import com.mingsoft.basic.entity.CategoryEntity;
import com.mingsoft.basic.entity.ManagerEntity; import com.mingsoft.basic.entity.ManagerEntity;
import com.mingsoft.basic.entity.ManagerSessionEntity; import com.mingsoft.basic.entity.ManagerSessionEntity;
import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.util.PageUtil; import com.mingsoft.util.PageUtil;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
......
...@@ -19,7 +19,7 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技 ...@@ -19,7 +19,7 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package com.mingsoft.cms.action; package com.mingsoft.basic.action;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -33,13 +33,15 @@ import org.springframework.web.bind.annotation.PathVariable; ...@@ -33,13 +33,15 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.mingsoft.base.action.BaseAction; import com.mingsoft.base.action.BaseAction;
import com.mingsoft.base.entity.BaseEntity; import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.entity.ManagerEntity; import com.mingsoft.basic.entity.ManagerEntity;
import com.mingsoft.cms.biz.IContentModelBiz; import com.mingsoft.basic.biz.IContentModelBiz;
import com.mingsoft.cms.entity.ContentModelEntity; import com.mingsoft.basic.biz.IFieldBiz;
import com.mingsoft.base.constant.CookieConst; import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.SessionConst; import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.basic.entity.ContentModelEntity;
import com.mingsoft.util.PageUtil; import com.mingsoft.util.PageUtil;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
/** /**
...@@ -78,8 +80,8 @@ import com.mingsoft.util.StringUtil; ...@@ -78,8 +80,8 @@ import com.mingsoft.util.StringUtil;
* </p> * </p>
*/ */
@Controller @Controller
@RequestMapping("/manager/cms/contentModel/") @RequestMapping("/manager/contentModel/")
public class ContentModelAction extends BaseAction{ public class ContentModelAction extends com.mingsoft.basic.action.BaseAction{
/** /**
* 自定义表前缀 * 自定义表前缀
...@@ -96,9 +98,10 @@ public class ContentModelAction extends BaseAction{ ...@@ -96,9 +98,10 @@ public class ContentModelAction extends BaseAction{
private IContentModelBiz contentModelBiz; private IContentModelBiz contentModelBiz;
/** /**
* 表单列表路径 * 注入字段业务层
*/ */
private final static String PAGE_URL="/manager/cms/contentModel/list.do"; @Autowired
private IFieldBiz fieldBiz;
/** /**
* 表单列表 * 表单列表
...@@ -115,12 +118,12 @@ public class ContentModelAction extends BaseAction{ ...@@ -115,12 +118,12 @@ public class ContentModelAction extends BaseAction{
pageNo = "1"; pageNo = "1";
} }
int recordCount = contentModelBiz.getContentModelByManagerId(managerId); int recordCount = contentModelBiz.getContentModelByManagerId(managerId);
PageUtil page = new PageUtil(StringUtil.string2Int(pageNo), recordCount, getUrl(request)+ PAGE_URL); PageUtil page = new PageUtil(1000);
this.setCookie(request, response, CookieConst.PAGENO_COOKIE, pageNo); this.setCookie(request, response, CookieConst.PAGENO_COOKIE, pageNo);
List<BaseEntity> listContentModel = contentModelBiz.queryPageByManagerId(page, "CM_ID", false,managerId); List<BaseEntity> listContentModel = contentModelBiz.queryPageByManagerId(page, "CM_ID", false,managerId);
model.addAttribute("listContentModel", listContentModel); model.addAttribute("listContentModel", listContentModel);
model.addAttribute("page", page); model.addAttribute("page", page);
return "/manager/cms/form/form_list"; return "/manager/content_model/content_model_list";
} }
/** /**
...@@ -129,18 +132,19 @@ public class ContentModelAction extends BaseAction{ ...@@ -129,18 +132,19 @@ public class ContentModelAction extends BaseAction{
* @param request 请求 * @param request 请求
* @param response 响应 * @param response 响应
*/ */
@RequestMapping("/{cmId}/delete") @RequestMapping("/delete")
@ResponseBody @ResponseBody
public int delete(@PathVariable int cmId, HttpServletRequest request) { public void delete(HttpServletRequest request,HttpServletResponse response) {
int pageNo = 1; String cmIds = request.getParameter("cmId");
if (cmId != 0) { if (!StringUtil.isBlank(cmIds) && StringUtil.isIntegers(cmIds.split(","))) {
ContentModelEntity contentModel = (ContentModelEntity) contentModelBiz.getEntity(cmId); Integer[] ids = StringUtil.stringsToIntegers(cmIds.split(","));
contentModelBiz.dropTable(contentModel.getCmTableName()); for (int i=0;i<ids.length;i++) {
contentModelBiz.deleteEntity(cmId); ContentModelEntity cme = (ContentModelEntity)contentModelBiz.getEntity(ids[i]);
//判断当前页码 contentModelBiz.dropTable(cme.getCmTableName());
this.getHistoryPageNoByCookie(request); contentModelBiz.deleteEntity(ids[i]);
}
this.outJson(response, true);
} }
return pageNo;
} }
/** /**
...@@ -150,9 +154,8 @@ public class ContentModelAction extends BaseAction{ ...@@ -150,9 +154,8 @@ public class ContentModelAction extends BaseAction{
*/ */
@RequestMapping("/add") @RequestMapping("/add")
public String add(ModelMap model) { public String add(ModelMap model) {
model.addAttribute("cmId", 0); model.addAttribute("contentModel",new ContentModelEntity());
model.addAttribute("flag", true); return "/manager/content_model/content_model";
return "/manager/cms/form/form";
} }
/** /**
...@@ -161,13 +164,11 @@ public class ContentModelAction extends BaseAction{ ...@@ -161,13 +164,11 @@ public class ContentModelAction extends BaseAction{
* @return 编辑表单页面 * @return 编辑表单页面
*/ */
@RequestMapping("/{cmId}/edit") @RequestMapping("/{cmId}/edit")
public String edit(@PathVariable int cmId, ModelMap model) { @ResponseBody
public void edit(@PathVariable int cmId, HttpServletResponse response) {
//获取表单实体 //获取表单实体
ContentModelEntity contentModel = (ContentModelEntity) contentModelBiz.getEntity(cmId); ContentModelEntity contentModel = (ContentModelEntity) contentModelBiz.getEntity(cmId);
model.addAttribute("contentModel", contentModel); this.outJson(response, JSONObject.toJSONString(contentModel));
model.addAttribute("cmId", cmId);
model.addAttribute("flag", false);
return "/manager/cms/form/form";
} }
...@@ -182,17 +183,24 @@ public class ContentModelAction extends BaseAction{ ...@@ -182,17 +183,24 @@ public class ContentModelAction extends BaseAction{
public void save(@ModelAttribute ContentModelEntity contentModel,HttpServletRequest request, HttpServletResponse response){ public void save(@ModelAttribute ContentModelEntity contentModel,HttpServletRequest request, HttpServletResponse response){
// 保存前判断数据是否合法 // 保存前判断数据是否合法
if(!StringUtil.checkLength(contentModel.getCmTipsName(), 1,30)){ if(!StringUtil.checkLength(contentModel.getCmTipsName(), 1,30)){
this.outJson(response, null, false,getResString("err.length",this.getResString("cmTipsName"),"1","30")); this.outJson(response, null, false,getResString("err.length",this.getResString("content.model.tips.name"),"1","30"));
return; return;
} }
if(!StringUtil.checkLength(contentModel.getCmTableName(), 1,20)){ if (!StringUtil.checkLength(contentModel.getCmTableName(), 1,20)) {
this.outJson(response, null, false,getResString("err.length",this.getResString("cmTableName"),"1","20")); this.outJson(response, null, false,getResString("err.length",this.getResString("content.model.table.name"),"1","20"));
return; return;
} }
// 获取当前管理员实体 // 获取当前管理员实体
ManagerEntity managerSession = (ManagerEntity) getSession(request, SessionConst.MANAGER_ESSION); ManagerEntity managerSession = (ManagerEntity) getSession(request, SessionConst.MANAGER_ESSION);
//获取当前管理员Id //获取当前管理员Id
int managerId = managerSession.getManagerId(); int managerId = managerSession.getManagerId();
if (contentModelBiz.getContentModelByTableName(TABLE_NAME_PREFIX+contentModel.getCmTableName()+TABLE_NAME_SPLIT+managerId)!=null) {
this.outJson(response, null, false,getResString("err.exist",this.getResString("content.model")));
return;
}
contentModel.setCmManagerId(managerId); contentModel.setCmManagerId(managerId);
// 新增表名为"cms_"+用户填写的表名+"_"+站点id // 新增表名为"cms_"+用户填写的表名+"_"+站点id
contentModel.setCmTableName(TABLE_NAME_PREFIX+contentModel.getCmTableName()+TABLE_NAME_SPLIT+managerId); contentModel.setCmTableName(TABLE_NAME_PREFIX+contentModel.getCmTableName()+TABLE_NAME_SPLIT+managerId);
...@@ -215,7 +223,7 @@ public class ContentModelAction extends BaseAction{ ...@@ -215,7 +223,7 @@ public class ContentModelAction extends BaseAction{
public void update(@ModelAttribute ContentModelEntity contentModel,HttpServletRequest request, HttpServletResponse response){ public void update(@ModelAttribute ContentModelEntity contentModel,HttpServletRequest request, HttpServletResponse response){
// 保存前判断数据是否合法 // 保存前判断数据是否合法
if(!StringUtil.checkLength(contentModel.getCmTipsName(), 1,30)){ if(!StringUtil.checkLength(contentModel.getCmTipsName(), 1,30)){
this.outJson(response, null, false,getResString("err.length",this.getResString("cmTipsName"),"1","30")); this.outJson(response, null, false,getResString("err.length",this.getResString("content.model.tips.name"),"1","30"));
return; return;
} }
// 获取当前管理员实体 // 获取当前管理员实体
...@@ -228,8 +236,8 @@ public class ContentModelAction extends BaseAction{ ...@@ -228,8 +236,8 @@ public class ContentModelAction extends BaseAction{
} }
/** /**
* 判断字段名是否存在重复 * 判断自定义模型表名是否重复
* @param fieldFieldName :字段名 * @param cmTableName 表明
* @param request * @param request
* @return true:存在重复,false:不存在重复 * @return true:存在重复,false:不存在重复
*/ */
......
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.action;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.mingsoft.base.action.BaseAction;
import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.e.TableCloumnEnum;
import com.mingsoft.base.constant.e.TableEnum;
import com.mingsoft.basic.biz.IContentModelBiz;
import com.mingsoft.basic.biz.IContentModelFieldBiz;
import com.mingsoft.basic.constant.e.ContentModelFieldEnum;
import com.mingsoft.basic.entity.ContentModelEntity;
import com.mingsoft.basic.entity.ContentModelFieldEntity;
import com.mingsoft.basic.entity.FieldEntity;
import com.mingsoft.util.StringUtil;
/**
*
* ms-basic 自定义模型字段
*
* @author 会飞的猪
* @version 版本号:<br/>
* 创建日期:2016年1月15日<br/>
* 历史修订:<br/>
*/
@Controller
@RequestMapping("/manager/contentModel/contentModelField")
public class ContentModelFieldAction extends com.mingsoft.basic.action.BaseAction {
@Autowired
private IContentModelFieldBiz contentModelFieldBiz;
@Autowired
private IContentModelBiz contentModelBiz;
/**
* 表单列表
*
* @return 返回表单列表页面
*/
@RequestMapping("/{contentModelId}/list")
public String list(@PathVariable int contentModelId, HttpServletRequest request, ModelMap model,
HttpServletResponse response) {
List list = contentModelFieldBiz.queryListByCmid(contentModelId);
// 获取字段属性
model.put("fieldTypes", ContentModelFieldEnum.toMap());
model.put("contentModelId", contentModelId);
model.addAttribute("contentModelFieldList", list);
return "/manager/content_model/content_model_field_list";
}
/**
* 保存内容模型实体
*
* @param contentModel
* @param response
*/
@RequestMapping("/save")
@ResponseBody
public void save(@ModelAttribute ContentModelFieldEntity field, HttpServletRequest request,
HttpServletResponse response) {
// 判断是否存在表单
ContentModelEntity contentModel = (ContentModelEntity)contentModelBiz.getEntity(field.getFieldCmid());
// 更新前判断数据是否合法
if(!StringUtil.checkLength(field.getFieldTipsName(), 1,30)){
this.outJson(response, null, false,getResString("err.length",this.getResString("content.model.field.tips.name"),"1","30"));
return ;
}
if(!StringUtil.checkLength(field.getFieldFieldName(), 1,30)){
this.outJson(response, null, false,getResString("err.length",this.getResString("content.model.field.column.ame"),"1","30"));
return ;
}
if (contentModelFieldBiz.getEntityByCmId(field.getFieldCmid(),field.getFieldFieldName())!=null) {
this.outJson(response, null, false,getResString("err.exist",this.getResString("content.model.field")));
return;
}
contentModelFieldBiz.saveEntity(field);
//动态的修改表结构
//获取字段信息
Map fileds = new HashMap();
//压入字段名
fileds.put("fieldName", field.getFieldFieldName());
//字段的数据类型
fileds.put("fieldType",field.getFieldColumnType());
//字段的默认值
fileds.put("default", field.getFieldDefault());
contentModelFieldBiz.alterTable(contentModel.getCmTableName(), fileds,TableEnum.ALTER_ADD);
this.outJson(response, null, true, null);
}
/**
* 删除表单类型
*
* @param cmId
* 表单ID
* @param request
* 请求
* @param response
* 响应
*/
@RequestMapping("/delete")
@ResponseBody
public void delete(HttpServletRequest request, HttpServletResponse response) {
String fieldIds = request.getParameter("fieldId");
if (!StringUtil.isBlank(fieldIds) && StringUtil.isIntegers(fieldIds.split(","))) {
int[] ids = StringUtil.stringsToInts(fieldIds.split(","));
for (int i=0;i<ids.length;i++) {
//获取要删除的字段实体
ContentModelFieldEntity field = (ContentModelFieldEntity) contentModelFieldBiz.getEntity(ids[i]);
contentModelFieldBiz.deleteEntity(ids[i]);
//获取内容模型实体
ContentModelEntity contentModel = (ContentModelEntity) contentModelBiz.getEntity(field.getFieldCmid());
if(contentModel != null){
Map<String,Object> fields = new HashMap<String, Object>();
// 要删除的字段名
fields.put("fieldName",field.getFieldFieldName());
//删除列
contentModelFieldBiz.alterTable(contentModel.getCmTableName(),fields,TableEnum.ALTER_DROP);
}
}
this.outJson(response, true);
}
}
/**
* 编辑表单
*
* @param cmId
* 表单ID
* @return 编辑表单页面
*/
@RequestMapping("/{filedId}/edit")
@ResponseBody
public void edit(@PathVariable int filedId,HttpServletResponse response) {
// 获取表单实体
ContentModelFieldEntity contentModelField = (ContentModelFieldEntity) contentModelFieldBiz.getEntity(filedId);
this.outJson(response, contentModelField);
}
/**
* 更新内容模型实体
*
* @param contentModel
* 内容模型实体
* @param request
* @param response
*/
@RequestMapping("/update")
@ResponseBody
public void update(@ModelAttribute ContentModelFieldEntity contentModelFieldEntity, HttpServletRequest request,
HttpServletResponse response) {
contentModelFieldBiz.updateEntity(contentModelFieldEntity);
this.outJson(response, true);
}
}
\ No newline at end of file
...@@ -33,9 +33,9 @@ import org.springframework.web.bind.annotation.PathVariable; ...@@ -33,9 +33,9 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.mingsoft.base.action.BaseAction; import com.mingsoft.base.action.BaseAction;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.basic.biz.IDiyFormBiz; import com.mingsoft.basic.biz.IDiyFormBiz;
import com.mingsoft.basic.biz.IDiyFormFieldBiz; import com.mingsoft.basic.biz.IDiyFormFieldBiz;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.basic.entity.DiyFormEntity; import com.mingsoft.basic.entity.DiyFormEntity;
import com.mingsoft.basic.entity.ManagerEntity; import com.mingsoft.basic.entity.ManagerEntity;
import com.mingsoft.util.PageUtil; import com.mingsoft.util.PageUtil;
...@@ -105,7 +105,7 @@ public class DiyFormAction extends BaseAction{ ...@@ -105,7 +105,7 @@ public class DiyFormAction extends BaseAction{
} }
int appId = this.getAppId(request); int appId = this.getAppId(request);
int count = diyFormBiz.countDiyFormData(diyFormId, appId); int count = diyFormBiz.countDiyFormData(diyFormId, appId);
PageUtil page = new PageUtil(pageNo, 30,count,"/manager/diy/form/"+diyFormId+"/data.do"); PageUtil page = new PageUtil(pageNo, 30,count,"/manager/diy/form/"+diyFormId+"/query.do");
Map map = diyFormBiz.queryDiyFormData(diyFormId, appId, page); Map map = diyFormBiz.queryDiyFormData(diyFormId, appId, page);
if (map!=null) { if (map!=null) {
if (map.get("fields") != null) { if (map.get("fields") != null) {
...@@ -204,7 +204,7 @@ public class DiyFormAction extends BaseAction{ ...@@ -204,7 +204,7 @@ public class DiyFormAction extends BaseAction{
//获取当前管理员Id //获取当前管理员Id
int managerId = managerSession.getManagerId(); int managerId = managerSession.getManagerId();
//获取实际创建的表名 //获取实际创建的表名
String diyFormTableName =TABLE_NAME_PREFIX+managerId+TABLE_NAME_SPLIT+diyForm.getDiyFormTableName(); String diyFormTableName =TABLE_NAME_PREFIX+diyForm.getDiyFormTableName()+TABLE_NAME_SPLIT+managerId;
//判断是否存在重复的表 //判断是否存在重复的表
if( this.diyFormBiz.getByTableName(diyFormTableName)!=null){ if( this.diyFormBiz.getByTableName(diyFormTableName)!=null){
this.outJson(response, null, false,this.getResString("err.exist",this.getResString("diy.form.table.name"))); this.outJson(response, null, false,this.getResString("err.exist",this.getResString("diy.form.table.name")));
...@@ -217,7 +217,7 @@ public class DiyFormAction extends BaseAction{ ...@@ -217,7 +217,7 @@ public class DiyFormAction extends BaseAction{
//设置管理员id //设置管理员id
diyForm.setDiyFormManagerId(managerId); diyForm.setDiyFormManagerId(managerId);
//设置自定义表单的表面 //设置自定义表单的表面
String tableName = TABLE_NAME_PREFIX+managerId+TABLE_NAME_SPLIT+diyForm.getDiyFormTableName(); String tableName = TABLE_NAME_PREFIX+diyForm.getDiyFormTableName()+TABLE_NAME_SPLIT+managerId;
diyForm.setDiyFormTableName(tableName); diyForm.setDiyFormTableName(tableName);
//在数据库中创建自定义表单的表 //在数据库中创建自定义表单的表
...@@ -268,7 +268,7 @@ public class DiyFormAction extends BaseAction{ ...@@ -268,7 +268,7 @@ public class DiyFormAction extends BaseAction{
//获取当前管理员Id //获取当前管理员Id
int managerId = managerSession.getManagerId(); int managerId = managerSession.getManagerId();
//组装表名 //组装表名
diyFormTableName =TABLE_NAME_PREFIX+managerId+TABLE_NAME_SPLIT+diyFormTableName; diyFormTableName =TABLE_NAME_PREFIX+diyFormTableName+TABLE_NAME_SPLIT+managerId;
DiyFormEntity diyForm = this.diyFormBiz.getByTableName(diyFormTableName); DiyFormEntity diyForm = this.diyFormBiz.getByTableName(diyFormTableName);
if(diyForm==null){ if(diyForm==null){
this.outJson(response, null, false); this.outJson(response, null, false);
......
...@@ -40,13 +40,13 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -40,13 +40,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.base.entity.BaseEntity; import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.biz.IManagerBiz; import com.mingsoft.basic.biz.IManagerBiz;
import com.mingsoft.basic.biz.IManagerModelPageBiz; import com.mingsoft.basic.biz.IManagerModelPageBiz;
import com.mingsoft.basic.biz.IModelBiz; import com.mingsoft.basic.biz.IModelBiz;
import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.basic.entity.ManagerEntity; import com.mingsoft.basic.entity.ManagerEntity;
import com.mingsoft.basic.entity.ManagerModelPageEntity; import com.mingsoft.basic.entity.ManagerModelPageEntity;
import com.mingsoft.basic.entity.ManagerSessionEntity; import com.mingsoft.basic.entity.ManagerSessionEntity;
......
...@@ -41,14 +41,14 @@ import com.mingsoft.basic.biz.IManagerBiz; ...@@ -41,14 +41,14 @@ import com.mingsoft.basic.biz.IManagerBiz;
import com.mingsoft.basic.biz.IModelBiz; import com.mingsoft.basic.biz.IModelBiz;
import com.mingsoft.basic.biz.IRoleBiz; import com.mingsoft.basic.biz.IRoleBiz;
import com.mingsoft.basic.biz.IRoleModelBiz; import com.mingsoft.basic.biz.IRoleModelBiz;
import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.basic.entity.AppEntity; import com.mingsoft.basic.entity.AppEntity;
import com.mingsoft.basic.entity.ManagerEntity; import com.mingsoft.basic.entity.ManagerEntity;
import com.mingsoft.basic.entity.ManagerSessionEntity; import com.mingsoft.basic.entity.ManagerSessionEntity;
import com.mingsoft.basic.entity.RoleEntity; import com.mingsoft.basic.entity.RoleEntity;
import com.mingsoft.basic.entity.RoleModelEntity; import com.mingsoft.basic.entity.RoleModelEntity;
import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.util.PageUtil; import com.mingsoft.util.PageUtil;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
...@@ -309,16 +309,19 @@ public class ManagerAction extends BaseAction { ...@@ -309,16 +309,19 @@ public class ManagerAction extends BaseAction {
return; return;
} }
//若数据库中存在该名称且当前名称不为更改前的名称,则属于重名 //若数据库中存在该名称且当前名称不为更改前的名称,则属于重名
if (!StringUtil.isBlank(managerBiz.countManagerName(manager.getManagerName())) && !manager.getManagerName().equals(oldManagerName)) { if (managerBiz.countManagerName(manager.getManagerName()) >0 && !manager.getManagerName().equals(oldManagerName)) {
this.outJson(response, ModelCode.ROLE, false, getResString("err.exist",this.getResString("managerName"))); this.outJson(response, ModelCode.ROLE, false, getResString("err.exist",this.getResString("managerName")));
return; return;
} }
System.out.println("============" + managerBiz.countManagerName(manager.getManagerName()));
//验证表单 //验证表单
if (!this.checkForm(manager, response)) { if (!this.checkForm(manager, response)) {
return; return;
} }
int websiteID = 0;int managerId = 0; int websiteID = 0;int managerId = 0;
String basicId = request.getParameter("basicId"); String basicId = request.getParameter("basicId");
//加密密码 //加密密码
// 新增网站时添加管理员 // 新增网站时添加管理员
if (!StringUtil.isBlank(basicId)) { if (!StringUtil.isBlank(basicId)) {
...@@ -338,22 +341,47 @@ public class ManagerAction extends BaseAction { ...@@ -338,22 +341,47 @@ public class ManagerAction extends BaseAction {
website.setAppManagerId(managerId); website.setAppManagerId(managerId);
appBiz.updateEntity(website); appBiz.updateEntity(website);
} else { } else {
role.setRoleName(manager.getManagerName()); manager = managerBiz.queryManagerByManagerName(manager.getManagerName());
managerId = managerBiz.queryManagerByManagerName(manager.getManagerName()).getManagerId(); if(manager==null){
role.setRoleManagerId(managerId); return;
//更新角色 }
this.saveOrUpdateRole(role, request, response, false); //查询当前用户所需的角色id
int roleId = manager.getManagerRoleID();
//判断当前用户角色
role = (RoleEntity) roleBiz.getEntity(roleId);
String modelId[] = request.getParameterValues("modelIds");
if(!StringUtil.isBlank(modelId)){
//将获取的模块ID分割成数组
modelId = modelId[0].split(",");
}
//若没有选择功能模块,则提示错误,并将其数据库中该已存在的模块删除
if(StringUtil.isBlank(modelId[0])){
roleModelBiz.deleteEntity(roleId);
return;
}
//为该角色增加/更新功能模块
List<RoleModelEntity> roleModelList =new ArrayList<RoleModelEntity>();
for(int i=0; i<modelId.length; i++){
RoleModelEntity roleModel = new RoleModelEntity();
roleModel.setModelId(Integer.parseInt(modelId[i]));
roleModel.setRoleId(roleBiz.queryRoleByRoleName(role.getRoleName(),role.getRoleManagerId()).getRoleId());
roleModelList.add(roleModel);
}
//修改该角色所拥有的模块数据
roleModelBiz.deleteEntity(roleId);
roleModelBiz.updateEntity(roleModelList);
} }
//设置管理员角色ID为自身角色ID //设置管理员角色ID为自身角色ID
manager.setManagerRoleID(roleBiz.queryRoleByRoleName(role.getRoleName(), role.getRoleManagerId()).getRoleId()); manager.setManagerRoleID(roleBiz.queryRoleByRoleName(role.getRoleName(), role.getRoleManagerId()).getRoleId());
manager.setManagerId(managerId);
if(!StringUtil.isBlank(manager.getManagerPassword())){ if(!StringUtil.isBlank(manager.getManagerPassword())){
manager.setManagerPassword(StringUtil.Md5(oldPassword)); manager.setManagerPassword(StringUtil.Md5(oldPassword));
//更新管理员 //更新管理员
managerBiz.updateEntity(manager); managerBiz.updateEntity(manager);
} }
} else { } else {
if (!StringUtil.isBlank(manager.getManagerPassword())) {
manager.setManagerPassword(StringUtil.Md5(manager.getManagerPassword())); manager.setManagerPassword(StringUtil.Md5(manager.getManagerPassword()));
}
if(flag){ if(flag){
managerBiz.saveEntity(manager); managerBiz.saveEntity(manager);
} else { } else {
...@@ -393,6 +421,7 @@ public class ManagerAction extends BaseAction { ...@@ -393,6 +421,7 @@ public class ManagerAction extends BaseAction {
@RequestMapping("/update") @RequestMapping("/update")
@ResponseBody @ResponseBody
public void update(@ModelAttribute ManagerEntity manager, HttpServletRequest request, HttpServletResponse response) { public void update(@ModelAttribute ManagerEntity manager, HttpServletRequest request, HttpServletResponse response) {
this.saveOrUpdateManager(false, manager, request, response); this.saveOrUpdateManager(false, manager, request, response);
} }
......
...@@ -37,10 +37,10 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -37,10 +37,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.base.entity.BaseEntity; import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.biz.IManagerBiz; import com.mingsoft.basic.biz.IManagerBiz;
import com.mingsoft.basic.biz.IModelBiz; import com.mingsoft.basic.biz.IModelBiz;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.basic.entity.ManagerEntity; import com.mingsoft.basic.entity.ManagerEntity;
import com.mingsoft.basic.entity.ModelEntity; import com.mingsoft.basic.entity.ModelEntity;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
......
...@@ -39,11 +39,11 @@ import com.mingsoft.basic.biz.IManagerBiz; ...@@ -39,11 +39,11 @@ import com.mingsoft.basic.biz.IManagerBiz;
import com.mingsoft.basic.biz.IModelBiz; import com.mingsoft.basic.biz.IModelBiz;
import com.mingsoft.basic.biz.IRoleBiz; import com.mingsoft.basic.biz.IRoleBiz;
import com.mingsoft.basic.biz.IRoleModelBiz; import com.mingsoft.basic.biz.IRoleModelBiz;
import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.basic.entity.ManagerSessionEntity; import com.mingsoft.basic.entity.ManagerSessionEntity;
import com.mingsoft.basic.entity.RoleEntity; import com.mingsoft.basic.entity.RoleEntity;
import com.mingsoft.basic.entity.RoleModelEntity; import com.mingsoft.basic.entity.RoleModelEntity;
import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.util.PageUtil; import com.mingsoft.util.PageUtil;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
...@@ -129,6 +129,15 @@ public class RoleAction extends BaseAction{ ...@@ -129,6 +129,15 @@ public class RoleAction extends BaseAction{
} }
} }
@RequestMapping("/{roleId}/queryByRole")
@ResponseBody
public void queryByRole(@PathVariable int roleId, HttpServletResponse response){
List models = modelBiz.queryModelByRoleId(roleId);
this.outJson(response, JSONObject.toJSONString(models));
}
/** /**
* 加载添加角色界面 * 加载添加角色界面
* @param request 请求对象 * @param request 请求对象
......
...@@ -33,9 +33,9 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -33,9 +33,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.mingsoft.basic.action.BaseAction; import com.mingsoft.basic.action.BaseAction;
import com.mingsoft.basic.biz.ISystemSkinBiz; import com.mingsoft.basic.biz.ISystemSkinBiz;
import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.basic.entity.ManagerSessionEntity; import com.mingsoft.basic.entity.ManagerSessionEntity;
import com.mingsoft.basic.entity.SystemSkinEntity; import com.mingsoft.basic.entity.SystemSkinEntity;
import com.mingsoft.base.constant.SessionConst;
/** /**
* 后台主题 * 后台主题
......
content.model=\u6a21\u578b
content.model.tips.name=\u6a21\u578b\u540d\u79f0
content.model.table.name=\u6a21\u578b\u8868\u540d
content.model.field=\u6a21\u578b\u5b57\u6bb5
content.model.field.tips.name=\u5b57\u6bb5\u63d0\u793a\u540d\u79f0
content.model.field.column.name=\u5b57\u6bb5\u540d\u79f0
diy.form=\u81ea\u5b9a\u4e49\u8868\u5355
diy.form.tips.name=\u8868\u5355\u540d\u79f0
diy.form.table.name=\u8868\u5355\u6570\u636e\u8868\u540d
diy.form.table.column.name=\u8868\u5355\u6570\u636e\u8868\u5217\u540d
\ No newline at end of file
...@@ -33,10 +33,13 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -33,10 +33,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mingsoft.base.action.BaseAction; import com.mingsoft.base.action.BaseAction;
import com.mingsoft.basic.biz.IDiyFormBiz; import com.mingsoft.basic.biz.IDiyFormBiz;
import com.mingsoft.util.PageUtil;
import com.mingsoft.base.constant.SessionConst; import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.base.entity.ListJson;
import com.mingsoft.util.PageUtil;
import com.mingsoft.util.StringUtil;
/** /**
* 通用自定义表单 * 通用自定义表单
...@@ -66,7 +69,10 @@ public class DiyFormAction extends BaseAction{ ...@@ -66,7 +69,10 @@ public class DiyFormAction extends BaseAction{
@ResponseBody @ResponseBody
public void save(@PathVariable("idBase64") String idBase64,HttpServletRequest request,HttpServletResponse response) { public void save(@PathVariable("idBase64") String idBase64,HttpServletRequest request,HttpServletResponse response) {
String temp =this.decryptByAES(request, idBase64); String temp =this.decryptByAES(request, idBase64);
//在进行自定义表单提交数据时是否需要提交验证码,默认是需要验证码
String isCode = request.getParameter("isCode");
//如果isCode为空获取,isCode=true,则进行验证码的验证
if(StringUtil.isBlank(isCode) || isCode.equals("true")){
Object obj = this.getSession(request, SessionConst.CODE_SESSION); Object obj = this.getSession(request, SessionConst.CODE_SESSION);
if (obj!=null) { if (obj!=null) {
if (!this.checkRandCode(request)) { if (!this.checkRandCode(request)) {
...@@ -74,6 +80,13 @@ public class DiyFormAction extends BaseAction{ ...@@ -74,6 +80,13 @@ public class DiyFormAction extends BaseAction{
return; return;
} }
} }
}
//判断传入的加密数字是否能转换成整形
if(!StringUtil.isInteger(temp)){
this.outJson(response, null, false);
return;
}
//获取表单id
int formId = Integer.parseInt(temp); int formId = Integer.parseInt(temp);
if (formId !=0 ) { if (formId !=0 ) {
LOG.debug("fromId:" + formId); LOG.debug("fromId:" + formId);
...@@ -82,7 +95,6 @@ public class DiyFormAction extends BaseAction{ ...@@ -82,7 +95,6 @@ public class DiyFormAction extends BaseAction{
} }
} }
/** /**
* 提供前端查询自定义表单提交数据 * 提供前端查询自定义表单提交数据
* @param idBase64 Base64编码数据 * @param idBase64 Base64编码数据
...@@ -95,6 +107,11 @@ public class DiyFormAction extends BaseAction{ ...@@ -95,6 +107,11 @@ public class DiyFormAction extends BaseAction{
String temp =this.decryptByAES(request, idBase64); String temp =this.decryptByAES(request, idBase64);
//获取自定义表单的id //获取自定义表单的id
int formId = Integer.parseInt(temp); int formId = Integer.parseInt(temp);
//判断传入的加密数字是否能转换成整形
if(!StringUtil.isInteger(temp)){
this.outJson(response, null, false);
return;
}
if (formId !=0 ) { if (formId !=0 ) {
int appId = this.getAppId(request); int appId = this.getAppId(request);
//当前页面 //当前页面
...@@ -105,16 +122,14 @@ public class DiyFormAction extends BaseAction{ ...@@ -105,16 +122,14 @@ public class DiyFormAction extends BaseAction{
int count = diyFormBiz.countDiyFormData(formId, appId); int count = diyFormBiz.countDiyFormData(formId, appId);
PageUtil page = new PageUtil(pageNo,pageSize,count,""); PageUtil page = new PageUtil(pageNo,pageSize,count,"");
Map map = diyFormBiz.queryDiyFormData(formId, appId, page); Map map = diyFormBiz.queryDiyFormData(formId, appId, page);
if (map!=null) { if(map!=null){
if (map.get("list") != null) { List list = (List) map.get("list");
this.outJson(response, JSON.toJSONString(map.get("list"))); ListJson json = new ListJson(count,list);
this.outJson(response, JSONObject.toJSONString(json));
return; return;
} }
} }
this.outJson(response, null); this.outJson(response, null, false);
}
} }
} }
\ No newline at end of file
...@@ -25,8 +25,9 @@ import javax.servlet.http.HttpServletRequest; ...@@ -25,8 +25,9 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.basic.action.BaseAction; import com.mingsoft.basic.action.BaseAction;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
/** /**
......
...@@ -32,8 +32,8 @@ import org.aspectj.lang.annotation.Pointcut; ...@@ -32,8 +32,8 @@ import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.mingsoft.basic.entity.ManagerSessionEntity;
import com.mingsoft.base.constant.SessionConst; import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.basic.entity.ManagerSessionEntity;
/** /**
* *
......
...@@ -23,6 +23,7 @@ package com.mingsoft.basic.biz; ...@@ -23,6 +23,7 @@ package com.mingsoft.basic.biz;
import java.util.List; import java.util.List;
import com.mingsoft.base.biz.IBaseBiz; import com.mingsoft.base.biz.IBaseBiz;
import com.mingsoft.basic.entity.BasicChildEntity; import com.mingsoft.basic.entity.BasicChildEntity;
...@@ -55,4 +56,24 @@ public interface IBasicChildBiz extends IBaseBiz{ ...@@ -55,4 +56,24 @@ public interface IBasicChildBiz extends IBaseBiz{
* @return 基础表关联数据集合 * @return 基础表关联数据集合
*/ */
List<BasicChildEntity> queryByBasicId(int basicId); List<BasicChildEntity> queryByBasicId(int basicId);
/**
* 根据basicId集合实现批量的删除
* @param basicIds basicId集合
*/
void deleteBatch(int[] basicIds);
/**
* 根据基础id和子id集合删除
* @param basicId 基础id
* @param basicChildIds 子集合id
*/
void deleteByChildIds(int basicId,int[] basicChildIds);
/**
* 根据基础id和子id删除
* @param basicId 基础id
* @param basicChildId 子id
*/
void deleteByBasicIdAndChildId(int basicId,int basicChildId);
} }
\ No newline at end of file
...@@ -200,7 +200,7 @@ public interface ICategoryBiz extends IBaseBiz { ...@@ -200,7 +200,7 @@ public interface ICategoryBiz extends IBaseBiz {
public List<CategoryEntity> queryByAppIdOrModelId(Integer appId, Integer modelId); public List<CategoryEntity> queryByAppIdOrModelId(Integer appId, Integer modelId);
/** /**
* 递归取父栏目, * 递归取父栏目,
* @param appId * @param appId
* 应用编号 * 应用编号
* @param modelId * @param modelId
......
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.biz;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.mingsoft.base.biz.IBaseBiz;
import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.entity.ContentModelEntity;
import com.mingsoft.util.PageUtil;
/**
*
*
* <p>
* <b>铭飞CMS-铭飞内容管理系统</b>
* </p>
*
* <p>
* Copyright: Copyright (c) 2014 - 2015
* </p>
*
* <p>
* Company:景德镇铭飞科技有限公司
* </p>
*
* @author 姓名 史爱华
*
* @version 300-001-001
*
* <p>
* 版权所有 铭飞科技
* </p>
*
* <p>
* Comments:表单内容管理业务处理层 || 继承IBasicBiz业务处理层
* </p>
*
* <p>
* Create Date:2014-7-14
* </p>
*
* <p>
* Modification history:
* </p>
*/
public interface IContentModelBiz extends IBaseBiz{
/**
* 根据内容模型的表名查找实体
* @param cmTableName 表名
* @return 内容模型实体
*/
public ContentModelEntity getContentModelByTableName(String cmTableName);
/**
* 根据管理员Id查找内容模型的总数
* @param cmManagerId 管理员id
* @return 记录总数
*/
public int getContentModelByManagerId(int cmManagerId);
/**
* 分页查询指定管理员的表单内容模型
* @param entity 实体
* @param page Map对象
* @param order 排序方式,true:asc;fales:desc
* @param cmManagerId 管理员id
* @return 表单内容模型
*/
List<BaseEntity> queryPageByManagerId(PageUtil page,String orderBy,boolean order, int cmManagerId);
/**
* 根据管理员id查找内容模型实体
* @param cmManagerId
* @return 表单内容模型
*/
public List<BaseEntity> queryByManagerId(int cmManagerId);
/**
* 根据模型ID把模型和相关数据全部删除
* @param cmId
*/
public void deleteAllByCmId(int cmId);
/**
* 根据模型ID把模型和相关数据全部删除
* @param cmId集合
*/
public void deleteAllByCmId(int[] cmId);
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.biz;
import java.util.List;
import java.util.Map;
import com.mingsoft.base.biz.IBaseBiz;
import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.constant.e.FieldSearchEnum;
import com.mingsoft.basic.entity.ContentModelFieldEntity;
import com.mingsoft.basic.entity.FieldEntity;
import com.mingsoft.util.PageUtil;
/**
*
*
* <p>
* <b>铭飞CMS-铭飞内容管理系统</b>
* </p>
*
* <p>
* Copyright: Copyright (c) 2014 - 2015
* </p>
*
* <p>
* Company:景德镇铭飞科技有限公司
* </p>
*
* @author 姓名:张敏
*
* @version 300-001-001
*
* <p>
* 版权所有 铭飞科技
* </p>
*
* <p>
* Comments:字段业务层,继承IBasicBiz
* </p>
*
* <p>
* Create Date:2014-9-11
* </p>
*
* <p>
* Modification history:暂无
* </p>
*/
public interface IContentModelFieldBiz extends IBaseBiz{
/**
* checkbox类表单
*/
int CHECKBOX = 11;
/**
* radio类的表单
*/
int RADIO = 10;
/**
* option 类的表单
*/
int OPTION = 9;
/**
* 整数类的表单
*/
int INT = 4;
/**
* float类的表单
*/
int FLOAT = 5;
/**
* 查询指定表单的自定义字段列表
* @param fieldCmid 表单ID
* @return
*/
public List<BaseEntity> queryListByCmid(int fieldCmid);
/**
* 统计指定表单的字段数量
* @param fieldCmid
* @return
*/
public int queryCountByCmid(int fieldCmid);
/**
* 分页查询指定表单的字段
* @param fieldCmid 表单ID
* @param pageNo 当前页
* @param pageSize 每页显示数
* @param orderBy 排序字段
* @param order 排序方式
* @return 返回字段集合
*/
public List<BaseEntity> queryByPage(int fieldCmid,PageUtil page,String orderBy,boolean order);
/**
* 根据字段名和表单模型id查找符合条件的记录个数
* @param fieldName :字段名
* @param fieldCmdId : 表单模型id
* @return 记录个数
*/
public int getCountFieldName(String fieldFieldName,int fieldCmdId);
/**
* 通过字段名获取字段实体
* @param fieldFieldName 字段名
* @return 字段实体
*/
public ContentModelFieldEntity getEntityByFieldName(String fieldFieldName);
/**
* 根据内容模型id和字段名查找字段实体
* @param cmId
* @param fieldFieldName
* @return 字段实体
*/
public ContentModelFieldEntity getEntityByCmId(int cmId,String fieldFieldName);
/**
* 根据自定义字段信息动态查询表
* @param table 表名
* @param diyFieldName 自定义字段
* @return 返回ID集合
*/
public List<Integer> queryListBySQL(String table,Map<String,String> diyFieldName);
/**
* 根据内容模型id获取到所有的字段
* @param contentModelId 内容模型字段
* @return 字段列表
*/
public List<FieldEntity> queryByContentModelId(int contentModelId);
/**
* 查询需要搜索的字段列表信息
* @param contentMdoel 内容模型id
* @param fieldIsSearch 是否支持搜索
* @return 字段列表信息
*/
public List<FieldEntity> queryByIsSearch(int contentMdoelId,FieldSearchEnum fieldIsSearch);
/**
* 根据模型ID删除相应字段
* @param fieldCmid 模型ID
*/
public void deleteEntityByFieldCmid(int fieldCmid);
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.biz;
import java.util.List;
import java.util.Map;
import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.biz.IBasicBiz;
import com.mingsoft.basic.constant.e.FieldSearchEnum;
import com.mingsoft.basic.entity.FieldEntity;
import com.mingsoft.util.PageUtil;
/**
*
*
* <p>
* <b>铭飞CMS-铭飞内容管理系统</b>
* </p>
*
* <p>
* Copyright: Copyright (c) 2014 - 2015
* </p>
*
* <p>
* Company:景德镇铭飞科技有限公司
* </p>
*
* @author 姓名:张敏
*
* @version 300-001-001
*
* <p>
* 版权所有 铭飞科技
* </p>
*
* <p>
* Comments:字段业务层,继承IBasicBiz 推荐使用IContentModelFieldBiz @see IContentModelFieldBiz
* </p>
*
* <p>
* Create Date:2014-9-11
* </p>
*
* <p>
* Modification history:暂无
* </p>
*
*/
@Deprecated
public interface IFieldBiz extends IBasicBiz{
/**
* checkbox类表单
*/
int CHECKBOX = 11;
/**
* radio类的表单
*/
int RADIO = 10;
/**
* option 类的表单
*/
int OPTION = 9;
/**
* 整数类的表单
*/
int INT = 4;
/**
* float类的表单
*/
int FLOAT = 5;
/**
* 查询指定表单的自定义字段列表
* @param fieldCmid 表单ID
* @return
*/
public List<BaseEntity> queryListByCmid(int fieldCmid);
/**
* 统计指定表单的字段数量
* @param fieldCmid
* @return
*/
public int queryCountByCmid(int fieldCmid);
/**
* 分页查询指定表单的字段
* @param fieldCmid 表单ID
* @param pageNo 当前页
* @param pageSize 每页显示数
* @param orderBy 排序字段
* @param order 排序方式
* @return 返回字段集合
*/
public List<BaseEntity> queryByPage(int fieldCmid,PageUtil page,String orderBy,boolean order);
/**
* 根据字段名和表单模型id查找符合条件的记录个数
* @param fieldName :字段名
* @param fieldCmdId : 表单模型id
* @return 记录个数
*/
public int getCountFieldName(String fieldFieldName,int fieldCmdId);
/**
* 通过字段名获取字段实体
* @param fieldFieldName 字段名
* @return 字段实体
*/
public FieldEntity getEntityByFieldName(String fieldFieldName);
/**
* 根据内容模型id和字段名查找字段实体
* @param cmId
* @param fieldFieldName
* @return 字段实体
*/
public FieldEntity getEntityByCmId(int cmId,String fieldFieldName);
/**
* 根据自定义字段信息动态查询表
* @param table 表名
* @param diyFieldName 自定义字段
* @return 返回ID集合
*/
public List<Integer> queryListBySQL(String table,Map<String,String> diyFieldName);
/**
* 根据内容模型id获取到所有的字段
* @param contentModelId 内容模型字段
* @return 字段列表
*/
public List<FieldEntity> queryByContentModelId(int contentModelId);
/**
* 查询需要搜索的字段列表信息
* @param contentMdoel 内容模型id
* @param fieldIsSearch 是否支持搜索
* @return 字段列表信息
*/
public List<FieldEntity> queryByIsSearch(int contentMdoelId,FieldSearchEnum fieldIsSearch);
/**
* 根据模型ID删除相应字段
* @param fieldCmid 模型ID
*/
public void deleteEntityByFieldCmid(int fieldCmid);
}
\ No newline at end of file
...@@ -55,7 +55,7 @@ public interface IManagerBiz extends IBaseBiz { ...@@ -55,7 +55,7 @@ public interface IManagerBiz extends IBaseBiz {
* @param managerName 管理员帐号 * @param managerName 管理员帐号
* @return 返回存在数量 * @return 返回存在数量
*/ */
public String countManagerName(String managerName); public int countManagerName(String managerName);
/** /**
* 查询当前登录的管理员的所有子管理员 * 查询当前登录的管理员的所有子管理员
......
...@@ -74,4 +74,24 @@ public class BasicChildBizImpl extends BaseBizImpl implements IBasicChildBiz{ ...@@ -74,4 +74,24 @@ public class BasicChildBizImpl extends BaseBizImpl implements IBasicChildBiz{
return basicChildDao; return basicChildDao;
} }
@Override
public void deleteBatch(int[] basicIds) {
basicChildDao.deleteBatch(basicIds);
}
@Override
public void deleteByChildIds(int basicId, int[] basicChildIds) {
basicChildDao.deleteByChildIds(basicId, basicChildIds);
}
@Override
public void deleteByBasicIdAndChildId(int basicId, int basicChildId) {
basicChildDao.deleteByBasicIdAndChildId(basicId, basicChildId);
}
} }
\ No newline at end of file
...@@ -154,6 +154,19 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz { ...@@ -154,6 +154,19 @@ public class CategoryBizImpl extends BaseBizImpl implements ICategoryBiz {
return categoryDao.queryCategoryIdByCategoryTitle(categorySchoolName, schoolModelId, facultyModelId); return categoryDao.queryCategoryIdByCategoryTitle(categorySchoolName, schoolModelId, facultyModelId);
} }
/**
* 根据分类标题和分类的模块ID查询该分类是否存在</br>
* 若存在则不持久化直接返回数据库中原来的数据</br>
* 若不存在则持久化并返回实体信息
*
* @param categoryTitle
* 分类标题
* @param categoryCategoryId
* 父ID
* @param categoryModelId
* 模块ID
* @return 返回分类实体
*/
@Override @Override
public CategoryEntity saveByCategoryTitle(String categoryTitle,int categoryCategoryId,int categoryModelId){ public CategoryEntity saveByCategoryTitle(String categoryTitle,int categoryCategoryId,int categoryModelId){
// TODO Auto-generated method stub // TODO Auto-generated method stub
......
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.biz.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.mingsoft.base.biz.impl.BaseBizImpl;
import com.mingsoft.base.dao.IBaseDao;
import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.biz.IContentModelBiz;
import com.mingsoft.basic.dao.IContentModelDao;
import com.mingsoft.basic.dao.IFieldDao;
import com.mingsoft.basic.entity.ContentModelEntity;
import com.mingsoft.util.PageUtil;
@Service("contentModelBiz")
public class ContentModelBizImpl extends BaseBizImpl implements IContentModelBiz{
/**
* 内容模型管理业务层
*/
@Autowired
private com.mingsoft.basic.dao.IContentModelDao contentModelDao;
/**
* 注入模型字段持久层接口
*/
private IFieldDao fieldDao;
/**
* 获取内容模型业务层
* @return 内容模型业务层
*/
public com.mingsoft.basic.dao.IContentModelDao getContentModelDao() {
return contentModelDao;
}
/**
* 设置内容模型业务层
* @param contentModelDao 内容模型业务层
*/
@Autowired
public void setContentModelDao(com.mingsoft.basic.dao.IContentModelDao contentModelDao) {
this.contentModelDao = contentModelDao;
}
/**
* 根据内容模型的表名查找实体
*/
@Override
public ContentModelEntity getContentModelByTableName(String cmTableName) {
// TODO Auto-generated method stub
return (ContentModelEntity) contentModelDao.getContentModelByTableName(cmTableName);
}
/**
* 获取内容模型的dao
*/
@Override
protected IBaseDao getDao() {
// TODO Auto-generated method stub
return contentModelDao;
}
/**
* 根据管理员Id查找内容模型的总数
* @param cmManagerId 管理员id
* @return 记录总数
*/
@Override
public int getContentModelByManagerId(int cmManagerId) {
// TODO Auto-generated method stub
return contentModelDao.getContentModelByManagerId(cmManagerId);
}
/**
* 分页查询指定管理员的表单内容模型
* @param entity 实体
* @param page Map对象
* @param order 排序方式,true:asc;fales:desc
* @param cmManagerId 管理员id
* @return
*/
@Override
public List<BaseEntity> queryPageByManagerId(PageUtil page,
String orderBy, boolean order, int cmManagerId) {
// TODO Auto-generated method stub
return contentModelDao.queryPageByManagerId(page.getPageNo(), page.getPageSize(), orderBy, order, cmManagerId);
}
/**
* 根据管理员id查找内容模型实体
* @param cmManagerId
* @return
*/
@Override
public List<BaseEntity> queryByManagerId(int cmManagerId) {
// TODO Auto-generated method stub
return contentModelDao.queryByManagerId(cmManagerId);
}
/**
* 根据模型Id把模型及其相关数据清除
* @param cmId 模型ID
*/
@Override
public void deleteAllByCmId(int cmId) {
// TODO Auto-generated method stub
//获取模型实体
ContentModelEntity contentModel = (ContentModelEntity) this.contentModelDao.getEntity(cmId);
//删除模型对应的表
this.contentModelDao.dropTable(contentModel.getCmTableName());
//删除模型下的所有的字段
this.fieldDao.deleteEntityByFieldCmid(cmId);
//删除模型实体
this.contentModelDao.deleteEntity(cmId);
}
@Override
public void deleteAllByCmId(int[] cmId) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
for (int i=0;i<cmId.length;i++) {
//获取模型实体
ContentModelEntity contentModel = (ContentModelEntity) this.contentModelDao.getEntity(cmId[i]);
//删除模型对应的表
try {
this.contentModelDao.dropTable(contentModel.getCmTableName());
} catch(Exception e){}
//删除模型下的所有的字段
//this.fieldDao.deleteEntityByFieldCmid(cmId[i]);
//删除模型实体
this.contentModelDao.deleteEntity(cmId[i]);
}
}
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.biz.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mingsoft.base.dao.IBaseDao;
import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.biz.IContentModelFieldBiz;
import com.mingsoft.basic.constant.e.FieldSearchEnum;
import com.mingsoft.basic.dao.IContentModelFieldDao;
import com.mingsoft.basic.entity.ContentModelFieldEntity;
import com.mingsoft.basic.entity.FieldEntity;
import com.mingsoft.util.PageUtil;
/**
*
*
* <p>
* <b>铭飞CMS-铭飞内容管理系统</b>
* </p>
*
* <p>
* Copyright: Copyright (c) 2014 - 2015
* </p>
*
* <p>
* Company:景德镇铭飞科技有限公司
* </p>
*
* @author 姓名:张敏
*
* @version 300-001-001
*
* <p>
* 版权所有 铭飞科技
* </p>
*
* <p>
* Comments:字段业务层实现类,继承BasicBizImpl,实现IFieldBiz
* </p>
*
* <p>
* Create Date:2014-9-11
* </p>
*
* <p>
* Modification history:暂无
* </p>
*/
@Service("contentModelFieldBizImpl")
public class ContentModelFieldBizImpl extends BasicBizImpl implements IContentModelFieldBiz{
/**
* 字段持久化层
*/
@Autowired
private IContentModelFieldDao contentModelFieldDao;
/**
* 获取fieldDao
*/
@Override
protected IBaseDao getDao() {
return contentModelFieldDao;
}
/**
* 查询指定表单的自定义字段列表
* @param fieldCmid 表单ID
* @return
*/
public List<BaseEntity> queryListByCmid(int fieldCmid){
return contentModelFieldDao.queryListByCmid(fieldCmid);
}
/**
* 统计指定表单的字段数量
* @param fieldCmid
* @return
*/
public int queryCountByCmid(int fieldCmid){
return contentModelFieldDao.queryCountByCmid(fieldCmid);
}
/**
* 分页查询指定表单的字段
* @param fieldCmid 表单ID
* @param pageNo 当前页
* @param pageSize 每页显示数
* @param orderBy 排序字段
* @param order 排序方式
* @return 返回字段集合
*/
public List<BaseEntity> queryByPage(int fieldCmid,PageUtil page,String orderBy,boolean order){
return contentModelFieldDao.queryByPage(fieldCmid, page.getPageNo(), page.getPageSize(), orderBy, order);
}
/**
* 根据字段名和表单模型id查找符合条件的记录个数
* @param fieldName :字段名
* @param fieldCmdId : 表单模型id
* @return 记录个数
*/
@Override
public int getCountFieldName(String fieldFieldName, int fieldCmdId) {
// TODO Auto-generated method stub
return contentModelFieldDao.getCountFieldName(fieldFieldName, fieldCmdId);
}
/**
* 通过字段名获取字段实体
* @param fieldFieldName 字段名
* @return 字段实体
*/
public ContentModelFieldEntity getEntityByFieldName(String fieldFieldName){
return contentModelFieldDao.getEntityByFieldName(fieldFieldName);
}
/**
* 根据内容模型id和字段名查找字段实体
* @param cmId
* @param fieldFieldName
* @return 字段实体
*/
@Override
public ContentModelFieldEntity getEntityByCmId(int cmId, String fieldFieldName) {
return contentModelFieldDao.getEntityByCmId(cmId, fieldFieldName);
}
/**
* 根据自定义字段信息动态查询表
* @param table 表名
* @param diyFieldName 自定义字段
* @return 返回ID集合
*/
public List<Integer> queryListBySQL(String table,Map<String,String> diyFieldName){
// 根据列名查找字段实体
List<ContentModelFieldEntity> listField = new ArrayList<ContentModelFieldEntity>();
Iterator<String> it = diyFieldName.keySet().iterator();
for(Iterator iter = diyFieldName.keySet().iterator();iter.hasNext();){
ContentModelFieldEntity field = (ContentModelFieldEntity)contentModelFieldDao.getEntityByFieldName(iter.next().toString());
if(field!=null){
listField.add(field);
}
}
String where = "where 1=1";
for(int i = 0;i<listField.size();i++){
for(Iterator iter = diyFieldName.keySet().iterator();iter.hasNext();){
String key = iter.next().toString();
if(listField.get(i).getFieldFieldName().equals(String.valueOf(key))){
//判断类型是否为数字类型
if(listField.get(i).getFieldType()==4||listField.get(i).getFieldType()==5){
//判断是否存在数字区间如7-8,如果不存在则进行等值查询
if(diyFieldName.get(key).indexOf("-")>0){
//取出“-”的前一位数
int preNum = 1;
//取出“-”的后一位数
int nextNum = 12;
where +=" and "+ listField.get(i).getFieldFieldName()+" between " + preNum +" and " +nextNum;
}else{
where +=" and "+listField.get(i).getFieldFieldName()+" = "+Integer.valueOf(diyFieldName.get(key));
}
}else{
where +=" and "+listField.get(i).getFieldFieldName()+" like "+"'%"+String.valueOf(diyFieldName.get(key))+"%'";
}
}
}
}
List<Map> listMap = contentModelFieldDao.queryListByListField(table,where);
List<Integer> listIds= new ArrayList<Integer>();
for(int i = 0;i<listMap.size();i++){
Iterator iter = listMap.get(i).keySet().iterator();
while (iter.hasNext()){
listIds.add(Integer.valueOf(listMap.get(i).get(iter.next()).toString()));
}
}
return listIds;
}
@Override
public List<FieldEntity> queryByContentModelId(int contentModelId) {
return this.contentModelFieldDao.queryByContentModelId(contentModelId);
}
@Override
public List<FieldEntity> queryByIsSearch(int contentMdoelId, FieldSearchEnum fieldIsSearch) {
// TODO Auto-generated method stub
return this.contentModelFieldDao.queryByIsSearch(contentMdoelId, fieldIsSearch.toInt());
}
/**
* 根据模型ID删除对应字段
* @param fieldCmid 模型ID
*/
@Override
public void deleteEntityByFieldCmid(int fieldCmid) {
// TODO Auto-generated method stub
this.contentModelFieldDao.deleteEntityByFieldCmid(fieldCmid);
}
}
\ No newline at end of file
...@@ -166,25 +166,25 @@ public class DiyFormBizImpl extends BaseBizImpl implements IDiyFormBiz { ...@@ -166,25 +166,25 @@ public class DiyFormBizImpl extends BaseBizImpl implements IDiyFormBiz {
for (int i = 0; i < listField.size(); i++) { for (int i = 0; i < listField.size(); i++) {
DiyFormFieldEntity field = (DiyFormFieldEntity) listField.get(i); DiyFormFieldEntity field = (DiyFormFieldEntity) listField.get(i);
String fieldName = field.getDiyFormFieldFieldName(); String fieldName = field.getDiyFormFieldFieldName();
int fieldType = field.getDiyFormFieldType(); // int fieldType = field.getDiyFormFieldType();
if (fieldType == DiyFormFieldEnum.CHECKBOX.toInt() ) { // if (fieldType == DiyFormFieldEnum. ) {
String langtyp[] = (String[])params.get(fieldName); // String langtyp[] = (String[])params.get(fieldName);
if (langtyp != null) { // if (langtyp != null) {
StringBuffer sb = new StringBuffer(); // StringBuffer sb = new StringBuffer();
for (int j = 0; j < langtyp.length; j++) { // for (int j = 0; j < langtyp.length; j++) {
sb.append(langtyp[j] + ","); // sb.append(langtyp[j] + ",");
} // }
mapParams.put(fieldName, sb.toString()); // mapParams.put(fieldName, sb.toString());
} else { // } else {
mapParams.put(fieldName, langtyp); // mapParams.put(fieldName, langtyp);
} // }
} else { // } else {
if (StringUtil.isBlank(params.get(fieldName))) { if (StringUtil.isBlank(params.get(fieldName))) {
mapParams.put(fieldName, null); mapParams.put(fieldName, null);
} else { } else {
mapParams.put(fieldName, params.get(fieldName)); mapParams.put(fieldName, params.get(fieldName));
} }
} // }
} }
return mapParams; return mapParams;
} }
......
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.biz.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mingsoft.base.dao.IBaseDao;
import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.biz.impl.BasicBizImpl;
import com.mingsoft.basic.biz.IFieldBiz;
import com.mingsoft.basic.constant.e.FieldSearchEnum;
import com.mingsoft.basic.dao.IFieldDao;
import com.mingsoft.basic.entity.FieldEntity;
import com.mingsoft.util.PageUtil;
/**
*
*
* <p>
* <b>铭飞CMS-铭飞内容管理系统</b>
* </p>
*
* <p>
* Copyright: Copyright (c) 2014 - 2015
* </p>
*
* <p>
* Company:景德镇铭飞科技有限公司
* </p>
*
* @author 姓名:张敏
*
* @version 300-001-001
*
* <p>
* 版权所有 铭飞科技
* </p>
*
* <p>
* Comments:字段业务层实现类,继承BasicBizImpl,实现IFieldBiz
* </p>
*
* <p>
* Create Date:2014-9-11
* </p>
*
* <p>
* Modification history:暂无
* </p>
*/
@Service("fieldBiz")
public class FieldBizImpl extends BasicBizImpl implements IFieldBiz{
/**
* 字段持久化层
*/
private IFieldDao fieldDao;
/**
* 获取fieldDao
*/
@Override
protected IBaseDao getDao() {
return fieldDao;
}
/**
* 查询指定表单的自定义字段列表
* @param fieldCmid 表单ID
* @return
*/
public List<BaseEntity> queryListByCmid(int fieldCmid){
return fieldDao.queryListByCmid(fieldCmid);
}
/**
* 统计指定表单的字段数量
* @param fieldCmid
* @return
*/
public int queryCountByCmid(int fieldCmid){
return fieldDao.queryCountByCmid(fieldCmid);
}
/**
* 分页查询指定表单的字段
* @param fieldCmid 表单ID
* @param pageNo 当前页
* @param pageSize 每页显示数
* @param orderBy 排序字段
* @param order 排序方式
* @return 返回字段集合
*/
public List<BaseEntity> queryByPage(int fieldCmid,PageUtil page,String orderBy,boolean order){
return fieldDao.queryByPage(fieldCmid, page.getPageNo(), page.getPageSize(), orderBy, order);
}
/**
* 根据字段名和表单模型id查找符合条件的记录个数
* @param fieldName :字段名
* @param fieldCmdId : 表单模型id
* @return 记录个数
*/
@Override
public int getCountFieldName(String fieldFieldName, int fieldCmdId) {
// TODO Auto-generated method stub
return fieldDao.getCountFieldName(fieldFieldName, fieldCmdId);
}
/**
* 通过字段名获取字段实体
* @param fieldFieldName 字段名
* @return 字段实体
*/
public FieldEntity getEntityByFieldName(String fieldFieldName){
return fieldDao.getEntityByFieldName(fieldFieldName);
}
/**
* 根据内容模型id和字段名查找字段实体
* @param cmId
* @param fieldFieldName
* @return 字段实体
*/
@Override
public FieldEntity getEntityByCmId(int cmId, String fieldFieldName) {
return fieldDao.getEntityByCmId(cmId, fieldFieldName);
}
/**
* 根据自定义字段信息动态查询表
* @param table 表名
* @param diyFieldName 自定义字段
* @return 返回ID集合
*/
public List<Integer> queryListBySQL(String table,Map<String,String> diyFieldName){
// 根据列名查找字段实体
List<FieldEntity> listField = new ArrayList<FieldEntity>();
Iterator<String> it = diyFieldName.keySet().iterator();
for(Iterator iter = diyFieldName.keySet().iterator();iter.hasNext();){
FieldEntity field = fieldDao.getEntityByFieldName(iter.next().toString());
if(field!=null){
listField.add(field);
}
}
String where = "where 1=1";
for(int i = 0;i<listField.size();i++){
for(Iterator iter = diyFieldName.keySet().iterator();iter.hasNext();){
String key = iter.next().toString();
if(listField.get(i).getFieldFieldName().equals(String.valueOf(key))){
//判断类型是否为数字类型
if(listField.get(i).getFieldType()==4||listField.get(i).getFieldType()==5){
//判断是否存在数字区间如7-8,如果不存在则进行等值查询
if(diyFieldName.get(key).indexOf("-")>0){
//取出“-”的前一位数
int preNum = 1;
//取出“-”的后一位数
int nextNum = 12;
where +=" and "+ listField.get(i).getFieldFieldName()+" between " + preNum +" and " +nextNum;
}else{
where +=" and "+listField.get(i).getFieldFieldName()+" = "+Integer.valueOf(diyFieldName.get(key));
}
}else{
where +=" and "+listField.get(i).getFieldFieldName()+" like "+"'%"+String.valueOf(diyFieldName.get(key))+"%'";
}
}
}
}
List<Map> listMap = fieldDao.queryListByListField(table,where);
List<Integer> listIds= new ArrayList<Integer>();
for(int i = 0;i<listMap.size();i++){
Iterator iter = listMap.get(i).keySet().iterator();
while (iter.hasNext()){
listIds.add(Integer.valueOf(listMap.get(i).get(iter.next()).toString()));
}
}
return listIds;
}
@Override
public List<FieldEntity> queryByContentModelId(int contentModelId) {
return this.fieldDao.queryByContentModelId(contentModelId);
}
@Override
public List<FieldEntity> queryByIsSearch(int contentMdoelId, FieldSearchEnum fieldIsSearch) {
// TODO Auto-generated method stub
return this.fieldDao.queryByIsSearch(contentMdoelId, fieldIsSearch.toInt());
}
/**
* 根据模型ID删除对应字段
* @param fieldCmid 模型ID
*/
@Override
public void deleteEntityByFieldCmid(int fieldCmid) {
// TODO Auto-generated method stub
this.fieldDao.deleteEntityByFieldCmid(fieldCmid);
}
}
\ No newline at end of file
...@@ -115,7 +115,7 @@ public class ManagerBizImpl extends BaseBizImpl implements IManagerBiz { ...@@ -115,7 +115,7 @@ public class ManagerBizImpl extends BaseBizImpl implements IManagerBiz {
} }
@Override @Override
public String countManagerName(String managerName){ public int countManagerName(String managerName){
// TODO Auto-generated method stub // TODO Auto-generated method stub
return managerDao.countManagerName(managerName); return managerDao.countManagerName(managerName);
} }
......
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.constant;
import java.util.ResourceBundle;
import org.springframework.context.ApplicationContext;
/**
* 基础枚举类
* @author 王天培QQ:78750478
* @version
* 版本号:100-000-000<br/>
* 创建日期:2012-03-15<br/>
* 历史修订:<br/>
*/
public final class Const {
/**
* action层对应的国际化资源文件
*/
public final static ResourceBundle RESOURCES = ResourceBundle.getBundle("com.mingsoft.basic.action.resources");
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.constant.e;
import java.util.HashMap;
import java.util.Map;
import com.mingsoft.base.constant.e.BaseEnum;
/**
* 自定义模型类型
*
* @author 猪
* @version 版本号:100-000-000<br/>
* 创建日期:2012-03-15<br/>
* 历史修订:<br/>
*/
public enum ContentModelFieldEnum implements BaseEnum {
TEXT(1, "单行"), TEXTAREA(2, "多行"), HTML(3, "html"), INT(4, "整型"), FLOAT(5, "小数"), DATE(6, "日期"), IMAGE(7,
"图片"), ATTACH(8, "附件"), OPTION(9, "下拉框"), RADIO(10, "单选"), CHECKBOX(11, "多选");
/**
* 构造方法
*
* @param code
* 传入的枚举类型
*/
ContentModelFieldEnum(int id, String text) {
this.id = id;
this.text = text;
}
/**
* 枚举类型
*/
private int id;
private String text;
@Override
public int toInt() {
// TODO Auto-generated method stub
return id;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return text;
}
public static Map toMap() {
Map<String, String> map = new HashMap<String, String>();
for (ContentModelFieldEnum e : ContentModelFieldEnum.values()) {
map.put(e.toInt() + "", e.toString());
}
return map;
}
public static ContentModelFieldEnum get(int id) {
for (ContentModelFieldEnum e : ContentModelFieldEnum.values()) {
if (e.toInt() == id) {
return e;
}
}
return null;
}
public static ContentModelFieldEnum get(String str) {
for (ContentModelFieldEnum e : ContentModelFieldEnum.values()) {
if (e.toString().equals(str)) {
return e;
}
}
return null;
}
}
\ No newline at end of file
...@@ -21,76 +21,47 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技 ...@@ -21,76 +21,47 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技
package com.mingsoft.basic.constant.e; package com.mingsoft.basic.constant.e;
import java.util.HashMap;
import java.util.Map;
import com.mingsoft.base.constant.e.BaseEnum; import com.mingsoft.base.constant.e.BaseEnum;
/** /**
* 自定义表单类型 * 自定义表单类型
*
* @author 王天培QQ:78750478 * @author 王天培QQ:78750478
* @version * @version 版本号:100-000-000<br/>
* 版本号:100-000-000<br/>
* 创建日期:2012-03-15<br/> * 创建日期:2012-03-15<br/>
* 历史修订:<br/> * 历史修订:<br/>
*/ */
public enum DiyFormFieldEnum implements BaseEnum { public enum DiyFormFieldEnum implements BaseEnum {
/** TEXT(1, "字符"),
* 单行文本 DATE(2, "日期"),
*/
TEXT(1),
/**
* 多行文本
*/
TEXTAREA(2),
/** /**
* HTML * HTML
*/ */
HTML(3), TEXTAREA(3, "文本"),
/** /**
* 整型 * 整型
*/ */
INT(4), INT(4, "整型"),
/** /**
* 小數 * 小數
*/ */
DOUBLE(5), FLOAT(5, "小数");
/**
* 時間
*/
DATE(6),
/**
* 图片
*/
IMAGE(7),
/**
* 附件
*/
ATTACHMENT(8),
/**
* 下拉框
*/
SELECT(9),
/**
* 單選
*/
RADIO(10),
/**
* 多選
*/
CHECKBOX(11),
/**
* 许为空
*/
IS_NULL(1);
/** /**
* 构造方法 * 构造方法
* @param code 传入的枚举类型 *
* @param code
* 传入的枚举类型
*/ */
DiyFormFieldEnum(Object code) { DiyFormFieldEnum(int id, Object code) {
this.code = code; this.code = code;
this.id = id;
} }
/** /**
...@@ -98,10 +69,46 @@ public enum DiyFormFieldEnum implements BaseEnum { ...@@ -98,10 +69,46 @@ public enum DiyFormFieldEnum implements BaseEnum {
*/ */
private Object code; private Object code;
private int id;
@Override @Override
public int toInt() { public int toInt() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return Integer.valueOf(code.toString()); return id;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return code.toString();
}
public static Map toMap() {
Map<String, String> map = new HashMap<String, String>();
for (DiyFormFieldEnum e : DiyFormFieldEnum.values()) {
map.put(e.toInt() + "", e.toString());
}
return map;
}
public static DiyFormFieldEnum get(int id) {
for (DiyFormFieldEnum e : DiyFormFieldEnum.values()) {
if (e.toInt() == id) {
return e;
}
}
return null;
}
public static DiyFormFieldEnum get(String str) {
for (DiyFormFieldEnum e : DiyFormFieldEnum.values()) {
if (e.toString().equals(str)) {
return e;
}
}
return null;
} }
} }
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.constant.e;
import com.mingsoft.base.constant.e.BaseEnum;
/**
* 字段是否支持搜索
* @author Administrator
*
*/
public enum FieldSearchEnum implements BaseEnum {
/**
* 不支持搜索
*/
NOT("0"),
/**
* 支持搜索
*/
IS("1");
FieldSearchEnum(Object code) {
this.code = code;
}
private Object code;
@Override
public int toInt() {
// TODO Auto-generated method stub
return Integer.valueOf(code+"");
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.mingsoft.basic.dao.IAppDao"> <mapper namespace="com.mingsoft.basic.dao.IAppDao">
<cache />
<!-- 字段绑定 开始 --> <!-- 字段绑定 开始 -->
<resultMap type="com.mingsoft.basic.entity.AppEntity" id="resultMap"> <resultMap type="com.mingsoft.basic.entity.AppEntity" id="resultMap">
<id column="APP_ID" property="appId" /><!-- 与website表绑定id --> <id column="APP_ID" property="appId" /><!-- 与website表绑定id -->
...@@ -22,6 +23,7 @@ ...@@ -22,6 +23,7 @@
<!-- 添加website信息开始 --> <!-- 添加website信息开始 -->
<insert id="saveEntity" parameterType="com.mingsoft.base.entity.BaseEntity" flushCache="true"> <insert id="saveEntity" parameterType="com.mingsoft.base.entity.BaseEntity" flushCache="true">
insert into app insert into app
<!-- 添加表字段 --> <!-- 添加表字段 -->
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="appName!= null">APP_NAME,</if> <if test="appName!= null">APP_NAME,</if>
...@@ -33,9 +35,11 @@ ...@@ -33,9 +35,11 @@
<if test="appStyle!= null">APP_STYLE,</if><!-- 添加模板风格 --> <if test="appStyle!= null">APP_STYLE,</if><!-- 添加模板风格 -->
<if test="appUrl!= null">APP_URL,</if><!-- 添加域名 --> <if test="appUrl!= null">APP_URL,</if><!-- 添加域名 -->
<if test="appManagerId &gt;0 ">APP_MANAGERID,</if><!-- 添加管理员id --> <if test="appManagerId &gt;0 ">APP_MANAGERID,</if><!-- 添加管理员id -->
<if test="appMobileStyle != null">APP_MOBILE_STYLE,</if><!-- 添加手机端模版 -->
<if test="appPayDate != null">APP_PAY_DATE,</if><!-- 应用续费时间 --> <if test="appPayDate != null">APP_PAY_DATE,</if><!-- 应用续费时间 -->
<if test="appPay != null">APP_PAY,</if><!-- 应用费用清单 --> <if test="appPay != null">APP_PAY,</if><!-- 应用费用清单 -->
</trim> </trim>
<!-- 注入控制层字段 --> <!-- 注入控制层字段 -->
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="appName != null">#{appName},</if> <if test="appName != null">#{appName},</if>
......
...@@ -23,6 +23,8 @@ package com.mingsoft.basic.dao; ...@@ -23,6 +23,8 @@ package com.mingsoft.basic.dao;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.mingsoft.base.dao.IBaseDao; import com.mingsoft.base.dao.IBaseDao;
import com.mingsoft.basic.entity.BasicChildEntity; import com.mingsoft.basic.entity.BasicChildEntity;
...@@ -56,4 +58,24 @@ public interface IBasicChildDao extends IBaseDao{ ...@@ -56,4 +58,24 @@ public interface IBasicChildDao extends IBaseDao{
* @return 基础表关联数据集合 * @return 基础表关联数据集合
*/ */
List<BasicChildEntity> queryByBasicId(int basicId); List<BasicChildEntity> queryByBasicId(int basicId);
/**
* 根据basicId集合实现批量的删除
* @param basicIds basicId集合
*/
void deleteBatch(@Param("basicIds")int[] basicIds);
/**
* 根据基础id和子id集合删除
* @param basicId 基础id
* @param basicChildIds 子集合id
*/
void deleteByChildIds(@Param("basicId")int basicId,@Param("basicChildIds")int[] basicChildIds);
/**
* 根据基础id和子id删除
* @param basicId 基础id
* @param basicChildId 子id
*/
void deleteByBasicIdAndChildId(@Param("basicId")int basicId,@Param("basicChildId")int basicChildId);
} }
\ No newline at end of file
...@@ -33,4 +33,40 @@ ...@@ -33,4 +33,40 @@
where bc_basic_Id=#{basicId} where bc_basic_Id=#{basicId}
</select> </select>
<!-- 根据id查询数据结束 --> <!-- 根据id查询数据结束 -->
<!-- 根据basicId集合实现批量的删除开始-->
<delete id="deleteBatch" >
delete from basic_child
<where>
and bc_basic_Id in <foreach collection="basicIds" item="item" index="index"
open="(" separator="," close=")">#{item}</foreach>
</where>
</delete>
<!-- 根据basicId集合实现批量的删除结束-->
<!-- 根据基础id和子id集合删除开始-->
<delete id="deleteByChildIds">
delete from basic_child
<where>
<if test="basicId>0">
bc_basic_Id = #{basicId}
</if>
and bc_basic_child_id in <foreach collection="basicChildIds" item="item" index="index"
open="(" separator="," close=")">#{item}</foreach>
</where>
</delete>
<!-- 根据基础id和子id集合删除结束-->
<!-- 根据基础id和子id集合删除开始-->
<delete id="deleteByBasicIdAndChildId">
delete from basic_child
<where>
<if test="basicId>0">
bc_basic_Id = #{basicId}
</if>
and bc_basic_child_id in <foreach collection="basicChildIds" item="item" index="index"
open="(" separator="," close=")">#{item}</foreach>
</where>
</delete>
<!-- 根据基础id和子id集合删除结束-->
</mapper> </mapper>
\ No newline at end of file
...@@ -19,7 +19,7 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技 ...@@ -19,7 +19,7 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package com.mingsoft.cms.dao; package com.mingsoft.basic.dao;
import java.util.List; import java.util.List;
......
<?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.mingsoft.basic.dao.IContentModelDao">
<!-- 表字段名开始 -->
<sql id="column_list">
CM_ID,CM_TIPSNAME,CM_TABLENAME,CM_MANAGERID
</sql>
<!-- 表字段名结束 -->
<!-- 字段绑定开始 -->
<resultMap type="com.mingsoft.basic.entity.ContentModelEntity" id="resultMap">
<id column="CM_ID" property="cmId"></id> <!--实体字段cmId 与表中的cmId绑定 -->
<result column="CM_TIPSNAME" property="cmTipsName"/><!--实体字段cmTipsName 与表中的表单提示文字绑定 -->
<result column="CM_TABLENAME" property="cmTableName"/><!--实体字段cmTableName 与表中的表单表名绑定 -->
<result column="CM_MANAGERID" property="cmManagerId"/>
</resultMap>
<!-- 字段绑定结束 -->
<!-- 统计表单开始 -->
<select id="queryCount" resultType="int">
select count(*) from cms_content_model;
</select>
<!-- 根据管理员Id查找内容模型的总数 -->
<select id="getContentModelByManagerId" resultType="int">
select count(*) from cms_content_model
where CM_MANAGERID = #{cmManagerId}
</select>
<select id="getContentModelByTableName" parameterType="String" resultMap="resultMap">
select <include refid="column_list"/>
from cms_content_model
where CM_TABLENAME = #{cmTableName}
</select>
<!-- 统计表单结束 -->
<!-- 表单列表分页查询开始 -->
<select id="queryByPage" resultMap="resultMap" parameterType="int">
select * from cms_content_model
<if test="orderBy != null">
order by ${orderBy}
</if>
<if test="order == true">
asc
</if>
<if test="order == false">
desc
</if>
limit ${pageNo*pageSize},#{pageSize}
</select>
<!-- 表单列表分页查询结束 -->
<!-- 根据管理员id进行表单列表分页查询开始 -->
<select id="queryPageByManagerId" resultMap="resultMap" parameterType="int">
select * from cms_content_model where CM_MANAGERID =#{cmManagerId}
<if test="orderBy != null">
order by ${orderBy}
</if>
<if test="order == true">
asc
</if>
<if test="order == false">
desc
</if>
limit ${pageNo*pageSize},#{pageSize}
</select>
<!-- 表单列表分页查询结束 -->
<!-- 新增表单内容模型开始 -->
<insert id="saveEntity" parameterType="com.mingsoft.basic.entity.ContentModelEntity">
insert into cms_content_model
<!-- 注入表字段 -->
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cmId != null">CM_ID,</if><!-- 内容模型id -->
<if test="cmTipsName != null">CM_TIPSNAME,</if><!-- 表单提示文字 -->
<if test="cmTableName != null">CM_TABLENAME,</if><!-- 表单的表名-->
<if test="cmManagerId != null">CM_MANAGERID,</if><!-- 表单的表名-->
</trim>
<!-- 注入控制层字段 -->
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cmId != null">#{cmId},</if>
<if test="cmTipsName != null">#{cmTipsName},</if>
<if test="cmTableName != null">#{cmTableName},</if>
<if test="cmManagerId != null">#{cmManagerId},</if>
</trim>
</insert>
<!-- 新增表单内容模型结束 -->
<!-- 更新表单内容模型开始 -->
<update id="updateEntity" parameterType="com.mingsoft.basic.entity.ContentModelEntity">
update cms_content_model
<set>
<if test="cmTipsName != null">CM_TIPSNAME=#{cmTipsName},</if>
</set>
where CM_ID = #{cmId}
</update>
<!-- 更新表单内容模型结束-->
<!-- 根据id删除内容模型表单记录开始 -->
<delete id="deleteEntity" parameterType="int">
delete from cms_content_model
where CM_ID = #{cmId}
</delete>
<!-- 根据id删除内容模型表单记录结束 -->
<!-- 根据id查找内容模型实体信息 -->
<select id="getEntity" resultMap="resultMap" parameterType="int">
select <include refid="column_list"/>
from cms_content_model
where CM_ID = #{cmId}
</select>
<!-- 根据id查找内容模型实体信息 -->
<!-- 查询所有内容模型实体信息开始 -->
<select id="queryAll" resultMap="resultMap">
select <include refid="column_list"/>
from cms_content_model
</select>
<!-- 查询所有内容模型实体信息结束-->
<!-- 根据管理员Id内容模型实体信息开始 -->
<select id="queryByManagerId" resultMap="resultMap">
select <include refid="column_list"/>
from cms_content_model
where CM_MANAGERID = #{cmManagerId}
</select>
<!-- 查询所有内容模型实体信息开始 -->
</mapper>
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.mingsoft.base.dao.IBaseDao;
import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.entity.ContentModelFieldEntity;
import com.mingsoft.basic.entity.FieldEntity;
/**
*
*
* <p>
* <b>铭飞CMS-铭飞内容管理系统</b>
* </p>
*
* <p>
* Copyright: Copyright (c) 2014 - 2015
* </p>
*
* <p>
* Company:景德镇铭飞科技有限公司
* </p>
*
* @author 姓名 史爱华
*
* @version 300-001-001
*
* <p>
* 版权所有 铭飞科技
* </p>
*
* <p>
* Comments:字段管理持久化层 || 继承IBaseDao持久化层
* </p>
*
* <p>
* Create Date:2014-9-11
* </p>
*
* <p>
* Modification history:
* </p>
*/
public interface IContentModelFieldDao extends IBaseDao{
/**
* 查询指定表单的自定义字段列表
* @param fieldCmid 表单ID
* @return 表单的自定义字段列表
*/
public List<BaseEntity> queryListByCmid(int fieldCmid);
/**
* 统计指定表单的字段数量
* @param fieldCmid 表单ID
* @return 表单的字段总数
*/
public int queryCountByCmid(int fieldCmid);
/**
* 分页查询指定表单的字段
* @param fieldCmid 表单ID
* @param pageNo 当前页
* @param pageSize 每页显示数
* @param orderBy 排序字段
* @param order 排序方式
* @return 返回字段集合
*/
public List<BaseEntity> queryByPage(@Param("fieldCmid")int fieldCmid,@Param("pageNo")int pageNo,@Param("pageSize")int pageSize,@Param("orderBy")String orderBy,@Param("order") boolean order);
/**
* 根据字段名和表单模型id查找符合条件的记录个数
* @param fieldName :字段名
* @param fieldCmdId : 表单模型id
* @return 记录个数
*/
public int getCountFieldName(@Param("fieldFieldName")String fieldFieldName,@Param("fieldCmdId")int fieldCmdId);
/**
* 根据表单类型id查找字段列表
* @param cmId 表单类型id
* @return 字段列表
*/
public List<BaseEntity> queryListByCmId(@Param("fieldCmId")int fieldCmId);
/**
* 通过字段名获取字段实体
* @param fieldFieldName 字段名
* @return 字段实体
*/
public ContentModelFieldEntity getEntityByFieldName(String fieldFieldName);
/**
* 根据内容模型id和字段名查找字段实体
* @param cmId
* @param fieldFieldName
* @return 字段实体
*/
public ContentModelFieldEntity getEntityByCmId(@Param("cmId") int cmId,@Param("fieldFieldName")String fieldFieldName);
/**
* 根据自定义字段信息动态查询表
* @param table 表名
* @param diyFieldName 自定义字段
* @return 返回ID集合
*/
public List<Map> queryListBySQL(@Param("table") String table, @Param("diyFieldName")Map<String,String> diyFieldName);
/**
* 根据表名和指定条件查询
* @param table 自定义字段表名
* @param where 指定的查询条件
* @return 字段集合
*/
public List<Map> queryListByListField(@Param("table") String table,@Param("where") String where);
/**
* 根据内容模型id获取到所有的字段
* @param contentModelId 内容模型字段
* @return 集合
*/
public List<FieldEntity> queryByContentModelId(@Param("contentModelId") int contentModelId);
/**
* 根据内容模型id和是否搜索查询字段实体列表
* @param contentModelId 内容模型id
* @param isSearch 是否搜索
* @return 字段实体列表
*/
public List<FieldEntity> queryByIsSearch(@Param("contentModelId") Integer contentModelId,@Param("fieldIsSearch")Integer fieldIsSearch);
/**
* 根据模型ID删除相应字段
* @param fieldCmid 模型ID
*/
public void deleteEntityByFieldCmid(@Param("fieldCmid") int fieldCmid);
}
\ No newline at end of file
<?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" >
<!-- 字段管理持久化层XML配置继承IFieldDao -->
<mapper namespace="com.mingsoft.basic.dao.IContentModelFieldDao">
<sql id="column_list">
FIELD_ID,FIELD_TIPSNAME,FIELD_FIELDNAME,FIELD_TYPE,FIELD_CMID,FIELD_DEFAULT,FIELD_ISNULL,FIELD_ISSEARCH,FIELD_LENGTH
</sql>
<!-- 表字段与实体属性对应,供返回实体信息时使用 -->
<resultMap id="resultMap" type="com.mingsoft.basic.entity.ContentModelFieldEntity">
<id column="FIELD_ID" property="fieldId" />
<result column="FIELD_TIPSNAME" property="fieldTipsName" />
<result column="FIELD_FIELDNAME" property="fieldFieldName" />
<result column="FIELD_TYPE" property="fieldType" />
<result column="FIELD_CMID" property="fieldCmid" />
<result column="FIELD_LENGTH" property="fieldLength" />
<result column="FIELD_DEFAULT" property="fieldDefault" />
<result column="FIELD_ISNULL" property="fieldIsNull" />
<result column="FIELD_ISSEARCH" property="fieldIsSearch" />
</resultMap>
<!-- 根据sql动态查询开始 -->
<select id="queryListBySQL" resultType="Map">
select basicId from ${table} where
<foreach item="item" index="key" collection="diyFieldName" open="" separator="and" close="">
${key} like '%${item}%'
</foreach>
</select>
<!-- 查询所有字段开始 -->
<select id="queryAll" resultMap="resultMap">
select * from cms_content_mode_field;
</select>
<!-- 查询所有字段结束 -->
<!-- 查询指定表单的自定义字段列表开始 -->
<select id="queryListByCmid" resultMap="resultMap" parameterType="int">
select * from cms_content_mode_field where FIELD_CMID = #{fieldCmid} order by field_sort,field_id desc;
</select>
<!-- 查询指定表单的自定义字段列表结束 -->
<!-- 统计指定表单的字段数量开始 -->
<select id="queryCountByCmid" resultType="int" parameterType="int">
select count(*) from cms_content_mode_field where FIELD_CMID = #{fieldCmid};
</select>
<!-- 统计指定表单的字段数量结束 -->
<!-- 字段列表分页查询开始 -->
<select id="queryByPage" resultMap="resultMap">
select * from cms_content_mode_field where FIELD_CMID = #{fieldCmid}
<if test="orderBy != null">
order by ${orderBy}
</if>
<if test="order == true">
asc
</if>
<if test="order == false">
desc
</if>
limit ${pageNo*pageSize},#{pageSize}
</select>
<!-- 字段列表分页查询结束 -->
<!-- 增加字段实体开始 -->
<insert id="saveEntity" parameterType="com.mingsoft.basic.entity.ContentModelFieldEntity">
insert into cms_content_mode_field
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fieldTipsName != null">FIELD_TIPSNAME,</if>
<if test="fieldFieldName != null">FIELD_FIELDNAME,</if>
<if test="fieldType != null">FIELD_TYPE,</if>
<if test="fieldCmid != null">FIELD_CMID,</if>
<if test="fieldLength != null">FIELD_LENGTH,</if>
<if test="fieldDefault != null">FIELD_DEFAULT,</if>
<if test="fieldIsNull != null">FIELD_ISNULL,</if>
<if test="fieldIsSearch != null">FIELD_ISSEARCH,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fieldTipsName != null">#{fieldTipsName},</if>
<if test="fieldFieldName != null">#{fieldFieldName},</if>
<if test="fieldType != null">#{fieldType},</if>
<if test="fieldCmid != null">#{fieldCmid},</if>
<if test="fieldLength != null">#{fieldLength},</if>
<if test="fieldDefault != null">#{fieldDefault},</if>
<if test="fieldIsNull != null">#{fieldIsNull},</if>
<if test="fieldIsSearch != null">#{fieldIsSearch}</if>
</trim>
</insert>
<!-- 增加字段实体结束 -->
<!-- 根据自增长ID删除字段实体开始 -->
<delete id="deleteEntity" parameterType="int">
delete from cms_content_mode_field where FIELD_ID = #{fieldId}
</delete>
<!-- 根据自增长ID删除字段实体结束 -->
<!-- 根据模型ID删除字段实体开始 -->
<delete id="deleteEntityByFieldCmid" parameterType="int">
delete from cms_content_mode_field where FIELD_CMID = #{fieldCmid}
</delete>
<!-- 根据模型ID删除字段实体结束 -->
<!-- 查询字段实体开始 -->
<select id="getEntity" resultMap="resultMap" parameterType="int">
select
<include refid="column_list"/>
from cms_content_mode_field where FIELD_ID=#{fieldId};
</select>
<!-- 查询字段实体结束 -->
<!-- 通过字段名获取字段实体开始 -->
<select id="getEntityByFieldName" resultMap="resultMap" parameterType="String">
select
<include refid="column_list"/>
from cms_content_mode_field where FIELD_FIELDNAME=#{fieldFieldName};
</select>
<!-- 通过字段名获取字段实体结束 -->
<!-- 通过字段名和内容模型id获取字段实体开始 -->
<select id="getEntityByCmId" resultMap="resultMap">
select
<include refid="column_list"/>
from cms_content_mode_field where FIELD_FIELDNAME=#{fieldFieldName} and FIELD_CMID=#{cmId};
</select>
<!-- 通过字段名获取字段实体结束 -->
<!-- 更新字段开始 -->
<update id="updateEntity" parameterType="com.mingsoft.basic.entity.ContentModelFieldEntity">
update cms_content_mode_field
<set>
<if test="fieldTipsName != null">FIELD_TIPSNAME=#{fieldTipsName},</if>
<if test="fieldFieldName != null">FIELD_FIELDNAME=#{fieldFieldName},</if>
<if test="fieldType != null">FIELD_TYPE=#{fieldType},</if>
<if test="fieldCmid != null">FIELD_CMID=#{fieldCmid},</if>
<if test="fieldLength != null">FIELD_LENGTH=#{fieldLength},</if>
<if test="fieldDefault != null">FIELD_DEFAULT=#{fieldDefault},</if>
<if test="fieldIsNull != null">FIELD_ISNULL=#{fieldIsNull},</if>
<if test="fieldIsSearch != null">FIELD_ISSEARCH=#{fieldIsSearch}</if>
</set>
where FIELD_ID=#{fieldId};
</update>
<!-- 更新字段结束 -->
<!-- 根据字段名和表单模型id查找符合条件的记录个数开始 -->
<select id="getCountFieldName" resultType="int">
select count(*) from cms_content_mode_field
where FIELD_CMID=#{fieldCmdId}
<if test="fieldFieldName!=null">and FIELD_FIELDNAME=#{fieldFieldName}</if>
</select>
<!-- 根据sql动态查询开始 -->
<select id="queryListByListField" resultType="Map">
select basicId from ${table} ${where}
</select>
<!-- - -->
<select id="queryByContentModelId" resultMap="resultMap">
select * from cms_content_mode_field where FIELD_CMID = #{contentModelId} order by field_sort,field_id desc
</select>
<select id="queryByIsSearch" resultMap="resultMap">
select * from cms_content_mode_field
<where>
<if test="contentModelId!=null">and FIELD_CMID=#{contentModelId}</if>
<if test="fieldIsSearch!=null">and FIELD_ISSEARCH=#{fieldIsSearch}</if>
order by field_sort,field_id desc
</where>
</select>
</mapper>
\ No newline at end of file
...@@ -19,14 +19,14 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技 ...@@ -19,14 +19,14 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
package com.mingsoft.cms.dao; package com.mingsoft.basic.dao;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.mingsoft.base.dao.IBaseDao; import com.mingsoft.base.dao.IBaseDao;
import com.mingsoft.base.entity.BaseEntity; import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.cms.entity.FieldEntity; import com.mingsoft.basic.entity.FieldEntity;
/** /**
* *
* *
...@@ -51,7 +51,7 @@ import com.mingsoft.cms.entity.FieldEntity; ...@@ -51,7 +51,7 @@ import com.mingsoft.cms.entity.FieldEntity;
* </p> * </p>
* *
* <p> * <p>
* Comments:字段管理持久化层 || 继承IBaseDao持久化层 * Comments:字段管理持久化层 || 继承IBaseDao持久化层 @see IContentModelFieldDao
* </p> * </p>
* *
* <p> * <p>
...@@ -151,4 +151,11 @@ public interface IFieldDao extends IBaseDao{ ...@@ -151,4 +151,11 @@ public interface IFieldDao extends IBaseDao{
* @return 字段实体列表 * @return 字段实体列表
*/ */
public List<FieldEntity> queryByIsSearch(@Param("contentModelId") Integer contentModelId,@Param("fieldIsSearch")Integer fieldIsSearch); public List<FieldEntity> queryByIsSearch(@Param("contentModelId") Integer contentModelId,@Param("fieldIsSearch")Integer fieldIsSearch);
/**
* 根据模型ID删除相应字段
* @param fieldCmid 模型ID
*/
public void deleteEntityByFieldCmid(@Param("fieldCmid") int fieldCmid);
} }
\ No newline at end of file
<?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" >
<!-- 字段管理持久化层XML配置继承IFieldDao -->
<mapper namespace="com.mingsoft.basic.dao.IFieldDao">
<sql id="column_list">
FIELD_ID,FIELD_TIPSNAME,FIELD_FIELDNAME,FIELD_TYPE,FIELD_CMID,FIELD_DEFAULT,FIELD_ISNULL,FIELD_ISSEARCH
</sql>
<!-- 表字段与实体属性对应,供返回实体信息时使用 -->
<resultMap id="resultMap" type="com.mingsoft.basic.entity.FieldEntity">
<id column="FIELD_ID" property="fieldId" />
<result column="FIELD_TIPSNAME" property="fieldTipsName" />
<result column="FIELD_FIELDNAME" property="fieldFieldName" />
<result column="FIELD_TYPE" property="fieldType" />
<result column="FIELD_CMID" property="fieldCmid" />
<result column="FIELD_DEFAULT" property="fieldDefault" />
<result column="FIELD_ISNULL" property="fieldIsNull" />
<result column="FIELD_ISSEARCH" property="fieldIsSearch" />
</resultMap>
<!-- 根据sql动态查询开始 -->
<select id="queryListBySQL" resultType="Map">
select basicId from ${table} where
<foreach item="item" index="key" collection="diyFieldName"
open="" separator="and" close="">
${key} like '%${item}%'
</foreach>
</select>
<!-- 查询所有字段开始 -->
<select id="queryAll" resultMap="resultMap">
select * from
cms_content_mode_field;
</select>
<!-- 查询所有字段结束 -->
<!-- 查询指定表单的自定义字段列表开始 -->
<select id="queryListByCmid" resultMap="resultMap"
parameterType="int">
select * from cms_content_mode_field where FIELD_CMID =
#{fieldCmid} order by field_sort,field_id desc;
</select>
<!-- 查询指定表单的自定义字段列表结束 -->
<!-- 统计指定表单的字段数量开始 -->
<select id="queryCountByCmid" resultType="int" parameterType="int">
select count(*) from cms_content_mode_field where FIELD_CMID =
#{fieldCmid};
</select>
<!-- 统计指定表单的字段数量结束 -->
<!-- 字段列表分页查询开始 -->
<select id="queryByPage" resultMap="resultMap">
select * from cms_content_mode_field where FIELD_CMID = #{fieldCmid}
<if test="orderBy != null">
order by ${orderBy}
</if>
<if test="order == true">
asc
</if>
<if test="order == false">
desc
</if>
limit ${pageNo*pageSize},#{pageSize}
</select>
<!-- 字段列表分页查询结束 -->
<!-- 增加字段实体开始 -->
<insert id="saveEntity" parameterType="com.mingsoft.basic.entity.FieldEntity">
insert into cms_content_mode_field
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fieldTipsName != null">FIELD_TIPSNAME,</if>
<if test="fieldFieldName != null">FIELD_FIELDNAME,</if>
<if test="fieldType != null">FIELD_TYPE,</if>
<if test="fieldCmid != null">FIELD_CMID,</if>
<if test="fieldDefault != null">FIELD_DEFAULT,</if>
<if test="fieldIsNull != null">FIELD_ISNULL,</if>
<if test="fieldIsSearch != null">FIELD_ISSEARCH,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fieldTipsName != null">#{fieldTipsName},</if>
<if test="fieldFieldName != null">#{fieldFieldName},</if>
<if test="fieldType != null">#{fieldType},</if>
<if test="fieldCmid != null">#{fieldCmid},</if>
<if test="fieldDefault != null">#{fieldDefault},</if>
<if test="fieldIsNull != null">#{fieldIsNull},</if>
<if test="fieldIsSearch != null">#{fieldIsSearch}</if>
</trim>
</insert>
<!-- 增加字段实体结束 -->
<!-- 根据自增长ID删除字段实体开始 -->
<delete id="deleteEntity" parameterType="int">
delete from
cms_content_mode_field where FIELD_ID = #{fieldId}
</delete>
<!-- 根据自增长ID删除字段实体结束 -->
<!-- 根据模型ID删除字段实体开始 -->
<delete id="deleteEntityByFieldCmid" parameterType="int">
delete from
cms_content_mode_field where FIELD_CMID = #{fieldCmid}
</delete>
<!-- 根据模型ID删除字段实体结束 -->
<!-- 查询字段实体开始 -->
<select id="getEntity" resultMap="resultMap" parameterType="int">
select
<include refid="column_list" />
from cms_content_mode_field where FIELD_ID=#{fieldId};
</select>
<!-- 查询字段实体结束 -->
<!-- 通过字段名获取字段实体开始 -->
<select id="getEntityByFieldName" resultMap="resultMap"
parameterType="String">
select
<include refid="column_list" />
from cms_content_mode_field where FIELD_FIELDNAME=#{fieldFieldName};
</select>
<!-- 通过字段名获取字段实体结束 -->
<!-- 通过字段名和内容模型id获取字段实体开始 -->
<select id="getEntityByCmId" resultMap="resultMap">
select
<include refid="column_list" />
from cms_content_mode_field where FIELD_FIELDNAME=#{fieldFieldName}
and FIELD_CMID=#{cmId};
</select>
<!-- 通过字段名获取字段实体结束 -->
<!-- 更新字段开始 -->
<update id="updateEntity" parameterType="com.mingsoft.basic.entity.FieldEntity">
update cms_content_mode_field
<set>
<if test="fieldTipsName != null">FIELD_TIPSNAME=#{fieldTipsName},</if>
<if test="fieldFieldName != null">FIELD_FIELDNAME=#{fieldFieldName},</if>
<if test="fieldType != null">FIELD_TYPE=#{fieldType},</if>
<if test="fieldCmid != null">FIELD_CMID=#{fieldCmid},</if>
<if test="fieldDefault != null">FIELD_DEFAULT=#{fieldDefault},</if>
<if test="fieldIsNull != null">FIELD_ISNULL=#{fieldIsNull},</if>
<if test="fieldIsSearch != null">FIELD_ISSEARCH=#{fieldIsSearch}</if>
</set>
where FIELD_ID=#{fieldId};
</update>
<!-- 更新字段结束 -->
<!-- 根据字段名和表单模型id查找符合条件的记录个数开始 -->
<select id="getCountFieldName" resultType="int">
select count(*) from cms_content_mode_field
where
FIELD_CMID=#{fieldCmdId}
<if test="fieldFieldName!=null">and FIELD_FIELDNAME=#{fieldFieldName}</if>
</select>
<!-- 根据sql动态查询开始 -->
<select id="queryListByListField" resultType="Map">
select basicId from
${table} ${where}
</select>
<!-- - -->
<select id="queryByContentModelId" resultMap="resultMap">
select * from
cms_content_mode_field where FIELD_CMID = #{contentModelId} order by
field_sort,field_id desc
</select>
<select id="queryByIsSearch" resultMap="resultMap">
select * from cms_content_mode_field
<where>
<if test="contentModelId!=null">and FIELD_CMID=#{contentModelId}</if>
<if test="fieldIsSearch!=null">and FIELD_ISSEARCH=#{fieldIsSearch}</if>
order by field_sort,field_id desc
</where>
</select>
</mapper>
\ No newline at end of file
...@@ -55,7 +55,7 @@ public interface IManagerDao extends IBaseDao { ...@@ -55,7 +55,7 @@ public interface IManagerDao extends IBaseDao {
* @param managerName 管理员帐号 * @param managerName 管理员帐号
* @return 返回存在数量 * @return 返回存在数量
*/ */
public String countManagerName(String managerName); public int countManagerName(String managerName);
/** /**
* 查询当前登录的管理员的所有子管理员 * 查询当前登录的管理员的所有子管理员
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<!-- 根据帐号查询管理员实体结束 --> <!-- 根据帐号查询管理员实体结束 -->
<!-- 增加管理员开始 --> <!-- 增加管理员开始 -->
<insert id="saveEntity" parameterType="com.mingsoft.basic.entity.ManagerEntity"> <insert id="saveEntity" parameterType="com.mingsoft.basic.entity.ManagerEntity" useGeneratedKeys="true" keyProperty="managerId">
insert into manager insert into manager
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="managerName != null">MANAGER_NAME,</if> <if test="managerName != null">MANAGER_NAME,</if>
...@@ -122,9 +122,8 @@ ...@@ -122,9 +122,8 @@
<if test="managerName != null">MANAGER_NAME=#{managerName},</if> <if test="managerName != null">MANAGER_NAME=#{managerName},</if>
<if test="managerNickName != null">MANAGER_NICKNAME=#{managerNickName},</if> <if test="managerNickName != null">MANAGER_NICKNAME=#{managerNickName},</if>
<if test="managerPassword != null">MANAGER_PASSWORD=#{managerPassword},</if> <if test="managerPassword != null">MANAGER_PASSWORD=#{managerPassword},</if>
<if test="managerRoleID != null">MANAGER_ROLEID=#{managerRoleID},</if> <if test="managerRoleID != null and managerRoleID gt 0">MANAGER_ROLEID=#{managerRoleID},</if>
<if test="managerPeopleID != null">MANAGER_PEOPLEID=#{managerPeopleID},</if> <if test="managerPeopleID != null and managerPeopleID gt 0">MANAGER_PEOPLEID=#{managerPeopleID},</if>
<if test="managerTime != null">MANAGER_TIME=#{managerTime}</if>
</set> </set>
where MANAGER_ID = #{managerId} where MANAGER_ID = #{managerId}
</update> </update>
...@@ -141,8 +140,8 @@ ...@@ -141,8 +140,8 @@
<!-- 修改用户登录密码结束 --> <!-- 修改用户登录密码结束 -->
<!-- 查询该管理员帐号在数据库中的存在数开始 --> <!-- 查询该管理员帐号在数据库中的存在数开始 -->
<select id="countManagerName" resultType="String" parameterType="java.lang.String"> <select id="countManagerName" resultType="int" parameterType="java.lang.String">
select * from manager where MANAGER_NAME=#{managerName}; select count(*) from manager where MANAGER_NAME=#{managerName};
</select> </select>
<!-- 查询该管理员帐号在数据库中的存在数结束 --> <!-- 查询该管理员帐号在数据库中的存在数结束 -->
......
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
select select
<include refid="column_list" /> <include refid="column_list" />
from model from model
where MODEL_CODE = ${modelCode} where MODEL_CODE = #{modelCode}
</select> </select>
<!-- 更具模块编号查询模块实体结束 --> <!-- 更具模块编号查询模块实体结束 -->
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<!-- 角色列表分页查询结束 --> <!-- 角色列表分页查询结束 -->
<!-- 新增角色开始 --> <!-- 新增角色开始 -->
<insert id="saveEntity" parameterType="com.mingsoft.basic.entity.RoleEntity"> <insert id="saveEntity" parameterType="com.mingsoft.basic.entity.RoleEntity" useGeneratedKeys="true" keyProperty="roleId">
insert into role insert into role
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="roleName != null">ROLE_NAME,</if> <if test="roleName != null">ROLE_NAME,</if>
......
...@@ -46,4 +46,10 @@ public interface IRoleModelDao extends IBaseDao{ ...@@ -46,4 +46,10 @@ public interface IRoleModelDao extends IBaseDao{
* @param roleModelList 集合 * @param roleModelList 集合
*/ */
public void updateEntity(List<RoleModelEntity> roleModelList); public void updateEntity(List<RoleModelEntity> roleModelList);
/**
* 根据角色编号删除对应功能
* @param id 角色编号
*/
public void deleteByRoleId(int id);
} }
\ No newline at end of file
...@@ -10,6 +10,12 @@ ...@@ -10,6 +10,12 @@
(#{item.modelId},#{item.roleId}) (#{item.modelId},#{item.roleId})
</foreach> </foreach>
</insert> </insert>
<insert id="saveBatch" parameterType="java.util.List">
insert into role_model (RM_MODELID,RM_ROLEID) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.modelId},#{item.roleId})
</foreach>
</insert>
<!-- 在角色模块表中保存数据,一个角色存在多个功能模块结束 --> <!-- 在角色模块表中保存数据,一个角色存在多个功能模块结束 -->
<!--为角色批量修改模块开始 --> <!--为角色批量修改模块开始 -->
...@@ -25,6 +31,9 @@ ...@@ -25,6 +31,9 @@
<update id="deleteEntity" parameterType="int"> <update id="deleteEntity" parameterType="int">
delete from role_model where RM_ROLEID=#{roleId} delete from role_model where RM_ROLEID=#{roleId}
</update> </update>
<update id="deleteByRoleId" parameterType="int">
delete from role_model where RM_ROLEID=#{roleId}
</update>
<!--删除指定角色的模块结束 --> <!--删除指定角色的模块结束 -->
</mapper> </mapper>
\ No newline at end of file
...@@ -64,7 +64,7 @@ public class AppEntity extends BaseEntity { ...@@ -64,7 +64,7 @@ public class AppEntity extends BaseEntity {
/** /**
* 移动端样式目录 * 移动端样式目录
*/ */
private String appMobileStyle; private String appMobileStyle="";
/** /**
......
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.entity;
import com.mingsoft.base.entity.BaseEntity;
/**
*
*
* <p>
* <b>铭飞CMS-铭飞内容管理系统</b>
* </p>
*
* <p>
* Copyright: Copyright (c) 2014 - 2015
* </p>
*
* <p>
* Company:景德镇铭飞科技有限公司
* </p>
*
* @author 姓名:张敏
*
* @version 300-001-001
*
* <p>
* 版权所有 铭飞科技
* </p>
*
* <p>
* Comments:内容模型实体,指表单类型,继承BaseEntity
* </p>
*
* <p>
* Create Date:2014-9-11
* </p>
*
* <p>
* Modification history:暂无
* </p>
*/
public class ContentModelEntity extends BaseEntity{
/**
* 自增长ID
*/
private int cmId;
/**
* 表名提示文字
*/
private String cmTipsName;
/**
* 表单名称
*/
private String cmTableName;
/**
* 表单所属的管理员id
*/
private int cmManagerId;
/**
* 获取cmId
* @return cmId
*/
public int getCmId() {
return cmId;
}
/**
* 设置cmId
* @param cmId
*/
public void setCmId(int cmId) {
this.cmId = cmId;
}
/**
* 获取cmTipsName
* @return cmTipsName
*/
public String getCmTipsName() {
return cmTipsName;
}
/**
* 设置cmTipsName
* @param cmTipsName
*/
public void setCmTipsName(String cmTipsName) {
this.cmTipsName = cmTipsName;
}
/**
* 获取cmTableName
* @return cmTableName
*/
public String getCmTableName() {
return cmTableName;
}
/**
* 设置cmTableName
* @param cmTableName
*/
public void setCmTableName(String cmTableName) {
this.cmTableName = cmTableName;
}
/**
* 获取该表单所属的管理员id
* @return
*/
public int getCmManagerId() {
return cmManagerId;
}
/**
* 设置该表单所属的管理员id
* @param cmManagerId
*/
public void setCmManagerId(int cmManagerId) {
this.cmManagerId = cmManagerId;
}
}
\ No newline at end of file
/**
The MIT License (MIT) * Copyright (c) 2015 铭飞科技
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.mingsoft.basic.entity;
import com.mingsoft.base.constant.e.TableCloumnEnum;
import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.constant.e.ContentModelFieldEnum;
import com.mingsoft.basic.constant.e.FieldSearchEnum;
/**
*
* ms-basic 自定义模型字段
*
* @author 会飞的猪
* @version 版本号:<br/>
* 创建日期:2016年1月15日<br/>
* 历史修订:<br/>
*/
public class ContentModelFieldEntity extends BaseEntity {
/**
* 自增长ID
*/
private int fieldId;
/**
* 字段提示文字
*/
private String fieldTipsName;
/**
* 字段名称
*/
private String fieldFieldName;
/**
* 字段类型(如:1单行文本 2多行文本...)
*/
private int fieldType;
/**
* 字段对应的字段类型中文名称
*/
private String fieldTypeString;
/**
* 字段的默认值
*/
private String fieldDefault;
/**
* 绑定内容模型表ID
*/
private int fieldCmid;
/**
* 判断字段为必填还是可选 0:必填 1:可选
*/
private int fieldIsNull;
/**
* 判断字段是否支持搜索
*/
private int fieldIsSearch;
/**
* 字段长度
*/
private int fieldLength = 1;
public String getFieldTypeString() {
return ContentModelFieldEnum.get(this.getFieldType()).toString();
}
public void setFieldTypeString(String fieldTypeString) {
this.fieldTypeString = fieldTypeString;
}
public int getFieldLength() {
return fieldLength;
}
public void setFieldLength(int fieldLength) {
if (this.fieldLength <= 0) {
this.fieldLength = 11;
} else {
this.fieldLength = fieldLength;
}
}
/**
*
* @return
*/
public int getFieldIsSearch() {
return fieldIsSearch;
}
/**
*
* @param fieldIsSearch
*/
@Deprecated
public void setFieldIsSearch(int fieldIsSearch) {
this.fieldIsSearch = fieldIsSearch;
}
public void setFieldIsSearch(FieldSearchEnum fieldIsSearch) {
this.fieldIsSearch = fieldIsSearch.toInt();
}
/**
* 获取fieldId
*
* @return fieldId
*/
public int getFieldId() {
return fieldId;
}
/**
* 设置fieldId
*
* @param fieldId
*/
public void setFieldId(int fieldId) {
this.fieldId = fieldId;
}
/**
* 获取fieldTipsName
*
* @return fieldTipsName
*/
public String getFieldTipsName() {
return fieldTipsName;
}
/**
* 设置fieldTipsName
*
* @param fieldTipsName
*/
public void setFieldTipsName(String fieldTipsName) {
this.fieldTipsName = fieldTipsName;
}
/**
* 获取fieldFieldName
*
* @return fieldFieldName
*/
public String getFieldFieldName() {
return fieldFieldName;
}
/**
* 设置fieldFieldName
*
* @param fieldFieldName
*/
public void setFieldFieldName(String fieldFieldName) {
this.fieldFieldName = fieldFieldName;
}
/**
* 获取fieldType
*
* @return fieldType
*/
public int getFieldType() {
return fieldType;
}
public String getFieldColumnType() {
// 1=单行文本(varchar)
// 2=多行文本
// 3=HTML文本
// 4=整数类型
// 5=小数类型
// 6=时间类型
// 7=图片
// 8=附件类型
// 9=使用option下拉框
// 10=使用radio选项卡
// 11=Checkbox多选框
if (this.getFieldType() == ContentModelFieldEnum.DATE.toInt()) {
return TableCloumnEnum.DATETIME.toString();
} else if (this.getFieldType() == ContentModelFieldEnum.FLOAT.toInt()) {
return TableCloumnEnum.FLOAT.toString() + "(10)";
} else if (this.getFieldType() == ContentModelFieldEnum.INT.toInt()) {
return TableCloumnEnum.INT.toString() + "(11)";
} else if (this.getFieldType() == ContentModelFieldEnum.HTML.toInt()) {
return TableCloumnEnum.TEXT.toString();
} else {
return TableCloumnEnum.VARCHAR.toString() + "(225)";
}
}
/**
* 设置fieldType
*
* @param fieldType
*/
public void setFieldType(int fieldType) {
this.fieldType = fieldType;
}
/**
* 获取fieldCmid
*
* @return fieldCmid
*/
public int getFieldCmid() {
return fieldCmid;
}
/**
* 设置fieldCmid
*
* @param fieldCmid
*/
public void setFieldCmid(int fieldCmid) {
this.fieldCmid = fieldCmid;
}
/**
* 设置字段的默认值
*
* @return
*/
public String getFieldDefault() {
if (this.fieldType == ContentModelFieldEnum.DATE.toInt()
|| this.fieldType == ContentModelFieldEnum.HTML.toInt()) {
return null;
}
if (fieldDefault == null || fieldDefault.length() == 0) {
return null;
}
return fieldDefault;
}
/**
* 获取字段的默认值
*
* @param fieldDefault
*/
public void setFieldDefault(String fieldDefault) {
this.fieldDefault = fieldDefault;
}
/**
* 获取字段是否是可选
*
* @return
*/
public int getFieldIsNull() {
return fieldIsNull;
}
/**
* 设置字段是否是可选
*
* @return
*/
public void setFieldIsNull(int fieldIsNull) {
this.fieldIsNull = fieldIsNull;
}
}
\ No newline at end of file
...@@ -21,7 +21,9 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技 ...@@ -21,7 +21,9 @@ The MIT License (MIT) * Copyright (c) 2015 铭飞科技
package com.mingsoft.basic.entity; package com.mingsoft.basic.entity;
import com.mingsoft.base.constant.e.TableCloumnEnum;
import com.mingsoft.base.entity.BaseEntity; import com.mingsoft.base.entity.BaseEntity;
import com.mingsoft.basic.constant.e.ContentModelFieldEnum;
import com.mingsoft.basic.constant.e.DiyFormFieldEnum; import com.mingsoft.basic.constant.e.DiyFormFieldEnum;
/** /**
...@@ -69,13 +71,39 @@ public class DiyFormFieldEntity extends BaseEntity{ ...@@ -69,13 +71,39 @@ public class DiyFormFieldEntity extends BaseEntity{
*/ */
private String diyFormFieldTipsName; private String diyFormFieldTipsName;
/**
* 长度
*/
private int diyFormFieldLength = 1;
/** /**
* 字段类型 * 字段类型
* 参考:DiyFormFieldEnum * 参考:DiyFormFieldEnum
*/ */
private int diyFormFieldType; private int diyFormFieldType;
public int getDiyFormFieldLength() {
return diyFormFieldLength;
}
public void setDiyFormFieldLength(int diyFormFieldLength) {
this.diyFormFieldLength = diyFormFieldLength;
}
public String getDiyFormFieldDefault() { public String getDiyFormFieldDefault() {
if (this.diyFormFieldType == DiyFormFieldEnum.DATE.toInt()
|| this.diyFormFieldType == DiyFormFieldEnum.TEXTAREA.toInt()) {
return null;
} else if (this.diyFormFieldType == DiyFormFieldEnum.FLOAT.toInt()
|| this.diyFormFieldType == DiyFormFieldEnum.INT.toInt()
) {
return "0";
}
return diyFormFieldDefault; return diyFormFieldDefault;
} }
...@@ -104,9 +132,27 @@ public class DiyFormFieldEntity extends BaseEntity{ ...@@ -104,9 +132,27 @@ public class DiyFormFieldEntity extends BaseEntity{
} }
public int getDiyFormFieldType() { public int getDiyFormFieldType() {
return diyFormFieldType; return diyFormFieldType;
} }
public String getDiyFormFieldColumnType() {
if (this.getDiyFormFieldType() == DiyFormFieldEnum.DATE.toInt()) {
return TableCloumnEnum.DATETIME.toString();
} else if (this.getDiyFormFieldType() == DiyFormFieldEnum.FLOAT.toInt()) {
return TableCloumnEnum.FLOAT.toString()+"(11)";
} else if (this.getDiyFormFieldType() == DiyFormFieldEnum.INT.toInt()) {
return TableCloumnEnum.INT.toString()+"(11)";
} else if (this.getDiyFormFieldType() == DiyFormFieldEnum.TEXTAREA.toInt()) {
return TableCloumnEnum.TEXT.toString();
} else {
return TableCloumnEnum.VARCHAR.toString()+"(100)";
}
}
public void setDiyFormFieldDefault(String diyFormFieldDefault) { public void setDiyFormFieldDefault(String diyFormFieldDefault) {
this.diyFormFieldDefault = diyFormFieldDefault; this.diyFormFieldDefault = diyFormFieldDefault;
} }
......
This diff is collapsed.
...@@ -62,7 +62,7 @@ public class ManagerFilter extends BaseFilter { ...@@ -62,7 +62,7 @@ public class ManagerFilter extends BaseFilter {
if (mangerObj!=null) { if (mangerObj!=null) {
chain.doFilter(request, response); chain.doFilter(request, response);
} else { } else {
httpResponse.sendRedirect(request.getScheme() + "://"+ request.getServerName() + (request.getServerPort()==80?"":":"+request.getServerPort())+ httpRequest.getContextPath() + "/ms/login.do"); httpResponse.sendRedirect(request.getScheme() + "://"+ request.getServerName() + (request.getServerPort()==80?"":":"+request.getServerPort())+ httpRequest.getContextPath() + "/msadmin/login.do");
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.mingsoft.base.constant.Const; import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.SessionConst; import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
...@@ -47,10 +48,14 @@ public class ActionInterceptor extends HandlerInterceptorAdapter { ...@@ -47,10 +48,14 @@ public class ActionInterceptor extends HandlerInterceptorAdapter {
private static String MODEL_ID = "modelId"; private static String MODEL_ID = "modelId";
private static String BASE_URL = "baseUrl";
public static boolean IS_WINDOWS = false; public static boolean IS_WINDOWS = false;
static { static {
if (System.getProperty("os.name").toLowerCase().indexOf("windows" )>0) { if (System.getProperty("os.name").toLowerCase().indexOf("windows" )>0) {
IS_WINDOWS = true; IS_WINDOWS = true;
...@@ -75,6 +80,7 @@ public class ActionInterceptor extends HandlerInterceptorAdapter { ...@@ -75,6 +80,7 @@ public class ActionInterceptor extends HandlerInterceptorAdapter {
} }
request.setAttribute(BASE, Const.BASE); request.setAttribute(BASE, Const.BASE);
request.setAttribute(BASE_PATH,request.getScheme() + "://"+ request.getServerName() + (request.getServerPort()==80?"":":"+request.getServerPort())+ Const.BASE); request.setAttribute(BASE_PATH,request.getScheme() + "://"+ request.getServerName() + (request.getServerPort()==80?"":":"+request.getServerPort())+ Const.BASE);
request.setAttribute(BASE_URL,request.getScheme() + "://" + request.getServerName() + (request.getServerPort()==80?"":":"+request.getServerPort())+request.getContextPath() + request.getServletPath()+ (request.getQueryString()==null?"":"?"+request.getQueryString()) );
return true; return true;
} }
......
...@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.web.context.support.WebApplicationContextUtils; import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.mingsoft.base.constant.SessionConst; import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
......
File mode changed from 100644 to 100755
...@@ -40,11 +40,11 @@ import org.springframework.web.context.support.WebApplicationContextUtils; ...@@ -40,11 +40,11 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mingsoft.base.entity.ResultJson; import com.mingsoft.base.entity.ResultJson;
import com.mingsoft.basic.biz.IAppBiz; import com.mingsoft.basic.biz.IAppBiz;
import com.mingsoft.basic.entity.AppEntity;
import com.mingsoft.base.constant.Const; import com.mingsoft.base.constant.Const;
import com.mingsoft.base.constant.CookieConst; import com.mingsoft.base.constant.CookieConst;
import com.mingsoft.base.constant.ModelCode; import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.base.constant.SessionConst; import com.mingsoft.base.constant.SessionConst;
import com.mingsoft.basic.entity.AppEntity;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
/** /**
......
...@@ -34,6 +34,7 @@ import javax.servlet.annotation.WebServlet; ...@@ -34,6 +34,7 @@ import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import com.mingsoft.base.constant.SessionConst; import com.mingsoft.base.constant.SessionConst;
......
...@@ -45,14 +45,7 @@ import com.google.zxing.common.BitMatrix; ...@@ -45,14 +45,7 @@ import com.google.zxing.common.BitMatrix;
@WebServlet(urlPatterns = "/qrcode") @WebServlet(urlPatterns = "/qrcode")
public class QrcodeServlet extends BaseServlet { public class QrcodeServlet extends BaseServlet {
/**
* 黑色颜色值
*/
private static final int BLACK = 0xff000000; private static final int BLACK = 0xff000000;
/**
* 白色颜色值
*/
private static final int WHITE = 0xFFFFFFFF; private static final int WHITE = 0xFFFFFFFF;
/** /**
......
...@@ -35,16 +35,14 @@ import org.apache.commons.fileupload.FileItem; ...@@ -35,16 +35,14 @@ import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.fileupload.servlet.ServletFileUpload;
import com.mingsoft.constant.Const;
import com.mingsoft.util.FileUtil; import com.mingsoft.util.FileUtil;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
/** /**
* 文件上传通用servlet * 文件上传通用servlet
*
* @author 王天培QQ:78750478 * @author 王天培QQ:78750478
* @version 版本号:100-000-000<br/> * @version
* 版本号:100-000-000<br/>
* 创建日期:2012-03-15<br/> * 创建日期:2012-03-15<br/>
* 历史修订:<br/> * 历史修订:<br/>
*/ */
...@@ -53,27 +51,23 @@ public class UploadServlet extends BaseServlet { ...@@ -53,27 +51,23 @@ public class UploadServlet extends BaseServlet {
/** /**
* 处理post请求上传文件 * 处理post请求上传文件
* * @param req HttpServletRequest对象
* @param req * @param res HttpServletResponse 对象
* HttpServletRequest对象 * @throws ServletException 异常处理
* @param res * @throws IOException 异常处理
* HttpServletResponse 对象
* @throws ServletException
* 异常处理
* @throws IOException
* 异常处理
*/ */
@Override @Override
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/html;charset=utf-8");
PrintWriter out = res.getWriter(); PrintWriter out = res.getWriter();
String uploadPath = this.getServletContext().getRealPath(Const.SEPARATOR); // 上传的文件路径 String uploadPath = this.getServletContext().getRealPath(File.separator); // 上传的文件路径
String isRename = "";// 是否重命名 true:重命名 String isRename = "";// 是否重命名 true:重命名
String _tempPath = req.getServletContext().getRealPath(Const.SEPARATOR) + "temp";// 存放文件的临时目录路径 String _tempPath = req.getServletContext().getRealPath(File.separator) + "temp";//存放文件的临时目录路径
FileUtil.createFolder(_tempPath); FileUtil.createFolder(_tempPath);
File tempPath = new File(_tempPath); // 用于存放临时文件的目录 File tempPath = new File(_tempPath); // 用于存放临时文件的目录
int maxSize = 1000000; // 允许上传文件大小,最大上传文件,单位:字节 1000000/1024=0.9M int maxSize = 1000000; // 允许上传文件大小,最大上传文件,单位:字节 1000000/1024=0.9M
// String allowedFile = ".jpg,.gif,.png,.zip"; // 允许上传文件 //String allowedFile = ".jpg,.gif,.png,.zip"; // 允许上传文件
String deniedFile = ".exe,.com,.cgi,.asp"; // 不允许上传文件 String deniedFile = ".exe,.com,.cgi,.asp"; // 不允许上传文件
DiskFileItemFactory factory = new DiskFileItemFactory(); DiskFileItemFactory factory = new DiskFileItemFactory();
...@@ -98,7 +92,7 @@ public class UploadServlet extends BaseServlet { ...@@ -98,7 +92,7 @@ public class UploadServlet extends BaseServlet {
// 过滤掉的文件类型 // 过滤掉的文件类型
String[] errorType = deniedFile.split(","); String[] errorType = deniedFile.split(",");
Pattern p = Pattern.compile(regExp); Pattern p = Pattern.compile(regExp);
String outPath = ""; // 输出保存后的图片路径 String outPath = ""; //输出保存后的图片路径
while (iter.hasNext()) { while (iter.hasNext()) {
FileItem item = (FileItem) iter.next(); FileItem item = (FileItem) iter.next();
...@@ -108,9 +102,9 @@ public class UploadServlet extends BaseServlet { ...@@ -108,9 +102,9 @@ public class UploadServlet extends BaseServlet {
} else if (item.getFieldName().equals("isRename")) { } else if (item.getFieldName().equals("isRename")) {
isRename = item.getString(); isRename = item.getString();
} else if (item.getFieldName().equals("maxSize")) { } else if (item.getFieldName().equals("maxSize")) {
maxSize = Integer.parseInt(item.getString()) * 1048576; maxSize = Integer.parseInt(item.getString())*1048576;
} else if (item.getFieldName().equals("allowedFile")) { } else if (item.getFieldName().equals("allowedFile")) {
// allowedFile = item.getString(); // allowedFile = item.getString();
} else if (item.getFieldName().equals("deniedFile")) { } else if (item.getFieldName().equals("deniedFile")) {
deniedFile = item.getString(); deniedFile = item.getString();
} else if (!item.isFormField()) { // 忽略其他不是文件域的所有表单信息 } else if (!item.isFormField()) { // 忽略其他不是文件域的所有表单信息
...@@ -125,7 +119,7 @@ public class UploadServlet extends BaseServlet { ...@@ -125,7 +119,7 @@ public class UploadServlet extends BaseServlet {
// 保存上传的文件到指定的目录 // 保存上传的文件到指定的目录
// 在下文中上传文件至数据库时,将对这里改写 // 在下文中上传文件至数据库时,将对这里改写
String fileName = System.currentTimeMillis() + name.substring(name.indexOf(".")); String fileName = System.currentTimeMillis() + name.substring(name.indexOf("."));
String savePath = uploadPath + Const.SEPARATOR; String savePath = uploadPath + File.separator;
FileUtil.createFolder(savePath); FileUtil.createFolder(savePath);
// 重命名 // 重命名
if (StringUtil.isBlank(isRename) || Boolean.parseBoolean(isRename)) { if (StringUtil.isBlank(isRename) || Boolean.parseBoolean(isRename)) {
...@@ -150,4 +144,20 @@ public class UploadServlet extends BaseServlet { ...@@ -150,4 +144,20 @@ public class UploadServlet extends BaseServlet {
this.logger.debug(e); this.logger.debug(e);
} }
} }
// /**
// * 处理get请求上传文件
// * @param request HttpServletRequest对象
// * @param response HttpServletResponse 对象
// * @throws ServletException Servlet异常处理
// * @throws IOException IO异常处理
// */
// @Override
// protected void doGet(HttpServletRequest request, HttpServletResponse response)
// throws ServletException, IOException {
// String uploadPath = request.getParameter("uploadPath"); // 上传的文件路径
// String fileSize = request.getParameter("fileSize"); // 上传的文件大小
// String fileType = request.getParameter("fileType"); // 上传的文件类型
// String deniedFileType = request.getParameter("deniedFileType"); // 不允许上传的文件类型,
// }
} }
\ No newline at end of file
...@@ -44,12 +44,12 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -44,12 +44,12 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mingsoft.basic.action.BaseAction; import com.mingsoft.basic.action.BaseAction;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.basic.entity.ManagerSessionEntity; import com.mingsoft.basic.entity.ManagerSessionEntity;
import com.mingsoft.cms.biz.IArticleBiz; import com.mingsoft.cms.biz.IArticleBiz;
import com.mingsoft.cms.biz.IColumnBiz; import com.mingsoft.cms.biz.IColumnBiz;
import com.mingsoft.cms.entity.ArticleEntity; import com.mingsoft.cms.entity.ArticleEntity;
import com.mingsoft.cms.entity.ColumnEntity; import com.mingsoft.cms.entity.ColumnEntity;
import com.mingsoft.base.constant.ModelCode;
import com.mingsoft.util.StringUtil; import com.mingsoft.util.StringUtil;
/** /**
...@@ -224,7 +224,6 @@ public class DedeAction extends BaseAction { ...@@ -224,7 +224,6 @@ public class DedeAction extends BaseAction {
article.setArticleKeyword(column.getColumnKeyword());// 文章关键字 article.setArticleKeyword(column.getColumnKeyword());// 文章关键字
article.setBasicThumbnails(column.getColumnDescrip());// 文章描述 article.setBasicThumbnails(column.getColumnDescrip());// 文章描述
article.setArticleType(""); article.setArticleType("");
article.setBasicAppId(managerSession.getBasicId());
article.setArticleWebId(managerSession.getBasicId());// 文章所属站点id article.setArticleWebId(managerSession.getBasicId());// 文章所属站点id
article.setBasicCategoryId(Integer.valueOf(localColumnId)); // 文章所属栏目ID article.setBasicCategoryId(Integer.valueOf(localColumnId)); // 文章所属栏目ID
article.setColumn(column); article.setColumn(column);
......
...@@ -104,7 +104,7 @@ public class ErrorAction extends BaseAction{ ...@@ -104,7 +104,7 @@ public class ErrorAction extends BaseAction{
public void _500(HttpServletRequest req, HttpServletResponse resp){ public void _500(HttpServletRequest req, HttpServletResponse resp){
//先判断当前因为是否有设置错误页面,错误页面的文件名称必须为500.htm //先判断当前因为是否有设置错误页面,错误页面的文件名称必须为500.htm
// 模版路径加上(用户选择的主页的模版的路径)default/index.html // 模版路径加上(用户选择的主页的模版的路径)default/index.html
String tmpFilePath = this.getTemplatePath(req) + "/500.html"; String tmpFilePath = this.getTemplatePath(req) + File.separator + "500.html";
String content = FileUtil.readFile(tmpFilePath); String content = FileUtil.readFile(tmpFilePath);
if (StringUtil.isBlank(content)) { if (StringUtil.isBlank(content)) {
content = FileUtil.readFile(this.getRealPath(req,ERR_500)); content = FileUtil.readFile(this.getRealPath(req,ERR_500));
......
...@@ -33,11 +33,11 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -33,11 +33,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mingsoft.base.action.BaseAction; import com.mingsoft.base.action.BaseAction;
import com.mingsoft.cms.biz.IColumnBiz; import com.mingsoft.cms.biz.IColumnBiz;
import com.mingsoft.cms.biz.IContentModelBiz; import com.mingsoft.basic.biz.IContentModelBiz;
import com.mingsoft.cms.biz.IFieldBiz; import com.mingsoft.basic.biz.IFieldBiz;
import com.mingsoft.cms.entity.ColumnEntity; import com.mingsoft.cms.entity.ColumnEntity;
import com.mingsoft.cms.entity.ContentModelEntity; import com.mingsoft.basic.entity.ContentModelEntity;
import com.mingsoft.cms.entity.FieldEntity; import com.mingsoft.basic.entity.FieldEntity;
/** /**
* *
......
...@@ -64,6 +64,7 @@ import com.mingsoft.util.PageUtil; ...@@ -64,6 +64,7 @@ import com.mingsoft.util.PageUtil;
* Modification history: * Modification history:
* </p> * </p>
*/ */
@Deprecated
public interface IContentModelBiz extends IBaseBiz{ public interface IContentModelBiz extends IBaseBiz{
/** /**
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment