线路工程管理
This commit is contained in:
parent
1e72c39e3c
commit
5bc9c1bdba
|
|
@ -54,6 +54,18 @@ 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
|
||||
|
|
|
|||
|
|
@ -10,4 +10,8 @@ public interface TbProjectMapper {
|
|||
TbProjectVo getTbProjectById(TbProjectVo data);
|
||||
|
||||
void UpdateTbProject(TbProjectVo data);
|
||||
|
||||
void addTbProject(TbProjectVo data);
|
||||
|
||||
TbProjectVo getTbProjectByProName(TbProjectVo data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,11 @@ public interface TbProjectService {
|
|||
* @return
|
||||
*/
|
||||
ServerResponse UpdateTbProject(TbProjectVo data);
|
||||
|
||||
/**
|
||||
* 线路工程管理-新增
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
ServerResponse addTbProject(TbProjectVo data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,14 @@ 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;
|
||||
|
||||
|
|
@ -69,13 +71,40 @@ public class TbProjectServiceImpl implements TbProjectService {
|
|||
@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();
|
||||
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("新增失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,39 @@
|
|||
<!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=",">
|
||||
|
|
@ -22,7 +55,7 @@
|
|||
</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
|
||||
|
|
@ -41,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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue