Commit d190a75e authored by 王夏晖's avatar 王夏晖

修改设备类型及设备列表的查询,关联模板一起查出来

parent 55598f3f
...@@ -23,10 +23,9 @@ public interface BusDeviceRepository extends BaseMapper<BusDevice> { ...@@ -23,10 +23,9 @@ public interface BusDeviceRepository extends BaseMapper<BusDevice> {
* *
*/ */
@Select("<script>select * from bus_device where 1=1 and pro_id = #{proId} " + @Select("<script>select * from bus_device where 1=1 and pro_id = #{proId} " +
"<if test=''></if>" "<if test='devTpId != null'> and dev_tp_id = #{devTpId}</if>"
+ "</script>") + "</script>")
@ResultMap(value = "BaseResultMap" ) List<Map<String,Object>> queryBusDevices(BusDevice busDevice);
List<BusDevice> queryBusDevices(BusDevice busDevice);
/* /*
通过项目id与子系统id获取子系统中的所有设备 通过项目id与子系统id获取子系统中的所有设备
......
...@@ -6,6 +6,7 @@ import org.rcisoft.core.model.PersistModel; ...@@ -6,6 +6,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by on 2018-4-12 15:33:23. * Created by on 2018-4-12 15:33:23.
...@@ -45,7 +46,7 @@ public interface BusDeviceService { ...@@ -45,7 +46,7 @@ public interface BusDeviceService {
* @param busDevice * @param busDevice
* @return * @return
*/ */
List<BusDevice> findAllByPagination(PageUtil<BusDevice> paginationUtility, List<Map<String,Object>> findAllByPagination(PageUtil<BusDevice> paginationUtility,
BusDevice busDevice); BusDevice busDevice);
/** /**
......
...@@ -4,6 +4,7 @@ import org.rcisoft.business.device.assets.dao.BusDeviceRepository; ...@@ -4,6 +4,7 @@ import org.rcisoft.business.device.assets.dao.BusDeviceRepository;
import org.rcisoft.business.device.assets.service.BusDeviceService; import org.rcisoft.business.device.assets.service.BusDeviceService;
import org.rcisoft.business.device.assets.vo.DeviceAssetStatisticVo; import org.rcisoft.business.device.assets.vo.DeviceAssetStatisticVo;
import org.rcisoft.business.manage.entity.BusDevicetpParam; import org.rcisoft.business.manage.entity.BusDevicetpParam;
import org.rcisoft.business.manage.service.BusDeviceParamService;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.device.assets.entity.BusDevice; import org.rcisoft.business.device.assets.entity.BusDevice;
...@@ -33,6 +34,8 @@ public class BusDeviceServiceImpl implements BusDeviceService { ...@@ -33,6 +34,8 @@ public class BusDeviceServiceImpl implements BusDeviceService {
@Autowired @Autowired
private BusDeviceRepository busDeviceRepository; private BusDeviceRepository busDeviceRepository;
@Autowired
private BusDeviceParamService busDeviceParamService;
/** /**
...@@ -105,11 +108,15 @@ public class BusDeviceServiceImpl implements BusDeviceService { ...@@ -105,11 +108,15 @@ public class BusDeviceServiceImpl implements BusDeviceService {
* @return * @return
*/ */
@Override @Override
public List<BusDevice> findAllByPagination(PageUtil<BusDevice> paginationUtility, public List<Map<String,Object>> findAllByPagination(PageUtil<BusDevice> paginationUtility,
BusDevice busDevice){ BusDevice busDevice){
//避免查出所有设备 //避免查出所有设备
if(busDevice.getProId()!=null && !busDevice.getProId().equals("")){ if(busDevice.getProId()!=null && !busDevice.getProId().equals("")){
return busDeviceRepository.queryBusDevices(busDevice); List<Map<String,Object>> list = busDeviceRepository.queryBusDevices(busDevice);
for(Map<String,Object> tmap : list){
tmap.put("paramList",busDeviceParamService.findByDev(tmap.get("DEV_NUM").toString(),tmap.get("PRO_ID").toString()));
}
return list;
} }
return null; return null;
} }
......
...@@ -35,10 +35,9 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan> ...@@ -35,10 +35,9 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan>
private BusEnergyPlanService busEnergyPlanServiceImpl; private BusEnergyPlanService busEnergyPlanServiceImpl;
@ApiOperation(value="添加", notes="添加") @ApiOperation(value="添加能耗计划", notes="添加能耗计划")
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result add(@Valid EnergyPlanList energyPlanlist) throws Exception{ public Result add(@RequestBody EnergyPlanList energyPlanlist) throws Exception{
List<EnergyPlanVo> epList = energyPlanlist.getEnergyPlanVoList(); List<EnergyPlanVo> epList = energyPlanlist.getEnergyPlanVoList();
for(EnergyPlanVo energyPlanVo : epList){ for(EnergyPlanVo energyPlanVo : epList){
busEnergyPlanServiceImpl.save(energyPlanVo); busEnergyPlanServiceImpl.save(energyPlanVo);
...@@ -49,43 +48,14 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan> ...@@ -49,43 +48,14 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan>
null); null);
} }
@ApiOperation(value="逻辑删除", notes="逻辑删除") @ApiOperation(value="删除设备某一天的能耗计划", notes="删除设备某一天的能耗计划")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")}) @DeleteMapping("/delete")
@DeleteMapping("/delete/{id:\\w+}") public Result delete(@RequestParam String devNum,@RequestParam String day) {
public Result delete(@PathVariable String id) { PersistModel data = busEnergyPlanServiceImpl.remove(devNum,day);
BusEnergyPlan busEnergyPlan = new BusEnergyPlan();
PersistModel data = busEnergyPlanServiceImpl.remove(busEnergyPlan);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
id); null);
}
@ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/update/{id:\\w+}")
public Result update(@Valid BusEnergyPlan busEnergyPlan, BindingResult bindingResult) {
PersistModel data = busEnergyPlanServiceImpl.merge(busEnergyPlan);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
busEnergyPlan);
}
@ApiOperation(value="查看单 ", notes="查看单 ")
@GetMapping("/detail/{id:\\w+}")
public Result detail(@PathVariable int id) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
busEnergyPlanServiceImpl.findById(id));
}
@ApiOperation(value="查看 集合", notes="查看 集合")
@GetMapping(value = "/queryBusEnergyPlanByPagination")
public GridModel listByPagination(BusEnergyPlan busEnergyPlan) {
busEnergyPlanServiceImpl.findAllByPagination(getPaginationUtility(), busEnergyPlan);
return getGridModelResponse();
} }
@ApiOperation(value="根据项目查询某一天计划总能耗", notes="根据项目查询某一天计划总能耗") @ApiOperation(value="根据项目查询某一天计划总能耗", notes="根据项目查询某一天计划总能耗")
......
...@@ -148,5 +148,13 @@ public interface BusEnergyPlanRepository extends BaseMapper<BusEnergyPlan> { ...@@ -148,5 +148,13 @@ public interface BusEnergyPlanRepository extends BaseMapper<BusEnergyPlan> {
"where PRO_ID = #{pro_id} and DATE_FORMAT(tm,'%Y-%m-%d') = #{day}" + "where PRO_ID = #{pro_id} and DATE_FORMAT(tm,'%Y-%m-%d') = #{day}" +
"</script>") "</script>")
List<Map<String,Object>> querySensor(Map<String,Object> map); List<Map<String,Object>> querySensor(Map<String,Object> map);
/**
* 根据设备编号和日期删除某一天该设备的用能计划
* @param map
* @return
*/
@Select("<script>delete from bus_energy_plan where dev_num = #{dev_num} and DATE_FORMAT(tm,'%Y-%m-%d') = #{day}</script>")
void deleteEnergyPlanDay(Map<String,Object> map);
} }
...@@ -5,6 +5,7 @@ import org.rcisoft.business.mainte.energyplan.entity.BusEnergyPlan; ...@@ -5,6 +5,7 @@ import org.rcisoft.business.mainte.energyplan.entity.BusEnergyPlan;
import org.rcisoft.business.mainte.energyplan.vo.EnergyPlanVo; import org.rcisoft.business.mainte.energyplan.vo.EnergyPlanVo;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -22,33 +23,11 @@ public interface BusEnergyPlanService { ...@@ -22,33 +23,11 @@ public interface BusEnergyPlanService {
PersistModel save(EnergyPlanVo energyPlan)throws Exception; PersistModel save(EnergyPlanVo energyPlan)throws Exception;
/** /**
* 逻辑删除 * 删除能耗计划
* @param busEnergyPlan
* @return * @return
*/ */
PersistModel remove(BusEnergyPlan busEnergyPlan); PersistModel remove(String devNum,String day);
/**
* 修改
* @param busEnergyPlan
* @return
*/
PersistModel merge(BusEnergyPlan busEnergyPlan);
/**
* 根据id查询
* @param id
* @return
*/
BusEnergyPlan findById(int id);
/**
* 分页查询
* @param busEnergyPlan
* @return
*/
List<BusEnergyPlan> findAllByPagination(PageUtil<BusEnergyPlan> paginationUtility,
BusEnergyPlan busEnergyPlan);
/** /**
* 根据项目查询某一天的电、气的总能耗 * 根据项目查询某一天的电、气的总能耗
......
...@@ -25,6 +25,7 @@ import java.text.SimpleDateFormat; ...@@ -25,6 +25,7 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import tk.mybatis.mapper.entity.Example;
/** /**
* Created by on 2018-4-17 17:47:37. * Created by on 2018-4-17 17:47:37.
...@@ -115,46 +116,24 @@ public class BusEnergyPlanServiceImpl implements BusEnergyPlanService { ...@@ -115,46 +116,24 @@ public class BusEnergyPlanServiceImpl implements BusEnergyPlanService {
/** /**
* 逻辑删除 * 逻辑删除
* @param busEnergyPlan
* @return * @return
*/ */
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override @Override
public PersistModel remove(BusEnergyPlan busEnergyPlan){ public PersistModel remove(String devNum,String day){
int line = busEnergyPlanRepository.logicalDelete(busEnergyPlan); int line = 1;
return new PersistModel(line); Map<String,Object> map = new HashMap<>();
map.put("dev_num",devNum);
map.put("day",day);
try {
busEnergyPlanRepository.deleteEnergyPlanDay(map);
}catch(Exception e){
line = 0;
} }
/**
* 修改 busEnergyPlan
* @param busEnergyPlan
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel merge(BusEnergyPlan busEnergyPlan){
int line = busEnergyPlanRepository.updateByPrimaryKeySelective(busEnergyPlan);
return new PersistModel(line); return new PersistModel(line);
} }
/**
* 根据id查询 busEnergyPlan
* @param id
* @return
*/
public BusEnergyPlan findById(int id){
return busEnergyPlanRepository.selectByPrimaryKey(id);
}
/**
* 分页查询 busEnergyPlan
* @param busEnergyPlan
* @return
*/
public List<BusEnergyPlan> findAllByPagination(PageUtil<BusEnergyPlan> paginationUtility,
BusEnergyPlan busEnergyPlan){
return busEnergyPlanRepository.queryBusEnergyPlans(busEnergyPlan);
}
@Override @Override
public List<Map<String, Object>> queryEnergyPlanDay(String proid, String day) { public List<Map<String, Object>> queryEnergyPlanDay(String proid, String day) {
......
...@@ -88,4 +88,15 @@ public class ParamLibraryController { ...@@ -88,4 +88,15 @@ public class ParamLibraryController {
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
busParamLibraryList); busParamLibraryList);
} }
@ApiOperation(value="清空设备参数库", notes="清空设备参数库")
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping(value = "/delete")
public Result delete(@RequestParam String devNum) {
PersistModel data = paramLibraryService.delete(devNum);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
devNum);
}
} }
...@@ -19,4 +19,6 @@ public interface ParamLibraryService { ...@@ -19,4 +19,6 @@ public interface ParamLibraryService {
List<Map<String,Object>> queryParamLibrary(Map<String,Object> map); List<Map<String,Object>> queryParamLibrary(Map<String,Object> map);
PersistModel save(BusParamLibraryList busPramLibraryList); PersistModel save(BusParamLibraryList busPramLibraryList);
PersistModel delete(String devNum);
} }
...@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
...@@ -70,4 +71,13 @@ public class ParamLibraryServiceImpl implements ParamLibraryService { ...@@ -70,4 +71,13 @@ public class ParamLibraryServiceImpl implements ParamLibraryService {
} }
return new PersistModel(1); return new PersistModel(1);
} }
@Override
public PersistModel delete(String devNum) {
Example example = new Example(BusParamLibrary.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("devNum",devNum);
int line = paramLibraryRepository.deleteByExample(example);
return new PersistModel(line);
}
} }
...@@ -41,7 +41,7 @@ public class BusDeviceParamController extends PaginationController<BusDevicePara ...@@ -41,7 +41,7 @@ public class BusDeviceParamController extends PaginationController<BusDevicePara
@ApiOperation(value="修改设备参数模板", notes="修改设备参数模板") @ApiOperation(value="修改设备参数模板", notes="修改设备参数模板")
@PutMapping("/update") @PutMapping("/update")
public Result update(@Valid BusDeviceParamList busDeviceParamList) { public Result update(@RequestBody BusDeviceParamList busDeviceParamList) {
PersistModel data = busDeviceParamServiceImpl.merge(busDeviceParamList); PersistModel data = busDeviceParamServiceImpl.merge(busDeviceParamList);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
...@@ -49,6 +49,23 @@ public class BusDeviceParamController extends PaginationController<BusDevicePara ...@@ -49,6 +49,23 @@ public class BusDeviceParamController extends PaginationController<BusDevicePara
busDeviceParamList); busDeviceParamList);
} }
@ApiOperation(value="添加或修改设备参数模板", notes="添加或修改设备参数模板")
@PutMapping("/saveOrupdate")
public Result saveOrupdate(@RequestBody BusDeviceParamList busDeviceParamList,@RequestParam String proId) {
PersistModel data = null;
String devNum = busDeviceParamList.getBusDeviceParamList().get(0).getDevNum();
List<Map<String,Object>> list = busDeviceParamServiceImpl.findByDev(devNum,proId);
if(list.size()>0){
data = busDeviceParamServiceImpl.merge(busDeviceParamList);
}else{
data = busDeviceParamServiceImpl.save(busDeviceParamList);
}
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
busDeviceParamList);
}
@ApiOperation(value="删除设备参数模板", notes="删除设备参数模板") @ApiOperation(value="删除设备参数模板", notes="删除设备参数模板")
@PutMapping("/delete") @PutMapping("/delete")
public Result delete(@RequestParam String devNum) { public Result delete(@RequestParam String devNum) {
......
...@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by on 2018-5-2 16:09:29. * Created by on 2018-5-2 16:09:29.
...@@ -59,7 +60,7 @@ public class BusDeviceTpController extends PaginationController<BusDeviceTp> { ...@@ -59,7 +60,7 @@ public class BusDeviceTpController extends PaginationController<BusDeviceTp> {
@ApiOperation(value="设备类型列表", notes="设备类型列表") @ApiOperation(value="设备类型列表", notes="设备类型列表")
@GetMapping(value = "/queryBusDeviceTpList") @GetMapping(value = "/queryBusDeviceTpList")
public List<BusDeviceTp> queryBusDeviceTpList(BusDeviceTp busDeviceTp) { public List<Map<String,Object>> queryBusDeviceTpList(@RequestParam String proId) {
return busDeviceTpServiceImpl.queryBusDeviceTpList(); return busDeviceTpServiceImpl.queryBusDeviceTpList(proId);
} }
} }
...@@ -48,7 +48,7 @@ public class BusDevicetpParamController extends PaginationController<BusDevicetp ...@@ -48,7 +48,7 @@ public class BusDevicetpParamController extends PaginationController<BusDevicetp
*/ */
@ApiOperation(value="修改设备类型模板", notes="修改设备类型模板") @ApiOperation(value="修改设备类型模板", notes="修改设备类型模板")
@PostMapping(value = "/update") @PostMapping(value = "/update")
public Result update(@Valid BusDevicetpParamList busDevicetpParamList) { public Result update(@RequestBody BusDevicetpParamList busDevicetpParamList) {
PersistModel data = busDevicetpParamServiceImpl.update(busDevicetpParamList); PersistModel data = busDevicetpParamServiceImpl.update(busDevicetpParamList);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
...@@ -56,6 +56,22 @@ public class BusDevicetpParamController extends PaginationController<BusDevicetp ...@@ -56,6 +56,22 @@ public class BusDevicetpParamController extends PaginationController<BusDevicetp
busDevicetpParamList); busDevicetpParamList);
} }
@ApiOperation(value="添加或修改设备类型模板", notes="添加或修改设备类型模板")
@PostMapping(value = "/saveOrUpdate")
public Result saveOrUpdate(@RequestBody BusDevicetpParamList busDevicetpParamList) {
PersistModel data = null;
List<BusDevicetpParam> list = busDevicetpParamServiceImpl.queryBusDevicetpParam(busDevicetpParamList.getBusDevicetpParamList().get(0));
if(list.size()>0){
data = busDevicetpParamServiceImpl.update(busDevicetpParamList);
}else{
data = busDevicetpParamServiceImpl.save(busDevicetpParamList);
}
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
busDevicetpParamList);
}
/** /**
* 删除模板 * 删除模板
* @return * @return
......
...@@ -28,7 +28,7 @@ public class BusProjectController extends PaginationController<BusProject> { ...@@ -28,7 +28,7 @@ public class BusProjectController extends PaginationController<BusProject> {
private BusProjectService busProjectServiceImpl; private BusProjectService busProjectServiceImpl;
@ApiOperation(value="添加", notes="添加") @ApiOperation(value="添加项目", notes="添加项目")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result add(@Valid BusProject busProject) { public Result add(@Valid BusProject busProject) {
PersistModel data = busProjectServiceImpl.save(busProject); PersistModel data = busProjectServiceImpl.save(busProject);
...@@ -39,7 +39,7 @@ public class BusProjectController extends PaginationController<BusProject> { ...@@ -39,7 +39,7 @@ public class BusProjectController extends PaginationController<BusProject> {
} }
@ApiOperation(value="修改", notes="修改") @ApiOperation(value="修改项目信息", notes="修改项目信息")
@PutMapping("/update") @PutMapping("/update")
public Result update(@Valid BusProject busProject) { public Result update(@Valid BusProject busProject) {
PersistModel data = busProjectServiceImpl.merge(busProject); PersistModel data = busProjectServiceImpl.merge(busProject);
...@@ -61,9 +61,9 @@ public class BusProjectController extends PaginationController<BusProject> { ...@@ -61,9 +61,9 @@ public class BusProjectController extends PaginationController<BusProject> {
busProject); busProject);
} }
@ApiOperation(value="查看单 ", notes="查看单 ") @ApiOperation(value="根据ID查询单个项目信息", notes="根据ID查询单个项目信息")
@GetMapping("/detail/{id:\\w+}") @GetMapping("/detail")
public Result detail(@PathVariable String id) { public Result detail(@RequestParam String id) {
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
......
...@@ -21,8 +21,7 @@ public interface BusDeviceTpRepository extends BaseMapper<BusDeviceTp> { ...@@ -21,8 +21,7 @@ public interface BusDeviceTpRepository extends BaseMapper<BusDeviceTp> {
*/ */
@Select("<script>select * from bus_device_tp where 1=1 " @Select("<script>select * from bus_device_tp where 1=1 "
+ "</script>") + "</script>")
@ResultMap(value = "BaseResultMap" ) List<Map<String,Object>> queryBusDeviceTps();
List<BusDeviceTp> queryBusDeviceTps();
/** /**
* 查看该设备类型是否配置模板 * 查看该设备类型是否配置模板
......
...@@ -56,6 +56,8 @@ public class BusProject{ ...@@ -56,6 +56,8 @@ public class BusProject{
private BigDecimal energyPotential; private BigDecimal energyPotential;
private String topology;
private BigDecimal shutPower;
} }
...@@ -34,7 +34,7 @@ public interface BusDeviceParamService { ...@@ -34,7 +34,7 @@ public interface BusDeviceParamService {
* 根据设备编号查询设备参数模板 * 根据设备编号查询设备参数模板
* @return * @return
*/ */
List<Map<String,Object>> findByDev(String devid,String proid); List<Map<String,Object>> findByDev(String devNum,String proid);
......
...@@ -4,6 +4,7 @@ import org.rcisoft.business.manage.entity.BusDeviceTp; ...@@ -4,6 +4,7 @@ import org.rcisoft.business.manage.entity.BusDeviceTp;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by on 2018-5-2 16:09:29. * Created by on 2018-5-2 16:09:29.
...@@ -36,7 +37,7 @@ public interface BusDeviceTpService { ...@@ -36,7 +37,7 @@ public interface BusDeviceTpService {
* 列表 * 列表
* @return * @return
*/ */
List<BusDeviceTp> queryBusDeviceTpList(); List<Map<String,Object>> queryBusDeviceTpList(String proId);
......
...@@ -5,6 +5,7 @@ import org.rcisoft.core.aop.PageUtil; ...@@ -5,6 +5,7 @@ import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by on 2018-5-2 16:09:30. * Created by on 2018-5-2 16:09:30.
...@@ -38,7 +39,7 @@ public interface BusProjectService { ...@@ -38,7 +39,7 @@ public interface BusProjectService {
* @param id * @param id
* @return * @return
*/ */
List<BusProject> findById(String id); List<Map<String,Object>> findById(String id);
/** /**
* 分页查询 * 分页查询
......
...@@ -3,8 +3,10 @@ package org.rcisoft.business.manage.service.impl; ...@@ -3,8 +3,10 @@ package org.rcisoft.business.manage.service.impl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.manage.dao.BusDeviceTpRepository; import org.rcisoft.business.manage.dao.BusDeviceTpRepository;
import org.rcisoft.business.manage.entity.BusDeviceTp; import org.rcisoft.business.manage.entity.BusDeviceTp;
import org.rcisoft.business.manage.entity.BusDevicetpParam;
import org.rcisoft.business.manage.entity.BusProject; import org.rcisoft.business.manage.entity.BusProject;
import org.rcisoft.business.manage.service.BusDeviceTpService; import org.rcisoft.business.manage.service.BusDeviceTpService;
import org.rcisoft.business.manage.service.BusDevicetpParamService;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -28,6 +30,8 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService { ...@@ -28,6 +30,8 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService {
@Autowired @Autowired
private BusDeviceTpRepository busDeviceTpRepository; private BusDeviceTpRepository busDeviceTpRepository;
@Autowired
private BusDevicetpParamService busDevicetpParamService;
/** /**
...@@ -75,8 +79,15 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService { ...@@ -75,8 +79,15 @@ public class BusDeviceTpServiceImpl implements BusDeviceTpService {
} }
@Override @Override
public List<BusDeviceTp> queryBusDeviceTpList() { public List<Map<String,Object>> queryBusDeviceTpList(String proId) {
return busDeviceTpRepository.queryBusDeviceTps(); List<Map<String,Object>> list = busDeviceTpRepository.queryBusDeviceTps();
for(Map<String,Object> tmap : list){
BusDevicetpParam bdp = new BusDevicetpParam();
bdp.setDevTpId(tmap.get("DEV_TP_ID").toString());
bdp.setProId(proId);
tmap.put("paramList",busDevicetpParamService.queryBusDevicetpParam(bdp));
}
return list;
} }
......
...@@ -3,6 +3,7 @@ package org.rcisoft.business.manage.service.impl; ...@@ -3,6 +3,7 @@ package org.rcisoft.business.manage.service.impl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.manage.entity.BusProject; import org.rcisoft.business.manage.entity.BusProject;
import org.rcisoft.business.manage.service.BusProjectService; import org.rcisoft.business.manage.service.BusProjectService;
import org.rcisoft.business.overview.dao.BusProjectRepository;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.manage.dao.ProjectRepository; import org.rcisoft.business.manage.dao.ProjectRepository;
...@@ -27,6 +28,8 @@ public class BusProjectServiceImpl implements BusProjectService { ...@@ -27,6 +28,8 @@ public class BusProjectServiceImpl implements BusProjectService {
@Autowired @Autowired
private ProjectRepository projectRepository; private ProjectRepository projectRepository;
@Autowired
private BusProjectRepository busProjectRepository;
/** /**
...@@ -80,10 +83,10 @@ public class BusProjectServiceImpl implements BusProjectService { ...@@ -80,10 +83,10 @@ public class BusProjectServiceImpl implements BusProjectService {
* @param id * @param id
* @return * @return
*/ */
public List<BusProject> findById(String id){ public List<Map<String,Object>> findById(String id){
BusProject bus = new BusProject(); org.rcisoft.business.overview.entity.BusProject bus = new org.rcisoft.business.overview.entity.BusProject();
bus.setProId(id); bus.setProId(id);
return projectRepository.queryBusProjects(bus); return busProjectRepository.queryBusProjects(bus);
} }
/** /**
......
...@@ -9,6 +9,7 @@ import org.springframework.stereotype.Repository; ...@@ -9,6 +9,7 @@ import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created with on 2018-4-14 10:15:52. * Created with on 2018-4-14 10:15:52.
...@@ -20,9 +21,18 @@ public interface BusProjectRepository extends BaseMapper<BusProject> { ...@@ -20,9 +21,18 @@ public interface BusProjectRepository extends BaseMapper<BusProject> {
* 查询项目信息 * 查询项目信息
* @return * @return
*/ */
@Select("<script>select * from bus_project</script>") @Select("<script>SELECT\n" +
@ResultMap(value = "BaseResultMap" ) "\ta.*,e.SYS_NM,b.BLD_TP_NM,c.OWN_NM,d1.TEAM_NM TEAM_NM_ON,d2.TEAM_NM TEAM_NM_OFF\n" +
List<BusProject> queryBusProjects(); "FROM bus_project a \n" +
"LEFT JOIN bus_build_tp b ON a.BLD_TP_ID = b.BLD_TP_ID\n" +
"LEFT JOIN sys_owner c ON a.OWN_ID = c.OWN_ID\n" +
"LEFT JOIN bus_team d1 on a.TEAM_ID_ON = d1.TEAM_ID\n" +
"LEFT JOIN bus_team d2 on a.TEAM_ID_OFF = d2.TEAM_ID\n" +
"LEFT JOIN bus_system e on a.PRO_ID = e.PRO_ID\n" +
"where 1=1 " +
"<if test =' proId != null '> and a.pro_id = #{proId}</if>" +
"</script>")
List<Map<String,Object>> queryBusProjects(BusProject busProject);
@Select("<script>select distinct code from bus_project</script>") @Select("<script>select distinct code from bus_project</script>")
@ResultType(String.class) @ResultType(String.class)
......
...@@ -30,6 +30,17 @@ public class Result { ...@@ -30,6 +30,17 @@ public class Result {
return result; return result;
} }
public static Result builder(PersistModel dataModel){
Result result = new Result();
result.setMessage(dataModel.getInfluenceReason());
if(dataModel.isSuccessBySinglePersist()){
result.setCode(200);
} else{
result.setCode(500);
}
return result;
}
public void setErrorMessage(String message, Object data) { public void setErrorMessage(String message, Object data) {
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
<result column="BLD_YEAR" jdbcType="TIMESTAMP" property="bldYear"/> <result column="BLD_YEAR" jdbcType="TIMESTAMP" property="bldYear"/>
<result column="DEVICE_YEAR" jdbcType="TIMESTAMP" property="deviceYear"/> <result column="DEVICE_YEAR" jdbcType="TIMESTAMP" property="deviceYear"/>
<result column="ENERGY_POTENTIAL" jdbcType="DECIMAL" property="energyPotential"/> <result column="ENERGY_POTENTIAL" jdbcType="DECIMAL" property="energyPotential"/>
<result column="TOPOLOGY" jdbcType="VARCHAR" property="topology"/>
<result column="SHUT_POWER" jdbcType="DECIMAL" property="shutPower"/>
</resultMap> </resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>--> <!--<cache type="${corePackag!}.util.RedisCache"/>-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment