提交权限修改

This commit is contained in:
LEED
2025-05-12 09:29:42 +08:00
parent 360b630306
commit dc68beb04d
39 changed files with 800 additions and 28 deletions

View File

@@ -40,6 +40,7 @@ public class SysOperlogController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog)
{
operLog.setDeptId(getDeptId());
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);

View File

@@ -89,6 +89,17 @@ public class SysDeptController extends BaseController
return success(depts);
}
/**
* 获取机构列表
*/
@ApiOperation("获取机构列表")
@GetMapping("/orgList")
public AjaxResult orgList()
{
List<SysDept> depts = deptService.selectOrgList();
return success(depts);
}
/**
* 查询机构列表(排除节点)
*/

View File

@@ -44,6 +44,7 @@ public class SysNoticeController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysNotice notice)
{
notice.setDeptId(getDeptId());
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
@@ -70,6 +71,7 @@ public class SysNoticeController extends BaseController
public AjaxResult add(@Validated @RequestBody SysNotice notice)
{
notice.setCreateBy(getUsername());
notice.setDeptId(getDeptId());
return toAjax(noticeService.insertNotice(notice));
}

View File

@@ -5,6 +5,7 @@ import com.xinda.common.config.RuoYiConfig;
import com.xinda.common.constant.UserConstants;
import com.xinda.common.core.controller.BaseController;
import com.xinda.common.core.domain.AjaxResult;
import com.xinda.common.core.domain.R;
import com.xinda.common.core.domain.entity.SysUser;
import com.xinda.common.core.domain.model.LoginUser;
import com.xinda.common.enums.BusinessType;
@@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* 个人信息 业务处理
@@ -163,4 +165,7 @@ public class SysProfileController extends BaseController
}
return error(MessageUtils.message("user.upload.avatar.failed"));
}
}

View File

@@ -0,0 +1,110 @@
package com.xinda.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
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.xinda.common.annotation.Log;
import com.xinda.common.core.controller.BaseController;
import com.xinda.common.core.domain.AjaxResult;
import com.xinda.common.enums.BusinessType;
import com.xinda.system.domain.SysSms;
import com.xinda.system.service.ISysSmsService;
import com.xinda.common.utils.poi.ExcelUtil;
import com.xinda.common.core.page.TableDataInfo;
/**
* 系统消息Controller
*
* @author kerwincui
* @date 2025-05-08
*/
@RestController
@RequestMapping("/system/sms")
@Api(tags = "系统消息")
public class SysSmsController extends BaseController
{
@Autowired
private ISysSmsService sysSmsService;
/**
* 查询系统消息列表
*/
@PreAuthorize("@ss.hasPermi('system:sms:list')")
@GetMapping("/list")
@ApiOperation("查询系统消息列表")
public TableDataInfo list(SysSms sysSms)
{
startPage();
List<SysSms> list = sysSmsService.selectSysSmsList(sysSms);
return getDataTable(list);
}
/**
* 导出系统消息列表
*/
@ApiOperation("导出系统消息列表")
@PreAuthorize("@ss.hasPermi('system:sms:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysSms sysSms)
{
List<SysSms> list = sysSmsService.selectSysSmsList(sysSms);
ExcelUtil<SysSms> util = new ExcelUtil<SysSms>(SysSms.class);
util.exportExcel(response, list, "系统消息数据");
}
/**
* 获取系统消息详细信息
*/
@PreAuthorize("@ss.hasPermi('system:sms:query')")
@GetMapping(value = "/{smsId}")
@ApiOperation("获取系统消息详细信息")
public AjaxResult getInfo(@PathVariable("smsId") Long smsId)
{
return success(sysSmsService.selectSysSmsBySmsId(smsId));
}
/**
* 新增系统消息
*/
@PreAuthorize("@ss.hasPermi('system:sms:add')")
@PostMapping
@ApiOperation("新增系统消息")
public AjaxResult add(@RequestBody SysSms sysSms)
{
return toAjax(sysSmsService.insertSysSms(sysSms));
}
/**
* 修改系统消息
*/
@PreAuthorize("@ss.hasPermi('system:sms:edit')")
@PutMapping
@ApiOperation("修改系统消息")
public AjaxResult edit(@RequestBody SysSms sysSms)
{
return toAjax(sysSmsService.updateSysSms(sysSms));
}
/**
* 删除系统消息
*/
@PreAuthorize("@ss.hasPermi('system:sms:remove')")
@DeleteMapping("/{smsIds}")
@ApiOperation("删除系统消息")
public AjaxResult remove(@PathVariable Long[] smsIds)
{
return toAjax(sysSmsService.deleteSysSmsBySmsIds(smsIds));
}
}

View File

@@ -81,6 +81,7 @@ public class LogAspect
if (loginUser != null)
{
operLog.setOperName(loginUser.getUsername());
operLog.setDeptId(loginUser.getDeptId());
}
if (e != null)

View File

@@ -18,6 +18,10 @@
<groupId>com.xinda</groupId>
<artifactId>xinda-common</artifactId>
</dependency>
<dependency>
<groupId>com.xinda</groupId>
<artifactId>xinda-system-service</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,32 @@
package com.xinda.itsm.controller;
import com.xinda.common.core.controller.BaseController;
import com.xinda.common.core.domain.R;
import com.xinda.itsm.service.ItsmService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 值班管理Controller
*
* @author kerwincui
* @date 2025-04-23
*/
@RestController
@RequestMapping("/itsm/index")
@Api(tags = "值班管理")
public class ItsmController extends BaseController
{
@Autowired
private ItsmService itsmService;
/**
* 统计登录用户的工单、巡检数量
*/
@GetMapping("/countRepairAndInspection")
public R<Map<String, Object>> countRepairAndInspection() {
return R.ok(itsmService.countRepairAndInspection());
}
}

View File

@@ -0,0 +1,26 @@
package com.xinda.itsm.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
/**
* 工单、巡检数量统计
* @Author cpems
* @Date 2023/11/2 13:16
**/
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class StateCountVo {
/**
* 时间
*/
private String time;
/**
* 已完成数量
*/
private Long finished;
/**
* 未完成数量
*/
private Long unfinished;
}

View File

@@ -0,0 +1,7 @@
package com.xinda.itsm.service;
import java.util.Map;
public interface ItsmService {
public Map<String, Object> countRepairAndInspection();
}

View File

@@ -0,0 +1,120 @@
package com.xinda.itsm.service.impl;
import com.xinda.common.core.domain.entity.SysDictData;
import com.xinda.common.core.domain.entity.SysUser;
import com.xinda.common.utils.DateUtils;
import com.xinda.itsm.domain.InspectionRecord;
import com.xinda.itsm.domain.RepairOrder;
import com.xinda.itsm.domain.enums.InspectionRecordStatus;
import com.xinda.itsm.domain.enums.RepairOrderStatus;
import com.xinda.itsm.domain.vo.StateCountVo;
import com.xinda.itsm.mapper.InspectionRecordMapper;
import com.xinda.itsm.mapper.RepairOrderMapper;
import com.xinda.itsm.service.ItsmService;
import com.xinda.system.mapper.SysDictDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
import static com.xinda.common.utils.SecurityUtils.getLoginUser;
@Service
public class ItsmServiceImpl implements ItsmService {
@Autowired
private RepairOrderMapper repairOrderMapper;
@Autowired
private InspectionRecordMapper inspectionRecordMapper;
@Autowired
private SysDictDataMapper sysDictDataMapper;
@Override
public Map<String, Object> countRepairAndInspection() {
Map<String, Object> result = new HashMap<>();
List<StateCountVo> repairCounts = new ArrayList<>();
List<StateCountVo> inspectionCounts = new ArrayList<>();
// 登录用户的所有工单
SysUser user = getLoginUser().getUser();
RepairOrder repairOrder = new RepairOrder();
repairOrder.setUserId(user.getUserId());
List<RepairOrder> repairs = repairOrderMapper.selectRepairOrderList(repairOrder);
// 登录用户的所有巡检
InspectionRecord inspectionRecord = new InspectionRecord();
inspectionRecord.setUserId(user.getUserId().toString());
List<InspectionRecord> inspections = inspectionRecordMapper.selectInspectionRecordList(inspectionRecord);
// 统计所有状态工单的数量
List<SysDictData> repairStates = sysDictDataMapper.selectDictDataByType("repair_status");
Map<String, Long> repairCount = repairs.stream().collect(Collectors.groupingBy(RepairOrder::getOrderStatus, Collectors.counting()));
for (SysDictData dictData : repairStates) {
Long value = 0L;
if(repairCount.keySet().contains(dictData.getDictValue())) {
value = repairCount.remove(dictData.getDictValue());
}
if(dictData.getDictValue().equals(RepairOrderStatus.CARRIED_OUT.getCode())) {
repairCount.put(RepairOrderStatus.CARRIED_OUT.getInfo(), value);
}
if(dictData.getDictValue().equals(RepairOrderStatus.IN_PROGRESS.getCode())) {
repairCount.put(RepairOrderStatus.IN_PROGRESS.getInfo(), value);
}
if(dictData.getDictValue().equals(RepairOrderStatus.COMPLETED.getCode())) {
repairCount.put(RepairOrderStatus.COMPLETED.getInfo(), value);
}
if(dictData.getDictValue().equals(RepairOrderStatus.CANCELED.getCode())) {
repairCount.put(RepairOrderStatus.CANCELED.getInfo(), value);
}
}
repairCount.put("total", (long) repairs.size());
result.put("repairCount", repairCount);
// 统计所有状态的巡检数量
List<SysDictData> inspectionStates = sysDictDataMapper.selectDictDataByType("inspection_record_status");
Map<String, Long> inspectionCount = inspections.stream().collect(Collectors.groupingBy(InspectionRecord::getInspectionStatus, Collectors.counting()));
for (SysDictData dictData : inspectionStates) {
Long value = 0L;
if(inspectionCount.keySet().contains(dictData.getDictValue())) {
value = inspectionCount.remove(dictData.getDictValue());
}
if(dictData.getDictValue().equals(InspectionRecordStatus.IN_PROGRESS.getCode())) {
inspectionCount.put(RepairOrderStatus.IN_PROGRESS.getInfo(), value);
}
if(dictData.getDictValue().equals(InspectionRecordStatus.COMPLETED.getCode())) {
inspectionCount.put(RepairOrderStatus.COMPLETED.getInfo(), value);
}
}
inspectionCount.put("total", (long) inspections.size());
result.put("inspectionCount", inspectionCount);
Date start = DateUtils.addYears(DateUtils.getNowDate(),-1);
// 查询近12个月工单数量
for (int i = 1; i < 13; i++) {
Date begin = DateUtils.addMonths(start, i);
Date finish = DateUtils.addMonths(start, i + 1);
StateCountVo repairCountVo = new StateCountVo();
long repairTotal = repairs.stream().filter(r->r.getUpdateTime().after(begin) && r.getUpdateTime().before(finish)).count();
long repairCompleted = repairs.stream().filter(r->r.getOrderStatus().equals(RepairOrderStatus.COMPLETED.getCode())
&& r.getUpdateTime().after(begin) && r.getUpdateTime().before(finish)).count();
repairCountVo.setTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM,begin));
repairCountVo.setFinished(repairCompleted);
repairCountVo.setUnfinished(repairTotal-repairCompleted);
repairCounts.add(repairCountVo);
StateCountVo inspectionCountVo = new StateCountVo();
long inspectionTotal = inspections.stream().filter(r->r.getUpdateTime().after(begin) && r.getUpdateTime().before(finish)).count();
long inspectionCompleted = inspections.stream().filter(r->r.getInspectionStatus().equals(InspectionRecordStatus.COMPLETED.getCode())
&& r.getUpdateTime().after(begin) && r.getUpdateTime().before(finish)).count();
inspectionCountVo.setTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM,begin));
inspectionCountVo.setFinished(inspectionCompleted);
inspectionCountVo.setUnfinished(inspectionTotal-inspectionCompleted);
inspectionCounts.add(inspectionCountVo);
}
result.put("repairs",repairCounts);
result.put("inspections", inspectionCounts);
return result;
}
}

View File

@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planTime != null "> and plan_time = #{planTime}</if>
<if test="inspectionTime != null "> and inspection_time = #{inspectionTime}</if>
<if test="inspectionPerson != null and inspectionPerson != ''"> and inspection_person = #{inspectionPerson}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userId != null and userId != ''"> and user_id like concat('%', #{userId}, '%')</if>
<if test="inspectionCycle != null and inspectionCycle != ''"> and inspection_cycle = #{inspectionCycle}</if>
<if test="cycle != null and cycle != ''"> and cycle = #{cycle}</if>
<if test="inspectionStatus != null and inspectionStatus != ''"> and inspection_status = #{inspectionStatus}</if>

View File

@@ -115,4 +115,6 @@ public interface ScadaMapper
Long selectProductByGuid(String guid);
Long selectSceneModelByGuid(String guid);
String selectSerialNumberByGuid(String guid);
}

View File

@@ -80,8 +80,10 @@ public class ScadaServiceImpl implements IScadaService
Long productId = scadaMapper.selectProductByGuid(scada.getGuid());
scadaVO.setProductId(productId);
} else if (ScadaTypeEnum.SCENE_MODEL.getType().equals(scada.getType())) {
Long sceneModelId = scadaMapper.selectSceneModelByGuid(scada.getGuid());
scadaVO.setSceneModelId(sceneModelId);
// Long sceneModelId = scadaMapper.selectSceneModelByGuid(scada.getGuid());
// scadaVO.setSceneModelId(sceneModelId);
String serialNumber = scadaMapper.selectSerialNumberByGuid(scada.getGuid());
scadaVO.setSerialNumber(serialNumber);
}
return scadaVO;
}

