beetlsql3-dev
parent
718a8e54c8
commit
c9bbdbaa69
@ -0,0 +1,126 @@
|
||||
package com.ibeetl.jlw.entity;
|
||||
|
||||
import com.ibeetl.admin.core.entity.BaseEntity;
|
||||
import com.ibeetl.admin.core.util.ValidateConfig;
|
||||
import com.ibeetl.jlw.enums.NoticeTypeEnum;
|
||||
import org.beetl.sql.annotation.entity.AssignID;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* 通知公告等-已读时间记录
|
||||
* gen by Spring Boot2 Admin 2023-01-10
|
||||
*/
|
||||
public class NoticeRead extends BaseEntity{
|
||||
|
||||
//ID
|
||||
@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
|
||||
// @SeqID(name = ORACLE_CORE_SEQ_NAME)
|
||||
@AssignID(value = "maskAutoID",param = "com.ibeetl.jlw.entity.NoticeRead")
|
||||
|
||||
private Long noticeReadId ;
|
||||
|
||||
//人员ID
|
||||
|
||||
private String personId ;
|
||||
|
||||
//类型 (枚举类 NoticeTypeEnum)
|
||||
|
||||
private NoticeTypeEnum noticeReadType ;
|
||||
|
||||
//已读时间
|
||||
|
||||
private Date noticeReadTime ;
|
||||
|
||||
//组织ID
|
||||
|
||||
private Long orgId ;
|
||||
|
||||
//用户ID
|
||||
|
||||
private Long userId ;
|
||||
|
||||
public NoticeRead(){
|
||||
}
|
||||
|
||||
/**ID
|
||||
*@return
|
||||
*/
|
||||
public Long getNoticeReadId(){
|
||||
return noticeReadId;
|
||||
}
|
||||
/**ID
|
||||
*@param noticeReadId
|
||||
*/
|
||||
public void setNoticeReadId(Long noticeReadId){
|
||||
this.noticeReadId = noticeReadId;
|
||||
}
|
||||
|
||||
/**人员ID
|
||||
*@return
|
||||
*/
|
||||
public String getPersonId(){
|
||||
return personId;
|
||||
}
|
||||
/**人员ID
|
||||
*@param personId
|
||||
*/
|
||||
public void setPersonId(String personId){
|
||||
this.personId = personId;
|
||||
}
|
||||
|
||||
/**类型 (枚举类 NoticeTypeEnum)
|
||||
*@return
|
||||
*/
|
||||
public NoticeTypeEnum getNoticeReadType(){
|
||||
return noticeReadType;
|
||||
}
|
||||
/**类型 (枚举类 NoticeTypeEnum)
|
||||
*@param noticeReadType
|
||||
*/
|
||||
public void setNoticeReadType(NoticeTypeEnum noticeReadType){
|
||||
this.noticeReadType = noticeReadType;
|
||||
}
|
||||
|
||||
/**已读时间
|
||||
*@return
|
||||
*/
|
||||
public Date getNoticeReadTime(){
|
||||
return noticeReadTime;
|
||||
}
|
||||
/**已读时间
|
||||
*@param noticeReadTime
|
||||
*/
|
||||
public void setNoticeReadTime(Date noticeReadTime){
|
||||
this.noticeReadTime = noticeReadTime;
|
||||
}
|
||||
|
||||
/**组织ID
|
||||
*@return
|
||||
*/
|
||||
public Long getOrgId(){
|
||||
return orgId;
|
||||
}
|
||||
/**组织ID
|
||||
*@param orgId
|
||||
*/
|
||||
public void setOrgId(Long orgId){
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
/**用户ID
|
||||
*@return
|
||||
*/
|
||||
public Long getUserId(){
|
||||
return userId;
|
||||
}
|
||||
/**用户ID
|
||||
*@param userId
|
||||
*/
|
||||
public void setUserId(Long userId){
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.ibeetl.jlw.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.beetl.sql.annotation.entity.EnumMapping;
|
||||
|
||||
/**
|
||||
* notice_read 表的类型
|
||||
* 用于记录通知相关的已读
|
||||
*
|
||||
* @author mlx
|
||||
*/
|
||||
@Getter
|
||||
@EnumMapping("name")
|
||||
@AllArgsConstructor
|
||||
public enum NoticeTypeEnum {
|
||||
|
||||
OPEN_COURSE_NOTICE("开课通知公告");
|
||||
|
||||
private String text;
|
||||
}
|
@ -0,0 +1,185 @@
|
||||
package com.ibeetl.jlw.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.jlw.util.ToolUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ibeetl.admin.core.entity.CoreUser;
|
||||
import com.ibeetl.admin.core.service.CoreBaseService;
|
||||
import com.ibeetl.admin.core.util.PlatformException;
|
||||
import com.ibeetl.admin.core.web.JsonResult;
|
||||
import com.ibeetl.admin.core.web.JsonReturnCode;
|
||||
import com.ibeetl.jlw.dao.NoticeReadDao;
|
||||
import com.ibeetl.jlw.entity.NoticeRead;
|
||||
import com.ibeetl.jlw.enums.NoticeTypeEnum;
|
||||
import com.ibeetl.jlw.web.query.NoticeReadQuery;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.beetl.sql.core.SqlId;
|
||||
import org.beetl.sql.core.engine.PageQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告已读管理 Service
|
||||
* 当分布式ID开启后请勿使用insert(*,true)
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
@Validated
|
||||
public class NoticeReadService extends CoreBaseService<NoticeRead>{
|
||||
|
||||
@Autowired private NoticeReadDao noticeReadDao;
|
||||
|
||||
public PageQuery<NoticeRead>queryByCondition(PageQuery query){
|
||||
PageQuery ret = noticeReadDao.queryByCondition(query);
|
||||
queryListAfter(ret.getList());
|
||||
return ret;
|
||||
}
|
||||
|
||||
public PageQuery<NoticeRead>queryByConditionQuery(PageQuery query){
|
||||
PageQuery ret = noticeReadDao.queryByConditionQuery(query);
|
||||
queryListAfter(ret.getList());
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void deleteByList(List list){
|
||||
String ids = "";
|
||||
ToolUtils.deleteNullList(list);
|
||||
for(int i=0;null != list && i<list.size();i++){
|
||||
ids += list.get(i).toString()+(i==list.size()-1?"":",");
|
||||
}
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
noticeReadDao.deleteNoticeReadByIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteNoticeRead(String ids){
|
||||
try {
|
||||
noticeReadDao.deleteNoticeReadByIds(ids);
|
||||
} catch (Exception e) {
|
||||
throw new PlatformException("批量删除公告已读管理失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
public String addAll(NoticeReadQuery noticeReadQuery){
|
||||
String msg = "";
|
||||
List<NoticeRead> noticeReadList = new ArrayList<>();
|
||||
try {
|
||||
noticeReadList = JSON.parseArray(noticeReadQuery.getNoticeReadJsonStr(), NoticeRead.class);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
noticeReadList.add(JSONObject.parseObject(noticeReadQuery.getNoticeReadJsonStr(), NoticeRead.class));
|
||||
} catch (Exception e1) {}
|
||||
}
|
||||
ToolUtils.deleteNullList(noticeReadList);
|
||||
if(null != noticeReadList && noticeReadList.size()>0){
|
||||
for(int i=0;i<noticeReadList.size();i++){
|
||||
NoticeRead noticeRead = noticeReadList.get(i);
|
||||
noticeRead.setUserId(noticeReadQuery.getUserId());
|
||||
noticeRead.setOrgId(noticeReadQuery.getOrgId());
|
||||
}
|
||||
insertBatch(noticeReadList);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public JsonResult add(NoticeReadQuery noticeReadQuery){
|
||||
String msg = "";
|
||||
NoticeRead noticeRead = noticeReadQuery.pojo();
|
||||
noticeReadDao.insert(noticeRead);
|
||||
noticeReadQuery.setNoticeReadId(noticeRead.getNoticeReadId());
|
||||
JsonResult jsonResult = new JsonResult();
|
||||
jsonResult.setData(noticeRead.getNoticeReadId());//自增的ID丢进去
|
||||
jsonResult.setCode(JsonReturnCode.SUCCESS.getCode());
|
||||
jsonResult.setMsg(msg);
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
public String edit(NoticeReadQuery noticeReadQuery){
|
||||
String msg = "";
|
||||
NoticeRead noticeRead = noticeReadQuery.pojo();
|
||||
noticeReadDao.updateTemplateById(noticeRead);
|
||||
return msg;
|
||||
}
|
||||
|
||||
public String updateGivenByIds(NoticeReadQuery noticeReadQuery){
|
||||
String msg = "";
|
||||
if(StringUtils.isNotBlank(noticeReadQuery.get_given())){
|
||||
boolean flag = noticeReadDao.updateGivenByIds(noticeReadQuery) > 0;
|
||||
if(!flag){
|
||||
msg = "更新指定参数失败";
|
||||
}
|
||||
}else{
|
||||
msg = "指定参数为空";
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public List<NoticeRead> getValues (Object paras){
|
||||
return sqlManager.select(SqlId.of("jlw.noticeRead.getNoticeReadValues"), NoticeRead.class, paras);
|
||||
}
|
||||
|
||||
public List<NoticeRead> getValuesByQuery (NoticeReadQuery noticeReadQuery){
|
||||
return noticeReadDao.getValuesByQuery(noticeReadQuery);
|
||||
}
|
||||
|
||||
public List<NoticeRead> getValuesByQueryNotWithPermission (NoticeReadQuery noticeReadQuery){
|
||||
return noticeReadDao.getValuesByQueryNotWithPermission(noticeReadQuery);
|
||||
}
|
||||
|
||||
public NoticeRead getInfo (Long noticeReadId){
|
||||
NoticeReadQuery noticeReadQuery = new NoticeReadQuery();
|
||||
noticeReadQuery.setNoticeReadId(noticeReadId);
|
||||
List<NoticeRead> list = noticeReadDao.getValuesByQuery(noticeReadQuery);
|
||||
if(null != list && list.size()>0){
|
||||
return list.get(0);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public NoticeRead getInfo (NoticeReadQuery noticeReadQuery){
|
||||
List<NoticeRead> list = noticeReadDao.getValuesByQuery(noticeReadQuery);
|
||||
if(null != list && list.size()>0){
|
||||
return list.get(0);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 已读
|
||||
* @param coreUser
|
||||
* @return
|
||||
*/
|
||||
public void readed(@NotNull(message = "查询的公告类型不能为空!") NoticeTypeEnum noticeType, @NotNull(message = "用户未登录!") CoreUser coreUser) {
|
||||
NoticeReadQuery noticeReadQuery = new NoticeReadQuery();
|
||||
noticeReadQuery.setPersonId(coreUser.getId().toString());
|
||||
noticeReadQuery.setNoticeReadType(noticeType);
|
||||
List<NoticeRead> list = noticeReadDao.getValuesByQueryNotWithPermission(noticeReadQuery);
|
||||
|
||||
// 更新已读的时间点
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
NoticeRead noticeRead = list.get(0);
|
||||
noticeRead.setNoticeReadTime(new Date());
|
||||
updateTemplate(noticeRead);
|
||||
}
|
||||
else {
|
||||
NoticeRead insertPO = new NoticeRead();
|
||||
insertPO.setNoticeReadTime(new Date());
|
||||
insertPO.setNoticeReadType(noticeType);
|
||||
insertPO.setUserId(coreUser.getId());
|
||||
insertPO.setOrgId(coreUser.getOrgId());
|
||||
insertPO.setPersonId(coreUser.getId().toString());
|
||||
insert(insertPO);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,208 @@
|
||||
package com.ibeetl.jlw.web;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.jlw.Interceptor.SCoreUser;
|
||||
import cn.jlw.validate.ValidateConfig;
|
||||
import com.ibeetl.admin.core.annotation.Function;
|
||||
import com.ibeetl.admin.core.entity.CoreUser;
|
||||
import com.ibeetl.admin.core.file.FileService;
|
||||
import com.ibeetl.admin.core.web.JsonResult;
|
||||
import com.ibeetl.jlw.entity.NoticeRead;
|
||||
import com.ibeetl.jlw.enums.NoticeTypeEnum;
|
||||
import com.ibeetl.jlw.service.NoticeReadService;
|
||||
import com.ibeetl.jlw.web.query.NoticeReadQuery;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.beetl.sql.core.engine.PageQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
|
||||
|
||||
/**
|
||||
* 公告已读管理 通知公告等-已读时间记录 接口
|
||||
* 切记不要对非线程安全的静态变量进行写操作
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@Validated
|
||||
public class NoticeReadController{
|
||||
|
||||
private final Log log = LogFactory.getLog(this.getClass());
|
||||
private static final String MODEL = "/jlw/noticeRead";
|
||||
private static final String API = "/api/noticeRead";
|
||||
|
||||
|
||||
@Autowired private NoticeReadService noticeReadService;
|
||||
|
||||
@Autowired FileService fileService;
|
||||
|
||||
/* 前端接口 */
|
||||
|
||||
@PostMapping(API + "/getPageList.do")
|
||||
public JsonResult<PageQuery> getPageList(NoticeReadQuery condition,@SCoreUser CoreUser coreUser){
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
PageQuery page = condition.getPageQuery();
|
||||
noticeReadService.queryByConditionQuery(page);
|
||||
return JsonResult.success(page);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(API + "/getInfo.do")
|
||||
public JsonResult<NoticeRead>getInfo(NoticeReadQuery param,@SCoreUser CoreUser coreUser) {
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
NoticeRead noticeRead = noticeReadService.getInfo(param);
|
||||
return JsonResult.success(noticeRead);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(API + "/getList.do")
|
||||
public JsonResult<List<NoticeRead>>getList(NoticeReadQuery param,@SCoreUser CoreUser coreUser) {
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
List<NoticeRead>list = noticeReadService.getValuesByQuery(param);
|
||||
return JsonResult.success(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 后台页面 */
|
||||
|
||||
@GetMapping(MODEL + "/index.do")
|
||||
public ModelAndView index() {
|
||||
ModelAndView view = new ModelAndView("/jlw/noticeRead/index.html") ;
|
||||
view.addObject("search", NoticeReadQuery.class.getName());
|
||||
return view;
|
||||
}
|
||||
|
||||
@GetMapping(MODEL + "/edit.do")
|
||||
public ModelAndView edit(Long noticeReadId) {
|
||||
ModelAndView view = new ModelAndView("/jlw/noticeRead/edit.html");
|
||||
NoticeRead noticeRead = noticeReadService.queryById(noticeReadId);
|
||||
view.addObject("noticeRead", noticeRead);
|
||||
return view;
|
||||
}
|
||||
|
||||
@GetMapping(MODEL + "/add.do")
|
||||
public ModelAndView add(Long noticeReadId) {
|
||||
ModelAndView view = new ModelAndView("/jlw/noticeRead/add.html");
|
||||
if(null != noticeReadId){
|
||||
NoticeRead noticeRead = noticeReadService.queryById(noticeReadId);
|
||||
view.addObject("noticeRead", noticeRead);
|
||||
}else {
|
||||
view.addObject("noticeRead", new NoticeRead());
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
/* 后台接口 */
|
||||
|
||||
@PostMapping(MODEL + "/list.json")
|
||||
public JsonResult<PageQuery> list(NoticeReadQuery condition){
|
||||
PageQuery page = condition.getPageQuery();
|
||||
noticeReadService.queryByCondition(page);
|
||||
return JsonResult.success(page);
|
||||
}
|
||||
|
||||
@PostMapping(MODEL + "/addAll.json")
|
||||
public JsonResult addAll(NoticeReadQuery noticeReadQuery,@SCoreUser CoreUser coreUser){
|
||||
if(null == coreUser){
|
||||
return JsonResult.failMessage("请登录后再操作");
|
||||
}else{
|
||||
noticeReadQuery.setUserId(coreUser.getId());
|
||||
noticeReadQuery.setOrgId(coreUser.getOrgId());
|
||||
String msg = noticeReadService.addAll(noticeReadQuery);
|
||||
if (StringUtils.isBlank(msg)) {
|
||||
return JsonResult.success();
|
||||
} else {
|
||||
return JsonResult.failMessage("新增失败,"+msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(MODEL + "/add.json")
|
||||
public JsonResult add(@Validated(ValidateConfig.ADD.class) NoticeReadQuery noticeReadQuery, BindingResult result,@SCoreUser CoreUser coreUser){
|
||||
if(result.hasErrors()){
|
||||
return JsonResult.failMessage(result);
|
||||
}else{
|
||||
|
||||
noticeReadQuery.setUserId(coreUser.getId());
|
||||
noticeReadQuery.setOrgId(coreUser.getOrgId());
|
||||
return noticeReadService.add(noticeReadQuery);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(MODEL + "/edit.json")
|
||||
public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) NoticeReadQuery noticeReadQuery, BindingResult result) {
|
||||
if(result.hasErrors()){
|
||||
return JsonResult.failMessage(result);
|
||||
}else {
|
||||
Assert.notNull(getUser(), "请登录后再操作");
|
||||
noticeReadQuery.setUserId(null);
|
||||
noticeReadQuery.setOrgId(null);
|
||||
String msg = noticeReadService.edit(noticeReadQuery);
|
||||
if (StringUtils.isBlank(msg)) {
|
||||
return JsonResult.success();
|
||||
} else {
|
||||
return JsonResult.failMessage("更新失败,"+msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(MODEL + "/view.json")
|
||||
@Function("noticeRead.query")
|
||||
public JsonResult<NoticeRead>queryInfo(Long noticeReadId) {
|
||||
NoticeRead noticeRead = noticeReadService.queryById( noticeReadId);
|
||||
return JsonResult.success(noticeRead);
|
||||
}
|
||||
|
||||
@GetMapping(MODEL + "/getValues.json")
|
||||
public JsonResult<List<NoticeRead>>getValues(NoticeReadQuery param) {
|
||||
List<NoticeRead>list = noticeReadService.getValuesByQuery(param);
|
||||
return JsonResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(MODEL + "/delete.json")
|
||||
@ResponseBody
|
||||
public JsonResult delete(String ids) {
|
||||
noticeReadService.deleteNoticeRead(ids);
|
||||
return JsonResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 通知已读, 也可以用于教师讨论的已读
|
||||
*
|
||||
* @param noticeType 通知类型
|
||||
* @param coreUser
|
||||
* @return {@link JsonResult}
|
||||
* @Author: lx
|
||||
* @Date: 2023/1/10 2:23
|
||||
*/
|
||||
@PostMapping(MODEL + "/readed.json")
|
||||
@ResponseBody
|
||||
public JsonResult readed(NoticeTypeEnum noticeType, @SCoreUser CoreUser coreUser) {
|
||||
noticeReadService.readed(noticeType, coreUser);
|
||||
return JsonResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package com.ibeetl.jlw.web.query;
|
||||
|
||||
import cn.jlw.validate.ValidateConfig;
|
||||
import com.ibeetl.admin.core.annotation.Query;
|
||||
import com.ibeetl.admin.core.entity.CoreUser;
|
||||
import com.ibeetl.admin.core.web.query.PageParam;
|
||||
import com.ibeetl.jlw.entity.NoticeRead;
|
||||
import com.ibeetl.jlw.enums.NoticeTypeEnum;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*公告已读管理查询
|
||||
*/
|
||||
public class NoticeReadQuery extends PageParam {
|
||||
@NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
|
||||
@Query(name = "ID", display = false)
|
||||
private Long noticeReadId;
|
||||
/**
|
||||
* 保存的是系统用户ID
|
||||
* {@link CoreUser#getId()}
|
||||
*/
|
||||
@Query(name = "人员ID", display = false)
|
||||
private String personId;
|
||||
@Query(name = "类型 (枚举类 NoticeTypeEnum)", display = false)
|
||||
private NoticeTypeEnum noticeReadType;
|
||||
@Query(name = "已读时间", display = false)
|
||||
private Date noticeReadTime;
|
||||
@Query(name = "组织ID", display = false)
|
||||
private Long orgId;
|
||||
@Query(name = "用户ID", display = false)
|
||||
private Long userId;
|
||||
|
||||
private String noticeReadIdPlural;
|
||||
private String orgIdPlural;
|
||||
private String userIdPlural;
|
||||
|
||||
private String noticeReadJsonStr;//json格式
|
||||
|
||||
private String _given;//指定更新的特定字段,多个逗号隔开
|
||||
|
||||
public Long getNoticeReadId(){
|
||||
return noticeReadId;
|
||||
}
|
||||
public void setNoticeReadId(Long noticeReadId ){
|
||||
this.noticeReadId = noticeReadId;
|
||||
}
|
||||
public String getPersonId(){
|
||||
return personId;
|
||||
}
|
||||
public void setPersonId(String personId ){
|
||||
this.personId = personId;
|
||||
}
|
||||
public NoticeTypeEnum getNoticeReadType(){
|
||||
return noticeReadType;
|
||||
}
|
||||
public void setNoticeReadType(NoticeTypeEnum noticeReadType ){
|
||||
this.noticeReadType = noticeReadType;
|
||||
}
|
||||
public Date getNoticeReadTime(){
|
||||
return noticeReadTime;
|
||||
}
|
||||
public void setNoticeReadTime(Date noticeReadTime ){
|
||||
this.noticeReadTime = noticeReadTime;
|
||||
}
|
||||
public Long getOrgId(){
|
||||
return orgId;
|
||||
}
|
||||
public void setOrgId(Long orgId ){
|
||||
this.orgId = orgId;
|
||||
}
|
||||
public Long getUserId(){
|
||||
return userId;
|
||||
}
|
||||
public void setUserId(Long userId ){
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public NoticeRead pojo(){
|
||||
NoticeRead pojo = new NoticeRead();
|
||||
pojo.setNoticeReadId(this.getNoticeReadId());
|
||||
pojo.setPersonId(this.getPersonId());
|
||||
pojo.setNoticeReadType(this.getNoticeReadType());
|
||||
pojo.setNoticeReadTime(this.getNoticeReadTime());
|
||||
pojo.setOrgId(this.getOrgId());
|
||||
pojo.setUserId(this.getUserId());
|
||||
return pojo;
|
||||
}
|
||||
|
||||
public String getNoticeReadIdPlural(){
|
||||
return noticeReadIdPlural;
|
||||
}
|
||||
public void setNoticeReadIdPlural(String noticeReadIdPlural){
|
||||
this.noticeReadIdPlural = noticeReadIdPlural;
|
||||
}
|
||||
public String getOrgIdPlural(){
|
||||
return orgIdPlural;
|
||||
}
|
||||
public void setOrgIdPlural(String orgIdPlural){
|
||||
this.orgIdPlural = orgIdPlural;
|
||||
}
|
||||
public String getUserIdPlural(){
|
||||
return userIdPlural;
|
||||
}
|
||||
public void setUserIdPlural(String userIdPlural){
|
||||
this.userIdPlural = userIdPlural;
|
||||
}
|
||||
public String getNoticeReadJsonStr(){
|
||||
return noticeReadJsonStr;
|
||||
}
|
||||
public void setNoticeReadJsonStr(String noticeReadJsonStr ){
|
||||
this.noticeReadJsonStr = noticeReadJsonStr;
|
||||
}
|
||||
public String get_given() {
|
||||
return _given;
|
||||
}
|
||||
public void set_given(String _given) {
|
||||
this._given = _given;
|
||||
}
|
||||
}
|
@ -0,0 +1,245 @@
|
||||
queryByCondition
|
||||
===
|
||||
* 根据不为空的参数进行分页查询
|
||||
|
||||
select
|
||||
@pageTag(){
|
||||
t.*
|
||||
@}
|
||||
from notice_read t
|
||||
where 1=1
|
||||
@if(!isEmpty(noticeReadId)){
|
||||
and t.notice_read_id =#noticeReadId#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadIdPlural)){
|
||||
and find_in_set(t.notice_read_id,#noticeReadIdPlural#)
|
||||
@}
|
||||
@if(!isEmpty(personId)){
|
||||
and t.person_id =#personId#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadType)){
|
||||
and t.notice_read_type =#noticeReadType#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadTime)){
|
||||
and t.notice_read_time =#noticeReadTime#
|
||||
@}
|
||||
@if(!isEmpty(orgId)){
|
||||
and t.org_id =#orgId#
|
||||
@}
|
||||
@if(!isEmpty(orgIdPlural)){
|
||||
and find_in_set(t.org_id,#orgIdPlural#)
|
||||
@}
|
||||
@if(!isEmpty(userId)){
|
||||
and t.user_id =#userId#
|
||||
@}
|
||||
@if(!isEmpty(userIdPlural)){
|
||||
and find_in_set(t.user_id,#userIdPlural#)
|
||||
@}
|
||||
|
||||
|
||||
queryByConditionQuery
|
||||
===
|
||||
* 根据不为空的参数进行分页查询(无权限)
|
||||
|
||||
select
|
||||
@pageTag(){
|
||||
t.*
|
||||
@}
|
||||
from notice_read t
|
||||
where 1=1
|
||||
@if(!isEmpty(noticeReadId)){
|
||||
and t.notice_read_id =#noticeReadId#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadIdPlural)){
|
||||
and find_in_set(t.notice_read_id,#noticeReadIdPlural#)
|
||||
@}
|
||||
@if(!isEmpty(personId)){
|
||||
and t.person_id =#personId#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadType)){
|
||||
and t.notice_read_type =#noticeReadType#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadTime)){
|
||||
and t.notice_read_time =#noticeReadTime#
|
||||
@}
|
||||
@if(!isEmpty(orgId)){
|
||||
and t.org_id =#orgId#
|
||||
@}
|
||||
@if(!isEmpty(orgIdPlural)){
|
||||
and find_in_set(t.org_id,#orgIdPlural#)
|
||||
@}
|
||||
@if(!isEmpty(userId)){
|
||||
and t.user_id =#userId#
|
||||
@}
|
||||
@if(!isEmpty(userIdPlural)){
|
||||
and find_in_set(t.user_id,#userIdPlural#)
|
||||
@}
|
||||
|
||||
|
||||
|
||||
|
||||
deleteNoticeReadByIds
|
||||
===
|
||||
|
||||
* 批量删除
|
||||
|
||||
delete from notice_read where find_in_set(notice_read_id,#ids#)
|
||||
|
||||
|
||||
|
||||
getByIds
|
||||
===
|
||||
|
||||
select * from notice_read where find_in_set(notice_read_id,#ids#)
|
||||
|
||||
|
||||
updateGivenByIds
|
||||
===
|
||||
|
||||
* 批量更新指定字段,无论此字段是否有值
|
||||
|
||||
update notice_read
|
||||
set
|
||||
@if(contain("personId",_given)){
|
||||
@if(isEmpty(personId)){
|
||||
person_id = null ,
|
||||
@}else{
|
||||
person_id = #personId# ,
|
||||
@}
|
||||
@}
|
||||
@if(contain("noticeReadType",_given)){
|
||||
@if(isEmpty(noticeReadType)){
|
||||
notice_read_type = null ,
|
||||
@}else{
|
||||
notice_read_type = #noticeReadType# ,
|
||||
@}
|
||||
@}
|
||||
@if(contain("noticeReadTime",_given)){
|
||||
@if(isEmpty(noticeReadTime)){
|
||||
notice_read_time = null ,
|
||||
@}else{
|
||||
notice_read_time = #noticeReadTime# ,
|
||||
@}
|
||||
@}
|
||||
@if(contain("orgId",_given)){
|
||||
@if(isEmpty(orgId)){
|
||||
org_id = null ,
|
||||
@}else{
|
||||
org_id = #orgId# ,
|
||||
@}
|
||||
@}
|
||||
@if(contain("userId",_given)){
|
||||
@if(isEmpty(userId)){
|
||||
user_id = null ,
|
||||
@}else{
|
||||
user_id = #userId# ,
|
||||
@}
|
||||
@}
|
||||
notice_read_id = notice_read_id
|
||||
where find_in_set(notice_read_id,#noticeReadIdPlural#)
|
||||
|
||||
|
||||
|
||||
getNoticeReadValues
|
||||
===
|
||||
|
||||
* 根据不为空的参数进行查询
|
||||
|
||||
select t.*
|
||||
from notice_read t
|
||||
where 1=1
|
||||
@if(!isEmpty(noticeReadId)){
|
||||
and t.notice_read_id =#noticeReadId#
|
||||
@}
|
||||
@if(!isEmpty(personId)){
|
||||
and t.person_id =#personId#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadType)){
|
||||
and t.notice_read_type =#noticeReadType#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadTime)){
|
||||
and t.notice_read_time =#noticeReadTime#
|
||||
@}
|
||||
@if(!isEmpty(orgId)){
|
||||
and t.org_id =#orgId#
|
||||
@}
|
||||
@if(!isEmpty(userId)){
|
||||
and t.user_id =#userId#
|
||||
@}
|
||||
|
||||
|
||||
getValuesByQuery
|
||||
===
|
||||
|
||||
* 根据不为空的参数进行查询
|
||||
|
||||
select t.*
|
||||
from notice_read t
|
||||
where 1=1
|
||||
@if(!isEmpty(noticeReadId)){
|
||||
and t.notice_read_id =#noticeReadId#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadIdPlural)){
|
||||
and find_in_set(t.notice_read_id,#noticeReadIdPlural#)
|
||||
@}
|
||||
@if(!isEmpty(personId)){
|
||||
and t.person_id =#personId#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadType)){
|
||||
and t.notice_read_type =#noticeReadType#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadTime)){
|
||||
and t.notice_read_time =#noticeReadTime#
|
||||
@}
|
||||
@if(!isEmpty(orgId)){
|
||||
and t.org_id =#orgId#
|
||||
@}
|
||||
@if(!isEmpty(orgIdPlural)){
|
||||
and find_in_set(t.org_id,#orgIdPlural#)
|
||||
@}
|
||||
@if(!isEmpty(userId)){
|
||||
and t.user_id =#userId#
|
||||
@}
|
||||
@if(!isEmpty(userIdPlural)){
|
||||
and find_in_set(t.user_id,#userIdPlural#)
|
||||
@}
|
||||
|
||||
|
||||
getValuesByQueryNotWithPermission
|
||||
===
|
||||
|
||||
* 根据不为空的参数进行查询(不包含权限)
|
||||
|
||||
select t.*
|
||||
from notice_read t
|
||||
where 1=1
|
||||
@if(!isEmpty(noticeReadId)){
|
||||
and t.notice_read_id =#noticeReadId#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadIdPlural)){
|
||||
and find_in_set(t.notice_read_id,#noticeReadIdPlural#)
|
||||
@}
|
||||
@if(!isEmpty(personId)){
|
||||
and t.person_id =#personId#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadType)){
|
||||
and t.notice_read_type =#noticeReadType#
|
||||
@}
|
||||
@if(!isEmpty(noticeReadTime)){
|
||||
and t.notice_read_time =#noticeReadTime#
|
||||
@}
|
||||
@if(!isEmpty(orgId)){
|
||||
and t.org_id =#orgId#
|
||||
@}
|
||||
@if(!isEmpty(orgIdPlural)){
|
||||
and find_in_set(t.org_id,#orgIdPlural#)
|
||||
@}
|
||||
@if(!isEmpty(userId)){
|
||||
and t.user_id =#userId#
|
||||
@}
|
||||
@if(!isEmpty(userIdPlural)){
|
||||
and find_in_set(t.user_id,#userIdPlural#)
|
||||
@}
|
||||
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
layui.define([ 'form', 'laydate', 'table','noticeReadApi'], function(exports) {
|
||||
var form = layui.form;
|
||||
var noticeReadApi = layui.noticeReadApi;
|
||||
var index = layui.index;
|
||||
var view = {
|
||||
init:function(){
|
||||
Lib.initGenrealForm($("#addForm"),form);
|
||||
this.initSubmit();
|
||||
},
|
||||
initSubmit:function(){
|
||||
$("#addButton").click(function(){
|
||||
form.on('submit(form)', function(){
|
||||
var noticeReadId = $("#addForm input[name='noticeReadId']").val();
|
||||
if(!$.isEmpty(noticeReadId)){
|
||||
noticeReadApi.updateNoticeRead($('#addForm'),function(){
|
||||
parent.window.dataReload();
|
||||
Common.info("更新成功");
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}else{
|
||||
noticeReadApi.addNoticeRead($('#addForm'),function(){
|
||||
parent.window.dataReload();
|
||||
Common.info("添加成功");
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$("#addButton-cancel").click(function(){
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
exports('add',view);
|
||||
});
|
@ -0,0 +1,23 @@
|
||||
layui.define(['table', 'noticeReadApi'], function(exports) {
|
||||
var noticeReadApi = layui.noticeReadApi;
|
||||
var table=layui.table;
|
||||
var view = {
|
||||
init:function(){
|
||||
},
|
||||
delBatch:function(){
|
||||
var data = Common.getMoreDataFromTable(table,"noticeReadTable");
|
||||
if(data==null){
|
||||
return ;
|
||||
}
|
||||
Common.openConfirm("确认要删除这些公告已读管理?",function(){
|
||||
var ids =Common.concatBatchId(data,"noticeReadId");
|
||||
noticeReadApi.del(ids,function(){
|
||||
Common.info("删除成功");
|
||||
dataReload();
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
exports('del',view);
|
||||
|
||||
});
|
@ -0,0 +1,28 @@
|
||||
layui.define([ 'form', 'laydate', 'table','noticeReadApi'], function(exports) {
|
||||
var form = layui.form;
|
||||
var noticeReadApi = layui.noticeReadApi;
|
||||
var index = layui.index;
|
||||
var view = {
|
||||
init:function(){
|
||||
Lib.initGenrealForm($("#updateForm"),form);
|
||||
this.initSubmit();
|
||||
},
|
||||
initSubmit:function(){
|
||||
$("#updateButton").click(function(){
|
||||
form.on('submit(form)', function(){
|
||||
noticeReadApi.updateNoticeRead($('#updateForm'),function(){
|
||||
parent.window.dataReload();
|
||||
Common.info("更新成功");
|
||||
Lib.closeFrame();
|
||||
});
|
||||
});
|
||||
});
|
||||
$("#updateButton-cancel").click(function(){
|
||||
Lib.closeFrame();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
exports('edit',view);
|
||||
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
/*访问后台的代码*/
|
||||
layui.define([], function(exports) {
|
||||
var api={
|
||||
updateNoticeRead:function(form,callback){
|
||||
Lib.submitForm("/jlw/noticeRead/edit.json",form,{},callback)
|
||||
},
|
||||
addNoticeRead:function(form,callback){
|
||||
Lib.submitForm("/jlw/noticeRead/add.json",form,{},callback)
|
||||
},
|
||||
del:function(ids,callback){
|
||||
Common.post("/jlw/noticeRead/delete.json",{"ids":ids},function(){
|
||||
callback();
|
||||
})
|
||||
}
|
||||
|
||||
};
|
||||
exports('noticeReadApi',api);
|
||||
});
|
@ -0,0 +1,29 @@
|
||||
<!--#layout("/common/layout.html",{"jsBase":"/js/jlw/noticeRead/"}){ -->
|
||||
<layui:searchForm formId="searchForm" searchList="" condition="${search}">
|
||||
</layui:searchForm>
|
||||
<table id="noticeReadTable" lay-filter="noticeReadTable"></table>
|
||||
<!--#} -->
|
||||
|
||||
<script type="text/html" id="toolbar_noticeRead">
|
||||
<div class="layui-btn-container">
|
||||
<div class="layui-btn-group" >
|
||||
<!--# if(core.searchIsShow(search)) {-->
|
||||
<layui:accessButton function="noticeRead.query" id="searchFormSearch" action="search"><i class="layui-icon"></i>搜索</layui:accessButton>
|
||||
<!--# }-->
|
||||
<layui:accessButton function="noticeRead.add" action="add">添加</layui:accessButton>
|
||||
<layui:accessButton function="noticeRead.edit" action="edit">修改</layui:accessButton>
|
||||
<layui:accessButton function="noticeRead.del" action="del">删除</layui:accessButton>
|
||||
<!--# if(!isEmpty(search)) {-->
|
||||
<layui:accessButton function="noticeRead.query" action="refresh"><i class="layui-icon"></i>刷新</layui:accessButton>
|
||||
<!--# }-->
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
|
||||
layui.use(['index'], function(){
|
||||
var index = layui.index;
|
||||
index.init();
|
||||
});
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue