Merge remote-tracking branch 'origin/master'

This commit is contained in:
lSun 2025-04-25 10:33:18 +08:00
commit 3a9b4bd239
11 changed files with 231 additions and 10 deletions

View File

@ -54,5 +54,29 @@ public class TbProjectController {
return tbProjectService.getTbProjectById(dto.getData());
}
/**
* 线路工程管理-新增
* @param dto
* @return
*/
@PostMapping(value = "addTbProject")
@DecryptAndVerify(decryptedClass = TbProjectVo.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-线路工程管理", operation = "新增", operDesc = "系统级事件",operType="查询")
public ServerResponse addTbProject(EncryptedReq<TbProjectVo> dto) {
return tbProjectService.addTbProject(dto.getData());
}
/**
* 线路工程管理-修改
* @param dto
* @return
*/
@PostMapping(value = "UpdateTbProject")
@DecryptAndVerify(decryptedClass = TbProjectVo.class)//加解密统一管理
@LogAnnotation(operModul = "基础管理-线路工程管理", operation = "修改", operDesc = "系统级事件",operType="查询")
public ServerResponse UpdateTbProject(EncryptedReq<TbProjectVo> dto) {
return tbProjectService.UpdateTbProject(dto.getData());
}
}

View File

@ -8,4 +8,10 @@ public interface TbProjectMapper {
List<TbProjectVo> getTbProjectList(TbProjectVo data);
TbProjectVo getTbProjectById(TbProjectVo data);
void UpdateTbProject(TbProjectVo data);
void addTbProject(TbProjectVo data);
TbProjectVo getTbProjectByProName(TbProjectVo data);
}

View File

@ -17,4 +17,18 @@ public interface TbProjectService {
* @return
*/
ServerResponse getTbProjectById(TbProjectVo data);
/**
* 线路工程管理-修改
* @param data
* @return
*/
ServerResponse UpdateTbProject(TbProjectVo data);
/**
* 线路工程管理-新增
* @param data
* @return
*/
ServerResponse addTbProject(TbProjectVo data);
}

View File

@ -5,12 +5,17 @@ import com.bonus.digitalSignage.basic.dao.TbProjectMapper;
import com.bonus.digitalSignage.basic.service.TbProjectService;
import com.bonus.digitalSignage.basic.vo.TbProjectVo;
import com.bonus.digitalSignage.utils.ServerResponse;
import com.bonus.digitalSignage.utils.UserUtil;
import com.bonus.digitalSignage.webResult.StringUtils;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
/**
* @author 马三炮
@ -30,14 +35,76 @@ public class TbProjectServiceImpl implements TbProjectService {
*/
@Override
public ServerResponse getTbProjectList(TbProjectVo data) {
try {
List<TbProjectVo> tbProjectVoList = tbProjectMapper.getTbProjectList(data);
PageInfo<TbProjectVo> pageInfo = new PageInfo<>(tbProjectVoList);
return ServerResponse.createSuccessPage(pageInfo, data.getPageNum(), data.getPageSize());
} catch (Exception e) {
log.error(e.toString(), e);
return ServerResponse.createErroe("查询列表失败");
}
}
/**
* 线路工程管理-查询详情
* @param data
* @return
*/
@Override
public ServerResponse getTbProjectById(TbProjectVo data) {
try {
TbProjectVo tbProject = tbProjectMapper.getTbProjectById(data);
return ServerResponse.createSuccess(tbProject);
} catch (Exception e) {
log.error(e.toString(), e);
return ServerResponse.createErroe("查询详情失败");
}
}
/**
* 线路工程管理-修改
* @param data
* @return
*/
@Override
public ServerResponse UpdateTbProject(TbProjectVo data) {
try {
TbProjectVo tbProjectVo = tbProjectMapper.getTbProjectByProName(data);
if (StringUtils.isNotNull(tbProjectVo) && data.getId()!=tbProjectVo.getId()){
return ServerResponse.createErroe("该项目部下以存在该工程");
}
Long userId = UserUtil.getLoginUser().getId();
data.setUpdateUserId(userId);
tbProjectMapper.UpdateTbProject(data);
return ServerResponse.createSuccess("修改成功");
} catch (Exception e) {
log.error(e.toString(), e);
return ServerResponse.createErroe("修改失败");
}
}
/**
* 线路工程管理-新增
* @param data
* @return
*/
@Override
public ServerResponse addTbProject(TbProjectVo data) {
try {
TbProjectVo tbProjectVo = tbProjectMapper.getTbProjectByProName(data);
if (StringUtils.isNotNull(tbProjectVo)){
return ServerResponse.createErroe("该项目部下以存在该工程");
}
Long userId = UserUtil.getLoginUser().getId();
data.setCreateUserId(userId);
data.setCreateTime(new Date());
tbProjectMapper.addTbProject(data);
return ServerResponse.createSuccess();
} catch (Exception e) {
log.error(e.toString(), e);
return ServerResponse.createErroe("新增失败");
}
}
}

View File

@ -89,12 +89,12 @@ public class TbProjectVo {
/**
* 创建人
*/
private Date createUserId;
private Long createUserId;
/**
* 修改人
*/
private Date updateUserId;
private Long updateUserId;
private int pageNum = 1;
private int pageSize = 10;

View File

@ -128,4 +128,25 @@ public class DistinctController {
public ServerResponse isRepeat(EncryptedReq<RepeatEntity> vo) {
return service.isRepeat(vo);
}
/**
* @param dto
* @return ServerResponse
* @description 查询字典列表
* @author cwchen
* @date 2023/11/1 15:06
*/
@PostMapping(value = "getDistinctListByParentCode")
@DecryptAndVerify(decryptedClass = DistinctDto.class)//加解密统一管理
@LogAnnotation(operModul = "系统管理-字典管理", operation = "查询字典列表", operDesc = "业务级事件", operType = "查询")
@PreAuthorize("@pms.hasPermission('sys:dict:query')")
public ServerResponse getDistinctListByParentCode(EncryptedReq<DistinctDto> dto) {
List<DistinctVo> list = new ArrayList();
try {
list = service.getDistinctListByParentCode(dto.getData());
} catch (Exception e) {
log.error("字典列表", e);
}
return ServerResponse.createSuccess(list);
}
}

View File

@ -64,4 +64,6 @@ public interface DistinctDao {
* @date 2023/10/13 15:18
*/
int isHasChild(String id);
List<DistinctVo> getDistinctListByParentCode(DistinctDto data);
}

View File

@ -57,4 +57,14 @@ public interface DistinctService {
* @date 2023/10/13 15:09
*/
ServerResponse getDistinctById(DistinctVo data);
/**
* @param data
* @return ServerResponse
* @description 查询字典列表
* @author cwchen
* @date 2023/11/1 15:06
*/
List<DistinctVo> getDistinctListByParentCode(DistinctDto data);
}

View File

@ -137,6 +137,11 @@ public class DistinctServiceImpl implements DistinctService {
return ServerResponse.createSuccess("获取成功", vo);
}
@Override
public List<DistinctVo> getDistinctListByParentCode(DistinctDto data) {
return mapper.getDistinctListByParentCode(data);
}
@Override
public ServerResponse isRepeat(EncryptedReq<RepeatEntity> vo) {
try {

View File

@ -2,9 +2,60 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.digitalSignage.basic.dao.TbProjectMapper">
<insert id="addTbProject">
insert into tb_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="departId != null ">depart_id,</if>
<if test="proName != null ">pro_name,</if>
<if test="voltageLevel != null ">voltage_level,</if>
<if test="lineLength != null ">line_length,</if>
<if test="planStartTime != null">plan_start_time,</if>
<if test="planEndTime != null ">plan_end_time,</if>
<if test="lon != null ">lon,</if>
<if test="lat != null ">lat,</if>
<if test="address != null ">address,</if>
<if test="proStatus != null ">pro_status,</if>
<if test="createTime != null">create_time,</if>
<if test="createUser != null ">create_user,</if>
is_active
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="departId != null ">#{departId},</if>
<if test="proName != null ">#{proName},</if>
<if test="voltageLevel != null ">#{voltageLevel},</if>
<if test="lineLength != null ">#{lineLength},</if>
<if test="planStartTime != null ">#{planStartTime},</if>
<if test="planEndTime != null ">#{planEndTime},</if>
<if test="lon != null ">#{lon},</if>
<if test="lat != null ">#{lat},</if>
<if test="address != null ">#{address},</if>
<if test="proStatus != null ">#{proStatus},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="createUser != null ">#{createUser},</if>
1
</trim>
</insert>
<update id="UpdateTbProject">
update tb_project
<trim prefix="SET" suffixOverrides=",">
<if test="departId != null">depart_id = #{departId},</if>
<if test="proName != null">pro_name = #{proName},</if>
<if test="voltageLevel != null">voltage_level = #{voltageLevel},</if>
<if test="lineLength != null">line_length = #{lineLength},</if>
<if test="planStartTime != null">plan_start_time = #{planStartTime},</if>
<if test="planEndTime != null">plan_end_time = #{planEndTime},</if>
<if test="lon != null">lon = #{lon},</if>
<if test="lat != null">lat = #{lat},</if>
<if test="address != null">address = #{address},</if>
<if test="proStatus != null">pro_status = #{proStatus},</if>
<if test="updateUserId != null">update_user_id = #{updateUserId},</if>
update_time = now()
</trim>
where id = #{id}
</update>
<select id="getTbProjectList" resultType="com.bonus.digitalSignage.basic.vo.TbProjectVo">
select tp.pro_name as proName,A.dict_name as voltageLevel,tp.line_length as lineLength,
select tp.id as id,tp.pro_name as proName,A.dict_name as voltageLevel,tp.line_length as lineLength,
tp.plan_start_time as planStartTime,tp.plan_end_time as planEndTime,tp.lon as lon,tp.lat as lat,
tp.address as address,B.dict_name as pro_status
from tb_project tp
@ -23,9 +74,15 @@
where tp.is_active = '1'
</select>
<select id="getTbProjectById" resultType="com.bonus.digitalSignage.basic.vo.TbProjectVo">
select tp.pro_name as proName,tp.voltage_level as voltageLevel,tp.line_length as lineLength,
select tp.id as id,tp.pro_name as proName,tp.voltage_level as voltageLevel,tp.line_length as lineLength,
tp.plan_start_time as planStartTime,tp.plan_end_time as planEndTime,tp.lon as lon,tp.lat as lat,
tp.address as address,B.pro_status as pro_status
from tb_project tp where id = #{id}
</select>
<select id="getTbProjectByProName" resultType="com.bonus.digitalSignage.basic.vo.TbProjectVo">
select tp.id as id,tp.pro_name as proName,tp.voltage_level as voltageLevel,tp.line_length as lineLength,
tp.plan_start_time as planStartTime,tp.plan_end_time as planEndTime,tp.lon as lon,tp.lat as lat,
tp.address as address,B.pro_status as pro_status
from tb_project tp where pro_name = #{proName} and is_active ='1'
</select>
</mapper>

View File

@ -66,4 +66,19 @@
WHERE p_id = #{id}
AND del_flag = 0
</select>
<select id="getDistinctListByParentCode" resultType="com.bonus.digitalSignage.system.vo.DistinctVo">
SELECT sd.id,
sd.dict_code AS dictCode,
sd.dict_name AS dictName,
sd.dict_value AS dictValue,
sd.p_id AS parentId,
sd.dict_sort AS dictSort
FROM sys_distinct sd
left join sys_distinct sd2 on sd.p_id = sd2.id
WHERE sd.del_flag = 0 and sd2.dict_code = #{dictCode}
<if test="keyWord!=null and keyWord!=''">
AND INSTR(sd.dict_name,#{keyWord}) > 0
</if>
ORDER BY sd.dict_sort
</select>
</mapper>