View File

@@ -332,6 +332,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and del_flag = '0'
</select>
<select id="selectSerialNumberByGuid" resultType="java.lang.String">
select serial_number
from iot_device
where guid = #{guid}
and del_flag = '0'
</select>
<select id="selectSceneModelByGuid" resultType="java.lang.Long">
select scene_model_id
from scene_model

View File

@@ -161,6 +161,10 @@
<artifactId>commons-jexl3</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.xinda</groupId>
<artifactId>xinda-itsm</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,6 +1,7 @@
package com.xinda.iot.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinda.itsm.domain.RepairOrder;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -57,6 +58,10 @@ public class AlertLog extends BaseEntity
private Long userId;
private Integer enable;
private Long orderId;
private RepairOrder order;
private String deviceName;
private Long deviceId;

View File

@@ -148,4 +148,6 @@ public interface AlertMapper
* @return 设备告警集合
*/
List<AlertSceneSendVO> listByAlertIds(Long sceneId);
List<Long> selectSceneByAlert(Long[] alertIds);
}

View File

@@ -37,6 +37,9 @@ public class ThingsModelDTO extends BaseEntity
/** 标识符,产品下唯一 */
private String identifier;
/** 排序 */
private Integer order;
/** 模型类别1-属性2-功能3-事件) */
private Integer type;

View File

