瀏覽代碼

Merge branch 'dev' of liuwenbin/patient-co-management into dev

yeshijie 7 年之前
父節點
當前提交
41ee4df6da

+ 40 - 40
edu-article/JkEdu/src/Article.sql.xml

@ -1,66 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<das-client>
	<Sqls> 
		 <Sql name='getArticleList'>
		 <![CDATA[
	<Sqls>
		<Sql name='getArticleList'>
			<![CDATA[
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 @Condition
		
			]]>
		</Sql>
			 <Sql name='getArticleListCount'>
		 <![CDATA[
		<Sql name='getArticleListCount'>
			<![CDATA[
	select count(*) from Org_Article m 
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 @Condition
			]]>
		</Sql>
				 <Sql name='getCollectionArticleList'>
		 <![CDATA[
		<Sql name='getCollectionArticleList'>
			<![CDATA[
select aa.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from (
select m.* from Org_Article m  INNER JOIN User_ArticleCollection n on  m.articleid=n.ArticleId and  1=1 @UserParam) as aa LEFT JOIN 
User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
			]]>
		</Sql>
					 <Sql name='getCollectionArticleListCount'>
		 <![CDATA[
		<Sql name='getCollectionArticleListCount'>
			<![CDATA[
select count(*) from (
select m.* from Org_Article m  INNER JOIN User_ArticleCollection n on  m.articleid=n.ArticleId and 1=1 @UserParam) as aa LEFT JOIN 
User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
			]]>
		</Sql>
			 <Sql name='pointNumberCount'>
		 <![CDATA[
		<Sql name='pointNumberCount'>
			<![CDATA[
select *  from User_Behavior where  BehaviorAction=1 and 1=1 @Condition
			]]>
		</Sql>
			 <Sql name='collectionNumberCount'>
		 <![CDATA[
		<Sql name='collectionNumberCount'>
			<![CDATA[
select * from User_ArticleCollection where 1=1 @Condition
			]]>
		</Sql>
		 <Sql name='updateArticleStatistic'>
		 <![CDATA[
		<Sql name='updateArticleStatistic'>
			<![CDATA[
		 update User_ArticleStatistics set @behaviorParam where @ArticleId
			]]>
		</Sql>
		
		 <Sql name='updateCollectionStatistic'>
		 <![CDATA[
		<Sql name='updateCollectionStatistic'>
			<![CDATA[
		 update User_ArticleStatistics set @behaviorParam= (
select count(*) from User_ArticleCollection where 1=1 @Condition) where @ArticleId
			]]>
		</Sql>
			 <Sql name='updateCommentStatistic'>
		 <![CDATA[
		<Sql name='updateCommentStatistic'>
			<![CDATA[
		 update User_ArticleStatistics  set @behaviorParam= (
select count(*) from User_ArticleComment where 1=1 @Condition) where @ArticleId
			]]>
		</Sql>
			 <Sql name='insertArticleStatistic'>
		 <![CDATA[
		<Sql name='insertArticleStatistic'>
			<![CDATA[
					
				INSERT INTO User_ArticleStatistics (		
			ArticleId
@ -70,14 +70,14 @@ FROM dual   where not exists( select ArticleId from User_ArticleStatistics where
	
			]]>
		</Sql>
		 <Sql name='deleteArticleStatistic'>
		 <![CDATA[
		<Sql name='deleteArticleStatistic'>
			<![CDATA[
					
				delete  from User_ArticleStatistics
			]]>
		</Sql>
		 <Sql name='queryArticleStatistic'>
		 <![CDATA[
		<Sql name='queryArticleStatistic'>
			<![CDATA[
				select * from (
			select count(case behavioraction when '1' then 'PointNumber' end) as PointNumber,
			 count(case behavioraction when '3' then 'ShareNumber' end) as ShareNumber, 
@ -89,19 +89,19 @@ FROM dual   where not exists( select ArticleId from User_ArticleStatistics where
			ON  aa.articleid=bb.articleid
			]]>
			
		</Sql>
		 <Sql name='insertArticleInitStatistic'>
		 <![CDATA[
		<Sql name='insertArticleInitStatistic'>
			<![CDATA[
			INSERT INTO User_ArticleStatistics (ArticleId, BrowseNumber, PointNumber, CommentNumber, ShareNumber, CollectionNumber) VALUES (?,?,?,?,?,?);
			]]>
			
		</Sql>
		
			 <Sql name='getDoctorArticleList'>
		 <![CDATA[
		<Sql name='getDoctorArticleList'>
			<![CDATA[
				select * from (
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
@ -113,8 +113,8 @@ LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   m.isauthen
		
			]]>
		</Sql>
			 <Sql name='getDoctorArticleListCount'>
		 <![CDATA[
		<Sql name='getDoctorArticleListCount'>
			<![CDATA[
		select articleid from (
		select articleid from Org_Article where isauthentication=1  and 1=1  @Condition
		union
@ -123,16 +123,16 @@ LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   m.isauthen
			]]>
		</Sql>
		
			 <Sql name='getDoctorArticalByUserId'>
		 <![CDATA[
		<Sql name='getDoctorArticalByUserId'>
			<![CDATA[
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   1=1 @Condition
			]]>
		</Sql>
			 <Sql name='getDoctorArticalByUserIdCount'>
		 <![CDATA[
		<Sql name='getDoctorArticalByUserIdCount'>
			<![CDATA[
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   1=1 @Condition 		 

+ 37 - 7
edu-article/JkEdu/src/com/yihu/jk/action/UserAction.java

@ -2,6 +2,8 @@ package com.yihu.jk.action;
import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONArray;
import net.sf.json.JsonConfig;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@ -12,6 +14,9 @@ import com.yihu.wsgw.api.ServiceBus;
import net.sf.json.JSONObject;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("user")
@ -29,7 +34,7 @@ public class UserAction {
			return ApiUtil.getRespJSON(-10000, e.getMessage()).toString();
		}
	}
	
	@RequestMapping("ssoLogin")
	@ResponseBody
	public String ssoLogin(HttpServletRequest request) {
@ -39,7 +44,7 @@ public class UserAction {
				return ApiUtil.getRespJSON(-10000, "参数param不能为空").toString();
			}
			JSONObject jsonParam=JSONObject.fromObject(param);
			
			if(jsonParam.optString("doctorType")==null){
				return ApiUtil.getRespJSON(-10000, "您不是医生,不能登入系统").toString();
			}
@ -52,11 +57,15 @@ public class UserAction {
			sessionBean.setPhoto(jsonParam.optString("photo"));
//			sessionBean.setUserId(jsonParam.optString("id"));
			sessionBean.setOrgId(jsonParam.optString("hospital"));
			
			sessionBean.setToken(jsonParam.optString("token"));
			
			JSONArray jsonArray = jsonParam.getJSONArray("userRole");
			List<Map<String,Object>> list = JSONArray.toList(jsonArray, Map.class);
			sessionBean.setUserRoleList(list);
			JSONObject jsonObject = jsonParam.getJSONObject("currentRole");
			Map<String,Object> map = jsonObject;
			sessionBean.setCurrentRole(map);
			
			//获取医生的信息
			JSONObject queryParam=new JSONObject();
			queryParam.put("userId", sessionBean.getUserId());
@ -72,7 +81,7 @@ public class UserAction {
			}
			
			request.getSession().setAttribute("session", sessionBean);
			request.getSession().setMaxInactiveInterval(-1);
			JSONObject rv = ApiUtil.getRespJSON(10000, "成功");
@ -82,6 +91,27 @@ public class UserAction {
			e.printStackTrace();
			return ApiUtil.getRespJSON(-10000, e.getMessage()).toString();
		}
	}	
	}
//	public static void main(String[] args) {
//		String a = "{'uid':'0de7295862dd11e69faffa163e8aee56'," +
//				"'doctorType' :2," +
//				"'name':'团队长'," +
//				"'token':'aeb3b537040b8607d9b82308aabef313'," +
//				"'photo' : '../../../images/d-male.png'," +
//				"'id' :4798," +
//				"'hospital':'3502110400'," +
//				"'userRole':[{'code':'350200','name':'厦门市卫生与计划生育委员会','areas':'350203'}]," +
//				"'currentRole':{'code':'350200','name':'厦门市卫生与计划生育委员会','areas':'350203'}}";
//
//		JSONObject jsonParam=JSONObject.fromObject(a);
//		SessionBean sessionBean=new SessionBean();
//		JSONArray jsonArray = jsonParam.getJSONArray("userRole");
//		List<Map<String,Object>> list = JSONArray.toList(jsonArray, Map.class);
//		sessionBean.setUserRoleList(list);
//		JSONObject jsonObject = jsonParam.getJSONObject("currentRole");
//		Map<String,Object> map = jsonObject;
//		sessionBean.setCurrentRole(map);
//	}
}

+ 8 - 8
edu-article/JkEdu/src/com/yihu/jk/api/ArticleApi.java

@ -23,7 +23,7 @@ public class ArticleApi {
	/**
	 * 查询文章列表 返回(文章统计,文章相关字段
	 * 
	 *
	 * @param im
	 * @return
	 * @throws JSONException
@ -98,7 +98,7 @@ public class ArticleApi {
	/**
	 * // 获取文章收藏列表
	 * 
	 *
	 * @param im
	 * @return
	 * @throws JSONException
@ -112,7 +112,7 @@ public class ArticleApi {
		Integer pageSize = StringUtil.isEmpty(json.get("pageSize")) ? 5 : json.getInt("pageSize");
		String userId = StringUtil.isEmpty(json.get("userId")) ? null : json.getString("userId");
		int userType = StringUtil.isEmpty(json.get("userType")) ? 2 : json.getInt("userType");// 1医生
		int myArticle = StringUtil.isEmpty(json.get("myArticle")) ? 2 : json.getInt("myArticle");
		boolean myArticle = StringUtil.isEmpty(json.get("myArticle")) ? false : json.getBoolean("myArticle");
		if (StringUtil.isEmpty(userId)) {
			return ApiUtil.getRespJSON(-10000, "userId 必传").toString();
@ -173,7 +173,7 @@ public class ArticleApi {
	/**
	 * 根据文章ID 获取文章详情
	 * 
	 *
	 * @param im
	 * @return
	 * @throws JSONException
@ -250,7 +250,7 @@ public class ArticleApi {
	/**
	 * // 更新统计表数据
	 * 
	 *
	 * @param articleId
	 * @param behaviorAction
	 * @param number
@ -303,7 +303,7 @@ public class ArticleApi {
	/**
	 * // 初始化统计数据
	 * 
	 *
	 * @throws SQLException
	 */
	public static void initArticleStatistic() throws SQLException {
@ -323,7 +323,7 @@ public class ArticleApi {
	/**
	 * 医生端查询文章列表
	 * 
	 *
	 * @param im
	 * @return
	 * @throws JSONException
@ -399,7 +399,7 @@ public class ArticleApi {
	/**
	 * 医生 端根据用户ID 查询发表文章
	 * 
	 *
	 * @param im
	 * @return
	 * @throws JSONException

+ 61 - 1
edu-article/JkEdu/src/com/yihu/jk/api/CategoryApi.java

@ -1,7 +1,11 @@
package com.yihu.jk.api;
import java.io.IOException;
import java.sql.SQLException;
import com.coreframework.remoting.standard.DateOper;
import com.yihu.jk.utils.Utils;
import com.yihu.jk.vo.SessionBean;
import net.sf.json.JSONObject;
import com.yihu.jk.dao.CategoryDao;
@ -9,9 +13,14 @@ import com.yihu.jk.utils.ApiUtil;
import com.yihu.jk.utils.StringUtil;
import com.yihu.jk.vo.Category;
import com.yihu.wsgw.api.InterfaceMessage;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CategoryApi {
	CategoryDao dao = new CategoryDao();
	//	@Autowired
	private CategoryDao dao = new CategoryDao();
	public String getCategoryList(InterfaceMessage im) {
		JSONObject json = JSONObject.fromObject(im.getParam());
@ -34,4 +43,55 @@ public class CategoryApi {
		}
	}
	/**
	 *添加文章分类
	 * @param im
	 * @return
	 */
	public String addCategory(InterfaceMessage im){
		JSONObject json = JSONObject.fromObject(im.getParam());
		String categoryId = StringUtil.isEmpty(json.get("categoryId")) ? null : json.getString("categoryId");
		String categoryName = StringUtil.isEmpty(json.get("categoryName")) ? null : json.getString("categoryName");
		Integer categoryLevel = StringUtil.isEmpty(json.get("categoryLevel")) ? null : json.getInt("categoryLevel");
		String secondLevelId = StringUtil.isEmpty(json.get("secondLevelId")) ? null : json.getString("secondLevelId");
		String firstlevelId = StringUtil.isEmpty(json.get("firstlevelId")) ? null : json.getString("firstlevelId");
		String orgName = StringUtil.isEmpty(json.get("orgName")) ? null : json.getString("orgName");
		String orgId = StringUtil.isEmpty(json.get("orgId")) ? null : json.getString("orgId");
		String operatorName = StringUtil.isEmpty(json.get("operatorName")) ? null : json.getString("operatorName");
		String operatorId = StringUtil.isEmpty(json.get("operatorId")) ? null : json.getString("operatorId");
		Category vo = new Category();
		vo.setCategoryId(categoryId);
		vo.setCategoryName(categoryName);
		vo.setCategoryLevel(categoryLevel);
		vo.setFirstlevelId(firstlevelId);
		vo.setSecondLevelId(secondLevelId);
		vo.setOperatorId(operatorId);
		vo.setOperatorName(operatorName);
		vo.setOrgId(orgId);
		vo.setOrgName(orgName);
		vo.setInsertTime(DateOper.getNowDateTime().toString());
		vo.setCategoryState(1);
		return dao.addCategory(vo).toString();
	}
	/**
	 * 更新文章分类
	 * @param im
	 * @return
	 */
	public String updateCategory(InterfaceMessage im){
		JSONObject json = JSONObject.fromObject(im.getParam());
		String categoryId = StringUtil.isEmpty(json.get("categoryId")) ? null : json.getString("categoryId");
		String categoryName = StringUtil.isEmpty(json.get("categoryName")) ? null : json.getString("categoryName");
		Integer categoryState = StringUtil.isEmpty(json.get("categoryState")) ? null : json.getInt("categoryState");
		Category vo = new Category();
		vo.setCategoryId(categoryId);
		vo.setCategoryName(categoryName);
		vo.setCategoryState(categoryState);
		vo.setUpdateTime(DateOper.getNowDateTime().toString());
		return dao.updateCategory(vo).toString();
	}
}

+ 7 - 1
edu-article/JkEdu/src/com/yihu/jk/dao/ArticleDao.java

@ -10,7 +10,9 @@ import com.yihu.jk.enums.ArticleSqlNameEnum;
import com.yihu.jk.enums.MyDatabaseEnum;
import com.yihu.jk.utils.StringUtil;
import com.yihu.jk.vo.ArticleStatistic;
import org.springframework.stereotype.Component;
@Component
public class ArticleDao {
	public List<ArticleStatistic> getArticleList(ArticleStatistic vo, int start, int pageSize) throws SQLException {
		Sql sql = DB.me().createSql(ArticleSqlNameEnum.getArticleList);
@ -76,7 +78,7 @@ public class ArticleDao {
	 * @return
	 * @throws SQLException
	 */
	public List<ArticleStatistic> getArticleCollectionArticleList(ArticleStatistic vo, int start, int pageSize,int myArticle)
	public List<ArticleStatistic> getArticleCollectionArticleList(ArticleStatistic vo, int start, int pageSize,boolean myArticle)
			throws SQLException {
		Sql sql = DB.me().createSql(ArticleSqlNameEnum.getCollectionArticleList);
		StringBuffer param = new StringBuffer();
@ -89,6 +91,9 @@ public class ArticleDao {
		if (StringUtil.isNotEmpty(vo.getFirstLevelCategoryId())) {
			param.append(" and FirstLevelCategoryId  in (").append(vo.getFirstLevelCategoryId()).append(")");
		}
		if(myArticle){
			userParam.append(" and OperatorId = '").append(vo.getUserId()).append("'");
		}
		if (StringUtil.isNotEmpty(vo.getUserId())) {
			userParam.append(" and UserId  ='").append(vo.getUserId()).append("'");
		}
@ -100,6 +105,7 @@ public class ArticleDao {
		sql.addVar("@Condition", param.toString());
		sql.addVar("@UserParam", userParam.toString());
		System.out.printf(sql.toString());
		List<ArticleStatistic> list = DB.me().queryForBeanList(MyDatabaseEnum.JkEduDB, sql, ArticleStatistic.class);
		return list;
	}

+ 47 - 45
edu-article/JkEdu/src/com/yihu/jk/dao/ArticlePcDao.java

@ -12,19 +12,21 @@ import com.yihu.jk.enums.MyDatabaseEnum;
import com.yihu.jk.enums.MyTableEnum;
import com.yihu.jk.utils.StringUtil;
import com.yihu.jk.vo.OrgArticleVo;
import org.springframework.stereotype.Component;
@Component
public class ArticlePcDao {
	public JSONObject queryArticlePcList(OrgArticleVo vo, int start, int pageSize) throws Exception {
		Sql sql = DB.me().createSql(ArticleSqlNameEnum.getArticlePcList);
 		StringBuilder sb = new StringBuilder();
		
	
		
		StringBuilder sb = new StringBuilder();
		if (StringUtil.isNotEmpty(vo.getArticleId())) {
			sb.append(" and ArticleId = ? ");
			sql.addParamValue(vo.getArticleId() );
		}
		
		if (StringUtil.isNotEmpty(vo.getArticleState())) {
			sb.append(" and ArticleState = ? ");
			sql.addParamValue(vo.getArticleState());
@ -37,70 +39,70 @@ public class ArticlePcDao {
			sb.append(" and Articlelevel = ? ");
			sql.addParamValue(vo.getArticlelevel());
		}
		 
		if (StringUtil.isNotEmpty(vo.getArticleTitle())) {
			
			sb.append(" and (ArticleTitle like '%" + vo.getArticleTitle() + "%'");
			sb.append(" or ArticleSource like '%" + vo.getArticleTitle() + "%')");
		}
 		
		if (StringUtil.isNotEmpty(vo.getStartTime())) {
			String startTime = vo.getStartTime();
			sb.append(" and  InsertTime >=? ");
			sql.addParamValue(startTime);
 		}
		
		}
		if (StringUtil.isNotEmpty(vo.getEndTime())) {
			
			String endTime = vo.getEndTime();
			sb.append(" and  InsertTime <=? ");
			sql.addParamValue(endTime);
			 
		}
		if (StringUtil.isNotEmpty(vo.getArticlelevel())) {
			sb.append(" and Articlelevel = ? ");
			sql.addParamValue(vo.getArticlelevel());
		}
		
		if (StringUtil.isNotEmpty(vo.getSecondLevelCategoryId())) {
			
			sb.append(" and SecondLevelCategoryId = ? ");
			sql.addParamValue(vo.getSecondLevelCategoryId());
			
		}
		if (StringUtil.isNotEmpty(vo.getFirstLevelCategoryId())) {
			sb.append(" and FirstLevelCategoryId = ? ");
			sql.addParamValue(vo.getFirstLevelCategoryId());
			
 		}
		}
		if (StringUtil.isNotEmpty(vo.getArticleType())) {
			sb.append(" and ArticleType = ? ");
			sql.addParamValue(vo.getArticleType());
			
 		}
		 
		}
		if (StringUtil.isNotEmpty(vo.getArticleSource())) {
			sb.append(" and ArticleSource = ? ");
			sql.addParamValue(vo.getArticleSource());
			
 		}
		}
		if (StringUtil.isNotEmpty(vo.getArticlelevel())) {
			sb.append(" and Articlelevel = ? ");
			sql.addParamValue(vo.getArticlelevel());
			
 		}
		}
		sql.addVar("@Condition", sb.toString());
		return DB.me().queryForJson(MyDatabaseEnum.JkEduDB, sql, start, pageSize);
	}
	
	public Integer removeArticle(OrgArticleVo bean) {
		try {
			bean.setUpdateTime(DateOper.getNowDateTime());
			Sql sql = DB.me().createUpdateSql(bean, MyTableEnum.Org_Article,
					"ArticleId = ?");
			sql.addParamValue(bean.getArticleId());
			
			int code = DB.me().update(MyDatabaseEnum.JkEduDB, sql);
			if (code == 1) {
				return 10000;
@ -113,8 +115,8 @@ public class ArticlePcDao {
		}
	}
	
	
	/**
	 * 修改 
	 * @author lxh <br> 2017-08-30
@ -124,17 +126,17 @@ public class ArticlePcDao {
		Sql sql = DB.me().createUpdateSql(bean, MyTableEnum.Org_Article,
				"ArticleId = ?");
		sql.addParamValue(bean.getArticleId());
		
		int code = DB.me().update(MyDatabaseEnum.JkEduDB, sql);
		
		return code;
	}
	
	public Integer saveArticle(OrgArticleVo orgArticleVo) {
		try {
			 
			Sql sql = DB.me().createInsertSql(orgArticleVo, MyTableEnum.Org_Article);
			DB.me().insert(MyDatabaseEnum.JkEduDB, sql);
			return 10000;
@ -143,14 +145,14 @@ public class ArticlePcDao {
			return -14444;
		}
	}
	
	public JSONObject queryCategory(Integer categoryLevel,String secondLevelCategoryId,String firstLevelCategoryId) throws Exception {
		Sql sql = DB.me().createSql(ArticleSqlNameEnum.queryCategory);
		StringBuffer param = new StringBuffer();
		if (StringUtil.isNotEmpty(categoryLevel)) {
			param.append(" and CategoryLevel = ? ");
			sql.addParamValue(categoryLevel);
			
		}
	/*	if (StringUtil.isNotEmpty(secondLevelCategoryId)) {
@ -159,9 +161,9 @@ public class ArticlePcDao {
			sql.addParamValue(secondLevelCategoryId);
			
		}*/
	
		if (StringUtil.isNotEmpty(firstLevelCategoryId)) {
			
			param.append(" and FirstLevelId = ? ");
			sql.addParamValue(firstLevelCategoryId);
		}
@ -169,29 +171,29 @@ public class ArticlePcDao {
		return DB.me().queryForJson(MyDatabaseEnum.JkEduDB, sql);
	}
	
	public JSONObject queryArticlePcId(OrgArticleVo vo) throws SQLException, JSONException {
		JSONObject jo;
		Sql sql = DB.me().createSql(ArticleSqlNameEnum.getArticlePcId);
		StringBuffer param = new StringBuffer();
	 
		if (StringUtil.isNotEmpty(vo.getArticleId())) {
			param.append(" and ArticleId = ? ");
			sql.addParamValue(vo.getArticleId() );
		}
		sql.addVar("@Condition", param.toString());
		jo=	 DB.me().queryForJson(MyDatabaseEnum.JkEduDB, sql );
		
		JSONObject jb = new JSONObject();
		 
		if (!jo.isNull("result")) {
			for (int i = 0; i < jo.getJSONArray("result").length(); i++) {
				
				JSONObject myjObject = jo.getJSONArray("result").getJSONObject(i);
				jb.put("result", myjObject);
			}
			
		} else {
			jb.put("Message", "查询失败");
			jb.put("Code", -10000);
@ -201,13 +203,13 @@ public class ArticlePcDao {
		// System.out.println("==" + sql.toString() + "==");
		return jb;
	}
	
	public net.sf.json.JSONObject editArticle(OrgArticleVo orgArticleVo) {
		net.sf.json.JSONObject jo = new net.sf.json.JSONObject();
		try {
			String articleId = orgArticleVo.getArticleId();
			Sql sql = DB.me().createUpdateSql(orgArticleVo,  MyTableEnum.Org_Article, " ArticleId=" + "'"+articleId+"'");
			
			int r = DB.me().update(MyDatabaseEnum.JkEduDB, sql);
			if (r > 0) {
@ -224,5 +226,5 @@ public class ArticlePcDao {
			return jo;
		}
	}
	 
}

+ 44 - 42
edu-article/JkEdu/src/com/yihu/jk/dao/ArticlePcDoctorDao.java

@ -12,19 +12,21 @@ import com.yihu.jk.enums.MyDatabaseEnum;
import com.yihu.jk.enums.MyTableEnum;
import com.yihu.jk.utils.StringUtil;
import com.yihu.jk.vo.OrgArticleVo;
import org.springframework.stereotype.Component;
@Component
public class ArticlePcDoctorDao {
	public JSONObject queryArticlePcDoctorList(OrgArticleVo vo, int start, int pageSize) throws Exception {
		Sql sql = DB.me().createSql(ArticleSqlNameEnum.getArticlePcList);
 		StringBuilder sb = new StringBuilder();
		
	
		
		StringBuilder sb = new StringBuilder();
		if (StringUtil.isNotEmpty(vo.getArticleId())) {
			sb.append(" and ArticleId = ? ");
			sql.addParamValue(vo.getArticleId() );
		}
		
		if (StringUtil.isNotEmpty(vo.getArticleState())) {
			sb.append(" and ArticleState = ? ");
			sql.addParamValue(vo.getArticleState());
@ -37,70 +39,70 @@ public class ArticlePcDoctorDao {
			sb.append(" and Articlelevel = ? ");
			sql.addParamValue(vo.getArticlelevel());
		}
		 
		if (StringUtil.isNotEmpty(vo.getArticleTitle())) {
			
			sb.append(" and (ArticleTitle like '%" + vo.getArticleTitle() + "%'");
			sb.append(" or ArticleSource like '%" + vo.getArticleTitle() + "%')");
		}
 		
		if (StringUtil.isNotEmpty(vo.getStartTime())) {
			String startTime = vo.getStartTime();
			sb.append(" and  InsertTime >=? ");
			sql.addParamValue(startTime);
 		}
		
		}
		if (StringUtil.isNotEmpty(vo.getEndTime())) {
			
			String endTime = vo.getEndTime();
			sb.append(" and  InsertTime <=? ");
			sql.addParamValue(endTime);
			 
		}
		if (StringUtil.isNotEmpty(vo.getArticlelevel())) {
			sb.append(" and Articlelevel = ? ");
			sql.addParamValue(vo.getArticlelevel());
		}
		
		if (StringUtil.isNotEmpty(vo.getSecondLevelCategoryId())) {
			
			sb.append(" and SecondLevelCategoryId = ? ");
			sql.addParamValue(vo.getSecondLevelCategoryId());
			
		}
		if (StringUtil.isNotEmpty(vo.getFirstLevelCategoryId())) {
			sb.append(" and FirstLevelCategoryId = ? ");
			sql.addParamValue(vo.getFirstLevelCategoryId());
			
 		}
		}
		if (StringUtil.isNotEmpty(vo.getArticleType())) {
			sb.append(" and ArticleType = ? ");
			sql.addParamValue(vo.getArticleType());
			
 		}
		 
		}
		if (StringUtil.isNotEmpty(vo.getArticleSource())) {
			sb.append(" and ArticleSource = ? ");
			sql.addParamValue(vo.getArticleSource());
			
 		}
		}
		if (StringUtil.isNotEmpty(vo.getArticlelevel())) {
			sb.append(" and Articlelevel = ? ");
			sql.addParamValue(vo.getArticlelevel());
			
 		}
		}
		sql.addVar("@Condition", sb.toString());
		return DB.me().queryForJson(MyDatabaseEnum.JkEduDB, sql, start, pageSize);
	}
	
	public Integer removeArticleDoctor(OrgArticleVo bean) {
		try {
			bean.setUpdateTime(DateOper.getNowDateTime());
			Sql sql = DB.me().createUpdateSql(bean, MyTableEnum.Org_Article,
					"ArticleId = ?");
			sql.addParamValue(bean.getArticleId());
			
			int code = DB.me().update(MyDatabaseEnum.JkEduDB, sql);
			if (code == 1) {
				return 10000;
@ -113,14 +115,14 @@ public class ArticlePcDoctorDao {
		}
	}
	
	
	 
	
	public Integer saveArticle(OrgArticleVo orgArticleVo) {
		try {
			 
			Sql sql = DB.me().createInsertSql(orgArticleVo, MyTableEnum.Org_Article);
			DB.me().insert(MyDatabaseEnum.JkEduDB, sql);
			return 10000;
@ -129,26 +131,26 @@ public class ArticlePcDoctorDao {
			return -14444;
		}
	}
	
	
	public JSONObject queryArticlePcDoctorId(OrgArticleVo vo) throws SQLException, JSONException {
		JSONObject jo;
		Sql sql = DB.me().createSql(ArticleSqlNameEnum.getArticlePcId);
		StringBuffer param = new StringBuffer();
 
		sql.addVar("@Condition", param.toString());
		jo=	 DB.me().queryForJson(MyDatabaseEnum.JkEduDB, sql );
		
		JSONObject jb = new JSONObject();
		 
		if (!jo.isNull("result")) {
			for (int i = 0; i < jo.getJSONArray("result").length(); i++) {
				
				JSONObject myjObject = jo.getJSONArray("result").getJSONObject(i);
				jb.put("result", myjObject);
			}
			
		} else {
			jb.put("Message", "查询失败");
			jb.put("Code", -10000);
@ -158,13 +160,13 @@ public class ArticlePcDoctorDao {
		// System.out.println("==" + sql.toString() + "==");
		return jb;
	}
	
	public net.sf.json.JSONObject editArticleDoctor(OrgArticleVo orgArticleVo) {
		net.sf.json.JSONObject jo = new net.sf.json.JSONObject();
		try {
			String articleId = orgArticleVo.getArticleId();
			Sql sql = DB.me().createUpdateSql(orgArticleVo,  MyTableEnum.Org_Article, " ArticleId=" + "'"+articleId+"'");
			
			int r = DB.me().update(MyDatabaseEnum.JkEduDB, sql);
			if (r > 0) {
@ -181,6 +183,6 @@ public class ArticlePcDoctorDao {
			return jo;
		}
	}
	
	 
}

+ 11 - 9
edu-article/JkEdu/src/com/yihu/jk/dao/ArticleQRCodeDao.java

@ -12,31 +12,33 @@ import com.yihu.jk.enums.MyDatabaseEnum;
import com.yihu.jk.enums.MyTableEnum;
import com.yihu.jk.vo.ArticleQRCode;
import com.yihu.jk.vo.OperationLogVo;
import org.springframework.stereotype.Component;
/**
 * 二维码管理表操作
 * @author chenzhibin <br> 2017-9-6 下午15:42:30 
 * @author chenzhibin <br> 2017-9-6 下午15:42:30
 */
@Component
public class ArticleQRCodeDao {
	
	/**
	 * 查询二维码管理
	 * @author chenzhibin <br> 2017-9-6 下午15:44:30 
	 * @throws SQLException 
	 * @throws SQLException
	 */
	public JSONObject queryArticleQRCodeDao() throws SQLException {
		Sql sql = DB.me().createSql(ConfigSysSqlNameEnum.getArticleORCode);
		
		JSONObject jo = DB.me().queryForJson(MyDatabaseEnum.JkEduDB, sql);
		return jo;
	}
	
	/**
	 * 新增二维码管理
	 * @author chenzhi <br> 2017-9-6 下午15:45:30
	 * @param bean 
	 * @throws SQLException 
	 * @param bean
	 * @throws SQLException
	 */
	public int saveArticleQRCode(ArticleQRCode bean) throws SQLException {
		Timestamp nowTime = DateOper.getNowDateTime();
@ -55,14 +57,14 @@ public class ArticleQRCodeDao {
		OperatorLogDao.addLog(logBean);
		return 1;
	}
	
	/**
	 * 修改二维码管理
	 * @author chenzhibin <br> 2017-9-6 下午15:50:30
	 * @param bean
	 * @param userId 修改人ID
	 * @param userName 修改人
	 * @throws SQLException 
	 * @throws SQLException
	 */
	public int updateArticleQRCode(ArticleQRCode bean, String userId, String userName) throws SQLException {
		Timestamp nowTime = DateOper.getNowDateTime();

+ 2 - 0
edu-article/JkEdu/src/com/yihu/jk/dao/BehaviorDao.java

@ -11,7 +11,9 @@ import com.yihu.jk.utils.StringUtil;
import com.yihu.jk.vo.ArticleCollection;
import com.yihu.jk.vo.ArticleComment;
import com.yihu.jk.vo.Behavior;
import org.springframework.stereotype.Component;
@Component
public class BehaviorDao {
	// 保存
	public void saveBehavior(Behavior vo) throws SQLException {