beetlsql3-dev
Mlxa0324 2 years ago
parent 718a8e54c8
commit c9bbdbaa69

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?PowerDesigner AppLocale="UTF16" ID="{BA33ABB7-B246-4DB0-85DE-396EDDB46458}" Label="" LastModificationDate="1673284017" Name="cjks" Objects="1387" Symbols="106" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
<?PowerDesigner AppLocale="UTF16" ID="{BA33ABB7-B246-4DB0-85DE-396EDDB46458}" Label="" LastModificationDate="1673284062" Name="cjks" Objects="1387" Symbols="106" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
<!-- do not edit this file -->
<Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@ -21575,11 +21575,11 @@ COLLATE = utf8_general_ci</a:PhysicalOptions>
</o:Table>
<o:Table Id="o222">
<a:ObjectID>2D458A59-6997-4E40-A026-4C8C9CC232EA</a:ObjectID>
<a:Name>teacher_open_course_notice_read</a:Name>
<a:Code>teacher_open_course_notice_read</a:Code>
<a:Name>notice_read</a:Name>
<a:Code>notice_read</a:Code>
<a:CreationDate>1661850632</a:CreationDate>
<a:Creator>lx</a:Creator>
<a:ModificationDate>1673284017</a:ModificationDate>
<a:ModificationDate>1673284062</a:ModificationDate>
<a:Modifier>lx</a:Modifier>
<a:Comment>通知公告等-已读时间记录</a:Comment>
<a:PhysicalOptions>auto_increment = 1
@ -21595,11 +21595,11 @@ COLLATE = utf8_general_ci</a:PhysicalOptions>
<c:Columns>
<o:Column Id="o1320">
<a:ObjectID>88D3FAD6-47EF-42D9-89A1-96D2BD3107B1</a:ObjectID>
<a:Name>teacher_open_course_notice_read_id</a:Name>
<a:Name>notice_read_id</a:Name>
<a:Code>notice_read_id</a:Code>
<a:CreationDate>1661850778</a:CreationDate>
<a:Creator>lx</a:Creator>
<a:ModificationDate>1673283995</a:ModificationDate>
<a:ModificationDate>1673284062</a:ModificationDate>
<a:Modifier>lx</a:Modifier>
<a:Comment>ID</a:Comment>
<a:DataType>bigint</a:DataType>

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?PowerDesigner AppLocale="UTF16" ID="{BA33ABB7-B246-4DB0-85DE-396EDDB46458}" Label="" LastModificationDate="1673284062" Name="cjks" Objects="1387" Symbols="106" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
<?PowerDesigner AppLocale="UTF16" ID="{BA33ABB7-B246-4DB0-85DE-396EDDB46458}" Label="" LastModificationDate="1673287949" Name="cjks" Objects="1387" Symbols="106" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
<!-- do not edit this file -->
<Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@ -21611,11 +21611,11 @@ COLLATE = utf8_general_ci</a:PhysicalOptions>
<a:Code>person_id</a:Code>
<a:CreationDate>1662046909</a:CreationDate>
<a:Creator>lx</a:Creator>
<a:ModificationDate>1673283995</a:ModificationDate>
<a:ModificationDate>1673287931</a:ModificationDate>
<a:Modifier>lx</a:Modifier>
<a:Comment>人员ID</a:Comment>
<a:DataType>varchar(2000)</a:DataType>
<a:Length>2000</a:Length>
<a:DataType>varchar(100)</a:DataType>
<a:Length>100</a:Length>
</o:Column>
<o:Column Id="o1322">
<a:ObjectID>CF9F793F-60AE-4A22-9114-EAE48E62E95B</a:ObjectID>
@ -21635,11 +21635,10 @@ COLLATE = utf8_general_ci</a:PhysicalOptions>
<a:Code>notice_read_time</a:Code>
<a:CreationDate>1662046909</a:CreationDate>
<a:Creator>lx</a:Creator>
<a:ModificationDate>1673283995</a:ModificationDate>
<a:ModificationDate>1673287949</a:ModificationDate>
<a:Modifier>lx</a:Modifier>
<a:Comment>已读时间</a:Comment>
<a:DataType>varchar(2000)</a:DataType>
<a:Length>2000</a:Length>
<a:DataType>datetime</a:DataType>
</o:Column>
<o:Column Id="o1324">
<a:ObjectID>D62D3646-4818-463C-98B0-82945D3B4081</a:ObjectID>