@@ -14,6 +14,8 @@ import com.xinda.iot.domain.Device;
import com.xinda.iot.model.AlertCountVO;
import com.xinda.iot.model.param.DataCenterParam;
import com.xinda.iot.model.DeviceAlertCount;
import com.xinda.itsm.domain.RepairOrder;
import com.xinda.itsm.mapper.RepairOrderMapper;
import com.xinda.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -42,6 +44,9 @@ public class AlertLogServiceImpl implements IAlertLogService {
@Resource
private SysUserMapper sysUserMapper;
@Resource
private RepairOrderMapper repairOrderMapper;
/**
* 查询设备告警
*
@@ -184,6 +189,11 @@ public class AlertLogServiceImpl implements IAlertLogService {
// 1=不需要处理,2=未处理,3=已处理
alertLog.setStatus(3);
}
if (alertLog.getEnable()==1) {
RepairOrder order = alertLog.getOrder();
repairOrderMapper.insertRepairOrder(order);
alertLog.setOrderId(order.getId());
}
return alertLogMapper.updateAlertLog(alertLog);
}

View File

@@ -242,6 +242,9 @@ public class AlertServiceImpl implements IAlertService {
}
alertMapper.deleteAlertSceneByAlertIds(alertIds);
}
// 将 List<Long> 转换为 Long[]
Long[] sceneIds = alertMapper.selectSceneByAlert(alertIds).toArray(new Long[0]);
sceneService.deleteSceneBySceneIds(sceneIds);
// 批量删除告警场景
alertMapper.deleteAlertSceneByAlertIds(alertIds);
// 批量删除告警通知模版配置
@@ -259,6 +262,8 @@ public class AlertServiceImpl implements IAlertService {
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteAlertByAlertId(Long alertId) {
Long[] sceneIds = alertMapper.selectSceneByAlert(new Long[]{alertId}).toArray(new Long[0]);
sceneService.deleteSceneBySceneIds(sceneIds);
// 批量删除告警场景
alertMapper.deleteAlertSceneByAlertIds(new Long[]{alertId});
// 批量删除告警通知模版配置

View File

@@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userId" column="user_id"/>
<result property="sceneId" column="scene_id"/>
<result property="sceneName" column="scene_name"/>
<result property="enable" column="enable"/>
<result property="orderId" column="order_id"/>
</resultMap>
<resultMap type="com.xinda.iot.model.DeviceAlertCount" id="DeviceAlertCount">
@@ -34,11 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectAlertLogVo">
select alert_log_id, alert_name, alert_level, status, product_id, detail, serial_number, create_by, create_time, remark, device_name, user_id from iot_alert_log
select alert_log_id, alert_name, alert_level, status, product_id, detail, serial_number, create_by, create_time, remark, device_name, user_id,enable,order_id from iot_alert_log
</sql>
<select id="selectAlertLogList" parameterType="com.xinda.iot.domain.AlertLog" resultMap="AlertLogResult">
select distinct al.alert_log_id, al.alert_name, al.alert_level, al.status, al.product_id, al.detail, al.serial_number, al.create_time, al.remark, al.device_name, al.user_id
select distinct al.alert_log_id, al.alert_name, al.alert_level, al.status, al.product_id, al.detail, al.serial_number, al.create_time, al.remark, al.device_name, al.user_id,al.enable,al.order_id
from iot_alert_log al
<where>
<if test="alertName != null and alertName != ''"> and al.alert_name like concat('%', #{alertName}, '%')</if>
@@ -55,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAlertLogListAndScene" parameterType="com.xinda.iot.domain.AlertLog" resultMap="AlertLogResult">
select al.alert_log_id, al.alert_name, al.alert_level, al.status, al.product_id, al.detail,
al.serial_number, al.create_time, al.remark, al.device_name, al.user_id,
al.serial_number, al.create_time, al.remark, al.device_name, al.user_id,al.enable,al.order_id,
s.scene_id,s.scene_name
from iot_alert_log al
left join iot_scene s on CAST(COALESCE(NULLIF(TRIM(al.create_by), ''), 0) AS signed) = s.scene_id
@@ -204,6 +206,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">#{remark},</if>
<if test="userId != null">#{userId},</if>
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
</trim>
</insert>
@@ -238,6 +241,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="enable != null">enable =#{enable},</if>
<if test="orderId != null">orderId =#{orderId},</if>
</trim>
where alert_log_id = #{alertLogId}
</update>

View File

@@ -221,4 +221,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="selectSceneByAlert" resultType="Long">
select scene_id
from iot_alert_scene
where alert_id in
<foreach item="alertId" collection="array" open="(" separator="," close=")">
#{alertId}
</foreach>
</select>
</mapper>

View File

@@ -750,17 +750,17 @@
(
select count(product_id)
from iot_product
<!-- <where>-->
<!-- <if test="deptId != null and deptId != 0">-->
<!-- and d.user_id in (SELECT-->
<!-- u.user_id-->
<!-- FROM-->
<!-- sys_user u-->
<!-- WHERE-->
<!-- u.dept_id IN ( SELECT dept_id FROM sys_dept WHERE find_in_set(#{deptId}, ancestors) OR dept_id = #{deptId}))-->
<!-- </if>-->
<!-- </where>-->
from iot_product p
<where>
<if test="deptId != null and deptId != 0">
and p.tenant_id in (SELECT
u.user_id
FROM
sys_user u
WHERE
u.dept_id IN ( SELECT dept_id FROM sys_dept WHERE find_in_set(#{deptId}, ancestors) OR dept_id = #{deptId}))
</if>
</where>
) as productCount,
<!-- &lt;!&ndash;告警设备数量&ndash;&gt;-->

View File

@@ -24,6 +24,8 @@ public class SysNotice extends BaseEntity
@ApiModelProperty("公告ID")
private Long noticeId;
private Long deptId;
/** 公告标题 */
@ApiModelProperty("公告标题")
private String noticeTitle;
@@ -93,6 +95,14 @@ public class SysNotice extends BaseEntity
return status;
}
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@@ -57,6 +57,8 @@ public class SysOperLog extends BaseEntity
@Excel(name = "操作人员")
private String operName;
private Long DeptId;
/** 部门名称 */
@ApiModelProperty("部门名称")
@Excel(name = "部门名称")
@@ -272,4 +274,12 @@ public class SysOperLog extends BaseEntity
{
this.operTime = operTime;
}
public Long getDeptId() {
return DeptId;
}
public void setDeptId(Long deptId) {
DeptId = deptId;
}
}

