Commit 234af950 authored by 姬鋆屾's avatar 姬鋆屾
parents afaac2d9 6f69d15c
...@@ -83,7 +83,28 @@ PRIMARY KEY (`id`) ...@@ -83,7 +83,28 @@ PRIMARY KEY (`id`)
ALTER TABLE `mortals_xhx_user` ADD COLUMN `photoPath` varchar(255) COMMENT '头像地址'; ALTER TABLE `mortals_xhx_user` ADD COLUMN `photoPath` varchar(255) COMMENT '头像地址';
ALTER TABLE `mortals_xhx_user` ADD COLUMN `companyAdress` varchar(512) COMMENT '单位地址'; ALTER TABLE `mortals_xhx_user` ADD COLUMN `companyAdress` varchar(512) COMMENT '单位地址';
ALTER TABLE `mortals_xhx_user` ADD COLUMN `nickName` varchar(128) COMMENT '昵称';
INSERT INTO `mortals_xhx_task` (`name`, `taskKey`, `status`, `excuteService`, `excuteParam`, `excuteHost`, `excuteStrategy`, `excuteDate`, `excuteTime`, `remark`, `lastExcuteHost`, `lastExcuteTime`, `interimExcuteStatus`, `createTime`, `createUserId`, `createUserName`) VALUES ('员工名片日访问数初始化', 'StaffViewsByDayInit', '0', 'StaffViewsByDayInit', NULL, NULL, '1', '0', '00:00', NULL, NULL, NULL, '0', NULL, '1', '系统管理员'); INSERT INTO `mortals_xhx_task` (`name`, `taskKey`, `status`, `excuteService`, `excuteParam`, `excuteHost`, `excuteStrategy`, `excuteDate`, `excuteTime`, `remark`, `lastExcuteHost`, `lastExcuteTime`, `interimExcuteStatus`, `createTime`, `createUserId`, `createUserName`) VALUES ('员工名片日访问数初始化', 'StaffViewsByDayInit', '0', 'StaffViewsByDayInit', NULL, NULL, '1', '0', '00:00', NULL, NULL, NULL, '0', NULL, '1', '系统管理员');
ALTER TABLE `mortals_xhx_bussinesscard` ADD COLUMN `backdrop` varchar(256) COMMENT '名片背景'; ALTER TABLE `mortals_xhx_bussinesscard` ADD COLUMN `backdrop` varchar(256) COMMENT '名片背景';
\ No newline at end of file ALTER TABLE `mortals_xhx_news` ADD COLUMN `upNums` tinyint(4) NOT NULL DEFAULT '0' COMMENT '点赞次数';
-- ----------------------------
-- 新闻点赞记录信息表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_news_up`;
CREATE TABLE mortals_xhx_news_up(
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`newsId` bigint(20) COMMENT '新闻ID',
`upId` bigint(20) COMMENT '点赞人ID',
`upName` varchar(64) NOT NULL COMMENT '点赞人名称',
`sumUp` int(4) DEFAULT '0' COMMENT '累计分享次数',
`remark` varchar(255) COMMENT '备注',
`upTime` datetime NOT NULL COMMENT '点赞时间',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
,KEY `upName` (`upName`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='新闻点赞记录信息';
...@@ -113,6 +113,10 @@ public class UserEntity extends UserVo implements IUser { ...@@ -113,6 +113,10 @@ public class UserEntity extends UserVo implements IUser {
* 单位地址 * 单位地址
*/ */
private String companyAdress; private String companyAdress;
/**
* 昵称
*/
private String nickName;
public UserEntity(){} public UserEntity(){}
...@@ -431,6 +435,14 @@ public class UserEntity extends UserVo implements IUser { ...@@ -431,6 +435,14 @@ public class UserEntity extends UserVo implements IUser {
this.companyAdress = companyAdress; this.companyAdress = companyAdress;
} }
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -502,5 +514,6 @@ public class UserEntity extends UserVo implements IUser { ...@@ -502,5 +514,6 @@ public class UserEntity extends UserVo implements IUser {
this.photoPath = ""; this.photoPath = "";
this.companyAdress = ""; this.companyAdress = "";
this.nickName = "";
} }
} }
\ No newline at end of file
...@@ -207,6 +207,11 @@ public class UserQuery extends UserEntity { ...@@ -207,6 +207,11 @@ public class UserQuery extends UserEntity {
/** 单位地址排除列表 */ /** 单位地址排除列表 */
private List <String> companyAdressNotList; private List <String> companyAdressNotList;
/** 昵称 */
private List<String> nickNameList;
/** 昵称排除列表 */
private List <String> nickNameNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<UserQuery> orConditionList; private List<UserQuery> orConditionList;
...@@ -1294,6 +1299,30 @@ public class UserQuery extends UserEntity { ...@@ -1294,6 +1299,30 @@ public class UserQuery extends UserEntity {
this.companyAdressNotList = companyAdressNotList; this.companyAdressNotList = companyAdressNotList;
} }
public List<String> getCompanyAdressList() {
return companyAdressList;
}
public void setCompanyAdressList(List<String> companyAdressList) {
this.companyAdressList = companyAdressList;
}
public List<String> getNickNameList() {
return nickNameList;
}
public void setNickNameList(List<String> nickNameList) {
this.nickNameList = nickNameList;
}
public List<String> getNickNameNotList() {
return nickNameNotList;
}
public void setNickNameNotList(List<String> nickNameNotList) {
this.nickNameNotList = nickNameNotList;
}
/** /**
* 设置 用户ID,主键,自增长 * 设置 用户ID,主键,自增长
* @param id * @param id
......
...@@ -26,7 +26,30 @@ public class NewsListInfo { ...@@ -26,7 +26,30 @@ public class NewsListInfo {
* 发布时间 * 发布时间
*/ */
private Date publishTime; private Date publishTime;
/**
* 所属部门名称
*/
private String deptName;
/**
* 声明
*/
private String statement;
/**
* 文章来源
*/
private String source;
/**
* 责任编辑
*/
private String editor;
/**点赞状态**/
private Integer upStatus;
/**分享状态**/
private Integer shareStatus;
/**
* 头像地址
*/
private String photoPath;
} }
package com.mortals.xhx.busiz.applets.web; package com.mortals.xhx.busiz.applets.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.IAuthTokenService; import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.applets.req.FavoriteReq; import com.mortals.xhx.busiz.applets.req.FavoriteReq;
import com.mortals.xhx.busiz.applets.req.LoginReq;
import com.mortals.xhx.busiz.applets.req.UserInfoReq;
import com.mortals.xhx.busiz.applets.rsp.FavoriteTypeListInfo; import com.mortals.xhx.busiz.applets.rsp.FavoriteTypeListInfo;
import com.mortals.xhx.module.bussinesscard.model.BussinesscardEntity; import com.mortals.xhx.module.bussinesscard.model.BussinesscardEntity;
import com.mortals.xhx.module.bussinesscard.model.BussinesscardQuery; import com.mortals.xhx.module.bussinesscard.model.BussinesscardQuery;
...@@ -19,16 +15,12 @@ import com.mortals.xhx.module.favorites.model.*; ...@@ -19,16 +15,12 @@ import com.mortals.xhx.module.favorites.model.*;
import com.mortals.xhx.module.favorites.service.FavoritesBusinesscardService; import com.mortals.xhx.module.favorites.service.FavoritesBusinesscardService;
import com.mortals.xhx.module.favorites.service.FavoritesNewsService; import com.mortals.xhx.module.favorites.service.FavoritesNewsService;
import com.mortals.xhx.module.favorites.service.FavoritesProductService; import com.mortals.xhx.module.favorites.service.FavoritesProductService;
import com.mortals.xhx.module.favorites.web.FavoritesBusinesscardController;
import com.mortals.xhx.module.news.model.NewsEntity; import com.mortals.xhx.module.news.model.NewsEntity;
import com.mortals.xhx.module.news.model.NewsQuery; import com.mortals.xhx.module.news.model.NewsQuery;
import com.mortals.xhx.module.news.service.NewsService; import com.mortals.xhx.module.news.service.NewsService;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.model.ProductQuery; import com.mortals.xhx.module.product.model.ProductQuery;
import com.mortals.xhx.module.product.service.ProductService; import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -124,6 +116,57 @@ public class FavoriteApiController extends AbstractBaseController<FavoriteReq>{ ...@@ -124,6 +116,57 @@ public class FavoriteApiController extends AbstractBaseController<FavoriteReq>{
return rest; return rest;
} }
@RequestMapping("cancelFavorite")
public Rest<Object> cancelFavorite(@RequestBody FavoriteReq favoriteReq) throws Exception {
String busiDesc = "取消收藏产品/新闻/名片";
Rest<Object> rest = Rest.ok();
try {
Context context = this.getContext();
IUser iUser = authTokenService.getLoginUser(request);
if(ObjectUtils.isEmpty(iUser)){
rest = Rest.fail("获取个人信息失败");
}else {
if(!ObjectUtils.isEmpty(favoriteReq.getProductId()) && favoriteReq.getProductId() != 0){
FavoritesProductQuery query = new FavoritesProductQuery();
query.setUserId(iUser.getId());
query.setProductId(favoriteReq.getProductId());
FavoritesProductEntity favoritesProductEntity = favoritesProductService.selectOne(query);
if(favoritesProductEntity!=null) {
favoritesProductService.remove(favoritesProductEntity.getId(),context);
}
rest.setMsg("取消收藏产品成功");
}
if(!ObjectUtils.isEmpty(favoriteReq.getNewsId()) && favoriteReq.getNewsId() != 0){
FavoritesNewsEntity query = new FavoritesNewsEntity();
query.setUserId(iUser.getId());
query.setNewsId(favoriteReq.getNewsId());
FavoritesNewsEntity favoritesNewsEntity = favoritesNewsService.selectOne(query);
if(favoritesNewsEntity!=null) {
favoritesNewsService.remove(favoritesNewsEntity.getId(),context);
}
rest.setMsg("取消收藏新闻成功");
}
if(!ObjectUtils.isEmpty(favoriteReq.getStaffId()) && favoriteReq.getStaffId() != 0){
FavoritesBusinesscardEntity query = new FavoritesBusinesscardEntity();
query.setUserId(iUser.getId());
query.setStaffId(favoriteReq.getStaffId());
FavoritesBusinesscardEntity favoritesBusinesscardEntity = favoritesBusinesscardService.selectOne(query);
if(favoritesBusinesscardEntity!=null) {
favoritesBusinesscardService.remove(favoritesBusinesscardEntity.getId(), context);
}
rest.setMsg("取消收藏名片成功");
}
}
}catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
/** /**
* 查询收藏分类 * 查询收藏分类
......
package com.mortals.xhx.busiz.applets.web; package com.mortals.xhx.busiz.applets.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
...@@ -12,10 +11,6 @@ import com.mortals.xhx.base.system.param.service.ParamService; ...@@ -12,10 +11,6 @@ import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.user.model.UserQuery; import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.applets.req.NewsReq; import com.mortals.xhx.busiz.applets.req.NewsReq;
import com.mortals.xhx.busiz.applets.rsp.NewsListInfo;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.category.model.CategoryQuery;
import com.mortals.xhx.module.category.service.CategoryService;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.news.model.NewsCategoryQuery; import com.mortals.xhx.module.news.model.NewsCategoryQuery;
...@@ -24,8 +19,6 @@ import com.mortals.xhx.module.news.model.NewsQuery; ...@@ -24,8 +19,6 @@ import com.mortals.xhx.module.news.model.NewsQuery;
import com.mortals.xhx.module.news.service.NewsCategoryService; import com.mortals.xhx.module.news.service.NewsCategoryService;
import com.mortals.xhx.module.news.service.NewsService; import com.mortals.xhx.module.news.service.NewsService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -35,7 +28,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -35,7 +28,6 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -114,12 +106,12 @@ public class NewsApiController extends AbstractBaseController<NewsReq> { ...@@ -114,12 +106,12 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
query.setOrderColList(Arrays.asList(new OrderCol("createTime", OrderCol.DESCENDING))); query.setOrderColList(Arrays.asList(new OrderCol("createTime", OrderCol.DESCENDING)));
Result<NewsEntity> result = newsService.find(query, pageInfo, context); Result<NewsEntity> result = newsService.find(query, pageInfo, context);
List<NewsListInfo> collect = result.getList().stream().map(item -> { // List<NewsListInfo> collect = result.getList().stream().map(item -> {
NewsListInfo newsListInfo = new NewsListInfo(); // NewsListInfo newsListInfo = new NewsListInfo();
BeanUtils.copyProperties(item, newsListInfo, BeanUtil.getNullPropertyNames(item)); // BeanUtils.copyProperties(item, newsListInfo, BeanUtil.getNullPropertyNames(item));
return newsListInfo; // return newsListInfo;
}).collect(Collectors.toList()); // }).collect(Collectors.toList());
model.put(KEY_RESULT_DATA, collect); model.put(KEY_RESULT_DATA, result.getList());
model.put(PAGEINFO_KEY, result.getPageInfo()); model.put(PAGEINFO_KEY, result.getPageInfo());
super.parsePageInfo(model, result.getPageInfo()); super.parsePageInfo(model, result.getPageInfo());
rest.setData(model); rest.setData(model);
...@@ -157,4 +149,108 @@ public class NewsApiController extends AbstractBaseController<NewsReq> { ...@@ -157,4 +149,108 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
} }
return rest; return rest;
} }
/**
* 新闻点赞
*/
@PostMapping(value = "up")
public Rest<NewsEntity> upNews(@RequestBody NewsReq newsReq) {
String busiDesc = "新闻点赞";
log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(newsReq));
Rest<NewsEntity> rest = Rest.ok(busiDesc + " 【成功】");
Context context = this.getContext();
Map<String, Object> model = new HashMap<>();
try {
if (ObjectUtils.isEmpty(newsReq.getId())) {
throw new AppException("新闻id不能为空!");
}
NewsEntity newsEntity = newsService.upNews(newsReq.getId(),context,1);
rest.setData(newsEntity);
this.init(model, context);
rest.setDict(model.get("dict"));
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
/**
* 新闻取消点赞
*/
@PostMapping(value = "cancelUp")
public Rest<NewsEntity> cancelUpNews(@RequestBody NewsReq newsReq) {
String busiDesc = "新闻点赞";
log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(newsReq));
Rest<NewsEntity> rest = Rest.ok(busiDesc + " 【成功】");
Context context = this.getContext();
Map<String, Object> model = new HashMap<>();
try {
if (ObjectUtils.isEmpty(newsReq.getId())) {
throw new AppException("新闻id不能为空!");
}
NewsEntity newsEntity = newsService.upNews(newsReq.getId(),context,-1);
rest.setData(newsEntity);
this.init(model, context);
rest.setDict(model.get("dict"));
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
/**
* 新闻浏览
*/
@PostMapping(value = "view")
public Rest<NewsEntity> viewNews(@RequestBody NewsReq newsReq) {
String busiDesc = "新闻浏览";
log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(newsReq));
Rest<NewsEntity> rest = Rest.ok(busiDesc + " 【成功】");
Context context = this.getContext();
Map<String, Object> model = new HashMap<>();
try {
if (ObjectUtils.isEmpty(newsReq.getId())) {
throw new AppException("新闻id不能为空!");
}
NewsEntity newsEntity = newsService.viewNews(newsReq.getId(),context);
rest.setData(newsEntity);
this.init(model, context);
rest.setDict(model.get("dict"));
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
/**
* 新闻分享
*/
@PostMapping(value = "share")
public Rest<NewsEntity> shareNews(@RequestBody NewsReq newsReq) {
String busiDesc = "新闻分享";
log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(newsReq));
Rest<NewsEntity> rest = Rest.ok(busiDesc + " 【成功】");
Context context = this.getContext();
Map<String, Object> model = new HashMap<>();
try {
if (ObjectUtils.isEmpty(newsReq.getId())) {
throw new AppException("新闻id不能为空!");
}
NewsEntity newsEntity = newsService.shareNews(newsReq.getId(),context);
rest.setData(newsEntity);
this.init(model, context);
rest.setDict(model.get("dict"));
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
} }
...@@ -8,22 +8,12 @@ import com.mortals.framework.model.Context; ...@@ -8,22 +8,12 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.xhx.busiz.applets.req.NewsReq;
import com.mortals.xhx.busiz.applets.req.ProductReq; import com.mortals.xhx.busiz.applets.req.ProductReq;
import com.mortals.xhx.busiz.applets.rsp.NewsListInfo;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.category.model.CategoryQuery; import com.mortals.xhx.module.category.model.CategoryQuery;
import com.mortals.xhx.module.category.service.CategoryService; import com.mortals.xhx.module.category.service.CategoryService;
import com.mortals.xhx.module.company.model.CompanyQuery;
import com.mortals.xhx.module.company.service.CompanyService;
import com.mortals.xhx.module.labels.model.LabelsQuery;
import com.mortals.xhx.module.labels.service.LabelsService;
import com.mortals.xhx.module.news.model.NewsEntity;
import com.mortals.xhx.module.news.model.NewsQuery;
import com.mortals.xhx.module.product.model.ProductCategoryQuery;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.model.ProductQuery; import com.mortals.xhx.module.product.model.ProductQuery;
import com.mortals.xhx.module.product.service.ProductCategoryService;
import com.mortals.xhx.module.product.service.ProductService; import com.mortals.xhx.module.product.service.ProductService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
......
...@@ -19,5 +19,8 @@ public class FeedbackVo extends BaseEntityLong { ...@@ -19,5 +19,8 @@ public class FeedbackVo extends BaseEntityLong {
/** 主键ID,主键,自增长列表 */ /** 主键ID,主键,自增长列表 */
private List <Long> idList; private List <Long> idList;
/**
* 头像地址
*/
private String photoPath;
} }
\ No newline at end of file
package com.mortals.xhx.module.feedback.service.impl; package com.mortals.xhx.module.feedback.service.impl;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -7,6 +14,12 @@ import com.mortals.xhx.module.feedback.dao.FeedbackDao; ...@@ -7,6 +14,12 @@ import com.mortals.xhx.module.feedback.dao.FeedbackDao;
import com.mortals.xhx.module.feedback.model.FeedbackEntity; import com.mortals.xhx.module.feedback.model.FeedbackEntity;
import com.mortals.xhx.module.feedback.service.FeedbackService; import com.mortals.xhx.module.feedback.service.FeedbackService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* FeedbackService * FeedbackService
* 反馈信息 service实现 * 反馈信息 service实现
...@@ -17,5 +30,37 @@ import lombok.extern.slf4j.Slf4j; ...@@ -17,5 +30,37 @@ import lombok.extern.slf4j.Slf4j;
@Service("feedbackService") @Service("feedbackService")
@Slf4j @Slf4j
public class FeedbackServiceImpl extends AbstractCRUDServiceImpl<FeedbackDao, FeedbackEntity, Long> implements FeedbackService { public class FeedbackServiceImpl extends AbstractCRUDServiceImpl<FeedbackDao, FeedbackEntity, Long> implements FeedbackService {
@Autowired
private UserService userService;
@Override
protected void saveBefore(FeedbackEntity entity, Context context) throws AppException {
super.saveBefore(entity,context);
if(StringUtils.isEmpty(entity.getTitle())){
entity.setTitle("来自微信小程序的反馈");
}
if(context!=null&&context.getUser()!=null){
UserEntity userEntity = userService.get(context.getUser().getId());
if(userEntity!=null){
entity.setFeedbackName(userEntity.getRealName());
}
}
}
@Override
protected void findAfter(FeedbackEntity params, PageInfo pageInfo, Context context, List<FeedbackEntity> list) throws AppException {
super.findAfter(params, pageInfo, context, list);
if(CollectionUtils.isNotEmpty(list)){
List<Long> userIdList = list.stream().map(FeedbackEntity::getCreateUserId).collect(Collectors.toList());
List<UserEntity> userList = userService.find(new UserQuery().idList(userIdList));
Map<Long,UserEntity> userMap = userList.parallelStream().collect(Collectors.toMap(x -> x.getId(), z -> z, (o, n) -> n));
for(FeedbackEntity item:list){
UserEntity userEntity = userMap.get(item.getCreateUserId());
if(userEntity!=null) {
item.setPhotoPath(userEntity.getPhotoPath());
}
}
}
}
} }
\ No newline at end of file
package com.mortals.xhx.module.news.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.news.model.NewsUpEntity;
import java.util.List;
/**
* 新闻点赞记录信息Dao
* 新闻点赞记录信息 DAO接口
*
* @author zxfei
* @date 2024-12-04
*/
public interface NewsUpDao extends ICRUDDao<NewsUpEntity,Long>{
}
package com.mortals.xhx.module.news.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.news.dao.NewsUpDao;
import com.mortals.xhx.module.news.model.NewsUpEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 新闻点赞记录信息DaoImpl DAO接口
*
* @author zxfei
* @date 2024-12-04
*/
@Repository("newsUpDao")
public class NewsUpDaoImpl extends BaseCRUDDaoMybatis<NewsUpEntity,Long> implements NewsUpDao {
}
...@@ -80,6 +80,10 @@ public class NewsEntity extends NewsVo { ...@@ -80,6 +80,10 @@ public class NewsEntity extends NewsVo {
* 备注 * 备注
*/ */
private String remark; private String remark;
/**
* 点赞次数
*/
private Integer upNums;
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -104,7 +108,7 @@ public class NewsEntity extends NewsVo { ...@@ -104,7 +108,7 @@ public class NewsEntity extends NewsVo {
this.content = ""; this.content = "";
this.top = 0; this.top = 0;
this.viewNums = 0; this.viewNums = 0;
this.publishTime =null; this.publishTime = new Date();
this.editor = ""; this.editor = "";
this.shareNums = 0; this.shareNums = 0;
this.deptId = null; this.deptId = null;
...@@ -112,5 +116,6 @@ public class NewsEntity extends NewsVo { ...@@ -112,5 +116,6 @@ public class NewsEntity extends NewsVo {
this.statement = ""; this.statement = "";
this.source = ""; this.source = "";
this.remark = ""; this.remark = "";
this.upNums = 0;
} }
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ import com.mortals.xhx.module.news.model.NewsEntity; ...@@ -7,7 +7,7 @@ import com.mortals.xhx.module.news.model.NewsEntity;
* 新闻查询对象 * 新闻查询对象
* *
* @author zxfei * @author zxfei
* @date 2023-09-28 * @date 2024-12-04
*/ */
public class NewsQuery extends NewsEntity { public class NewsQuery extends NewsEntity {
/** 开始 主键ID,主键,自增长 */ /** 开始 主键ID,主键,自增长 */
...@@ -138,6 +138,21 @@ public class NewsQuery extends NewsEntity { ...@@ -138,6 +138,21 @@ public class NewsQuery extends NewsEntity {
/** 结束 更新时间 */ /** 结束 更新时间 */
private String updateTimeEnd; private String updateTimeEnd;
/** 开始 点赞次数 */
private Integer upNumsStart;
/** 结束 点赞次数 */
private Integer upNumsEnd;
/** 增加 点赞次数 */
private Integer upNumsIncrement;
/** 点赞次数列表 */
private List <Integer> upNumsList;
/** 点赞次数排除列表 */
private List <Integer> upNumsNotList;
/** 责任编辑 */ /** 责任编辑 */
private List<String> editorList; private List<String> editorList;
...@@ -911,6 +926,87 @@ public class NewsQuery extends NewsEntity { ...@@ -911,6 +926,87 @@ public class NewsQuery extends NewsEntity {
this.updateTimeEnd = updateTimeEnd; this.updateTimeEnd = updateTimeEnd;
} }
/**
* 获取 开始 点赞次数
* @return upNumsStart
*/
public Integer getUpNumsStart(){
return this.upNumsStart;
}
/**
* 设置 开始 点赞次数
* @param upNumsStart
*/
public void setUpNumsStart(Integer upNumsStart){
this.upNumsStart = upNumsStart;
}
/**
* 获取 结束 点赞次数
* @return $upNumsEnd
*/
public Integer getUpNumsEnd(){
return this.upNumsEnd;
}
/**
* 设置 结束 点赞次数
* @param upNumsEnd
*/
public void setUpNumsEnd(Integer upNumsEnd){
this.upNumsEnd = upNumsEnd;
}
/**
* 获取 增加 点赞次数
* @return upNumsIncrement
*/
public Integer getUpNumsIncrement(){
return this.upNumsIncrement;
}
/**
* 设置 增加 点赞次数
* @param upNumsIncrement
*/
public void setUpNumsIncrement(Integer upNumsIncrement){
this.upNumsIncrement = upNumsIncrement;
}
/**
* 获取 点赞次数
* @return upNumsList
*/
public List<Integer> getUpNumsList(){
return this.upNumsList;
}
/**
* 设置 点赞次数
* @param upNumsList
*/
public void setUpNumsList(List<Integer> upNumsList){
this.upNumsList = upNumsList;
}
/**
* 获取 点赞次数
* @return upNumsNotList
*/
public List<Integer> getUpNumsNotList(){
return this.upNumsNotList;
}
/**
* 设置 点赞次数
* @param upNumsNotList
*/
public void setUpNumsNotList(List<Integer> upNumsNotList){
this.upNumsNotList = upNumsNotList;
}
/** /**
* 获取 责任编辑 * 获取 责任编辑
* @return editorList * @return editorList
...@@ -1636,6 +1732,60 @@ public class NewsQuery extends NewsEntity { ...@@ -1636,6 +1732,60 @@ public class NewsQuery extends NewsEntity {
} }
/**
* 设置 点赞次数
* @param upNums
*/
public NewsQuery upNums(Integer upNums){
setUpNums(upNums);
return this;
}
/**
* 设置 开始 点赞次数
* @param upNumsStart
*/
public NewsQuery upNumsStart(Integer upNumsStart){
this.upNumsStart = upNumsStart;
return this;
}
/**
* 设置 结束 点赞次数
* @param upNumsEnd
*/
public NewsQuery upNumsEnd(Integer upNumsEnd){
this.upNumsEnd = upNumsEnd;
return this;
}
/**
* 设置 增加 点赞次数
* @param upNumsIncrement
*/
public NewsQuery upNumsIncrement(Integer upNumsIncrement){
this.upNumsIncrement = upNumsIncrement;
return this;
}
/**
* 设置 点赞次数
* @param upNumsList
*/
public NewsQuery upNumsList(List<Integer> upNumsList){
this.upNumsList = upNumsList;
return this;
}
/**
* 设置 点赞次数
* @param upNumsNotList
*/
public NewsQuery upNumsNotList(List<Integer> upNumsNotList){
this.upNumsNotList = upNumsNotList;
return this;
}
/** /**
* 设置 责任编辑 * 设置 责任编辑
......
package com.mortals.xhx.module.news.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.news.model.vo.NewsUpVo;
import lombok.Data;
/**
* 新闻点赞记录信息实体对象
*
* @author zxfei
* @date 2024-12-04
*/
@Data
public class NewsUpEntity extends NewsUpVo {
private static final long serialVersionUID = 1L;
/**
* 新闻ID
*/
private Long newsId;
/**
* 点赞人ID
*/
private Long upId;
/**
* 点赞人名称
*/
private String upName;
/**
* 累计分享次数
*/
private Integer sumUp;
/**
* 备注
*/
private String remark;
/**
* 点赞时间
*/
private Date upTime;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof NewsUpEntity) {
NewsUpEntity tmp = (NewsUpEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.newsId = null;
this.upId = null;
this.upName = "";
this.sumUp = 0;
this.remark = "";
this.upTime = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.news.model;
import java.util.Date;
import java.util.List;
import com.mortals.xhx.module.news.model.NewsUpEntity;
/**
* 新闻点赞记录信息查询对象
*
* @author zxfei
* @date 2024-12-04
*/
public class NewsUpQuery extends NewsUpEntity {
/** 开始 序号,主键,自增长 */
private Long idStart;
/** 结束 序号,主键,自增长 */
private Long idEnd;
/** 增加 序号,主键,自增长 */
private Long idIncrement;
/** 序号,主键,自增长列表 */
private List <Long> idList;
/** 序号,主键,自增长排除列表 */
private List <Long> idNotList;
/** 开始 新闻ID */
private Long newsIdStart;
/** 结束 新闻ID */
private Long newsIdEnd;
/** 增加 新闻ID */
private Long newsIdIncrement;
/** 新闻ID列表 */
private List <Long> newsIdList;
/** 新闻ID排除列表 */
private List <Long> newsIdNotList;
/** 开始 点赞人ID */
private Long upIdStart;
/** 结束 点赞人ID */
private Long upIdEnd;
/** 增加 点赞人ID */
private Long upIdIncrement;
/** 点赞人ID列表 */
private List <Long> upIdList;
/** 点赞人ID排除列表 */
private List <Long> upIdNotList;
/** 点赞人名称 */
private List<String> upNameList;
/** 点赞人名称排除列表 */
private List <String> upNameNotList;
/** 开始 累计分享次数 */
private Integer sumUpStart;
/** 结束 累计分享次数 */
private Integer sumUpEnd;
/** 增加 累计分享次数 */
private Integer sumUpIncrement;
/** 累计分享次数列表 */
private List <Integer> sumUpList;
/** 累计分享次数排除列表 */
private List <Integer> sumUpNotList;
/** 备注 */
private List<String> remarkList;
/** 备注排除列表 */
private List <String> remarkNotList;
/** 开始 点赞时间 */
private String upTimeStart;
/** 结束 点赞时间 */
private String upTimeEnd;
/** 开始 创建用户 */
private Long createUserIdStart;
/** 结束 创建用户 */
private Long createUserIdEnd;
/** 增加 创建用户 */
private Long createUserIdIncrement;
/** 创建用户列表 */
private List <Long> createUserIdList;
/** 创建用户排除列表 */
private List <Long> createUserIdNotList;
/** 开始 创建时间 */
private String createTimeStart;
/** 结束 创建时间 */
private String createTimeEnd;
/** 开始 更新用户 */
private Long updateUserIdStart;
/** 结束 更新用户 */
private Long updateUserIdEnd;
/** 增加 更新用户 */
private Long updateUserIdIncrement;
/** 更新用户列表 */
private List <Long> updateUserIdList;
/** 更新用户排除列表 */
private List <Long> updateUserIdNotList;
/** 开始 更新时间 */
private String updateTimeStart;
/** 结束 更新时间 */
private String updateTimeEnd;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<NewsUpQuery> orConditionList;
/** AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4) */
private List<NewsUpQuery> andConditionList;
public NewsUpQuery(){}
/**
* 获取 开始 序号,主键,自增长
* @return idStart
*/
public Long getIdStart(){
return this.idStart;
}
/**
* 设置 开始 序号,主键,自增长
* @param idStart
*/
public void setIdStart(Long idStart){
this.idStart = idStart;
}
/**
* 获取 结束 序号,主键,自增长
* @return $idEnd
*/
public Long getIdEnd(){
return this.idEnd;
}
/**
* 设置 结束 序号,主键,自增长
* @param idEnd
*/
public void setIdEnd(Long idEnd){
this.idEnd = idEnd;
}
/**
* 获取 增加 序号,主键,自增长
* @return idIncrement
*/
public Long getIdIncrement(){
return this.idIncrement;
}
/**
* 设置 增加 序号,主键,自增长
* @param idIncrement
*/
public void setIdIncrement(Long idIncrement){
this.idIncrement = idIncrement;
}
/**
* 获取 序号,主键,自增长
* @return idList
*/
public List<Long> getIdList(){
return this.idList;
}
/**
* 设置 序号,主键,自增长
* @param idList
*/
public void setIdList(List<Long> idList){
this.idList = idList;
}
/**
* 获取 序号,主键,自增长
* @return idNotList
*/
public List<Long> getIdNotList(){
return this.idNotList;
}
/**
* 设置 序号,主键,自增长
* @param idNotList
*/
public void setIdNotList(List<Long> idNotList){
this.idNotList = idNotList;
}
/**
* 获取 开始 新闻ID
* @return newsIdStart
*/
public Long getNewsIdStart(){
return this.newsIdStart;
}
/**
* 设置 开始 新闻ID
* @param newsIdStart
*/
public void setNewsIdStart(Long newsIdStart){
this.newsIdStart = newsIdStart;
}
/**
* 获取 结束 新闻ID
* @return $newsIdEnd
*/
public Long getNewsIdEnd(){
return this.newsIdEnd;
}
/**
* 设置 结束 新闻ID
* @param newsIdEnd
*/
public void setNewsIdEnd(Long newsIdEnd){
this.newsIdEnd = newsIdEnd;
}
/**
* 获取 增加 新闻ID
* @return newsIdIncrement
*/
public Long getNewsIdIncrement(){
return this.newsIdIncrement;
}
/**
* 设置 增加 新闻ID
* @param newsIdIncrement
*/
public void setNewsIdIncrement(Long newsIdIncrement){
this.newsIdIncrement = newsIdIncrement;
}
/**
* 获取 新闻ID
* @return newsIdList
*/
public List<Long> getNewsIdList(){
return this.newsIdList;
}
/**
* 设置 新闻ID
* @param newsIdList
*/
public void setNewsIdList(List<Long> newsIdList){
this.newsIdList = newsIdList;
}
/**
* 获取 新闻ID
* @return newsIdNotList
*/
public List<Long> getNewsIdNotList(){
return this.newsIdNotList;
}
/**
* 设置 新闻ID
* @param newsIdNotList
*/
public void setNewsIdNotList(List<Long> newsIdNotList){
this.newsIdNotList = newsIdNotList;
}
/**
* 获取 开始 点赞人ID
* @return upIdStart
*/
public Long getUpIdStart(){
return this.upIdStart;
}
/**
* 设置 开始 点赞人ID
* @param upIdStart
*/
public void setUpIdStart(Long upIdStart){
this.upIdStart = upIdStart;
}
/**
* 获取 结束 点赞人ID
* @return $upIdEnd
*/
public Long getUpIdEnd(){
return this.upIdEnd;
}
/**
* 设置 结束 点赞人ID
* @param upIdEnd
*/
public void setUpIdEnd(Long upIdEnd){
this.upIdEnd = upIdEnd;
}
/**
* 获取 增加 点赞人ID
* @return upIdIncrement
*/
public Long getUpIdIncrement(){
return this.upIdIncrement;
}
/**
* 设置 增加 点赞人ID
* @param upIdIncrement
*/
public void setUpIdIncrement(Long upIdIncrement){
this.upIdIncrement = upIdIncrement;
}
/**
* 获取 点赞人ID
* @return upIdList
*/
public List<Long> getUpIdList(){
return this.upIdList;
}
/**
* 设置 点赞人ID
* @param upIdList
*/
public void setUpIdList(List<Long> upIdList){
this.upIdList = upIdList;
}
/**
* 获取 点赞人ID
* @return upIdNotList
*/
public List<Long> getUpIdNotList(){
return this.upIdNotList;
}
/**
* 设置 点赞人ID
* @param upIdNotList
*/
public void setUpIdNotList(List<Long> upIdNotList){
this.upIdNotList = upIdNotList;
}
/**
* 获取 点赞人名称
* @return upNameList
*/
public List<String> getUpNameList(){
return this.upNameList;
}
/**
* 设置 点赞人名称
* @param upNameList
*/
public void setUpNameList(List<String> upNameList){
this.upNameList = upNameList;
}
/**
* 获取 点赞人名称
* @return upNameNotList
*/
public List<String> getUpNameNotList(){
return this.upNameNotList;
}
/**
* 设置 点赞人名称
* @param upNameNotList
*/
public void setUpNameNotList(List<String> upNameNotList){
this.upNameNotList = upNameNotList;
}
/**
* 获取 开始 累计分享次数
* @return sumUpStart
*/
public Integer getSumUpStart(){
return this.sumUpStart;
}
/**
* 设置 开始 累计分享次数
* @param sumUpStart
*/
public void setSumUpStart(Integer sumUpStart){
this.sumUpStart = sumUpStart;
}
/**
* 获取 结束 累计分享次数
* @return $sumUpEnd
*/
public Integer getSumUpEnd(){
return this.sumUpEnd;
}
/**
* 设置 结束 累计分享次数
* @param sumUpEnd
*/
public void setSumUpEnd(Integer sumUpEnd){
this.sumUpEnd = sumUpEnd;
}
/**
* 获取 增加 累计分享次数
* @return sumUpIncrement
*/
public Integer getSumUpIncrement(){
return this.sumUpIncrement;
}
/**
* 设置 增加 累计分享次数
* @param sumUpIncrement
*/
public void setSumUpIncrement(Integer sumUpIncrement){
this.sumUpIncrement = sumUpIncrement;
}
/**
* 获取 累计分享次数
* @return sumUpList
*/
public List<Integer> getSumUpList(){
return this.sumUpList;
}
/**
* 设置 累计分享次数
* @param sumUpList
*/
public void setSumUpList(List<Integer> sumUpList){
this.sumUpList = sumUpList;
}
/**
* 获取 累计分享次数
* @return sumUpNotList
*/
public List<Integer> getSumUpNotList(){
return this.sumUpNotList;
}
/**
* 设置 累计分享次数
* @param sumUpNotList
*/
public void setSumUpNotList(List<Integer> sumUpNotList){
this.sumUpNotList = sumUpNotList;
}
/**
* 获取 备注
* @return remarkList
*/
public List<String> getRemarkList(){
return this.remarkList;
}
/**
* 设置 备注
* @param remarkList
*/
public void setRemarkList(List<String> remarkList){
this.remarkList = remarkList;
}
/**
* 获取 备注
* @return remarkNotList
*/
public List<String> getRemarkNotList(){
return this.remarkNotList;
}
/**
* 设置 备注
* @param remarkNotList
*/
public void setRemarkNotList(List<String> remarkNotList){
this.remarkNotList = remarkNotList;
}
/**
* 获取 开始 点赞时间
* @return upTimeStart
*/
public String getUpTimeStart(){
return this.upTimeStart;
}
/**
* 设置 开始 点赞时间
* @param upTimeStart
*/
public void setUpTimeStart(String upTimeStart){
this.upTimeStart = upTimeStart;
}
/**
* 获取 结束 点赞时间
* @return upTimeEnd
*/
public String getUpTimeEnd(){
return this.upTimeEnd;
}
/**
* 设置 结束 点赞时间
* @param upTimeEnd
*/
public void setUpTimeEnd(String upTimeEnd){
this.upTimeEnd = upTimeEnd;
}
/**
* 获取 开始 创建用户
* @return createUserIdStart
*/
public Long getCreateUserIdStart(){
return this.createUserIdStart;
}
/**
* 设置 开始 创建用户
* @param createUserIdStart
*/
public void setCreateUserIdStart(Long createUserIdStart){
this.createUserIdStart = createUserIdStart;
}
/**
* 获取 结束 创建用户
* @return $createUserIdEnd
*/
public Long getCreateUserIdEnd(){
return this.createUserIdEnd;
}
/**
* 设置 结束 创建用户
* @param createUserIdEnd
*/
public void setCreateUserIdEnd(Long createUserIdEnd){
this.createUserIdEnd = createUserIdEnd;
}
/**
* 获取 增加 创建用户
* @return createUserIdIncrement
*/
public Long getCreateUserIdIncrement(){
return this.createUserIdIncrement;
}
/**
* 设置 增加 创建用户
* @param createUserIdIncrement
*/
public void setCreateUserIdIncrement(Long createUserIdIncrement){
this.createUserIdIncrement = createUserIdIncrement;
}
/**
* 获取 创建用户
* @return createUserIdList
*/
public List<Long> getCreateUserIdList(){
return this.createUserIdList;
}
/**
* 设置 创建用户
* @param createUserIdList
*/
public void setCreateUserIdList(List<Long> createUserIdList){
this.createUserIdList = createUserIdList;
}
/**
* 获取 创建用户
* @return createUserIdNotList
*/
public List<Long> getCreateUserIdNotList(){
return this.createUserIdNotList;
}
/**
* 设置 创建用户
* @param createUserIdNotList
*/
public void setCreateUserIdNotList(List<Long> createUserIdNotList){
this.createUserIdNotList = createUserIdNotList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
*/
public String getCreateTimeStart(){
return this.createTimeStart;
}
/**
* 设置 开始 创建时间
* @param createTimeStart
*/
public void setCreateTimeStart(String createTimeStart){
this.createTimeStart = createTimeStart;
}
/**
* 获取 结束 创建时间
* @return createTimeEnd
*/
public String getCreateTimeEnd(){
return this.createTimeEnd;
}
/**
* 设置 结束 创建时间
* @param createTimeEnd
*/
public void setCreateTimeEnd(String createTimeEnd){
this.createTimeEnd = createTimeEnd;
}
/**
* 获取 开始 更新用户
* @return updateUserIdStart
*/
public Long getUpdateUserIdStart(){
return this.updateUserIdStart;
}
/**
* 设置 开始 更新用户
* @param updateUserIdStart
*/
public void setUpdateUserIdStart(Long updateUserIdStart){
this.updateUserIdStart = updateUserIdStart;
}
/**
* 获取 结束 更新用户
* @return $updateUserIdEnd
*/
public Long getUpdateUserIdEnd(){
return this.updateUserIdEnd;
}
/**
* 设置 结束 更新用户
* @param updateUserIdEnd
*/
public void setUpdateUserIdEnd(Long updateUserIdEnd){
this.updateUserIdEnd = updateUserIdEnd;
}
/**
* 获取 增加 更新用户
* @return updateUserIdIncrement
*/
public Long getUpdateUserIdIncrement(){
return this.updateUserIdIncrement;
}
/**
* 设置 增加 更新用户
* @param updateUserIdIncrement
*/
public void setUpdateUserIdIncrement(Long updateUserIdIncrement){
this.updateUserIdIncrement = updateUserIdIncrement;
}
/**
* 获取 更新用户
* @return updateUserIdList
*/
public List<Long> getUpdateUserIdList(){
return this.updateUserIdList;
}
/**
* 设置 更新用户
* @param updateUserIdList
*/
public void setUpdateUserIdList(List<Long> updateUserIdList){
this.updateUserIdList = updateUserIdList;
}
/**
* 获取 更新用户
* @return updateUserIdNotList
*/
public List<Long> getUpdateUserIdNotList(){
return this.updateUserIdNotList;
}
/**
* 设置 更新用户
* @param updateUserIdNotList
*/
public void setUpdateUserIdNotList(List<Long> updateUserIdNotList){
this.updateUserIdNotList = updateUserIdNotList;
}
/**
* 获取 开始 更新时间
* @return updateTimeStart
*/
public String getUpdateTimeStart(){
return this.updateTimeStart;
}
/**
* 设置 开始 更新时间
* @param updateTimeStart
*/
public void setUpdateTimeStart(String updateTimeStart){
this.updateTimeStart = updateTimeStart;
}
/**
* 获取 结束 更新时间
* @return updateTimeEnd
*/
public String getUpdateTimeEnd(){
return this.updateTimeEnd;
}
/**
* 设置 结束 更新时间
* @param updateTimeEnd
*/
public void setUpdateTimeEnd(String updateTimeEnd){
this.updateTimeEnd = updateTimeEnd;
}
/**
* 设置 序号,主键,自增长
* @param id
*/
public NewsUpQuery id(Long id){
setId(id);
return this;
}
/**
* 设置 开始 序号,主键,自增长
* @param idStart
*/
public NewsUpQuery idStart(Long idStart){
this.idStart = idStart;
return this;
}
/**
* 设置 结束 序号,主键,自增长
* @param idEnd
*/
public NewsUpQuery idEnd(Long idEnd){
this.idEnd = idEnd;
return this;
}
/**
* 设置 增加 序号,主键,自增长
* @param idIncrement
*/
public NewsUpQuery idIncrement(Long idIncrement){
this.idIncrement = idIncrement;
return this;
}
/**
* 设置 序号,主键,自增长
* @param idList
*/
public NewsUpQuery idList(List<Long> idList){
this.idList = idList;
return this;
}
/**
* 设置 序号,主键,自增长
* @param idNotList
*/
public NewsUpQuery idNotList(List<Long> idNotList){
this.idNotList = idNotList;
return this;
}
/**
* 设置 新闻ID
* @param newsId
*/
public NewsUpQuery newsId(Long newsId){
setNewsId(newsId);
return this;
}
/**
* 设置 开始 新闻ID
* @param newsIdStart
*/
public NewsUpQuery newsIdStart(Long newsIdStart){
this.newsIdStart = newsIdStart;
return this;
}
/**
* 设置 结束 新闻ID
* @param newsIdEnd
*/
public NewsUpQuery newsIdEnd(Long newsIdEnd){
this.newsIdEnd = newsIdEnd;
return this;
}
/**
* 设置 增加 新闻ID
* @param newsIdIncrement
*/
public NewsUpQuery newsIdIncrement(Long newsIdIncrement){
this.newsIdIncrement = newsIdIncrement;
return this;
}
/**
* 设置 新闻ID
* @param newsIdList
*/
public NewsUpQuery newsIdList(List<Long> newsIdList){
this.newsIdList = newsIdList;
return this;
}
/**
* 设置 新闻ID
* @param newsIdNotList
*/
public NewsUpQuery newsIdNotList(List<Long> newsIdNotList){
this.newsIdNotList = newsIdNotList;
return this;
}
/**
* 设置 点赞人ID
* @param upId
*/
public NewsUpQuery upId(Long upId){
setUpId(upId);
return this;
}
/**
* 设置 开始 点赞人ID
* @param upIdStart
*/
public NewsUpQuery upIdStart(Long upIdStart){
this.upIdStart = upIdStart;
return this;
}
/**
* 设置 结束 点赞人ID
* @param upIdEnd
*/
public NewsUpQuery upIdEnd(Long upIdEnd){
this.upIdEnd = upIdEnd;
return this;
}
/**
* 设置 增加 点赞人ID
* @param upIdIncrement
*/
public NewsUpQuery upIdIncrement(Long upIdIncrement){
this.upIdIncrement = upIdIncrement;
return this;
}
/**
* 设置 点赞人ID
* @param upIdList
*/
public NewsUpQuery upIdList(List<Long> upIdList){
this.upIdList = upIdList;
return this;
}
/**
* 设置 点赞人ID
* @param upIdNotList
*/
public NewsUpQuery upIdNotList(List<Long> upIdNotList){
this.upIdNotList = upIdNotList;
return this;
}
/**
* 设置 点赞人名称
* @param upName
*/
public NewsUpQuery upName(String upName){
setUpName(upName);
return this;
}
/**
* 设置 点赞人名称
* @param upNameList
*/
public NewsUpQuery upNameList(List<String> upNameList){
this.upNameList = upNameList;
return this;
}
/**
* 设置 累计分享次数
* @param sumUp
*/
public NewsUpQuery sumUp(Integer sumUp){
setSumUp(sumUp);
return this;
}
/**
* 设置 开始 累计分享次数
* @param sumUpStart
*/
public NewsUpQuery sumUpStart(Integer sumUpStart){
this.sumUpStart = sumUpStart;
return this;
}
/**
* 设置 结束 累计分享次数
* @param sumUpEnd
*/
public NewsUpQuery sumUpEnd(Integer sumUpEnd){
this.sumUpEnd = sumUpEnd;
return this;
}
/**
* 设置 增加 累计分享次数
* @param sumUpIncrement
*/
public NewsUpQuery sumUpIncrement(Integer sumUpIncrement){
this.sumUpIncrement = sumUpIncrement;
return this;
}
/**
* 设置 累计分享次数
* @param sumUpList
*/
public NewsUpQuery sumUpList(List<Integer> sumUpList){
this.sumUpList = sumUpList;
return this;
}
/**
* 设置 累计分享次数
* @param sumUpNotList
*/
public NewsUpQuery sumUpNotList(List<Integer> sumUpNotList){
this.sumUpNotList = sumUpNotList;
return this;
}
/**
* 设置 备注
* @param remark
*/
public NewsUpQuery remark(String remark){
setRemark(remark);
return this;
}
/**
* 设置 备注
* @param remarkList
*/
public NewsUpQuery remarkList(List<String> remarkList){
this.remarkList = remarkList;
return this;
}
/**
* 设置 创建用户
* @param createUserId
*/
public NewsUpQuery createUserId(Long createUserId){
setCreateUserId(createUserId);
return this;
}
/**
* 设置 开始 创建用户
* @param createUserIdStart
*/
public NewsUpQuery createUserIdStart(Long createUserIdStart){
this.createUserIdStart = createUserIdStart;
return this;
}
/**
* 设置 结束 创建用户
* @param createUserIdEnd
*/
public NewsUpQuery createUserIdEnd(Long createUserIdEnd){
this.createUserIdEnd = createUserIdEnd;
return this;
}
/**
* 设置 增加 创建用户
* @param createUserIdIncrement
*/
public NewsUpQuery createUserIdIncrement(Long createUserIdIncrement){
this.createUserIdIncrement = createUserIdIncrement;
return this;
}
/**
* 设置 创建用户
* @param createUserIdList
*/
public NewsUpQuery createUserIdList(List<Long> createUserIdList){
this.createUserIdList = createUserIdList;
return this;
}
/**
* 设置 创建用户
* @param createUserIdNotList
*/
public NewsUpQuery createUserIdNotList(List<Long> createUserIdNotList){
this.createUserIdNotList = createUserIdNotList;
return this;
}
/**
* 设置 更新用户
* @param updateUserId
*/
public NewsUpQuery updateUserId(Long updateUserId){
setUpdateUserId(updateUserId);
return this;
}
/**
* 设置 开始 更新用户
* @param updateUserIdStart
*/
public NewsUpQuery updateUserIdStart(Long updateUserIdStart){
this.updateUserIdStart = updateUserIdStart;
return this;
}
/**
* 设置 结束 更新用户
* @param updateUserIdEnd
*/
public NewsUpQuery updateUserIdEnd(Long updateUserIdEnd){
this.updateUserIdEnd = updateUserIdEnd;
return this;
}
/**
* 设置 增加 更新用户
* @param updateUserIdIncrement
*/
public NewsUpQuery updateUserIdIncrement(Long updateUserIdIncrement){
this.updateUserIdIncrement = updateUserIdIncrement;
return this;
}
/**
* 设置 更新用户
* @param updateUserIdList
*/
public NewsUpQuery updateUserIdList(List<Long> updateUserIdList){
this.updateUserIdList = updateUserIdList;
return this;
}
/**
* 设置 更新用户
* @param updateUserIdNotList
*/
public NewsUpQuery updateUserIdNotList(List<Long> updateUserIdNotList){
this.updateUserIdNotList = updateUserIdNotList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList
*/
public List<NewsUpQuery> getOrConditionList(){
return this.orConditionList;
}
/**
* 设置 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @param orConditionList
*/
public void setOrConditionList(List<NewsUpQuery> orConditionList){
this.orConditionList = orConditionList;
}
/**
* 获取 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @return andConditionList
*/
public List<NewsUpQuery> getAndConditionList(){
return this.andConditionList;
}
/**
* 设置 AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4)
* @param andConditionList
*/
public void setAndConditionList(List<NewsUpQuery> andConditionList){
this.andConditionList = andConditionList;
}
}
\ No newline at end of file
package com.mortals.xhx.module.news.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.news.model.NewsUpEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 新闻点赞记录信息视图对象
*
* @author zxfei
* @date 2024-12-04
*/
@Data
public class NewsUpVo extends BaseEntityLong {
/** 序号,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
...@@ -23,6 +23,12 @@ public class NewsVo extends BaseEntityLong { ...@@ -23,6 +23,12 @@ public class NewsVo extends BaseEntityLong {
* 分享次数 * 分享次数
*/ */
private Integer shareNums; private Integer shareNums;
/**点赞状态**/
private Integer upStatus;
/**分享状态**/
private Integer shareStatus;
/**
* 头像地址
*/
private String photoPath;
} }
\ No newline at end of file
package com.mortals.xhx.module.news.service; package com.mortals.xhx.module.news.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.news.model.NewsEntity; import com.mortals.xhx.module.news.model.NewsEntity;
import com.mortals.xhx.module.news.dao.NewsDao; import com.mortals.xhx.module.news.dao.NewsDao;
...@@ -13,4 +15,31 @@ import com.mortals.xhx.module.news.dao.NewsDao; ...@@ -13,4 +15,31 @@ import com.mortals.xhx.module.news.dao.NewsDao;
public interface NewsService extends ICRUDService<NewsEntity,Long>{ public interface NewsService extends ICRUDService<NewsEntity,Long>{
NewsDao getDao(); NewsDao getDao();
/**
* 点赞
* @param id
* @param context
* @param increment 点赞次数增减值
* @return
*/
NewsEntity upNews(Long id, Context context, int increment) throws AppException;
/**
* 浏览新闻
* @param id
* @param context
* @return
* @throws AppException
*/
NewsEntity viewNews(Long id, Context context) throws AppException;
/**
* 分享新闻
* @param id
* @param context
* @return
* @throws AppException
*/
NewsEntity shareNews(Long id, Context context) throws AppException;
} }
\ No newline at end of file
package com.mortals.xhx.module.news.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.news.model.NewsUpEntity;
import com.mortals.xhx.module.news.dao.NewsUpDao;
/**
* NewsUpService
*
* 新闻点赞记录信息 service接口
*
* @author zxfei
* @date 2024-12-04
*/
public interface NewsUpService extends ICRUDService<NewsUpEntity,Long>{
NewsUpDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.news.service.impl; package com.mortals.xhx.module.news.service.impl;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.module.news.model.*;
import com.mortals.xhx.module.news.service.NewsRecordService;
import com.mortals.xhx.module.news.service.NewsShareService;
import com.mortals.xhx.module.news.service.NewsUpService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.xhx.module.news.dao.NewsDao; import com.mortals.xhx.module.news.dao.NewsDao;
import com.mortals.xhx.module.news.model.NewsEntity;
import com.mortals.xhx.module.news.service.NewsService; import com.mortals.xhx.module.news.service.NewsService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* NewsService * NewsService
* 新闻 service实现 * 新闻 service实现
...@@ -17,5 +33,158 @@ import lombok.extern.slf4j.Slf4j; ...@@ -17,5 +33,158 @@ import lombok.extern.slf4j.Slf4j;
@Service("newsService") @Service("newsService")
@Slf4j @Slf4j
public class NewsServiceImpl extends AbstractCRUDServiceImpl<NewsDao, NewsEntity, Long> implements NewsService { public class NewsServiceImpl extends AbstractCRUDServiceImpl<NewsDao, NewsEntity, Long> implements NewsService {
@Autowired
private NewsShareService newsShareService;
@Autowired
private NewsRecordService newsRecordService;
@Autowired
private NewsUpService newsUpService;
@Autowired
private UserService userService;
@Override
protected void findAfter(NewsEntity params, PageInfo pageInfo, Context context, List<NewsEntity> list) throws AppException {
if(CollectionUtils.isNotEmpty(list)){
List<Long> userIdList = list.stream().map(NewsEntity::getCreateUserId).collect(Collectors.toList());
List<UserEntity> userList = userService.find(new UserQuery().idList(userIdList));
Map<Long,UserEntity> userMap = userList.parallelStream().collect(Collectors.toMap(x -> x.getId(), z -> z, (o, n) -> n));
if(context!=null && context.getUser()!=null){
List<Long> newsIdList = list.stream().map(NewsEntity::getId).collect(Collectors.toList());
List<NewsUpEntity> upList = newsUpService.find(new NewsUpQuery().newsIdList(newsIdList).upId(context.getUser().getId()));
Map<Long,NewsUpEntity> upMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(upList)){
upMap = upList.parallelStream().collect(Collectors.toMap(x -> x.getId(), z -> z, (o, n) -> n));
}
List<NewsShareEntity> shareList = newsShareService.find(new NewsShareQuery().newsIdList(newsIdList).createUserId(context.getUser().getId()));
Map<Long,NewsShareEntity> shareMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(shareList)) {
shareMap = shareList.parallelStream().collect(Collectors.toMap(x -> x.getId(), z -> z, (o, n) -> n));
}
for(NewsEntity item:list){
if(upMap.containsKey(item.getId())){
item.setUpStatus(1);
}else {
item.setUpStatus(0);
}
if(shareMap.containsKey(item.getId())){
item.setShareStatus(1);
}else {
item.setShareStatus(0);
}
UserEntity userEntity = userMap.get(item.getCreateUserId());
if(userEntity!=null) {
item.setPhotoPath(userEntity.getPhotoPath());
}
}
}
}
}
@Override
public NewsEntity upNews(Long id, Context context, int increment) throws AppException {
NewsEntity news = this.get(id);
if(news==null){
throw new AppException("新闻不存在");
}
if(context!=null && context.getUser()!=null) {
NewsUpEntity newsUpEntity = newsUpService.selectOne(new NewsUpQuery().newsId(id).upId(context.getUser().getId()));
if(newsUpEntity!=null){
if(increment < 0){
newsUpService.remove(newsUpEntity.getId(),context);
}else {
NewsUpQuery updateUp = new NewsUpQuery();
updateUp.setId(newsUpEntity.getId());
updateUp.setSumUpIncrement(increment);
updateUp.setUpTime(new Date());
updateUp.setUpdateTime(new Date());
updateUp.setUpdateUserId(context.getUser().getId());
newsUpService.update(updateUp);
}
}else {
if(increment > 0) {
newsUpEntity = new NewsUpEntity();
newsUpEntity.initAttrValue();
newsUpEntity.setNewsId(id);
newsUpEntity.setUpId(context.getUser().getId());
newsUpEntity.setUpName(context.getUser().getRealName());
newsUpEntity.setUpTime(new Date());
newsUpEntity.setCreateTime(new Date());
newsUpEntity.setCreateUserId(context.getUser().getId());
newsUpEntity.setSumUp(increment);
newsUpService.save(newsUpEntity);
}
}
}
NewsQuery update = new NewsQuery();
update.setId(id);
update.setUpNumsIncrement(increment);
return this.update(update);
}
@Override
public NewsEntity viewNews(Long id, Context context) throws AppException {
NewsEntity news = this.get(id);
if(news==null){
throw new AppException("新闻不存在");
}
if(context!=null && context.getUser()!=null) {
NewsRecordEntity newsRecordEntity = newsRecordService.selectOne(new NewsRecordQuery().newsId(id).viewId(context.getUser().getId()));
if(newsRecordEntity!=null){
NewsRecordQuery updateRecord = new NewsRecordQuery();
updateRecord.setId(newsRecordEntity.getId());
updateRecord.setSumViewsIncrement(1);
updateRecord.setViewTime(new Date());
updateRecord.setUpdateTime(new Date());
updateRecord.setUpdateUserId(context.getUser().getId());
newsRecordService.update(updateRecord);
}else {
newsRecordEntity = new NewsRecordEntity();
newsRecordEntity.initAttrValue();
newsRecordEntity.setNewsId(id);
newsRecordEntity.setViewId(context.getUser().getId());
newsRecordEntity.setViewName(context.getUser().getRealName());
newsRecordEntity.setCreateTime(new Date());
newsRecordEntity.setCreateUserId(context.getUser().getId());
newsRecordEntity.setSumViews(1);
newsRecordService.save(newsRecordEntity);
}
}
NewsQuery update = new NewsQuery();
update.setId(id);
update.setViewNumsIncrement(1);
return this.update(update);
}
@Override
public NewsEntity shareNews(Long id, Context context) throws AppException {
NewsEntity news = this.get(id);
if(news==null){
throw new AppException("新闻不存在");
}
if(context!=null && context.getUser()!=null) {
NewsShareEntity newsShareEntity = newsShareService.selectOne(new NewsShareQuery().newsId(id).createUserId(context.getUser().getId()));
if(newsShareEntity!=null){
NewsShareQuery updateShare = new NewsShareQuery();
updateShare.setId(id);
updateShare.setSumSharesIncrement(1);
updateShare.setUpdateTime(new Date());
updateShare.setUpdateUserId(context.getUser().getId());
newsShareService.update(updateShare);
}else {
newsShareEntity = new NewsShareEntity();
newsShareEntity.initAttrValue();
newsShareEntity.setNewsId(id);
newsShareEntity.setSumShares(1);
newsShareEntity.setShareName(context.getUser().getRealName());
newsShareEntity.setCreateTime(new Date());
newsShareEntity.setCreateUserId(context.getUser().getId());
newsShareService.save(newsShareEntity);
}
}
NewsQuery update = new NewsQuery();
update.setId(id);
update.setShareNumsIncrement(1);
return this.update(update);
}
} }
\ No newline at end of file
package com.mortals.xhx.module.news.service.impl;
import org.springframework.beans.BeanUtils;
import java.util.function.Function;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.news.dao.NewsUpDao;
import com.mortals.xhx.module.news.model.NewsUpEntity;
import com.mortals.xhx.module.news.service.NewsUpService;
import lombok.extern.slf4j.Slf4j;
/**
* NewsUpService
* 新闻点赞记录信息 service实现
*
* @author zxfei
* @date 2024-12-04
*/
@Service("newsUpService")
@Slf4j
public class NewsUpServiceImpl extends AbstractCRUDServiceImpl<NewsUpDao, NewsUpEntity, Long> implements NewsUpService {
}
\ No newline at end of file
package com.mortals.xhx.module.news.web; package com.mortals.xhx.module.news.web;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.user.model.UserQuery; import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.applets.req.NewsReq;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
...@@ -93,4 +95,54 @@ public class NewsController extends BaseCRUDJsonBodyMappingController<NewsServic ...@@ -93,4 +95,54 @@ public class NewsController extends BaseCRUDJsonBodyMappingController<NewsServic
} }
} }
/**
* 新闻浏览
*/
@PostMapping(value = "view")
public Rest<NewsEntity> viewNews(@RequestBody NewsReq newsReq) {
String busiDesc = "新闻浏览";
Rest<NewsEntity> rest = Rest.ok(busiDesc + " 【成功】");
Context context = this.getContext();
Map<String, Object> model = new HashMap<>();
try {
if (org.springframework.util.ObjectUtils.isEmpty(newsReq.getId())) {
throw new AppException("新闻id不能为空!");
}
NewsEntity newsEntity =service.viewNews(newsReq.getId(),context);
rest.setData(newsEntity);
this.init(model, context);
rest.setDict(model.get("dict"));
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
/**
* 新闻分享
*/
@PostMapping(value = "share")
public Rest<NewsEntity> shareNews(@RequestBody NewsReq newsReq) {
String busiDesc = "新闻分享";
Rest<NewsEntity> rest = Rest.ok(busiDesc + " 【成功】");
Context context = this.getContext();
Map<String, Object> model = new HashMap<>();
try {
if (org.springframework.util.ObjectUtils.isEmpty(newsReq.getId())) {
throw new AppException("新闻id不能为空!");
}
NewsEntity newsEntity = service.shareNews(newsReq.getId(),context);
rest.setData(newsEntity);
this.init(model, context);
rest.setDict(model.get("dict"));
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
} }
\ No newline at end of file
package com.mortals.xhx.module.news.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.news.model.NewsUpEntity;
import com.mortals.xhx.module.news.service.NewsUpService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
import com.mortals.xhx.common.code.*;
/**
*
* 新闻点赞记录信息
*
* @author zxfei
* @date 2024-12-04
*/
@RestController
@RequestMapping("news/up")
public class NewsUpController extends BaseCRUDJsonBodyMappingController<NewsUpService,NewsUpEntity,Long> {
@Autowired
private ParamService paramService;
public NewsUpController(){
super.setModuleDesc( "新闻点赞记录信息");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
}
\ No newline at end of file
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<result property="openId" column="openId" /> <result property="openId" column="openId" />
<result property="photoPath" column="photoPath" /> <result property="photoPath" column="photoPath" />
<result property="companyAdress" column="companyAdress" /> <result property="companyAdress" column="companyAdress" />
<result property="nickName" column="nickName" />
</resultMap> </resultMap>
<!-- 表所有列 --> <!-- 表所有列 -->
...@@ -110,23 +111,26 @@ ...@@ -110,23 +111,26 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('companyAdress') or colPickMode == 1 and data.containsKey('companyAdress')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('companyAdress') or colPickMode == 1 and data.containsKey('companyAdress')))">
a.companyAdress, a.companyAdress,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('nickName') or colPickMode == 1 and data.containsKey('nickName')))">
a.nickName,
</if>
</trim> </trim>
</sql> </sql>
<!-- 新增 区分主键自增加还是业务插入 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="UserEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="UserEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_user insert into mortals_xhx_user
(loginName,loginPwd,loginLimitAddress,realName,mobile,phone,email,qq,userType,status,customerId,createTime,createUserId,createUserName,lastLoginTime,lastLoginAddress,deptId,deptName,siteIds,areaCodes,staffId,openId,photoPath,companyAdress) (loginName,loginPwd,loginLimitAddress,realName,mobile,phone,email,qq,userType,status,customerId,createTime,createUserId,createUserName,lastLoginTime,lastLoginAddress,deptId,deptName,siteIds,areaCodes,staffId,openId,photoPath,companyAdress,nickName)
VALUES VALUES
(#{loginName},#{loginPwd},#{loginLimitAddress},#{realName},#{mobile},#{phone},#{email},#{qq},#{userType},#{status},#{customerId},#{createTime},#{createUserId},#{createUserName},#{lastLoginTime},#{lastLoginAddress},#{deptId},#{deptName},#{siteIds},#{areaCodes},#{staffId},#{openId},#{photoPath},#{companyAdress}) (#{loginName},#{loginPwd},#{loginLimitAddress},#{realName},#{mobile},#{phone},#{email},#{qq},#{userType},#{status},#{customerId},#{createTime},#{createUserId},#{createUserName},#{lastLoginTime},#{lastLoginAddress},#{deptId},#{deptName},#{siteIds},#{areaCodes},#{staffId},#{openId},#{photoPath},#{companyAdress},#{nickName})
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto"> <insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_user insert into mortals_xhx_user
(loginName,loginPwd,loginLimitAddress,realName,mobile,phone,email,qq,userType,status,customerId,createTime,createUserId,createUserName,lastLoginTime,lastLoginAddress,deptId,deptName,siteIds,areaCodes,staffId,openId,photoPath,companyAdress) (loginName,loginPwd,loginLimitAddress,realName,mobile,phone,email,qq,userType,status,customerId,createTime,createUserId,createUserName,lastLoginTime,lastLoginAddress,deptId,deptName,siteIds,areaCodes,staffId,openId,photoPath,companyAdress,nickName)
VALUES VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," > <foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.loginName},#{item.loginPwd},#{item.loginLimitAddress},#{item.realName},#{item.mobile},#{item.phone},#{item.email},#{item.qq},#{item.userType},#{item.status},#{item.customerId},#{item.createTime},#{item.createUserId},#{item.createUserName},#{item.lastLoginTime},#{item.lastLoginAddress},#{item.deptId},#{item.deptName},#{item.siteIds},#{item.areaCodes},#{item.staffId},#{item.openId},#{item.photoPath},#{item.companyAdress}) (#{item.loginName},#{item.loginPwd},#{item.loginLimitAddress},#{item.realName},#{item.mobile},#{item.phone},#{item.email},#{item.qq},#{item.userType},#{item.status},#{item.customerId},#{item.createTime},#{item.createUserId},#{item.createUserName},#{item.lastLoginTime},#{item.lastLoginAddress},#{item.deptId},#{item.deptName},#{item.siteIds},#{item.areaCodes},#{item.staffId},#{item.openId},#{item.photoPath},#{item.companyAdress},#{item.nickName})
</foreach> </foreach>
</insert> </insert>
...@@ -226,6 +230,9 @@ ...@@ -226,6 +230,9 @@
<if test="(colPickMode==0 and data.containsKey('companyAdress')) or (colPickMode==1 and !data.containsKey('companyAdress'))"> <if test="(colPickMode==0 and data.containsKey('companyAdress')) or (colPickMode==1 and !data.containsKey('companyAdress'))">
a.companyAdress=#{data.companyAdress}, a.companyAdress=#{data.companyAdress},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('nickName')) or (colPickMode==1 and !data.containsKey('nickName'))">
a.nickName=#{data.nickName},
</if>
</trim> </trim>
<trim suffixOverrides="where" suffix=""> <trim suffixOverrides="where" suffix="">
where where
...@@ -436,6 +443,13 @@ ...@@ -436,6 +443,13 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="nickName=(case" suffix="ELSE nickName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('nickName')) or (colPickMode==1 and !item.containsKey('nickName'))">
when a.id=#{item.id} then #{item.nickName}
</if>
</foreach>
</trim>
</trim> </trim>
where id in where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")"> <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
...@@ -1111,6 +1125,27 @@ ...@@ -1111,6 +1125,27 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="conditionParamRef.containsKey('nickName')">
<if test="conditionParamRef.nickName != null and conditionParamRef.nickName != ''">
${_conditionType_} a.nickName like #{${_conditionParam_}.nickName}
</if>
<if test="conditionParamRef.nickName == null">
${_conditionType_} a.nickName is null
</if>
</if>
<if test="conditionParamRef.containsKey('nickNameList') and conditionParamRef.nickNameList.size() > 0">
${_conditionType_} a.nickName in
<foreach collection="conditionParamRef.nickNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('nickNameNotList') and conditionParamRef.nickNameNotList.size() > 0">
${_conditionType_} a.nickName not in
<foreach collection="conditionParamRef.nickNameNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
</sql> </sql>
<sql id="_orderCols_"> <sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()"> <if test="orderColList != null and !orderColList.isEmpty()">
...@@ -1347,6 +1382,11 @@ ...@@ -1347,6 +1382,11 @@
<if test='orderCol.companyAdress != null and "DESC".equalsIgnoreCase(orderCol.companyAdress)'>DESC</if> <if test='orderCol.companyAdress != null and "DESC".equalsIgnoreCase(orderCol.companyAdress)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('nickName')">
a.nickName
<if test='orderCol.nickName != null and "DESC".equalsIgnoreCase(orderCol.nickName)'>DESC</if>
,
</if>
</trim> </trim>
</if> </if>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<result property="createTime" column="createTime" /> <result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" /> <result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" /> <result property="updateTime" column="updateTime" />
<result property="upNums" column="upNums" />
<result property="editor" column="editor" /> <result property="editor" column="editor" />
<result property="shareNums" column="shareNums" /> <result property="shareNums" column="shareNums" />
<result property="deptId" column="deptId" /> <result property="deptId" column="deptId" />
...@@ -25,10 +26,8 @@ ...@@ -25,10 +26,8 @@
<result property="statement" column="statement" /> <result property="statement" column="statement" />
<result property="source" column="source" /> <result property="source" column="source" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
</resultMap> </resultMap>
<!-- 表所有列 --> <!-- 表所有列 -->
<sql id="_columns"> <sql id="_columns">
<trim suffixOverrides="," suffix=""> <trim suffixOverrides="," suffix="">
...@@ -71,6 +70,9 @@ ...@@ -71,6 +70,9 @@
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime, a.updateTime,
</if> </if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('upNums') or colPickMode == 1 and data.containsKey('upNums')))">
a.upNums,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('editor') or colPickMode == 1 and data.containsKey('editor')))"> <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('editor') or colPickMode == 1 and data.containsKey('editor')))">
a.editor, a.editor,
</if> </if>
...@@ -97,18 +99,18 @@ ...@@ -97,18 +99,18 @@
<!-- 新增 区分主键自增加还是业务插入 --> <!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="NewsEntity" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="NewsEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_news insert into mortals_xhx_news
(categoryId,categoryName,title,titleLogoPath,content,top,viewNums,publishTime,createUserId,createTime,updateUserId,updateTime,editor,shareNums,deptId,deptName,statement,source,remark) (categoryId,categoryName,title,titleLogoPath,content,top,viewNums,publishTime,createUserId,createTime,updateUserId,updateTime,upNums,editor,shareNums,deptId,deptName,statement,source,remark)
VALUES VALUES
(#{categoryId},#{categoryName},#{title},#{titleLogoPath},#{content},#{top},#{viewNums},#{publishTime},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{editor},#{shareNums},#{deptId},#{deptName},#{statement},#{source},#{remark}) (#{categoryId},#{categoryName},#{title},#{titleLogoPath},#{content},#{top},#{viewNums},#{publishTime},#{createUserId},#{createTime},#{updateUserId},#{updateTime},#{upNums},#{editor},#{shareNums},#{deptId},#{deptName},#{statement},#{source},#{remark})
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto"> <insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_news insert into mortals_xhx_news
(categoryId,categoryName,title,titleLogoPath,content,top,viewNums,publishTime,createUserId,createTime,updateUserId,updateTime,editor,shareNums,deptId,deptName,statement,source,remark) (categoryId,categoryName,title,titleLogoPath,content,top,viewNums,publishTime,createUserId,createTime,updateUserId,updateTime,upNums,editor,shareNums,deptId,deptName,statement,source,remark)
VALUES VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," > <foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.categoryId},#{item.categoryName},#{item.title},#{item.titleLogoPath},#{item.content},#{item.top},#{item.viewNums},#{item.publishTime},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.editor},#{item.shareNums},#{item.deptId},#{item.deptName},#{item.statement},#{item.source},#{item.remark}) (#{item.categoryId},#{item.categoryName},#{item.title},#{item.titleLogoPath},#{item.content},#{item.top},#{item.viewNums},#{item.publishTime},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime},#{item.upNums},#{item.editor},#{item.shareNums},#{item.deptId},#{item.deptName},#{item.statement},#{item.source},#{item.remark})
</foreach> </foreach>
</insert> </insert>
...@@ -169,6 +171,12 @@ ...@@ -169,6 +171,12 @@
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))"> <if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime}, a.updateTime=#{data.updateTime},
</if> </if>
<if test="(colPickMode==0 and data.containsKey('upNums')) or (colPickMode==1 and !data.containsKey('upNums'))">
a.upNums=#{data.upNums},
</if>
<if test="(colPickMode==0 and data.containsKey('upNumsIncrement')) or (colPickMode==1 and !data.containsKey('upNumsIncrement'))">
a.upNums=ifnull(a.upNums,0) + #{data.upNumsIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('editor')) or (colPickMode==1 and !data.containsKey('editor'))"> <if test="(colPickMode==0 and data.containsKey('editor')) or (colPickMode==1 and !data.containsKey('editor'))">
a.editor=#{data.editor}, a.editor=#{data.editor},
</if> </if>
...@@ -317,6 +325,18 @@ ...@@ -317,6 +325,18 @@
</if> </if>
</foreach> </foreach>
</trim> </trim>
<trim prefix="upNums=(case" suffix="ELSE upNums end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('upNums')) or (colPickMode==1 and !item.containsKey('upNums'))">
when a.id=#{item.id} then #{item.upNums}
</when>
<when test="(colPickMode==0 and item.containsKey('upNumsIncrement')) or (colPickMode==1 and !item.containsKey('upNumsIncrement'))">
when a.id=#{item.id} then ifnull(a.upNums,0) + #{item.upNumsIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="editor=(case" suffix="ELSE editor end),"> <trim prefix="editor=(case" suffix="ELSE editor end),">
<foreach collection="data.dataList" item="item" index="index" separator="" > <foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('editor')) or (colPickMode==1 and !item.containsKey('editor'))"> <if test="(colPickMode==0 and item.containsKey('editor')) or (colPickMode==1 and !item.containsKey('editor'))">
...@@ -487,6 +507,10 @@ ...@@ -487,6 +507,10 @@
<!-- 条件映射-代参数 --> <!-- 条件映射-代参数 -->
<sql id="_condition_param_"> <sql id="_condition_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/> <bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="permissionSql != null and permissionSql != ''">
${permissionSql}
</if>
<if test="conditionParamRef.containsKey('id')"> <if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null"> <if test="conditionParamRef.id != null">
${_conditionType_} a.id=#{${_conditionParam_}.id} ${_conditionType_} a.id=#{${_conditionParam_}.id}
...@@ -783,6 +807,33 @@ ...@@ -783,6 +807,33 @@
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''"> <if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if> </if>
<if test="conditionParamRef.containsKey('upNums')">
<if test="conditionParamRef.upNums != null ">
${_conditionType_} a.upNums = #{${_conditionParam_}.upNums}
</if>
<if test="conditionParamRef.upNums == null">
${_conditionType_} a.upNums is null
</if>
</if>
<if test="conditionParamRef.containsKey('upNumsList') and conditionParamRef.upNumsList.size() > 0">
${_conditionType_} a.upNums in
<foreach collection="conditionParamRef.upNumsList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('upNumsNotList') and conditionParamRef.upNumsNotList.size() > 0">
${_conditionType_} a.upNums not in
<foreach collection="conditionParamRef.upNumsNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('upNumsStart') and conditionParamRef.upNumsStart != null">
${_conditionType_} a.upNums <![CDATA[ >= ]]> #{${_conditionParam_}.upNumsStart}
</if>
<if test="conditionParamRef.containsKey('upNumsEnd') and conditionParamRef.upNumsEnd != null">
${_conditionType_} a.upNums <![CDATA[ <= ]]> #{${_conditionParam_}.upNumsEnd}
</if>
<if test="conditionParamRef.containsKey('editor')"> <if test="conditionParamRef.containsKey('editor')">
<if test="conditionParamRef.editor != null and conditionParamRef.editor != ''"> <if test="conditionParamRef.editor != null and conditionParamRef.editor != ''">
...@@ -988,6 +1039,13 @@ ...@@ -988,6 +1039,13 @@
</foreach> </foreach>
, ,
</if> </if>
<if test="conditionParamRef.containsKey('upNumsList') and conditionParamRef.upNumsList.size() > 0">
field(a.upNums,
<foreach collection="conditionParamRef.upNumsList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('shareNumsList') and conditionParamRef.shareNumsList.size() > 0"> <if test="conditionParamRef.containsKey('shareNumsList') and conditionParamRef.shareNumsList.size() > 0">
field(a.shareNums, field(a.shareNums,
<foreach collection="conditionParamRef.shareNumsList" open="" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.shareNumsList" open="" close=")" index="index" item="item" separator=",">
...@@ -1052,6 +1110,13 @@ ...@@ -1052,6 +1110,13 @@
</foreach> </foreach>
, ,
</if> </if>
<if test="conditionParamRef.containsKey('upNumsList') and conditionParamRef.upNumsList.size() > 0">
field(a.upNums,
<foreach collection="conditionParamRef.upNumsList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('shareNumsList') and conditionParamRef.shareNumsList.size() > 0"> <if test="conditionParamRef.containsKey('shareNumsList') and conditionParamRef.shareNumsList.size() > 0">
field(a.shareNums, field(a.shareNums,
<foreach collection="conditionParamRef.shareNumsList" open="" close=")" index="index" item="item" separator=","> <foreach collection="conditionParamRef.shareNumsList" open="" close=")" index="index" item="item" separator=",">
...@@ -1132,6 +1197,11 @@ ...@@ -1132,6 +1197,11 @@
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if> <if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
, ,
</if> </if>
<if test="orderCol.containsKey('upNums')">
a.upNums
<if test='orderCol.upNums != null and "DESC".equalsIgnoreCase(orderCol.upNums)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('editor')"> <if test="orderCol.containsKey('editor')">
a.editor a.editor
<if test='orderCol.editor != null and "DESC".equalsIgnoreCase(orderCol.editor)'>DESC</if> <if test='orderCol.editor != null and "DESC".equalsIgnoreCase(orderCol.editor)'>DESC</if>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.news.dao.ibatis.NewsUpDaoImpl">
<!-- 字段和属性映射 -->
<resultMap type="NewsUpEntity" id="NewsUpEntity-Map">
<id property="id" column="id" />
<result property="newsId" column="newsId" />
<result property="upId" column="upId" />
<result property="upName" column="upName" />
<result property="sumUp" column="sumUp" />
<result property="remark" column="remark" />
<result property="upTime" column="upTime" />
<result property="createUserId" column="createUserId" />
<result property="createTime" column="createTime" />
<result property="updateUserId" column="updateUserId" />
<result property="updateTime" column="updateTime" />
</resultMap>
<!-- 表所有列 -->
<sql id="_columns">
<trim suffixOverrides="," suffix="">
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
a.id,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('newsId') or colPickMode == 1 and data.containsKey('newsId')))">
a.newsId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('upId') or colPickMode == 1 and data.containsKey('upId')))">
a.upId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('upName') or colPickMode == 1 and data.containsKey('upName')))">
a.upName,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('sumUp') or colPickMode == 1 and data.containsKey('sumUp')))">
a.sumUp,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remark') or colPickMode == 1 and data.containsKey('remark')))">
a.remark,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('upTime') or colPickMode == 1 and data.containsKey('upTime')))">
a.upTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
a.createUserId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
a.createTime,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateUserId') or colPickMode == 1 and data.containsKey('updateUserId')))">
a.updateUserId,
</if>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('updateTime') or colPickMode == 1 and data.containsKey('updateTime')))">
a.updateTime,
</if>
</trim>
</sql>
<!-- 新增 区分主键自增加还是业务插入 -->
<insert id="insert" parameterType="NewsUpEntity" useGeneratedKeys="true" keyProperty="id">
insert into mortals_xhx_news_up
(newsId,upId,upName,sumUp,remark,upTime,createUserId,createTime,updateUserId,updateTime)
VALUES
(#{newsId},#{upId},#{upName},#{sumUp},#{remark},#{upTime},#{createUserId},#{createTime},#{updateUserId},#{updateTime})
</insert>
<!-- 批量新增 -->
<insert id="insertBatch" parameterType="paramDto">
insert into mortals_xhx_news_up
(newsId,upId,upName,sumUp,remark,upTime,createUserId,createTime,updateUserId,updateTime)
VALUES
<foreach collection="data.dataList" item="item" index="index" separator="," >
(#{item.newsId},#{item.upId},#{item.upName},#{item.sumUp},#{item.remark},#{item.upTime},#{item.createUserId},#{item.createTime},#{item.updateUserId},#{item.updateTime})
</foreach>
</insert>
<!-- 根据ParamDto更新 -->
<update id="update" parameterType="paramDto">
update mortals_xhx_news_up as a
set
<trim suffixOverrides="," suffix="">
<if test="(colPickMode==0 and data.containsKey('newsId')) or (colPickMode==1 and !data.containsKey('newsId'))">
a.newsId=#{data.newsId},
</if>
<if test="(colPickMode==0 and data.containsKey('newsIdIncrement')) or (colPickMode==1 and !data.containsKey('newsIdIncrement'))">
a.newsId=ifnull(a.newsId,0) + #{data.newsIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('upId')) or (colPickMode==1 and !data.containsKey('upId'))">
a.upId=#{data.upId},
</if>
<if test="(colPickMode==0 and data.containsKey('upIdIncrement')) or (colPickMode==1 and !data.containsKey('upIdIncrement'))">
a.upId=ifnull(a.upId,0) + #{data.upIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('upName')) or (colPickMode==1 and !data.containsKey('upName'))">
a.upName=#{data.upName},
</if>
<if test="(colPickMode==0 and data.containsKey('sumUp')) or (colPickMode==1 and !data.containsKey('sumUp'))">
a.sumUp=#{data.sumUp},
</if>
<if test="(colPickMode==0 and data.containsKey('sumUpIncrement')) or (colPickMode==1 and !data.containsKey('sumUpIncrement'))">
a.sumUp=ifnull(a.sumUp,0) + #{data.sumUpIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('remark')) or (colPickMode==1 and !data.containsKey('remark'))">
a.remark=#{data.remark},
</if>
<if test="(colPickMode==0 and data.containsKey('upTime')) or (colPickMode==1 and !data.containsKey('upTime'))">
a.upTime=#{data.upTime},
</if>
<if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))">
a.createUserId=#{data.createUserId},
</if>
<if test="(colPickMode==0 and data.containsKey('createUserIdIncrement')) or (colPickMode==1 and !data.containsKey('createUserIdIncrement'))">
a.createUserId=ifnull(a.createUserId,0) + #{data.createUserIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
a.createTime=#{data.createTime},
</if>
<if test="(colPickMode==0 and data.containsKey('updateUserId')) or (colPickMode==1 and !data.containsKey('updateUserId'))">
a.updateUserId=#{data.updateUserId},
</if>
<if test="(colPickMode==0 and data.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !data.containsKey('updateUserIdIncrement'))">
a.updateUserId=ifnull(a.updateUserId,0) + #{data.updateUserIdIncrement},
</if>
<if test="(colPickMode==0 and data.containsKey('updateTime')) or (colPickMode==1 and !data.containsKey('updateTime'))">
a.updateTime=#{data.updateTime},
</if>
</trim>
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</update>
<!-- 批量更新 -->
<update id="updateBatch" parameterType="paramDto">
update mortals_xhx_news_up as a
<trim prefix="set" suffixOverrides=",">
<trim prefix="newsId=(case" suffix="ELSE newsId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('newsId')) or (colPickMode==1 and !item.containsKey('newsId'))">
when a.id=#{item.id} then #{item.newsId}
</when>
<when test="(colPickMode==0 and item.containsKey('newsIdIncrement')) or (colPickMode==1 and !item.containsKey('newsIdIncrement'))">
when a.id=#{item.id} then ifnull(a.newsId,0) + #{item.newsIdIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="upId=(case" suffix="ELSE upId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('upId')) or (colPickMode==1 and !item.containsKey('upId'))">
when a.id=#{item.id} then #{item.upId}
</when>
<when test="(colPickMode==0 and item.containsKey('upIdIncrement')) or (colPickMode==1 and !item.containsKey('upIdIncrement'))">
when a.id=#{item.id} then ifnull(a.upId,0) + #{item.upIdIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="upName=(case" suffix="ELSE upName end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('upName')) or (colPickMode==1 and !item.containsKey('upName'))">
when a.id=#{item.id} then #{item.upName}
</if>
</foreach>
</trim>
<trim prefix="sumUp=(case" suffix="ELSE sumUp end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('sumUp')) or (colPickMode==1 and !item.containsKey('sumUp'))">
when a.id=#{item.id} then #{item.sumUp}
</when>
<when test="(colPickMode==0 and item.containsKey('sumUpIncrement')) or (colPickMode==1 and !item.containsKey('sumUpIncrement'))">
when a.id=#{item.id} then ifnull(a.sumUp,0) + #{item.sumUpIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="remark=(case" suffix="ELSE remark end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('remark')) or (colPickMode==1 and !item.containsKey('remark'))">
when a.id=#{item.id} then #{item.remark}
</if>
</foreach>
</trim>
<trim prefix="upTime=(case" suffix="ELSE upTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('upTime')) or (colPickMode==1 and !item.containsKey('upTime'))">
when a.id=#{item.id} then #{item.upTime}
</if>
</foreach>
</trim>
<trim prefix="createUserId=(case" suffix="ELSE createUserId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('createUserId')) or (colPickMode==1 and !item.containsKey('createUserId'))">
when a.id=#{item.id} then #{item.createUserId}
</when>
<when test="(colPickMode==0 and item.containsKey('createUserIdIncrement')) or (colPickMode==1 and !item.containsKey('createUserIdIncrement'))">
when a.id=#{item.id} then ifnull(a.createUserId,0) + #{item.createUserIdIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="createTime=(case" suffix="ELSE createTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('createTime')) or (colPickMode==1 and !item.containsKey('createTime'))">
when a.id=#{item.id} then #{item.createTime}
</if>
</foreach>
</trim>
<trim prefix="updateUserId=(case" suffix="ELSE updateUserId end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<choose>
<when test="(colPickMode==0 and item.containsKey('updateUserId')) or (colPickMode==1 and !item.containsKey('updateUserId'))">
when a.id=#{item.id} then #{item.updateUserId}
</when>
<when test="(colPickMode==0 and item.containsKey('updateUserIdIncrement')) or (colPickMode==1 and !item.containsKey('updateUserIdIncrement'))">
when a.id=#{item.id} then ifnull(a.updateUserId,0) + #{item.updateUserIdIncrement}
</when>
</choose>
</foreach>
</trim>
<trim prefix="updateTime=(case" suffix="ELSE updateTime end),">
<foreach collection="data.dataList" item="item" index="index" separator="" >
<if test="(colPickMode==0 and item.containsKey('updateTime')) or (colPickMode==1 and !item.containsKey('updateTime'))">
when a.id=#{item.id} then #{item.updateTime}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
#{item.id}
</foreach>
</update>
<!-- 根据主健查询 -->
<select id="getByKey" parameterType="paramDto" resultMap="NewsUpEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_news_up as a
where a.id=#{condition.id}
</select>
<!-- 根据主健删除 -->
<delete id="deleteByKey" parameterType="paramDto">
delete a.* from mortals_xhx_news_up as a where a.id=#{condition.id}
</delete>
<!-- 根据主健删除一批,针对单一主健有效 -->
<delete id="deleteByKeys">
delete from mortals_xhx_news_up where id in
<foreach collection="array" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 根据主健列表删除一批,针对单一主健有效 -->
<delete id="deleteByKeyList">
delete from mortals_xhx_news_up where id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 根据对象列表删除一批,针对单一主健有效 -->
<delete id="deleteByEntityList">
delete from mortals_xhx_news_up where id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item.id}
</foreach>
</delete>
<!-- 根据paramDto删除一批 -->
<delete id="deleteByMap" parameterType="paramDto">
delete a.* from mortals_xhx_news_up as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</delete>
<!-- 获取列表 -->
<select id="getList" parameterType="paramDto" resultMap="NewsUpEntity-Map">
select <include refid="_columns"/>
from mortals_xhx_news_up as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取 -->
<select id="getListCount" parameterType="paramDto" resultType="int">
select count(1)
from mortals_xhx_news_up as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</select>
<!-- 条件映射 -->
<sql id="_condition_">
<if test="condition != null and !condition.isEmpty()">
<!-- 条件映射-普通条件 -->
<include refid="_condition_param_">
<property name="_conditionParam_" value="condition"/>
<property name="_conditionType_" value="and"/>
</include>
<!-- 条件映射-集合之间使用AND,集合中元素使用OR-(list[0].1 or list[0].2) and (list[1].3 or list[1].4) -->
<if test="condition.containsKey('andConditionList') and !condition.andConditionList.isEmpty()">
and
<foreach collection="condition.andConditionList" open="(" close=")" index="index" item="andCondition" separator=" and ">
<trim prefixOverrides="or" prefix="(" suffix=")">
<include refid="_condition_param_">
<property name="_conditionParam_" value="andCondition"/>
<property name="_conditionType_" value="or"/>
</include>
</trim>
</foreach>
</if>
<!-- 条件映射-集合之间使用OR,集合中元素使用AND-(list[0].1 and list[0].2) or (list[1].3 and list[1].4) -->
<if test="condition.containsKey('orConditionList') and !condition.orConditionList.isEmpty()">
and
<foreach collection="condition.orConditionList" open="(" close=")" index="index" item="orCondition" separator=" or ">
<trim prefixOverrides="and" prefix="(" suffix=")">
<include refid="_condition_param_">
<property name="_conditionParam_" value="orCondition"/>
<property name="_conditionType_" value="and"/>
</include>
</trim>
</foreach>
</if>
</if>
</sql>
<!-- 条件映射-代参数 -->
<sql id="_condition_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="permissionSql != null and permissionSql != ''">
${permissionSql}
</if>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null">
${_conditionType_} a.id=#{${_conditionParam_}.id}
</if>
</if>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null ">
${_conditionType_} a.id = #{${_conditionParam_}.id}
</if>
<if test="conditionParamRef.id == null">
${_conditionType_} a.id is null
</if>
</if>
<if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
${_conditionType_} a.id in
<foreach collection="conditionParamRef.idList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('idNotList') and conditionParamRef.idNotList.size() > 0">
${_conditionType_} a.id not in
<foreach collection="conditionParamRef.idNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('idStart') and conditionParamRef.idStart != null">
${_conditionType_} a.id <![CDATA[ >= ]]> #{${_conditionParam_}.idStart}
</if>
<if test="conditionParamRef.containsKey('idEnd') and conditionParamRef.idEnd != null">
${_conditionType_} a.id <![CDATA[ <= ]]> #{${_conditionParam_}.idEnd}
</if>
<if test="conditionParamRef.containsKey('newsId')">
<if test="conditionParamRef.newsId != null ">
${_conditionType_} a.newsId = #{${_conditionParam_}.newsId}
</if>
<if test="conditionParamRef.newsId == null">
${_conditionType_} a.newsId is null
</if>
</if>
<if test="conditionParamRef.containsKey('newsIdList') and conditionParamRef.newsIdList.size() > 0">
${_conditionType_} a.newsId in
<foreach collection="conditionParamRef.newsIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('newsIdNotList') and conditionParamRef.newsIdNotList.size() > 0">
${_conditionType_} a.newsId not in
<foreach collection="conditionParamRef.newsIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('newsIdStart') and conditionParamRef.newsIdStart != null">
${_conditionType_} a.newsId <![CDATA[ >= ]]> #{${_conditionParam_}.newsIdStart}
</if>
<if test="conditionParamRef.containsKey('newsIdEnd') and conditionParamRef.newsIdEnd != null">
${_conditionType_} a.newsId <![CDATA[ <= ]]> #{${_conditionParam_}.newsIdEnd}
</if>
<if test="conditionParamRef.containsKey('upId')">
<if test="conditionParamRef.upId != null ">
${_conditionType_} a.upId = #{${_conditionParam_}.upId}
</if>
<if test="conditionParamRef.upId == null">
${_conditionType_} a.upId is null
</if>
</if>
<if test="conditionParamRef.containsKey('upIdList') and conditionParamRef.upIdList.size() > 0">
${_conditionType_} a.upId in
<foreach collection="conditionParamRef.upIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('upIdNotList') and conditionParamRef.upIdNotList.size() > 0">
${_conditionType_} a.upId not in
<foreach collection="conditionParamRef.upIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('upIdStart') and conditionParamRef.upIdStart != null">
${_conditionType_} a.upId <![CDATA[ >= ]]> #{${_conditionParam_}.upIdStart}
</if>
<if test="conditionParamRef.containsKey('upIdEnd') and conditionParamRef.upIdEnd != null">
${_conditionType_} a.upId <![CDATA[ <= ]]> #{${_conditionParam_}.upIdEnd}
</if>
<if test="conditionParamRef.containsKey('upName')">
<if test="conditionParamRef.upName != null and conditionParamRef.upName != ''">
${_conditionType_} a.upName like #{${_conditionParam_}.upName}
</if>
<if test="conditionParamRef.upName == null">
${_conditionType_} a.upName is null
</if>
</if>
<if test="conditionParamRef.containsKey('upNameList') and conditionParamRef.upNameList.size() > 0">
${_conditionType_} a.upName in
<foreach collection="conditionParamRef.upNameList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('upNameNotList') and conditionParamRef.upNameNotList.size() > 0">
${_conditionType_} a.upName not in
<foreach collection="conditionParamRef.upNameNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('sumUp')">
<if test="conditionParamRef.sumUp != null ">
${_conditionType_} a.sumUp = #{${_conditionParam_}.sumUp}
</if>
<if test="conditionParamRef.sumUp == null">
${_conditionType_} a.sumUp is null
</if>
</if>
<if test="conditionParamRef.containsKey('sumUpList') and conditionParamRef.sumUpList.size() > 0">
${_conditionType_} a.sumUp in
<foreach collection="conditionParamRef.sumUpList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('sumUpNotList') and conditionParamRef.sumUpNotList.size() > 0">
${_conditionType_} a.sumUp not in
<foreach collection="conditionParamRef.sumUpNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('sumUpStart') and conditionParamRef.sumUpStart != null">
${_conditionType_} a.sumUp <![CDATA[ >= ]]> #{${_conditionParam_}.sumUpStart}
</if>
<if test="conditionParamRef.containsKey('sumUpEnd') and conditionParamRef.sumUpEnd != null">
${_conditionType_} a.sumUp <![CDATA[ <= ]]> #{${_conditionParam_}.sumUpEnd}
</if>
<if test="conditionParamRef.containsKey('remark')">
<if test="conditionParamRef.remark != null and conditionParamRef.remark != ''">
${_conditionType_} a.remark like #{${_conditionParam_}.remark}
</if>
<if test="conditionParamRef.remark == null">
${_conditionType_} a.remark is null
</if>
</if>
<if test="conditionParamRef.containsKey('remarkList') and conditionParamRef.remarkList.size() > 0">
${_conditionType_} a.remark in
<foreach collection="conditionParamRef.remarkList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('remarkNotList') and conditionParamRef.remarkNotList.size() > 0">
${_conditionType_} a.remark not in
<foreach collection="conditionParamRef.remarkNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('upTime')">
<if test="conditionParamRef.upTime != null ">
${_conditionType_} a.upTime = #{${_conditionParam_}.upTime}
</if>
<if test="conditionParamRef.upTime == null">
${_conditionType_} a.upTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('upTimeStart') and conditionParamRef.upTimeStart != null and conditionParamRef.upTimeStart!=''">
${_conditionType_} a.upTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.upTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('upTimeEnd') and conditionParamRef.upTimeEnd != null and conditionParamRef.upTimeEnd!=''">
${_conditionType_} a.upTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.upTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('createUserId')">
<if test="conditionParamRef.createUserId != null ">
${_conditionType_} a.createUserId = #{${_conditionParam_}.createUserId}
</if>
<if test="conditionParamRef.createUserId == null">
${_conditionType_} a.createUserId is null
</if>
</if>
<if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
${_conditionType_} a.createUserId in
<foreach collection="conditionParamRef.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('createUserIdNotList') and conditionParamRef.createUserIdNotList.size() > 0">
${_conditionType_} a.createUserId not in
<foreach collection="conditionParamRef.createUserIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('createUserIdStart') and conditionParamRef.createUserIdStart != null">
${_conditionType_} a.createUserId <![CDATA[ >= ]]> #{${_conditionParam_}.createUserIdStart}
</if>
<if test="conditionParamRef.containsKey('createUserIdEnd') and conditionParamRef.createUserIdEnd != null">
${_conditionType_} a.createUserId <![CDATA[ <= ]]> #{${_conditionParam_}.createUserIdEnd}
</if>
<if test="conditionParamRef.containsKey('createTime')">
<if test="conditionParamRef.createTime != null ">
${_conditionType_} a.createTime = #{${_conditionParam_}.createTime}
</if>
<if test="conditionParamRef.createTime == null">
${_conditionType_} a.createTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('createTimeStart') and conditionParamRef.createTimeStart != null and conditionParamRef.createTimeStart!=''">
${_conditionType_} a.createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('createTimeEnd') and conditionParamRef.createTimeEnd != null and conditionParamRef.createTimeEnd!=''">
${_conditionType_} a.createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('updateUserId')">
<if test="conditionParamRef.updateUserId != null ">
${_conditionType_} a.updateUserId = #{${_conditionParam_}.updateUserId}
</if>
<if test="conditionParamRef.updateUserId == null">
${_conditionType_} a.updateUserId is null
</if>
</if>
<if test="conditionParamRef.containsKey('updateUserIdList') and conditionParamRef.updateUserIdList.size() > 0">
${_conditionType_} a.updateUserId in
<foreach collection="conditionParamRef.updateUserIdList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('updateUserIdNotList') and conditionParamRef.updateUserIdNotList.size() > 0">
${_conditionType_} a.updateUserId not in
<foreach collection="conditionParamRef.updateUserIdNotList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
<if test="conditionParamRef.containsKey('updateUserIdStart') and conditionParamRef.updateUserIdStart != null">
${_conditionType_} a.updateUserId <![CDATA[ >= ]]> #{${_conditionParam_}.updateUserIdStart}
</if>
<if test="conditionParamRef.containsKey('updateUserIdEnd') and conditionParamRef.updateUserIdEnd != null">
${_conditionType_} a.updateUserId <![CDATA[ <= ]]> #{${_conditionParam_}.updateUserIdEnd}
</if>
<if test="conditionParamRef.containsKey('updateTime')">
<if test="conditionParamRef.updateTime != null ">
${_conditionType_} a.updateTime = #{${_conditionParam_}.updateTime}
</if>
<if test="conditionParamRef.updateTime == null">
${_conditionType_} a.updateTime is null
</if>
</if>
<if test="conditionParamRef.containsKey('updateTimeStart') and conditionParamRef.updateTimeStart != null and conditionParamRef.updateTimeStart!=''">
${_conditionType_} a.updateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
</if>
<if test="conditionParamRef.containsKey('updateTimeEnd') and conditionParamRef.updateTimeEnd != null and conditionParamRef.updateTimeEnd!=''">
${_conditionType_} a.updateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{${_conditionParam_}.updateTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
</if>
</sql>
<sql id="_orderCols_">
<if test="orderColList != null and !orderColList.isEmpty()">
order by
<if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
field(a.id,
<foreach collection="conditionParamRef.idList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('newsIdList') and conditionParamRef.newsIdList.size() > 0">
field(a.newsId,
<foreach collection="conditionParamRef.newsIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('upIdList') and conditionParamRef.upIdList.size() > 0">
field(a.upId,
<foreach collection="conditionParamRef.upIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('sumUpList') and conditionParamRef.sumUpList.size() > 0">
field(a.sumUp,
<foreach collection="conditionParamRef.sumUpList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
field(a.createUserId,
<foreach collection="conditionParamRef.createUserIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('updateUserIdList') and conditionParamRef.updateUserIdList.size() > 0">
field(a.updateUserId,
<foreach collection="conditionParamRef.updateUserIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<trim suffixOverrides="," suffix="">
<foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
a.${item.colName} ${item.sortKind}
</foreach>
</trim>
</if>
<if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
order by
<if test="conditionParamRef.containsKey('idList') and conditionParamRef.idList.size() > 0">
field(a.id,
<foreach collection="conditionParamRef.idList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('newsIdList') and conditionParamRef.newsIdList.size() > 0">
field(a.newsId,
<foreach collection="conditionParamRef.newsIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('upIdList') and conditionParamRef.upIdList.size() > 0">
field(a.upId,
<foreach collection="conditionParamRef.upIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('sumUpList') and conditionParamRef.sumUpList.size() > 0">
field(a.sumUp,
<foreach collection="conditionParamRef.sumUpList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('createUserIdList') and conditionParamRef.createUserIdList.size() > 0">
field(a.createUserId,
<foreach collection="conditionParamRef.createUserIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<if test="conditionParamRef.containsKey('updateUserIdList') and conditionParamRef.updateUserIdList.size() > 0">
field(a.updateUserId,
<foreach collection="conditionParamRef.updateUserIdList" open="" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
,
</if>
<trim suffixOverrides="," suffix="">
<if test="orderCol.containsKey('id')">
a.id
<if test='orderCol.id != null and "DESC".equalsIgnoreCase(orderCol.id)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('newsId')">
a.newsId
<if test='orderCol.newsId != null and "DESC".equalsIgnoreCase(orderCol.newsId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('upId')">
a.upId
<if test='orderCol.upId != null and "DESC".equalsIgnoreCase(orderCol.upId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('upName')">
a.upName
<if test='orderCol.upName != null and "DESC".equalsIgnoreCase(orderCol.upName)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('sumUp')">
a.sumUp
<if test='orderCol.sumUp != null and "DESC".equalsIgnoreCase(orderCol.sumUp)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('remark')">
a.remark
<if test='orderCol.remark != null and "DESC".equalsIgnoreCase(orderCol.remark)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('upTime')">
a.upTime
<if test='orderCol.upTime != null and "DESC".equalsIgnoreCase(orderCol.upTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('createUserId')">
a.createUserId
<if test='orderCol.createUserId != null and "DESC".equalsIgnoreCase(orderCol.createUserId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('createTime')">
a.createTime
<if test='orderCol.createTime != null and "DESC".equalsIgnoreCase(orderCol.createTime)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('updateUserId')">
a.updateUserId
<if test='orderCol.updateUserId != null and "DESC".equalsIgnoreCase(orderCol.updateUserId)'>DESC</if>
,
</if>
<if test="orderCol.containsKey('updateTime')">
a.updateTime
<if test='orderCol.updateTime != null and "DESC".equalsIgnoreCase(orderCol.updateTime)'>DESC</if>
,
</if>
</trim>
</if>
</sql>
<sql id="_group_by_">
<if test="groupList != null and !groupList.isEmpty()">
GROUP BY
<trim suffixOverrides="," suffix="">
<foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
${item}
</foreach>
</trim>
</if>
</sql>
</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