@ -542,9 +542,9 @@ drop table if exists notice_read;
create table notice_read
(
notice_read_id bigint not null comment 'ID',
person_id varchar(2000) comment '人员ID',
person_id varchar(100) comment '人员ID',
notice_read_type varchar(50) comment '类型 (枚举类 NoticeTypeEnum)',
notice_read_time varchar(2000) comment '已读时间',
notice_read_time datetime comment '已读时间',
org_id bigint comment '组织ID',
user_id bigint comment '用户ID',
primary key (notice_read_id)
@ -555,3 +555,4 @@ create table notice_read
COLLATE = utf8_general_ci;
alter table notice_read comment '通知公告等-已读时间记录';

@ -0,0 +1,29 @@
package com.ibeetl.jlw.dao;
import com.ibeetl.jlw.entity.NoticeRead;
import com.ibeetl.jlw.web.query.NoticeReadQuery;
import org.beetl.sql.core.engine.PageQuery;
import org.beetl.sql.mapper.BaseMapper;
import org.beetl.sql.mapper.annotation.SqlResource;
import org.beetl.sql.mapper.annotation.Update;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Dao
*/
// 实际可以不用加Repository注解调用的地方注入时候Idea会报红看着难受
@Repository
@SqlResource("jlw.noticeRead")
public interface NoticeReadDao extends BaseMapper<NoticeRead>{
PageQuery<NoticeRead> queryByCondition(PageQuery query);
PageQuery<NoticeRead> queryByConditionQuery(PageQuery query);
@Update
void deleteNoticeReadByIds(String ids);
@Update
int updateGivenByIds(NoticeReadQuery noticeReadQuery);
List<NoticeRead> getByIds(String ids);
List<NoticeRead> getValuesByQuery(NoticeReadQuery noticeReadQuery);
List<NoticeRead> getValuesByQueryNotWithPermission(NoticeReadQuery noticeReadQuery);
}

@ -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,164 @@
layui.define([ 'form', 'laydate', 'table' ], function(exports) {
var form = layui.form;
var laydate = layui.laydate;
var table = layui.table;
var noticeReadTable = null;
var view ={
init:function(){
var that = this
this.initTable();
this.initSearchForm();
this.initToolBar();
window.dataReload = function(){
Lib.doSearchForm($("#searchForm"),noticeReadTable)
that.initToolBar();
}
},
initTable:function(){
var sx_ = localStorage.getItem("noticeReadTable_field_"+Common.userInfoId); //筛选值显示、隐藏缓存
if($.isEmpty(sx_)){sx_ = {};}else {sx_ = JSON.parse(sx_);}
noticeReadTable = table.render({
elem : '#noticeReadTable',
height : Lib.getTableHeight(1),
cellMinWidth: 100,
method : 'post',
url : Common.ctxPath + '/jlw/noticeRead/list.json' // 数据接口
,page : Lib.tablePage // 开启分页
,toolbar: '#toolbar_noticeRead' //自定义头部左侧工具栏
,defaultToolbar: ['filter', 'print', 'exports'] //头部右侧工具栏
,limit : 10,
cols : [ [ // 表头
{
type : 'checkbox',
},
{
field : 'noticeReadId',
title : 'ID',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['noticeReadId'])?false:sx_['noticeReadId'],
width : 60,
},
{
field : 'personId',
title : '人员ID',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['personId'])?false:sx_['personId'],
},
{
field : 'noticeReadType',
title : '类型 (枚举类 NoticeTypeEnum)',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['noticeReadType'])?false:sx_['noticeReadType'],
},
{
field : 'noticeReadTime',
title : '已读时间',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['noticeReadTime'])?false:sx_['noticeReadTime'],
},
{
field : 'orgId',
title : '组织ID',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['orgId'])?false:sx_['orgId'],
},
{
field : 'userId',
title : '用户ID',
align:"center",
hideField :false,
hide:$.isEmpty(sx_['userId'])?false:sx_['userId'],
}
,{
field : 'operation_',title : '操作',align:"center", templet: function (d) {
var htm = '<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">编辑</button>';
htm += '<button type="button" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
return htm;
}
}
] ]
});
table.on('checkbox(noticeReadTable)', function(obj){
var noticeRead = obj.data;
if(obj.checked){
//按钮逻辑Lib.buttonEnable()
}else{
}
})
},
initSearchForm:function(){
Lib.initSearchForm( $("#searchForm"),noticeReadTable,form);
},
initToolBar:function(){
toolbar = {
add: function () {
var url = "/jlw/noticeRead/add.do";
Common.openDlg(url,"公告已读管理管理>新增");
},
edit: function () {
var data = Common.getOneFromTable(table,"noticeReadTable");
if(data==null){
return ;
}
var url = "/jlw/noticeRead/add.do?noticeReadId="+data.noticeReadId;
Common.openDlg(url,"公告已读管理管理>"+data.noticeReadId+">编辑");
},
del: function () {
layui.use(['del'], function(){
var delView = layui.del
delView.delBatch();
});
},
search: function () {
Lib.doSearchForm($("#searchForm"), noticeReadTable, 1);
view.initToolBar()
},
refresh: function () {
searchForm.reset();
Lib.doSearchForm($("#searchForm"), noticeReadTable, 1);
view.initToolBar()
},
}
//触发事件
$('.ext-toolbar').on('click', function() {
var type = $(this).data('type');
toolbar[type] ? toolbar[type].call(this) : '';
});
}, initTableTool: table.on('tool(noticeReadTable)', function (obj) {
var data = obj.data;
if (obj.event === 'edit') {
var url = "/jlw/noticeRead/add.do?noticeReadId="+data.noticeReadId;
Common.openDlg(url,"公告已读管理管理>"+data.noticeReadId+">编辑");
}else if(obj.event === "del"){
layer.confirm('是否确定删除该信息?', function (index) {
var ret = Common.postAjax("/jlw/noticeRead/delete.json",{ids:data.noticeReadId});
layer.msg(ret.code == 0?"删除成功!":ret.msg, {
offset: ['50%'],
icon: ret.code == 0?1:2,
time: 1500 //2秒关闭如果不配置默认是3秒
},function (){
if(ret.code == 0){
Lib.tableRefresh();
}
});
});
}
})
}
exports('index',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,56 @@
<!--# layout("/common/layout.html",{"jsBase":"/js/jlw/noticeRead/"}){ -->
<form class="layui-form" id="addForm">
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">人员ID</label>
<div class="layui-input-inline">
<input type="text" id="personId" name="personId" value="${noticeRead.personId}" class="layui-input" >
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">类型 (枚举类 NoticeTypeEnum)</label>
<div class="layui-input-inline">
<input type="text" id="noticeReadType" name="noticeReadType" value="${noticeRead.noticeReadType}" class="layui-input" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">已读时间</label>
<div class="layui-input-inline">
<input type="text" id="noticeReadTime" name="noticeReadTime" value="${noticeRead.noticeReadTime}" class="layui-input" >
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">组织ID</label>
<div class="layui-input-inline">
<input type="text" id="orgId" name="orgId" value="${noticeRead.orgId}" class="layui-input" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">用户ID</label>
<div class="layui-input-inline">
<input type="text" id="userId" name="userId" value="${noticeRead.userId}" class="layui-input" >
</div>
</div>
</div>
</div>
<!-- 业务对象须有hidden字段保存delFlag和version字段-->
<input type="hidden" name="noticeReadId" value="${noticeRead.noticeReadId}" />
<layui:submitButtons id="addButton" buttonType="" showExamine="2" />
</form>
<!--#} -->
<script>
layui.use(['add'], function(){
var noticeReadAdd = layui.add
noticeReadAdd.init();
});
</script>

@ -0,0 +1,56 @@
<!--# layout("/common/layout.html",{"jsBase":"/js/jlw/noticeRead/"}){ -->
<form class="layui-form" id="updateForm">
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">人员ID</label>
<div class="layui-input-inline">
<input type="text" id="personId" name="personId" value="${noticeRead.personId}" class="layui-input" >
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">类型 (枚举类 NoticeTypeEnum)</label>
<div class="layui-input-inline">
<input type="text" id="noticeReadType" name="noticeReadType" value="${noticeRead.noticeReadType}" class="layui-input" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">已读时间</label>
<div class="layui-input-inline">
<input type="text" id="noticeReadTime" name="noticeReadTime" value="${noticeRead.noticeReadTime}" class="layui-input" >
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">组织ID</label>
<div class="layui-input-inline">
<input type="text" id="orgId" name="orgId" value="${noticeRead.orgId}" class="layui-input" >
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">用户ID</label>
<div class="layui-input-inline">
<input type="text" id="userId" name="userId" value="${noticeRead.userId}" class="layui-input" >
</div>
</div>
</div>
</div>
<!-- 业务对象须有hidden字段保存delFlag和version字段-->
<input type="hidden" name="noticeReadId" value="${noticeRead.noticeReadId}" />
<layui:submitButtons id="updateButton" buttonType="" showExamine="2" />
</form>
<!--#} -->
<script>
layui.use(['edit'], function(){
var noticeReadEdit = layui.edit
noticeReadEdit.init();
});
</script>

@ -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">&#xe615;</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">&#xe669;</i>刷新</layui:accessButton>
<!--# }-->
</div>
</div>
</script>
<script>
layui.use(['index'], function(){
var index = layui.index;
index.init();
});
</script>
Loading…
Cancel
Save