diff --git a/op-modules/op-system/src/main/java/com/op/system/controller/SysNoticeGroupController.java b/op-modules/op-system/src/main/java/com/op/system/controller/SysNoticeGroupController.java new file mode 100644 index 00000000..60ff2f06 --- /dev/null +++ b/op-modules/op-system/src/main/java/com/op/system/controller/SysNoticeGroupController.java @@ -0,0 +1,104 @@ +package com.op.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.op.common.log.annotation.Log; +import com.op.common.log.enums.BusinessType; +import com.op.common.security.annotation.RequiresPermissions; +import com.op.system.domain.SysNoticeGroup; +import com.op.system.service.ISysNoticeGroupService; +import com.op.common.core.web.controller.BaseController; +import com.op.common.core.web.domain.AjaxResult; +import com.op.common.core.utils.poi.ExcelUtil; +import com.op.common.core.web.page.TableDataInfo; + +/** + * 通知公告-班组Controller + * + * @author Open Platform + * @date 2024-05-14 + */ +@RestController +@RequestMapping("/noticeGroup") +public class SysNoticeGroupController extends BaseController { + @Autowired + private ISysNoticeGroupService sysNoticeGroupService; + +/** + * 查询通知公告-班组列表 + */ +@RequiresPermissions("noticeGroup:noticeGroup:list") +@GetMapping("/list") + public TableDataInfo list(SysNoticeGroup sysNoticeGroup) { + startPage(); + List list = sysNoticeGroupService.selectSysNoticeGroupList(sysNoticeGroup); + return getDataTable(list); + } + + /** + * 导出通知公告-班组列表 + */ + @RequiresPermissions("noticeGroup:noticeGroup:export") + @Log(title = "通知公告-班组", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysNoticeGroup sysNoticeGroup) { + List list = sysNoticeGroupService.selectSysNoticeGroupList(sysNoticeGroup); + ExcelUtil util = new ExcelUtil(SysNoticeGroup. class); + util.exportExcel(response, list, "通知公告-班组数据"); + } + + /** + * 获取通知公告-班组详细信息 + */ + @RequiresPermissions("noticeGroup:noticeGroup:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(sysNoticeGroupService.selectSysNoticeGroupById(id)); + } + + /** + * 新增通知公告-班组 + */ + @RequiresPermissions("noticeGroup:noticeGroup:add") + @Log(title = "通知公告-班组", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysNoticeGroup sysNoticeGroup) { + return toAjax(sysNoticeGroupService.insertSysNoticeGroup(sysNoticeGroup)); + } + + /** + * 修改通知公告-班组 + */ + @RequiresPermissions("noticeGroup:noticeGroup:edit") + @Log(title = "通知公告-班组", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysNoticeGroup sysNoticeGroup) { + return toAjax(sysNoticeGroupService.updateSysNoticeGroup(sysNoticeGroup)); + } + + /** + * 删除通知公告-班组 + */ + @RequiresPermissions("noticeGroup:noticeGroup:remove") + @Log(title = "通知公告-班组", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(sysNoticeGroupService.deleteSysNoticeGroupByIds(ids)); + } + + @PostMapping("/teamBind") + public AjaxResult teamBind(@RequestBody SysNoticeGroup sysNoticeGroup) { + return toAjax(sysNoticeGroupService.insertSysNoticeGroup(sysNoticeGroup)); + } + +} diff --git a/op-modules/op-system/src/main/java/com/op/system/domain/SysNoticeGroup.java b/op-modules/op-system/src/main/java/com/op/system/domain/SysNoticeGroup.java new file mode 100644 index 00000000..90ad2a5a --- /dev/null +++ b/op-modules/op-system/src/main/java/com/op/system/domain/SysNoticeGroup.java @@ -0,0 +1,120 @@ +package com.op.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; + +/** + * 通知公告-班组对象 sys_notice_group + * + * @author Open Platform + * @date 2024-05-14 + */ +public class SysNoticeGroup extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 公告ID + */ + private Long id; + + /** + * 公告标题 + */ + @Excel(name = "公告标题") + private Long noticeId; + + /** + * 班组编码 + */ + @Excel(name = "班组编码") + private String groupCode; + + /** + * 班组名称 + */ + @Excel(name = "班组名称") + private String groupName; + + /** + * 1删除 + */ + private String delFlag; + + private String[] groupCodes; + + private String[] groupNames; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setNoticeId(Long noticeId) { + this.noticeId = noticeId; + } + + public Long getNoticeId() { + return noticeId; + } + + public void setGroupCode(String groupCode) { + this.groupCode = groupCode; + } + + public String getGroupCode() { + return groupCode; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public String getGroupName() { + return groupName; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getDelFlag() { + return delFlag; + } + + public String[] getGroupCodes() { + return groupCodes; + } + + public void setGroupCodes(String[] groupCodes) { + this.groupCodes = groupCodes; + } + + public String[] getGroupNames() { + return groupNames; + } + + public void setGroupNames(String[] groupNames) { + this.groupNames = groupNames; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("noticeId", getNoticeId()) + .append("groupCode", getGroupCode()) + .append("groupName", getGroupName()) + .append("delFlag", getDelFlag()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/op-modules/op-system/src/main/java/com/op/system/mapper/SysNoticeGroupMapper.java b/op-modules/op-system/src/main/java/com/op/system/mapper/SysNoticeGroupMapper.java new file mode 100644 index 00000000..92f02b74 --- /dev/null +++ b/op-modules/op-system/src/main/java/com/op/system/mapper/SysNoticeGroupMapper.java @@ -0,0 +1,65 @@ +package com.op.system.mapper; + +import java.util.List; + +import com.op.system.domain.SysNoticeGroup; +import org.apache.ibatis.annotations.Mapper; + +/** + * 通知公告-班组Mapper接口 + * + * @author Open Platform + * @date 2024-05-14 + */ +@Mapper +public interface SysNoticeGroupMapper { + /** + * 查询通知公告-班组 + * + * @param id 通知公告-班组主键 + * @return 通知公告-班组 + */ + public SysNoticeGroup selectSysNoticeGroupById(Long id); + + /** + * 查询通知公告-班组列表 + * + * @param sysNoticeGroup 通知公告-班组 + * @return 通知公告-班组集合 + */ + public List selectSysNoticeGroupList(SysNoticeGroup sysNoticeGroup); + + /** + * 新增通知公告-班组 + * + * @param sysNoticeGroup 通知公告-班组 + * @return 结果 + */ + public int insertSysNoticeGroup(SysNoticeGroup sysNoticeGroup); + + /** + * 修改通知公告-班组 + * + * @param sysNoticeGroup 通知公告-班组 + * @return 结果 + */ + public int updateSysNoticeGroup(SysNoticeGroup sysNoticeGroup); + + /** + * 删除通知公告-班组 + * + * @param id 通知公告-班组主键 + * @return 结果 + */ + public int deleteSysNoticeGroupById(Long id); + + /** + * 批量删除通知公告-班组 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysNoticeGroupByIds(Long[] ids); + + public int getSerialNumber(); +} diff --git a/op-modules/op-system/src/main/java/com/op/system/service/ISysNoticeGroupService.java b/op-modules/op-system/src/main/java/com/op/system/service/ISysNoticeGroupService.java new file mode 100644 index 00000000..332a7731 --- /dev/null +++ b/op-modules/op-system/src/main/java/com/op/system/service/ISysNoticeGroupService.java @@ -0,0 +1,62 @@ +package com.op.system.service; + +import java.util.List; + +import com.op.system.domain.SysNoticeGroup; + +/** + * 通知公告-班组Service接口 + * + * @author Open Platform + * @date 2024-05-14 + */ +public interface ISysNoticeGroupService { + /** + * 查询通知公告-班组 + * + * @param id 通知公告-班组主键 + * @return 通知公告-班组 + */ + public SysNoticeGroup selectSysNoticeGroupById(Long id); + + /** + * 查询通知公告-班组列表 + * + * @param sysNoticeGroup 通知公告-班组 + * @return 通知公告-班组集合 + */ + public List selectSysNoticeGroupList(SysNoticeGroup sysNoticeGroup); + + /** + * 新增通知公告-班组 + * + * @param sysNoticeGroup 通知公告-班组 + * @return 结果 + */ + public int insertSysNoticeGroup(SysNoticeGroup sysNoticeGroup); + + /** + * 修改通知公告-班组 + * + * @param sysNoticeGroup 通知公告-班组 + * @return 结果 + */ + public int updateSysNoticeGroup(SysNoticeGroup sysNoticeGroup); + + /** + * 批量删除通知公告-班组 + * + * @param ids 需要删除的通知公告-班组主键集合 + * @return 结果 + */ + public int deleteSysNoticeGroupByIds(Long[] ids); + + /** + * 删除通知公告-班组信息 + * + * @param id 通知公告-班组主键 + * @return 结果 + */ + public int deleteSysNoticeGroupById(Long id); + +} diff --git a/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeGroupServiceImpl.java b/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeGroupServiceImpl.java new file mode 100644 index 00000000..62c6fa07 --- /dev/null +++ b/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeGroupServiceImpl.java @@ -0,0 +1,125 @@ +package com.op.system.service.impl; + +import java.util.List; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.uuid.IdUtils; +import com.op.common.security.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.op.system.mapper.SysNoticeGroupMapper; +import com.op.system.domain.SysNoticeGroup; +import com.op.system.service.ISysNoticeGroupService; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +/** + * 通知公告-班组Service业务层处理 + * + * @author Open Platform + * @date 2024-05-14 + */ +@Service +public class SysNoticeGroupServiceImpl implements ISysNoticeGroupService { + @Autowired + private SysNoticeGroupMapper sysNoticeGroupMapper; + + /** + * 查询通知公告-班组 + * + * @param id 通知公告-班组主键 + * @return 通知公告-班组 + */ + @Override + public SysNoticeGroup selectSysNoticeGroupById(Long id) { + return sysNoticeGroupMapper.selectSysNoticeGroupById(id); + } + + /** + * 查询通知公告-班组列表 + * + * @param sysNoticeGroup 通知公告-班组 + * @return 通知公告-班组 + */ + @Override + public List selectSysNoticeGroupList(SysNoticeGroup sysNoticeGroup) { + return sysNoticeGroupMapper.selectSysNoticeGroupList(sysNoticeGroup); + } + + /** + * 新增通知公告-班组 + * + * @param sysNoticeGroup 通知公告-班组 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int insertSysNoticeGroup(SysNoticeGroup sysNoticeGroup) { + String[] groupCodes = sysNoticeGroup.getGroupCodes(); + if (groupCodes == null){ + return 0; + } + String[] groupNames = sysNoticeGroup.getGroupNames(); + Long noticeId = sysNoticeGroup.getNoticeId(); + String username = SecurityUtils.getUsername(); + + Long serialId = getSerialId(); + int count = 0; + for (int i = 0; i < groupCodes.length; i++) { + sysNoticeGroup.setId(serialId++); + sysNoticeGroup.setNoticeId(noticeId); + sysNoticeGroup.setGroupCode(groupCodes[i]); + sysNoticeGroup.setGroupName(groupNames[i]); + sysNoticeGroup.setCreateBy(username); + sysNoticeGroup.setCreateTime(DateUtils.getNowDate()); + count += sysNoticeGroupMapper.insertSysNoticeGroup(sysNoticeGroup); + } + return count; + } + + /** + * 修改通知公告-班组 + * + * @param sysNoticeGroup 通知公告-班组 + * @return 结果 + */ + @Override + public int updateSysNoticeGroup(SysNoticeGroup sysNoticeGroup) { + sysNoticeGroup.setUpdateTime(DateUtils.getNowDate()); + return sysNoticeGroupMapper.updateSysNoticeGroup(sysNoticeGroup); + } + + /** + * 批量删除通知公告-班组 + * + * @param ids 需要删除的通知公告-班组主键 + * @return 结果 + */ + @Override + public int deleteSysNoticeGroupByIds(Long[] ids) { + return sysNoticeGroupMapper.deleteSysNoticeGroupByIds(ids); + } + + /** + * 删除通知公告-班组信息 + * + * @param id 通知公告-班组主键 + * @return 结果 + */ + @Override + public int deleteSysNoticeGroupById(Long id) { + return sysNoticeGroupMapper.deleteSysNoticeGroupById(id); + } + + @DS("#header.poolName") + private Long getSerialId() { + String dateToStr = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); + int serialNumber = sysNoticeGroupMapper.getSerialNumber(); + String serialStr = String.format("%04d", serialNumber); + String serialIdStr = dateToStr + serialStr; + return Long.valueOf(serialIdStr); + } +} diff --git a/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeServiceImpl.java b/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeServiceImpl.java index 2c661f4c..ce97d8b6 100644 --- a/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeServiceImpl.java +++ b/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeServiceImpl.java @@ -2,6 +2,7 @@ package com.op.system.service.impl; import java.util.List; +import com.baomidou.dynamic.datasource.annotation.DS; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.system.domain.SysNotice; @@ -25,6 +26,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService { * @return 公告信息 */ @Override + @DS("#header.poolName") public SysNotice selectNoticeById(Long noticeId) { return noticeMapper.selectNoticeById(noticeId); } @@ -36,6 +38,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService { * @return 公告集合 */ @Override + @DS("#header.poolName") public List selectNoticeList(SysNotice notice) { return noticeMapper.selectNoticeList(notice); } @@ -47,6 +50,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService { * @return 结果 */ @Override + @DS("#header.poolName") public int insertNotice(SysNotice notice) { return noticeMapper.insertNotice(notice); } @@ -58,6 +62,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService { * @return 结果 */ @Override + @DS("#header.poolName") public int updateNotice(SysNotice notice) { return noticeMapper.updateNotice(notice); } @@ -69,6 +74,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService { * @return 结果 */ @Override + @DS("#header.poolName") public int deleteNoticeById(Long noticeId) { return noticeMapper.deleteNoticeById(noticeId); } @@ -80,6 +86,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService { * @return 结果 */ @Override + @DS("#header.poolName") public int deleteNoticeByIds(Long[] noticeIds) { return noticeMapper.deleteNoticeByIds(noticeIds); } diff --git a/op-modules/op-system/src/main/resources/mapper/system/SysNoticeGroupMapper.xml b/op-modules/op-system/src/main/resources/mapper/system/SysNoticeGroupMapper.xml new file mode 100644 index 00000000..3fc67cf3 --- /dev/null +++ b/op-modules/op-system/src/main/resources/mapper/system/SysNoticeGroupMapper.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + select id, notice_id, group_code, group_name, del_flag, create_by, create_time, update_by, update_time, remark from sys_notice_group + + + + + + + + insert into sys_notice_group + + id, + + notice_id, + + group_code, + + group_name, + + del_flag, + + create_by, + + create_time, + + update_by, + + update_time, + + remark, + + + + #{id}, + + #{noticeId}, + + #{groupCode}, + + #{groupName}, + + #{delFlag}, + + #{createBy}, + + #{createTime}, + + #{updateBy}, + + #{updateTime}, + + #{remark}, + + + + + + update sys_notice_group + + notice_id = + #{noticeId}, + + group_code = + #{groupCode}, + + group_name = + #{groupName}, + + del_flag = + #{delFlag}, + + create_by = + #{createBy}, + + create_time = + #{createTime}, + + update_by = + #{updateBy}, + + update_time = + #{updateTime}, + + remark = + #{remark}, + + + where id = #{id} + + + + delete from sys_notice_group where id = #{id} + + + + delete from sys_notice_group where id in + + #{id} + + + +