View File

@@ -0,0 +1,39 @@
package com.xinda.system.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.xinda.common.annotation.Excel;
import com.xinda.common.core.domain.BaseEntity;
/**
* 系统消息对象 sys_sms
*
* @author kerwincui
* @date 2025-05-08
*/
@ApiModel(value = "SysSms",description = "系统消息 sys_sms")
@Data
public class SysSms extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 公告ID */
private Long smsId;
/** 公告标题 */
@Excel(name = "公告标题")
@ApiModelProperty("公告标题")
private String smsTitle;
/** 公告内容 */
@Excel(name = "公告内容")
@ApiModelProperty("公告内容")
private String smsContent;
/** 公告状态0正常 1关闭 */
private String status;
}

View File

@@ -153,4 +153,6 @@ public interface SysDeptMapper
* @return java.lang.Long
*/
Long selectRoleIdByDeptId(Long deptId);
List<SysDept> selectOrgList();
}

View File

@@ -0,0 +1,61 @@
package com.xinda.system.mapper;
import java.util.List;
import com.xinda.system.domain.SysSms;
/**
* 系统消息Mapper接口
*
* @author kerwincui
* @date 2025-05-08
*/
public interface SysSmsMapper
{
/**
* 查询系统消息
*
* @param smsId 系统消息主键
* @return 系统消息
*/
public SysSms selectSysSmsBySmsId(Long smsId);
/**
* 查询系统消息列表
*
* @param sysSms 系统消息
* @return 系统消息集合
*/
public List<SysSms> selectSysSmsList(SysSms sysSms);
/**
* 新增系统消息
*
* @param sysSms 系统消息
* @return 结果
*/
public int insertSysSms(SysSms sysSms);
/**
* 修改系统消息
*
* @param sysSms 系统消息
* @return 结果
*/
public int updateSysSms(SysSms sysSms);
/**
* 删除系统消息
*
* @param smsId 系统消息主键
* @return 结果
*/
public int deleteSysSmsBySmsId(Long smsId);
/**
* 批量删除系统消息
*
* @param smsIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteSysSmsBySmsIds(Long[] smsIds);
}

View File

@@ -155,4 +155,6 @@ public interface ISysDeptService
Long selectRoleIdByDeptId(Long deptId);
public List<TreeProSelect> selectDeptProTreeList(SysDept dept);
List<SysDept> selectOrgList();
}

View File

@@ -0,0 +1,61 @@
package com.xinda.system.service;
import java.util.List;
import com.xinda.system.domain.SysSms;
/**
* 系统消息Service接口
*
* @author kerwincui
* @date 2025-05-08
*/
public interface ISysSmsService
{
/**
* 查询系统消息
*
* @param smsId 系统消息主键
* @return 系统消息
*/
public SysSms selectSysSmsBySmsId(Long smsId);
/**
* 查询系统消息列表
*
* @param sysSms 系统消息
* @return 系统消息集合
*/
public List<SysSms> selectSysSmsList(SysSms sysSms);
/**
* 新增系统消息
*
* @param sysSms 系统消息
* @return 结果
*/
public int insertSysSms(SysSms sysSms);
/**
* 修改系统消息
*
* @param sysSms 系统消息
* @return 结果
*/
public int updateSysSms(SysSms sysSms);
/**
* 批量删除系统消息
*
* @param smsIds 需要删除的系统消息主键集合
* @return 结果
*/
public int deleteSysSmsBySmsIds(Long[] smsIds);
/**
* 删除系统消息信息
*
* @param smsId 系统消息主键
* @return 结果
*/
public int deleteSysSmsBySmsId(Long smsId);
}

View File

@@ -3,6 +3,7 @@ package com.xinda.system.service;
import com.xinda.common.core.domain.entity.SysUser;
import java.util.List;
import java.util.Map;
/**
* 用户 业务层
@@ -254,4 +255,5 @@ public interface ISysUserService
* @return
*/
List<SysUser> selectByDeptId();
}

