Commit 77e0c173 by 罗绍泽

初步查询到所有的应用信息

parent a394e449
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<property name="mapperLocations"> <property name="mapperLocations">
<list> <list>
<value>classpath:com/jw/app/business/portlet/PortletDAO.xml</value> <value>classpath:com/jw/app/business/portlet/PortletDAO.xml</value>
<value>classpath:com/jw/app/business/apps/AppsDAO.xml</value>
</list> </list>
</property> </property>
</bean> </bean>
...@@ -17,9 +18,19 @@ ...@@ -17,9 +18,19 @@
<property name="portletDAO" ref="portletDAO"/> <property name="portletDAO" ref="portletDAO"/>
</bean> </bean>
<bean id="AppsBusiness"
class="com.jw.app.business.apps.AppsBusinessImpl">
<property name="appsDAO" ref="appsDAO"/>
</bean>
<!-- DAO --> <!-- DAO -->
<bean id="portletDAO" class="org.mybatis.spring.mapper.MapperFactoryBean"> <bean id="portletDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.jw.app.business.portlet.PortletDAO"/> <property name="mapperInterface" value="com.jw.app.business.portlet.PortletDAO"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory-apps"/> <property name="sqlSessionFactory" ref="sqlSessionFactory-apps"/>
</bean> </bean>
<bean id="appsDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.jw.app.business.apps.AppsDAO"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory-apps"/>
</bean>
</beans> </beans>
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/plug/fancyBox/js/jquery.fancybox-media.js?v=1.0.5"></script> <script type="text/javascript" src="${pageContext.request.contextPath}/lib/plug/fancyBox/js/jquery.fancybox-media.js?v=1.0.5"></script>
<!-- xcConfirm的js --> <!-- xcConfirm的js -->
<script src="${pageContext.request.contextPath}/lib/plug/xcConfirm/js/xcConfirm.js"></script> <script src="${pageContext.request.contextPath}/lib/plug/xcConfirm/js/xcConfirm.js"></script>
<!-- 调用api时的js -->
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/common/js/lang_json.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/apps/js/jwAppAppsModule.js" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
var ctx='${pageContext.request.contextPath}'; var ctx='${pageContext.request.contextPath}';
</script> </script>
...@@ -212,7 +215,7 @@ a{ ...@@ -212,7 +215,7 @@ a{
<div class="index_application_right"> <div class="index_application_right">
<div class="index_application_show"> <div class="index_application_show">
<div class="index_application_show_tabs"> <div class="index_application_show_tabs">
<span class="index_application_show_tabs_click">全部应用</span><span>教学类</span><span>管理类</span><span>服务类</span><span>娱乐类</span><span>默认应用</span> <!-- <span class="index_application_show_tabs_click">全部应用</span><span>教学类</span><span>管理类</span><span>服务类</span><span>娱乐类</span><span>默认应用</span> -->
</div> </div>
<div class="index_application_show_tabs_container"> <div class="index_application_show_tabs_container">
...@@ -290,7 +293,18 @@ a{ ...@@ -290,7 +293,18 @@ a{
</div> </div>
<script> <script>
//全局变量所有的应用
var list_allApps = jwAppAppsModel.jwAppsAppsDataAction.list_allApps_by_user({FIELD_COLUMN_ID:$('.layout_center_navClick').data('uuid')});
$(function(){ $(function(){
//初始化类别
init_index_categorys();
//初始化apps
//init_index_apps();
//左边导航的切换 //左边导航的切换
$('.index_application_left>div').bind('click',function(){ $('.index_application_left>div').bind('click',function(){
$('.index_application_left_click').toggleClass('index_application_left_click'); $('.index_application_left_click').toggleClass('index_application_left_click');
...@@ -327,7 +341,6 @@ $(function(){ ...@@ -327,7 +341,6 @@ $(function(){
$('.index_application_show_tabs>span').bind('click',function(){ $('.index_application_show_tabs>span').bind('click',function(){
$('.index_application_show_tabs_click').toggleClass('index_application_show_tabs_click'); $('.index_application_show_tabs_click').toggleClass('index_application_show_tabs_click');
$(this).addClass('index_application_show_tabs_click'); $(this).addClass('index_application_show_tabs_click');
}) })
}) })
...@@ -395,4 +408,10 @@ function index_application_isLoad(handler){ ...@@ -395,4 +408,10 @@ function index_application_isLoad(handler){
function index_application_close(){ function index_application_close(){
console.log('关闭') console.log('关闭')
} }
//初始化类别
function init_index_categorys(){
console.log(list_allApps)
}
</script> </script>
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/plug/jquery-easyui-1.5.3/locale/easyui-lang-zh_CN.js"></script> <script type="text/javascript" src="${pageContext.request.contextPath}/lib/plug/jquery-easyui-1.5.3/locale/easyui-lang-zh_CN.js"></script>
<!-- 调用api时的js --> <!-- 调用api时的js -->
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/common/js/lang_json.js"></script> <script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/common/js/lang_json.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/portlet/js/jwAppPortletModule.js" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
var ctx='${pageContext.request.contextPath}'; var ctx='${pageContext.request.contextPath}';
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<head> <head>
<title>首页</title> <title>首页</title>
<jsp:include page="header.jsp"></jsp:include> <jsp:include page="header.jsp"></jsp:include>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/portlet/js/jwAppPortletModule.js" charset="utf-8"></script>
<script src="${ctx}/jfcas04/js/index.js"></script> <script src="${ctx}/jfcas04/js/index.js"></script>
</head> </head>
<body> <body>
......
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:include page="../header.jsp"></jsp:include> <jsp:include page="../header.jsp"></jsp:include>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/portlet/js/jwAppPortletModule.js" charset="utf-8"></script>
<div class="index_container_two_left_echarts_container"> <div class="index_container_two_left_echarts_container">
<div><span>各部门每天办件率情况图表.</span><a href="javascript:void(0)">查看更多</a></div> <div><span>各部门每天办件率情况图表.</span><a href="javascript:void(0)">查看更多</a></div>
<div id="index_content_echartsContainer" style="width:100%;height:314px;"></div> <div id="index_content_echartsContainer" style="width:100%;height:314px;"></div>
......
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:include page="../header.jsp"></jsp:include> <jsp:include page="../header.jsp"></jsp:include>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/portlet/js/jwAppPortletModule.js" charset="utf-8"></script>
<div class="index_container_three_center_container"> <div class="index_container_three_center_container">
<div> <div>
<span>技术</span> <span>技术</span>
......
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:include page="../header.jsp"></jsp:include> <jsp:include page="../header.jsp"></jsp:include>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/portlet/js/jwAppPortletModule.js" charset="utf-8"></script>
<div class="index_container_news"> <div class="index_container_news">
<div>中纪委“大虎”通报缘何出现重大变化</div> <div>中纪委“大虎”通报缘何出现重大变化</div>
<div>国家移民管理局挂牌仪式举行 郭声琨出席</div> <div>国家移民管理局挂牌仪式举行 郭声琨出席</div>
......
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:include page="../header.jsp"></jsp:include> <jsp:include page="../header.jsp"></jsp:include>
<script type="text/javascript" src="${pageContext.request.contextPath}/jwapp/pages/portlet/js/jwAppPortletModule.js" charset="utf-8"></script>
<style> <style>
.sp-preview{ .sp-preview{
border:none; border:none;
......
//此乃本模块与后台交互的方法接口部分
var jwAppAppsModel = function(format) {
this.module = "";
this.action = "";
this.format = format;
};
//定义数据交互
jwAppAppsModel.prototype = BusinessObject;
//获取当前登陆人的所有应用
jwAppAppsModel.prototype.list_allApps_by_user = function(){};
/*//获取所有应用的类别
jwAppAppsModel.prototype.list_allCategory = function(){};*/
//创建一个数据操作对象,然后再后续使用
jwAppAppsModel.jwAppsAppsActAction = new jwAppAppsModel("json").delegate("jwAppsAppstoreAct");
//创建一个数据获取对象,然后再后续使用
jwAppAppsModel.jwAppsAppsDataAction = new jwAppAppsModel("json").delegate("jwAppsAppstoreData");
//说明: 1、所有方法里统一传递josn格式的参数,用于后台交互,如data.listTables(param) ,如没有参数则传'{}',如data.listTables({})
// 2、前后台数据获取传输协议 如:json[{'0':{pageCount':'2','pageNo':'1','pageSize':'20','rowSet':'[{0},{1}....]'}}]
// 3、前后台增删改的返回状态 如:json[{'0':{'rowSet':{'NAME':'-1','VALUE':'保存失败'}}}]
package com.jw.app.apps.action; package com.jw.app.apps.action;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import com.gaowj.business.action.BasicAction; import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Encipher;
import com.gaowj.business.util.RequestUtils;
import com.jw.app.business.AppsBusiness;
import com.gaowj.business.SystemOpeBusiness;
import com.jw.app.business.utils.QueryParamUtil;
import com.jw.app.business.utils.Status;
public class actAction extends BasicAction{ public class actAction extends BasicAction{
...@@ -36,419 +21,4 @@ public class actAction extends BasicAction{ ...@@ -36,419 +21,4 @@ public class actAction extends BasicAction{
this.jsonObject = jsonObject; this.jsonObject = jsonObject;
} }
public String insertAppAccount() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
if(entity.get("PWD") != null){
entity.put("PWD", Encipher.EncodePasswd((String)entity.get("PWD")));
}
String returnid = "";
Map<String,Object> query = new HashMap<String,Object>();
query.put("APP_ID", entity.get("APP_ID"));
query.put("USERID", entity.get("USERID"));
List<Map<String, Object>> listData = business.list_app_account(query);
if(listData.size()<1){
returnid = business.insert_app_account(entity);
}
jsonObject.putAll(Status.getStatus(Status.INSERT_OK_RETURNID,returnid));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String updateAppAccount() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
if(entity.get("PWD") != null){
entity.put("PWD", Encipher.EncodePasswd((String)entity.get("PWD")));
}
business.update_app_account(entity);
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteAppAccount() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_app_account(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String insertApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
entity.remove("OPETYPE");
try{
entity = QueryParamUtil.StringToDate(entity);
String returnid = business.insert_app(entity);
//操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("insertApp", ""+entity,"增加集成应用记录",returnid,(String)entity.get("NAME"),"JW_APPS_APPS_APP");
jsonObject.putAll(Status.getStatus(Status.INSERT_OK_RETURNID,returnid));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String updateApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
entity.remove("OPETYPE");
// System.out.println("------update"+entity);
try{
entity = QueryParamUtil.StringToDate(entity);
business.update_app(entity);
//操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("updateApp", ""+entity,"修改集成应用记录",(String)entity.get("APP_ID"),(String)entity.get("NAME"),"JW_APPS_APPS_APP");
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
Map<String,Object>query=new HashMap<String, Object>();
deletekey="";
for (String string : ListKey) {
deletekey+="\'"+string+"\',";
}
deletekey = deletekey.substring(0,deletekey.length() - 1);
query.put("list", deletekey);
List<Map<String,Object>>list=business.list_app(query);
query=new HashMap<String, Object>();
//名称
String Name="";
for (Map<String, Object> map : list) {
Name+=map.get("NAME")+",";
}
query.put("NAME", Name);
business.delete_app(ListKey);
business.delete_install_app_id(ListKey);
business.delete_uninstall_app_id(ListKey);
//操作日志
SystemOpeBusiness sysbusiness = BusinessManager.getBusiness(SystemOpeBusiness.class);
sysbusiness.insert_logBusiness("deleteApp", ""+ListKey.toString(),"删除集成应用记录",ListKey.toString(),query.toString(),"JW_APPS_APPS_APP");
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String insertCategory() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.insert_category(entity);
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String updateCategory() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.update_category(entity);
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteCategory() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_category(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String insertDefaultInstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
SystemOpeBusiness business_sys = BusinessManager.getBusiness(SystemOpeBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
entity.remove("OPETYPE");
try{
entity = QueryParamUtil.StringToDate(entity);
List<Map<String,Object>> alluser=new ArrayList<Map<String,Object>>();
if(entity.get("G_ID")!=null&&!entity.get("G_ID").toString().equals("all"))
{
String gids[] = ((String)entity.get("G_ID")).split(",");
for(int i=0;i<gids.length;i++){
Map<String, Object>map=new HashMap<String, Object>();
map.put("EMDEPART", gids[i]);
List<Map<String,Object>> t_alluser= business_sys.listLoginUserInfo(map);
alluser.addAll(t_alluser);
}
}
else {
alluser= business_sys.listLoginUserInfo(null);
}
//删除原有此APP的所有用户
String app_id = (String) entity.get("APP_ID");
List<String> delApp = new ArrayList<String>();
delApp.add(app_id);
business.delete_install_app_id(delApp);
business.delete_uninstall_app_id(delApp);
//重新为所有用户安装此app
String is_default = (String) entity.get("IS_DEFAULT");
for(Map<String,Object> user:alluser){
Map<String,Object> entityNew = new HashMap<String,Object>();
entityNew.put("APP_ID", entity.get("APP_ID"));
entityNew.put("USERID", user.get("CODE"));
if(StringUtils.isNotEmpty(is_default) && StringUtils.equals(is_default, "1")){
business.insert_install(entityNew);
}else{
business.insert_uninstall(entityNew);
}
}
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String insertDefaultInstallNewUser() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
List<Map<String,Object>> alluser = business.list_userallapp_newuser(null);
for(Map<String,Object> user:alluser){
Map<String,Object> entityNew = new HashMap<String,Object>();
entityNew.put("APP_ID", entity.get("APP_ID"));
entityNew.put("USERID", user.get("CODE"));
business.insert_install(entityNew);
}
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String insertInstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.insert_install(entity);
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String updateInstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.update_install(entity);
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteInstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_install(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteInstall_app_id() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_install_app_id(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteInstall_app_user() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_install_app_user(entity);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String insertUninstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.insert_uninstall(entity);
jsonObject.putAll(Status.getStatus(Status.INSERT_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.INSERT_ERR));
e.printStackTrace();
}
return "json";
}
public String updateUninstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
entity = QueryParamUtil.StringToDate(entity);
business.update_uninstall(entity);
jsonObject.putAll(Status.getStatus(Status.UPDATE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.UPDATE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteUninstall() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_uninstall(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteUninstall_app_id() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_uninstall_app_id(ListKey);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String deleteUninstall_app_user() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
String deletekey = RequestUtils.getString(request, "deletekey");
List<String> ListKey = QueryParamUtil.StringToList(deletekey);
Map<String,Object> entity = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try{
business.delete_uninstall_app_user(entity);
jsonObject.putAll(Status.getStatus(Status.DELETE_OK));
}catch(Exception e){
jsonObject.putAll(Status.getStatus(Status.DELETE_ERR));
e.printStackTrace();
}
return "json";
}
public String uploadApp() throws BusinessException{
String upPath = request.getSession().getServletContext().getRealPath("/uploadFile/apps/apps");
super.setUserUploadFilePath(upPath);
return super.upload();
}
} }
...@@ -11,8 +11,6 @@ import net.sf.json.JSONObject; ...@@ -11,8 +11,6 @@ import net.sf.json.JSONObject;
import com.gaowj.business.action.BasicAction; import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager; import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException; import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Encipher;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.RequestUtils; import com.gaowj.business.util.RequestUtils;
import com.gaowj.business.util.SessionUtil; import com.gaowj.business.util.SessionUtil;
import com.jw.app.business.AppsBusiness; import com.jw.app.business.AppsBusiness;
...@@ -56,114 +54,53 @@ public class dataAction extends BasicAction{ ...@@ -56,114 +54,53 @@ public class dataAction extends BasicAction{
this.page = getPageNo(); this.page = getPageNo();
} }
public String listAppAccount() throws BusinessException{ public String list_allApps_by_user() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class); jsonObject=new JSONObject();
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX); //1.根据用户id,获取
/*SELECT * FROM (
SELECT ai_in.* FROM app_install ai_in where ai_in.USERID='6666'
) ai
RIGHT JOIN apps_app apps ON ai.APP_ID=apps.APP_ID*/
/*PortletBusiness business = BusinessManager
.getBusiness(PortletBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,
RequestUtils.UPDATEDATAFIELDPREFIX);*/
AppsBusiness business = BusinessManager
.getBusiness(AppsBusiness.class);
Map<String, Object> query = RequestUtils.getUpdateFieldMap(request,
RequestUtils.UPDATEDATAFIELDPREFIX);
try { try {
query = QueryParamUtil.StringToDate(query); query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_app_account(pageNo,pageSize,query); //设置当前登陆人
for(Map<String,Object>m : pageRows.getItems()){ query.put("USER_ID", SessionUtil.getEmid());
if(m.get("PWD")!=null){ List<Map<String, Object>> listData = business
m.put("PWD", Encipher.DecodePasswd((String)m.get("PWD"))); .list_allApps_by_user(query);
} for (Map<String, Object> rm : listData) {
} if(rm.get("USERID")!=null){
setPageCount((pageRows.getCount() - 1) / pageSize + 1); Map<String, Object> data = new HashMap<String, Object>();
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listAllAppAccount() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> listData = business.list_app_account(query);
for(Map<String,Object>m : listData){
if(m.get("PWD")!=null){
m.put("PWD", Encipher.DecodePasswd((String)m.get("PWD")));
}
}
int listDataCount = business.listCount_app_account(query);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(listData)); data.put("rowSet", QueryParamUtil.DateToString(listData));
data.put("pageNo", 1); data.put("pageNo", 1);
data.put("pageSize", listDataCount); data.put("pageSize", listData.size());
data.put("pageCount", listDataCount); data.put("pageCount", listData.size());
data.put("rows", data.get("rowSet")); data.put("rows", data.get("rowSet"));
data.put("total", listDataCount); data.put("total", listData.size());
jsonObject = new JSONObject(); jsonObject.put("apps",data);
jsonObject.putAll(data); //查找所有的应用所属的类型
} catch (SQLException e) { Map<String, Object> queryCategory = RequestUtils.getUpdateFieldMap(request,
// TODO Auto-generated catch block RequestUtils.UPDATEDATAFIELDPREFIX);
e.printStackTrace(); List<Map<String, Object>> listCategory = business
} catch (ParseException e) { .list_allCategory(queryCategory);
// TODO Auto-generated catch block Map<String, Object> allCategory = new HashMap<String, Object>();
e.printStackTrace(); allCategory.put("rowSet", QueryParamUtil.DateToString(listCategory));
} allCategory.put("pageNo", 1);
return "json"; allCategory.put("pageSize", listCategory.size());
} allCategory.put("pageCount", listCategory.size());
allCategory.put("rows", allCategory.get("rowSet"));
public String listApp() throws BusinessException{ allCategory.put("total", listCategory.size());
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class); jsonObject.put("types",listCategory);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX); break;
try {
query = QueryParamUtil.StringToDate(query);
Page<Map<String, Object>> pageRows = business.list_app(pageNo,pageSize,query);
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
return "json";
} }
public String listAllApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
List<Map<String, Object>> listData = business.list_apps_portal(query);
int listDataCount = business.listCount_app(query);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(listData));
data.put("pageNo", 1);
data.put("pageSize", listDataCount);
data.put("pageCount", listDataCount);
data.put("rows", data.get("rowSet"));
data.put("total", listDataCount);
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) { } catch (SQLException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
...@@ -171,61 +108,13 @@ public class dataAction extends BasicAction{ ...@@ -171,61 +108,13 @@ public class dataAction extends BasicAction{
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
return "json";
}
public String listAllCategory() throws BusinessException{ //2上述结果中的USERID全部为null,表示一个app都没安装
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try { //3.验证apps_uninstall有没有数据
query = QueryParamUtil.StringToDate(query); //4.如果也没有,表示这个用户是新建用户,需要初始化应用
List<Map<String, Object>> listData = business.list_category(query); //5.初始化应用
int listDataCount = business.listCount_category(query);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(listData));
data.put("pageNo", 1);
data.put("pageSize", listDataCount);
data.put("pageCount", listDataCount);
data.put("rows", data.get("rowSet"));
data.put("total", listDataCount);
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json";
}
public String listUserAllApp() throws BusinessException{
AppsBusiness business = BusinessManager.getBusiness(AppsBusiness.class);
Map<String,Object> query = RequestUtils.getUpdateFieldMap(request, RequestUtils.UPDATEDATAFIELDPREFIX);
try {
query = QueryParamUtil.StringToDate(query);
query.put("USERID", SessionUtil.getCode());
Page<Map<String, Object>> pageRows = business.list_userallapp(pageNo,pageSize,query);
setPageCount((pageRows.getCount() - 1) / pageSize + 1);
Map<String,Object> data = new HashMap<String,Object>();
data.put("rowSet", QueryParamUtil.DateToString(pageRows.getItems()));
data.put("pageNo", pageNo);
data.put("pageSize", pageSize);
data.put("pageCount", pageCount);
data.put("rows", data.get("rowSet"));
data.put("total", pageRows.getCount());
jsonObject = new JSONObject();
jsonObject.putAll(data);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "json"; return "json";
} }
......
...@@ -6,93 +6,23 @@ import java.util.Map; ...@@ -6,93 +6,23 @@ import java.util.Map;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gaowj.business.exception.BusinessException; import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
@Service @Service
public interface AppsBusiness { public interface AppsBusiness {
//APP_ACCOUNT 模拟登陆帐号密码管理 /**获取该用户的所有应用
String insert_app_account(Map<String,Object> entity) throws BusinessException ; *
* @param query
* @return
* @throws BusinessException
*/
List<Map<String,Object>> list_allApps_by_user(Map<String, Object> query) throws BusinessException ;
/**获得所有应用的所属类型
*
* @param query
* @return
*/
List<Map<String, Object>> list_allCategory(Map<String, Object> query) throws BusinessException ;
void update_app_account(Map<String,Object> entity) throws BusinessException ;
void delete_app_account(List<String> list)throws BusinessException;
Page<Map<String, Object>> list_app_account(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_app_account(Map<String, Object> query) throws BusinessException ;
int listCount_app_account(Map<String, Object> query) throws BusinessException ;
//APPS_APP app详细信息
String insert_app(Map<String,Object> entity) throws BusinessException ;
void update_app(Map<String,Object> entity) throws BusinessException ;
void delete_app(List<String> list)throws BusinessException;
Page<Map<String, Object>> list_app(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_app(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_apps_portal(Map<String, Object> query) throws BusinessException ;
int listCount_app(Map<String, Object> query) throws BusinessException ;
//APPS_CATEGORY app分类信息
void insert_category(Map<String,Object> entity) throws BusinessException ;
void update_category(Map<String,Object> entity) throws BusinessException ;
void delete_category(List<String> list)throws BusinessException;
Page<Map<String, Object>> list_category(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_category(Map<String, Object> query) throws BusinessException ;
int listCount_category(Map<String, Object> query) throws BusinessException ;
//APP_INSTALL app用户安装信息
void insert_install(Map<String,Object> entity) throws BusinessException ;
void update_install(Map<String,Object> entity) throws BusinessException ;
void delete_install(List<String> list)throws BusinessException;
void delete_install_app_id(List<String> list) throws BusinessException ;
void delete_install_app_user(Map<String, Object> query) throws BusinessException ;
Page<Map<String, Object>> list_install(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_install(Map<String, Object> query) throws BusinessException ;
int listCount_install(Map<String, Object> query) throws BusinessException ;
//APPS_UNINSTALL app用户卸载信息
void insert_uninstall(Map<String,Object> entity) throws BusinessException ;
void update_uninstall(Map<String, Object> query)throws BusinessException;
void delete_uninstall(List<String> list)throws BusinessException;
void delete_uninstall_app_id(List<String> list) throws BusinessException ;
void delete_uninstall_app_user(Map<String, Object> query) throws BusinessException ;
Page<Map<String, Object>> list_uninstall(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_uninstall(Map<String, Object> query) throws BusinessException ;
int listCount_uninstall(Map<String, Object> query) throws BusinessException ;
//APPS_USERALLAPP用户所有已安装和未安装app信息
Page<Map<String, Object>> list_userallapp(int pageNo, int pageSize, Map<String, Object> query)throws BusinessException ;
List<Map<String,Object>> list_userallapp(Map<String, Object> query) throws BusinessException ;
int listCount_userallapp(Map<String, Object> query) throws BusinessException ;
//APPS_USERALLAPP_NEWUSER找出所有未安装app的信息
List<Map<String,Object>> list_userallapp_newuser(Map<String,Object> query) throws BusinessException ;
} }
package com.jw.app.business.apps; package com.jw.app.business.apps;
import java.io.File; import java.io.IOException;
import java.util.ArrayList; import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException; import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.Page;
import com.gaowj.business.util.SessionUtil; import com.gaowj.business.util.SessionUtil;
import com.jw.app.business.AppsBusiness; import com.jw.app.business.AppsBusiness;
import com.jw.app.business.utils.QueryParamUtil;
public class AppsBusinessImpl implements AppsBusiness { public class AppsBusinessImpl implements AppsBusiness {
...@@ -28,648 +22,35 @@ public class AppsBusinessImpl implements AppsBusiness { ...@@ -28,648 +22,35 @@ public class AppsBusinessImpl implements AppsBusiness {
this.appsDAO = appsDAO; this.appsDAO = appsDAO;
} }
/**--------------APPS_APP app详细信息---------------- **/
@Override
public String insert_app_account(Map<String, Object> entity)
throws BusinessException {
String new_id = java.util.UUID.randomUUID().toString();
if(entity.get("IDU")==null){
entity.put("IDU", new_id);
}
if(entity.get("USERID")==null){
entity.put("USERID", SessionUtil.getCode());
}
if(entity.get("SIGN")==null){
entity.put("SIGN", "1");
}
if(entity.get("ALIAS")==null){
entity.put("ALIAS", SessionUtil.getEmname());
}
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_app_account(entity);
}
//
return new_id;
}
@Override
public void update_app_account(Map<String, Object> entity)
throws BusinessException {
//动态传值修改
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("IDU",str)) continue;
if (StringUtils.equalsIgnoreCase("USERID",str)) continue;
if (StringUtils.equalsIgnoreCase("APP_ID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
appsDAO.update_app_account(entity);
}
//
}
@Override
public void delete_app_account(List<String> list)
throws BusinessException {
appsDAO.delete_app_account(list);
}
@Override
public Page<Map<String, Object>> list_app_account(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_app_account(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_app_account(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_app_account(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_app_account(query);
}
@Override
public int listCount_app_account(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_app_account(query);
}
/**--------------APPS_APP app详细信息---------------- **/
@Override
public String insert_app(Map<String, Object> entity)
throws BusinessException {
String new_id = java.util.UUID.randomUUID().toString();
if(entity.get("APP_ID")==null){
entity.put("APP_ID", new_id);
}
if(entity.get("CREATE_TIME")==null){
entity.put("CREATE_TIME", new Date());
}
if(entity.get("CREATOR_ID")==null){
entity.put("CREATOR_ID", SessionUtil.getCode());
}
if(entity.get("NEED_HEAD")==null){
entity.put("NEED_HEAD", "0");
}
if(entity.get("DELETE_FLAG")==null){
entity.put("DELETE_FLAG", "0");
}
if(entity.get("UPDATE_TIME")==null){
entity.put("UPDATE_TIME", new Date());
}
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_app(entity);
}
//
return new_id;
}
@Override
public void update_app(Map<String, Object> entity)
throws BusinessException {
if(entity.get("UPDATE_TIME")==null){
entity.put("UPDATE_TIME", new Date());
}
//删除原来的图片
if(entity.get("OLD_IMAGE")!=null){
String delFileName = (String) entity.get("OLD_IMAGE");
File delFile = new File(delFileName);
if(delFile.exists()){
System.out.println("(OLD_IMAGE)图片:"+delFileName+" 存在!");
if(delFile.delete()){
System.out.println("(OLD_IMAGE)图片:"+delFileName+" 删除成功!");
}else{
System.out.println("(OLD_IMAGE)图片:"+delFileName+" 删除失败!");
}
}else{
System.out.println("(OLD_IMAGE)图片:"+delFileName+" 不存在!");
}
entity.remove("OLD_IMAGE");
}
//
//动态传值修改
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("APP_ID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
appsDAO.update_app(entity);
}
//
}
@Override
public void delete_app(List<String> list)
throws BusinessException {
List<Map<String, Object>> list_delete_app = appsDAO.list_delete_app(list);
appsDAO.delete_app(list);
for(Map<String, Object> mfile : list_delete_app){
if(mfile.get("IMG_ID_L")!=null){
String delFileName = (String) mfile.get("IMG_ID_L");
File delFile = new File(delFileName);
if(delFile.exists()){
System.out.println("(IMG_ID_L)图片:"+delFileName+" 存在!");
if(delFile.delete()){
System.out.println("(IMG_ID_L)图片:"+delFileName+" 删除成功!");
}else{
System.out.println("(IMG_ID_L)图片:"+delFileName+" 删除失败!");
}
}else{
System.out.println("(IMG_ID_L)图片:"+delFileName+" 不存在!");
}
}else if(mfile.get("IMG_ID_M")!=null){
String delFileName = (String) mfile.get("IMG_ID_M");
File delFile = new File(delFileName);
if(delFile.exists()){
System.out.println("(IMG_ID_M)图片:"+delFileName+" 存在!");
if(delFile.delete()){
System.out.println("(IMG_ID_M)图片:"+delFileName+" 删除成功!");
}else{
System.out.println("(IMG_ID_M)图片:"+delFileName+" 删除失败!");
}
}else{
System.out.println("(IMG_ID_M)图片:"+delFileName+" 不存在!");
}
}else if(mfile.get("IMG_ID_S")!=null){
String delFileName = (String) mfile.get("IMG_ID_S");
File delFile = new File(delFileName);
if(delFile.exists()){
System.out.println("(IMG_ID_S)图片:"+delFileName+" 存在!");
if(delFile.delete()){
System.out.println("(IMG_ID_S)图片:"+delFileName+" 删除成功!");
}else{
System.out.println("(IMG_ID_S)图片:"+delFileName+" 删除失败!");
}
}else{
System.out.println("(IMG_ID_S)图片:"+delFileName+" 不存在!");
}
}
}
}
@Override
public Page<Map<String, Object>> list_app(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_app(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_app(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_app(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_app(query);
}
@Override
public int listCount_app(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_app(query);
}
/**--------------APPS_CATEGORY app分类信息---------------- **/
@Override
public void insert_category(Map<String, Object> entity)
throws BusinessException {
if(entity.get("CATEGORY_ID")==null){
entity.put("CATEGORY_ID", java.util.UUID.randomUUID().toString());
}
if(entity.get("CREATE_TIME")==null){
entity.put("CREATE_TIME", new Date());
}
if(entity.get("CREATOR_ID")==null){
entity.put("CREATOR_ID", SessionUtil.getCode());
}
if(entity.get("DELETE_FLAG")==null){
entity.put("DELETE_FLAG", "0");
}
if(entity.get("UPDATE_TIME")==null){
entity.put("UPDATE_TIME", new Date());
}
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_category(entity);
}
//
}
@Override
public void update_category(Map<String, Object> entity)
throws BusinessException {
if(entity.get("UPDATE_TIME")==null){
entity.put("UPDATE_TIME", new Date());
}
//动态传值修改
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("CATEGORY_ID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
appsDAO.update_category(entity);
}
//
}
@Override
public void delete_category(List<String> list)
throws BusinessException {
appsDAO.delete_category(list);
}
@Override
public Page<Map<String, Object>> list_category(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_category(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_category(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_category(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_category(query);
}
@Override
public int listCount_category(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_category(query);
}
/**--------------APP_INSTALL app用户安装信息 ---------------- **/
@Override
public void insert_install(Map<String, Object> entity)
throws BusinessException {
if(entity.get("RESOURCE_ID")==null){
entity.put("RESOURCE_ID", java.util.UUID.randomUUID().toString());
}
if(entity.get("USERID")==null){
entity.put("USERID", SessionUtil.getCode());
}
if(entity.get("INSTALL_TIME")==null){
entity.put("INSTALL_TIME", new Date());
}
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_install(entity);
}
//
}
@Override
public void update_install(Map<String, Object> entity)
throws BusinessException {
//动态传值修改
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("RESOURCE_ID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
appsDAO.update_install(entity);
}
//
}
@Override
public void delete_install(List<String> list)
throws BusinessException {
appsDAO.delete_install(list);
}
@Override
public void delete_install_app_id(List<String> list)
throws BusinessException {
appsDAO.delete_install_app_id(list);
}
@Override
public void delete_install_app_user(Map<String, Object> query)
throws BusinessException {
if(query.get("USERID")==null){
query.put("USERID", SessionUtil.getCode());
}
appsDAO.delete_install_app_user(query);
}
@Override
public Page<Map<String, Object>> list_install(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_install(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_install(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_install(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_install(query);
}
@Override
public int listCount_install(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_install(query);
}
/**--------------APPS_UNINSTALL app用户卸载信息 ---------------- **/
@Override
public void insert_uninstall(Map<String, Object> entity)
throws BusinessException {
if(entity.get("RESOURCE_ID")==null){
entity.put("RESOURCE_ID", java.util.UUID.randomUUID().toString());
}
if(entity.get("USERID")==null){
entity.put("USERID", SessionUtil.getCode());
}
//动态传值插入
List<String> infoListKey = new ArrayList<String>();
List<Object> infoList = new ArrayList<Object>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
infoList.add(entity.get(str));
infoListKey.add(str);
}
entity.put("infoListKey", infoListKey);
entity.put("infoList", infoList);
// 插入
appsDAO.insert_uninstall(entity);
}
//
}
@Override
public void update_uninstall(Map<String, Object> entity)
throws BusinessException {
//动态传值修改
List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
if(entity.keySet()!=null){
Set<String> key = entity.keySet();
// 将map集合中的key和value 取出来分别放到list集合里
for (String str : key) {
Map<String, Object> updateMap = new HashMap<String, Object>();
if (StringUtils.equalsIgnoreCase("RESOURCE_ID",str)) continue;
updateMap.put("key", str);
updateMap.put("value", entity.get(str));
updateList.add(updateMap);
}
entity.put("info", updateList);
//
appsDAO.update_uninstall(entity);
}
//
}
@Override @Override
public void delete_uninstall(List<String> list) public List<Map<String, Object>> list_allApps_by_user(Map<String, Object> query) throws BusinessException {
throws BusinessException { List<Map<String, Object>> listData = null;
appsDAO.delete_uninstall(list); try {
query.put("USER_ID", SessionUtil.getEmid());
listData = QueryParamUtil.ClobToString(appsDAO.list_allApps_by_user(query));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
return listData;
@Override
public void delete_uninstall_app_id(List<String> list)
throws BusinessException {
appsDAO.delete_uninstall_app_id(list);
} }
@Override @Override
public void delete_uninstall_app_user(Map<String, Object> query) public List<Map<String, Object>> list_allCategory(Map<String, Object> query) throws BusinessException {
throws BusinessException { List<Map<String, Object>> listData = null;
if(query.get("USERID")==null){ try {
query.put("USERID", SessionUtil.getCode()); listData = QueryParamUtil.ClobToString(appsDAO.list_allCategory(query));
} } catch (IOException e) {
appsDAO.delete_uninstall_app_user(query); // TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
return listData;
@Override
public Page<Map<String, Object>> list_uninstall(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_uninstall(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_uninstall(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
@Override
public List<Map<String, Object>> list_uninstall(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_uninstall(query);
}
@Override
public int listCount_uninstall(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_uninstall(query);
}
/**--------------APPS_USERALLAPP用户所有已安装和未安装app信息 ---------------- **/
@Override
public Page<Map<String, Object>> list_userallapp(int pageNo, int pageSize,
Map<String, Object> query) throws BusinessException {
//计算起始记录
int pageStart = (pageNo - 1) * pageSize;
//获取列表
List<Map<String, Object>> items = appsDAO.list_userallapp(new RowBounds(pageStart, pageSize), query);
//获取列表个数
int count = appsDAO.listCount_userallapp(query);
//创建分页对象
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setStart(pageStart);
page.setLimit(pageSize);
page.setCount(count);
page.setItems(items);
return page;
}
/**--------------APPS_USERALLAPP_NEWUSER找出所有未安装app的信息 ---------------- **/
@Override
public List<Map<String, Object>> list_userallapp(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_userallapp(query);
}
@Override
public int listCount_userallapp(Map<String, Object> query)
throws BusinessException {
return appsDAO.listCount_userallapp(query);
}
@Override
public List<Map<String, Object>> list_userallapp_newuser(Map<String, Object> query)
throws BusinessException {
return appsDAO.list_userallapp_newuser(query);
}
@Override
public List<Map<String, Object>> list_apps_portal(Map<String, Object> query) throws BusinessException {
return appsDAO.list_apps_portal(query);
} }
} }
...@@ -3,96 +3,13 @@ package com.jw.app.business.apps; ...@@ -3,96 +3,13 @@ package com.jw.app.business.apps;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import com.gaowj.business.exception.BusinessException; import com.gaowj.business.exception.BusinessException;
public interface AppsDAO {
//APP_ACCOUNT 模拟登陆帐号密码管理
void insert_app_account(Map<String,Object> entity) throws BusinessException ;
void update_app_account(Map<String,Object> entity) throws BusinessException ;
void delete_app_account(List<String> list) throws BusinessException;
List<Map<String,Object>> list_app_account(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_app_account(Map<String,Object> query) throws BusinessException ;
int listCount_app_account(Map<String, Object> query) throws BusinessException ;
//APPS_APP app详细信息
void insert_app(Map<String,Object> entity) throws BusinessException ;
void update_app(Map<String,Object> entity) throws BusinessException ;
void delete_app(List<String> list) throws BusinessException;
List<Map<String,Object>> list_app(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_app(Map<String,Object> query) throws BusinessException ;
int listCount_app(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_delete_app(List<String> list) throws BusinessException;
//APPS_CATEGORY app分类信息
void insert_category(Map<String,Object> entity) throws BusinessException ;
void update_category(Map<String,Object> entity) throws BusinessException ;
void delete_category(List<String> list) throws BusinessException;
List<Map<String,Object>> list_category(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_category(Map<String,Object> query) throws BusinessException ;
int listCount_category(Map<String, Object> query) throws BusinessException ; public interface AppsDAO {
//APP_INSTALL app用户安装信息
void insert_install(Map<String,Object> entity) throws BusinessException ;
void update_install(Map<String,Object> entity) throws BusinessException ;
void delete_install(List<String> list) throws BusinessException;
void delete_install_app_id(List<String> list) throws BusinessException ;
void delete_install_app_user(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_install(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_install(Map<String,Object> query) throws BusinessException ;
int listCount_install(Map<String, Object> query) throws BusinessException ;
//APPS_UNINSTALL app用户卸载信息
void insert_uninstall(Map<String,Object> entity) throws BusinessException ;
void update_uninstall(Map<String,Object> entity) throws BusinessException ;
void delete_uninstall(List<String> list) throws BusinessException;
void delete_uninstall_app_id(List<String> list) throws BusinessException ;
void delete_uninstall_app_user(Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_uninstall(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_uninstall(Map<String,Object> query) throws BusinessException ;
int listCount_uninstall(Map<String, Object> query) throws BusinessException ;
//APPS_USERALLAPP用户所有已安装和未安装app信息
List<Map<String,Object>> list_userallapp(RowBounds rowbounds, Map<String, Object> query) throws BusinessException ;
List<Map<String,Object>> list_userallapp(Map<String,Object> query) throws BusinessException ;
int listCount_userallapp(Map<String, Object> query) throws BusinessException ; List<Map<String,Object>> list_allApps_by_user(Map<String,Object> query) throws BusinessException ;
//APPS_USERALLAPP_NEWUSER找出所有未安装app的信息 List<Map<String,Object>> list_allCategory(Map<String,Object> query) throws BusinessException ;
List<Map<String,Object>> list_userallapp_newuser(Map<String,Object> query) throws BusinessException ;
List<Map<String,Object>> list_apps_portal(Map<String,Object> query) throws BusinessException ;
} }
<?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.jw.app.business.apps.AppsDAO"> <mapper namespace="com.jw.app.business.apps.AppsDAO">
<!-- APP_ACCOUNT 模拟登陆帐号密码管理 --> <select id="list_allApps_by_user" parameterType="map"
<insert id="insert_app_account" parameterType="map"> resultType="upperCaseKeyMap">
insert into APP_ACCOUNT( SELECT * FROM (
<trim prefix="" suffixOverrides=","> SELECT ai_in.* FROM app_install ai_in where ai_in.USERID=#{USER_ID}
<foreach collection="infoListKey" item="key"> ) ai
${key}, RIGHT JOIN apps_app apps ON ai.APP_ID=apps.APP_ID
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_app_account" parameterType="map">
<![CDATA[
update APP_ACCOUNT set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="IDU != null and IDU != ''">
and IDU = #{IDU}
</if>
<if test="USERID != null and USERID != ''">
and USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and APP_ID = #{APP_ID}
</if>
</where>
</update>
<delete id="delete_app_account" parameterType="list">
<![CDATA[
delete from APP_ACCOUNT where IDU IN
]]>
<foreach collection="list" item="IDU" open="(" separator="," close=")">
#{IDU}
</foreach>
</delete>
<select id="list_app_account" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from APP_ACCOUNT f where 1=1
]]>
<if test="IDU != null and IDU != ''">
and f.IDU = #{IDU}
</if>
<if test="ALIAS != null and ALIAS != ''">
and f.ALIAS like '%${ALIAS}%'
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="ACCOUNTU != null and ACCOUNTU != ''">
and f.ACCOUNTU = #{ACCOUNTU}
</if>
<if test="PWD != null and PWD != ''">
and f.PWD = #{PWD}
</if>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
</select>
<select id="listCount_app_account" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from APP_ACCOUNT f where 1=1
]]>
<if test="IDU != null and IDU != ''">
and f.IDU = #{IDU}
</if>
<if test="ALIAS != null and ALIAS != ''">
and f.ALIAS like '%${ALIAS}%'
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="ACCOUNTU != null and ACCOUNTU != ''">
and f.ACCOUNTU = #{ACCOUNTU}
</if>
<if test="PWD != null and PWD != ''">
and f.PWD = #{PWD}
</if>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
</select>
<!-- APPS_APP app详细信息 -->
<insert id="insert_app" parameterType="map">
insert into APPS_APP(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_app" parameterType="map">
<![CDATA[
update APPS_APP set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="APP_ID != null and APP_ID != ''">
and APP_ID = #{APP_ID}
</if>
</where>
</update>
<delete id="delete_app" parameterType="list">
<![CDATA[
delete APPS_APP where APP_ID IN
]]>
<foreach collection="list" item="APP_ID" open="(" separator="," close=")">
#{APP_ID}
</foreach>
</delete>
<select id="list_app" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from APPS_APP f where 1=1
]]>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="NAME != null and NAME != ''">
and f.NAME like '%${NAME}%'
</if>
<if test="CATEGORY != null and CATEGORY != ''">
and f.CATEGORY = #{CATEGORY}
</if>
<if test="IS_CLASSIC != null and IS_CLASSIC != ''">
and f.IS_CLASSIC = #{IS_CLASSIC}
</if>
<if test="IS_DEFAULT != null and IS_DEFAULT != ''">
and f.IS_DEFAULT = #{IS_DEFAULT}
</if>
<if test="APP_CODE != null and APP_CODE != ''">
and f.APP_CODE = #{APP_CODE}
</if>
<if test="DELETE_FLAG != null and DELETE_FLAG != ''">
and f.DELETE_FLAG = #{DELETE_FLAG}
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.OPEN_TIME &gt;= #{START_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.OPEN_TIME &lt;= #{END_TIME}
</if>
<if test="list != null and list != ''">
and f.APP_ID in ( ${list} )
</if>
<if test="G_ID != null and G_ID != ''">
and f.G_ID like '%${G_ID}%'
</if>
<if test="ORDERBY != null and ORDERBY != ''">
order by '${ORDERBY}'
</if>
</select>
<select id="listCount_app" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from APPS_APP f where 1=1
]]>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="NAME != null and NAME != ''">
and f.NAME like '%${NAME}%'
</if>
<if test="CATEGORY != null and CATEGORY != ''">
and f.CATEGORY = #{CATEGORY}
</if>
<if test="IS_CLASSIC != null and IS_CLASSIC != ''">
and f.IS_CLASSIC = #{IS_CLASSIC}
</if>
<if test="IS_DEFAULT != null and IS_DEFAULT != ''">
and f.IS_DEFAULT = #{IS_DEFAULT}
</if>
<if test="APP_CODE != null and APP_CODE != ''">
and f.APP_CODE = #{APP_CODE}
</if>
<if test="DELETE_FLAG != null and DELETE_FLAG != ''">
and f.DELETE_FLAG = #{DELETE_FLAG}
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.OPEN_TIME &gt;= #{START_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.OPEN_TIME &lt;= #{END_TIME}
</if>
<if test="list != null and list != ''">
and f.APP_ID in ( ${list} )
</if>
<if test="G_ID != null and G_ID != ''">
and f.G_ID like '%${G_ID}%'
</if>
</select>
<select id="list_delete_app" parameterType="list" resultType="upperCaseKeyMap">
<![CDATA[
select APP_ID,IMG_ID_L,IMG_ID_M,IMG_ID_S from APPS_APP where APP_ID IN
]]>
<foreach collection="list" item="APP_ID" open="(" separator="," close=")">
#{APP_ID}
</foreach>
</select>
<!-- APPS_CATEGORY app分类信息 -->
<insert id="insert_category" parameterType="map">
insert into APPS_CATEGORY(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_category" parameterType="map">
<![CDATA[
update APPS_CATEGORY set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="CATEGORY_ID != null and CATEGORY_ID != ''">
and CATEGORY_ID = #{CATEGORY_ID}
</if>
</where>
</update>
<delete id="delete_category" parameterType="list">
<![CDATA[
delete APPS_CATEGORY where DELETE_FLAG = '1' AND CATEGORY_ID IN
]]>
<foreach collection="list" item="CATEGORY_ID" open="(" separator="," close=")">
#{CATEGORY_ID}
</foreach>
</delete>
<select id="list_category" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from APPS_CATEGORY f where 1=1
]]>
<if test="CATEGORY_ID != null and CATEGORY_ID != ''">
and f.CATEGORY_ID = #{CATEGORY_ID}
</if>
<if test="NAME != null and NAME != ''">
and f.NAME like '%${NAME}%'
</if>
<if test="DELETE_FLAG != null and DELETE_FLAG != ''">
and f.DELETE_FLAG = #{DELETE_FLAG}
</if>
order by DISPLAY_ORDER
</select>
<select id="listCount_category" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from APPS_CATEGORY f where 1=1
]]>
<if test="CATEGORY_ID != null and CATEGORY_ID != ''">
and f.CATEGORY_ID = #{CATEGORY_ID}
</if>
<if test="NAME != null and NAME != ''">
and f.NAME like '%${NAME}%'
</if>
<if test="DELETE_FLAG != null and DELETE_FLAG != ''">
and f.DELETE_FLAG = #{DELETE_FLAG}
</if>
</select>
<!-- APP_INSTALL app用户安装信息 -->
<insert id="insert_install" parameterType="map">
insert into APP_INSTALL(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_install" parameterType="map">
<![CDATA[
update APP_INSTALL set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="RESOURCE_ID != null and RESOURCE_ID != ''">
and RESOURCE_ID = #{RESOURCE_ID}
</if>
</where>
</update>
<delete id="delete_install" parameterType="list">
<![CDATA[
delete from APP_INSTALL where RESOURCE_ID IN
]]>
<foreach collection="list" item="RESOURCE_ID" open="(" separator="," close=")">
#{RESOURCE_ID}
</foreach>
</delete>
<delete id="delete_install_app_id" parameterType="list">
<![CDATA[
delete from APP_INSTALL where APP_ID IN
]]>
<foreach collection="list" item="APP_ID" open="(" separator="," close=")">
#{APP_ID}
</foreach>
</delete>
<delete id="delete_install_app_user" parameterType="map">
<![CDATA[
delete from APP_INSTALL where USERID = #{USERID}
]]>
<if test="APP_ID != null and APP_ID != ''">
and APP_ID = #{APP_ID}
</if>
</delete>
<select id="list_install" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*,app.NAME APPNAME,app.PUB_DATE APPPUB_DATE,app.CATEGORY APPCATEGORY,app.LINK APPLINK,app.IMG_ID_L APPIMG_ID_L,app.IMG_ID_M APPIMG_ID_M,
app.IMG_ID_S APPIMG_ID_S
from APP_INSTALL f
left join APPS_APP app on app.APP_ID = f.APP_ID
where 1=1
]]>
<if test="RESOURCE_ID != null and RESOURCE_ID != ''">
and f.RESOURCE_ID = #{RESOURCE_ID}
</if>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="CATEGORY != null and CATEGORY != ''">
and app.CATEGORY = #{CATEGORY}
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.INSTALL_TIME &gt;= #{INSTALL_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.INSTALL_TIME &lt;= #{INSTALL_TIME}
</if>
order by ORDER_NUM
</select>
<select id="listCount_install" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from from APP_INSTALL f
left join APPS_APP app on app.APP_ID = f.APP_ID
where 1=1
]]>
<if test="RESOURCE_ID != null and RESOURCE_ID != ''">
and f.RESOURCE_ID = #{RESOURCE_ID}
</if>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="CATEGORY != null and CATEGORY != ''">
and app.CATEGORY = #{CATEGORY}
</if>
<if test="START_TIME != null and START_TIME != ''">
and f.INSTALL_TIME &gt;= #{INSTALL_TIME}
</if>
<if test="END_TIME != null and END_TIME != ''">
and f.INSTALL_TIME &lt;= #{INSTALL_TIME}
</if>
</select>
<!-- APPS_UNINSTALL app用户卸载信息 -->
<insert id="insert_uninstall" parameterType="map">
insert into APPS_UNINSTALL(
<trim prefix="" suffixOverrides=",">
<foreach collection="infoListKey" item="key">
${key},
</foreach>
</trim>
<![CDATA[ ) values( ]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="infoList" item="value">
#{value},
</foreach>
</trim>
<![CDATA[ ) ]]>
</insert>
<update id="update_uninstall" parameterType="map">
<![CDATA[
update APPS_UNINSTALL set
]]>
<trim prefix="" suffixOverrides=",">
<foreach collection="info" item="info">
${info.key} = #{info.value} ,
</foreach>
</trim>
<where>
<if test="RESOURCE_ID != null and RESOURCE_ID != ''">
and RESOURCE_ID = #{RESOURCE_ID}
</if>
</where>
</update>
<delete id="delete_uninstall" parameterType="list">
<![CDATA[
delete from APPS_UNINSTALL where RESOURCE_ID IN
]]>
<foreach collection="list" item="RESOURCE_ID" open="(" separator="," close=")">
#{RESOURCE_ID}
</foreach>
</delete>
<delete id="delete_uninstall_app_id" parameterType="list">
<![CDATA[
delete from APPS_UNINSTALL where APP_ID IN
]]>
<foreach collection="list" item="APP_ID" open="(" separator="," close=")">
#{APP_ID}
</foreach>
</delete>
<delete id="delete_uninstall_app_user" parameterType="map">
<![CDATA[
delete from APPS_UNINSTALL where USERID = #{USERID}
]]>
<if test="APP_ID != null and APP_ID != ''">
and APP_ID = #{APP_ID}
</if>
</delete>
<select id="list_uninstall" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*,app.NAME APPNAME,app.PUB_DATE APPPUB_DATE,app.CATEGORY APPCATEGORY,app.LINK APPLINK,app.IMG_ID_L APPIMG_ID_L,app.IMG_ID_M APPIMG_ID_M,
app.IMG_ID_S APPIMG_ID_S
from APPS_UNINSTALL f
left join APPS_APP app on app.APP_ID = f.APP_ID
where 1=1
]]>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
</select>
<select id="listCount_uninstall" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from APPS_UNINSTALL f
left join APPS_APP app on app.APP_ID = f.APP_ID
where 1=1
]]>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
</select>
<select id="list_userallapp" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.*
from APPS_USERALLAPP f
where 1=1
]]>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="APPNAME != null and APPNAME != ''">
and f.APPNAME like '%${APPNAME}%'
</if>
<if test="INSTALL_STATUS != null and INSTALL_STATUS != ''">
and f.INSTALL_STATUS = #{INSTALL_STATUS}
</if>
<if test="APPCATEGORY != null and APPCATEGORY != ''">
and f.APPCATEGORY = #{APPCATEGORY}
</if>
<if test="APPIS_CLASSIC != null and APPIS_CLASSIC != ''">
and f.APPIS_CLASSIC = #{APPIS_CLASSIC}
</if>
<if test="APPIS_DEFAULT != null and APPIS_DEFAULT != ''">
and f.APPIS_DEFAULT = #{APPIS_DEFAULT}
</if>
</select>
<select id="listCount_userallapp" parameterType="map" resultType="int">
<![CDATA[
select count(*) c from APPS_USERALLAPP f
where 1=1
]]>
<if test="USERID != null and USERID != ''">
and f.USERID = #{USERID}
</if>
<if test="APP_ID != null and APP_ID != ''">
and f.APP_ID = #{APP_ID}
</if>
<if test="APPNAME != null and APPNAME != ''">
and f.APPNAME like '%${APPNAME}%'
</if>
<if test="INSTALL_STATUS != null and INSTALL_STATUS != ''">
and f.INSTALL_STATUS = #{INSTALL_STATUS}
</if>
<if test="APPCATEGORY != null and APPCATEGORY != ''">
and f.APPCATEGORY = #{APPCATEGORY}
</if>
<if test="APPIS_CLASSIC != null and APPIS_CLASSIC != ''">
and f.APPIS_CLASSIC = #{APPIS_CLASSIC}
</if>
<if test="APPIS_DEFAULT != null and APPIS_DEFAULT != ''">
and f.APPIS_DEFAULT = #{APPIS_DEFAULT}
</if>
</select>
<select id="list_userallapp_newuser" parameterType="map" resultType="upperCaseKeyMap">
<![CDATA[
select f.* from APPS_USERALLAPP_NEWUSER f where 1=1
]]>
</select> </select>
<select id="list_apps_portal" parameterType="map" resultType="upperCaseKeyMap"> <select id="list_allCategory" parameterType="map"
<![CDATA[ resultType="upperCaseKeyMap">
select f.* from b_t_ufp_apps f where f.IS_DELETE=0 SELECT * FROM apps_category
]]>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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