View File

@@ -50,6 +50,13 @@ public class SysDeptServiceImpl implements ISysDeptService
@Resource
private SysRoleDeptMapper sysRoleDeptMapper;
@Override
public List<SysDept> selectOrgList() {
List<SysDept> depts = deptMapper.selectOrgList();
return depts;
}
/**
* 查询部门管理数据
*

View File

@@ -0,0 +1,96 @@
package com.xinda.system.service.impl;
import java.util.List;
import com.xinda.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xinda.system.mapper.SysSmsMapper;
import com.xinda.system.domain.SysSms;
import com.xinda.system.service.ISysSmsService;
/**
* 系统消息Service业务层处理
*
* @author kerwincui
* @date 2025-05-08
*/
@Service
public class SysSmsServiceImpl implements ISysSmsService
{
@Autowired
private SysSmsMapper sysSmsMapper;
/**
* 查询系统消息
*
* @param smsId 系统消息主键
* @return 系统消息
*/
@Override
public SysSms selectSysSmsBySmsId(Long smsId)
{
return sysSmsMapper.selectSysSmsBySmsId(smsId);
}
/**
* 查询系统消息列表
*
* @param sysSms 系统消息
* @return 系统消息
*/
@Override
public List<SysSms> selectSysSmsList(SysSms sysSms)
{
return sysSmsMapper.selectSysSmsList(sysSms);
}
/**
* 新增系统消息
*
* @param sysSms 系统消息
* @return 结果
*/
@Override
public int insertSysSms(SysSms sysSms)
{
sysSms.setCreateTime(DateUtils.getNowDate());
return sysSmsMapper.insertSysSms(sysSms);
}
/**
* 修改系统消息
*
* @param sysSms 系统消息
* @return 结果
*/
@Override
public int updateSysSms(SysSms sysSms)
{
sysSms.setUpdateTime(DateUtils.getNowDate());
return sysSmsMapper.updateSysSms(sysSms);
}
/**
* 批量删除系统消息
*
* @param smsIds 需要删除的系统消息主键
* @return 结果
*/
@Override
public int deleteSysSmsBySmsIds(Long[] smsIds)
{
return sysSmsMapper.deleteSysSmsBySmsIds(smsIds);
}
/**
* 删除系统消息信息
*
* @param smsId 系统消息主键
* @return 结果
*/
@Override
public int deleteSysSmsBySmsId(Long smsId)
{
return sysSmsMapper.deleteSysSmsBySmsId(smsId);
}
}

View File

@@ -1,6 +1,7 @@
package com.xinda.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xinda.common.annotation.DataScope;
import com.xinda.common.constant.UserConstants;
import com.xinda.common.core.domain.entity.SysDept;
@@ -34,8 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.validation.Validator;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import static com.xinda.common.utils.SecurityUtils.getLoginUser;
@@ -72,6 +72,7 @@ public class SysUserServiceImpl implements ISysUserService
@Autowired
protected Validator validator;
/**
* 根据条件分页查询用户列表
*

View File

@@ -50,6 +50,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by d.parent_id, d.order_num
</select>
<select id="selectOrgList" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0' AND dept_type = '1'
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from sys_dept d

View File

@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SysNotice" id="SysNoticeResult">
<result property="noticeId" column="notice_id" />
<result property="deptId" column="dept_id" />
<result property="noticeTitle" column="notice_title" />
<result property="noticeType" column="notice_type" />
<result property="noticeContent" column="notice_content" />
@@ -18,32 +19,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectNoticeVo">
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
from sys_notice
select n.notice_id, n.dept_id, n.notice_title, n.notice_type, cast(n.notice_content as char) as notice_content, n.status, n.create_by, n.create_time, n.update_by, n.update_time, n.remark
from sys_notice n
</sql>
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
where notice_id = #{noticeId}
where n.notice_id = #{noticeId}
</select>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="deptId != null and deptId != 0 ">
and
( n.dept_id in (SELECT de.dept_id FROM sys_dept de
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
)
</if>
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
AND n.notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
AND n.notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
AND n.create_by like concat('%', #{createBy}, '%')
</if>
</where>
</select>
<insert id="insertNotice" parameterType="SysNotice">
insert into sys_notice (
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
@@ -52,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
@@ -65,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateNotice" parameterType="SysNotice">
update sys_notice
<set>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>

View File

@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="requestMethod" column="request_method" />
<result property="operatorType" column="operator_type" />
<result property="operName" column="oper_name" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="operUrl" column="oper_url" />
<result property="operIp" column="oper_ip" />
@@ -24,13 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectOperLogVo">
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_id, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time
from sys_oper_log
</sql>
<insert id="insertOperlog" parameterType="SysOperLog">
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time)
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate())
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name,dept_id, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time)
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptId},#{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate())
</insert>
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
@@ -54,6 +55,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%')
</if>
<if test="deptId != null and deptId != 0 ">
and
( dept_id in (SELECT de.dept_id FROM sys_dept de
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
)
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(oper_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinda.system.mapper.SysSmsMapper">
<resultMap type="SysSms" id="SysSmsResult">
<result property="smsId" column="sms_id" />
<result property="smsTitle" column="sms_title" />
<result property="smsContent" column="sms_content" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSysSmsVo">
select sms_id, sms_title, sms_content, status, create_by, create_time, update_by, update_time, remark from sys_sms
</sql>
<select id="selectSysSmsList" parameterType="SysSms" resultMap="SysSmsResult">
<include refid="selectSysSmsVo"/>
<where>
<if test="smsTitle != null and smsTitle != ''"> and sms_title = #{smsTitle}</if>
<if test="smsContent != null and smsContent != ''"> and sms_content = #{smsContent}</if>
</where>
</select>
<select id="selectSysSmsBySmsId" parameterType="Long" resultMap="SysSmsResult">
<include refid="selectSysSmsVo"/>
where sms_id = #{smsId}
</select>
<insert id="insertSysSms" parameterType="SysSms" useGeneratedKeys="true" keyProperty="smsId">
insert into sys_sms
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="smsTitle != null and smsTitle != ''">sms_title,</if>
<if test="smsContent != null">sms_content,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="smsTitle != null and smsTitle != ''">#{smsTitle},</if>
<if test="smsContent != null">#{smsContent},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysSms" parameterType="SysSms">
update sys_sms
<trim prefix="SET" suffixOverrides=",">
<if test="smsTitle != null and smsTitle != ''">sms_title = #{smsTitle},</if>
<if test="smsContent != null">sms_content = #{smsContent},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where sms_id = #{smsId}
</update>
<delete id="deleteSysSmsBySmsId" parameterType="Long">
delete from sys_sms where sms_id = #{smsId}
</delete>
<delete id="deleteSysSmsBySmsIds" parameterType="String">
delete from sys_sms where sms_id in
<foreach item="smsId" collection="array" open="(" separator="," close=")">
#{smsId}
</foreach>
</delete>
</mapper>