问题修改

This commit is contained in:
jiang 2025-10-14 20:20:27 +08:00
parent 5d025d86b8
commit bac4027c05
11 changed files with 175 additions and 5 deletions

View File

@ -0,0 +1,41 @@
package com.bonus.material.cnarea.controller;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.cnarea.service.CnareaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 地址选择
*/
@RestController
@RequestMapping("/cnarea")
@Slf4j
public class CnareaController extends BaseController {
@Resource
private CnareaService cnareaService;
/**
* 获取所有省份
*/
@GetMapping("/provinces")
public AjaxResult getProvinces() {
return AjaxResult.success(cnareaService.getProvinces());
}
/**
* 根据代码获取城市列表
*/
@GetMapping("/cities/{provinceCode}")
public AjaxResult getCities(@PathVariable String provinceCode) {
return AjaxResult.success(cnareaService.getCities(provinceCode));
}
}

View File

@ -0,0 +1,4 @@
package com.bonus.material.cnarea.dto;
public class Cnarea {
}

View File

@ -0,0 +1,19 @@
package com.bonus.material.cnarea.mapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface CnareaMapper {
/**
* 获取所有省份
*/
@MapKey("value")
List<Map<String, Object>> getProvinces();
@MapKey("value")
List<Map<String, Object>> getCities(String provinceCode);
}

View File

@ -0,0 +1,16 @@
package com.bonus.material.cnarea.service;
import java.util.List;
import java.util.Map;
public interface CnareaService {
/**
* 获取所有省份
*/
List<Map<String, Object>> getProvinces();
/**
* 根据省份代码获取城市列表
*/
List<Map<String, Object>> getCities(String provinceCode);
}

View File

@ -0,0 +1,34 @@
package com.bonus.material.cnarea.service.impl;
import com.bonus.material.cnarea.mapper.CnareaMapper;
import com.bonus.material.cnarea.service.CnareaService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
public class CnareaServiceImpl implements CnareaService {
@Resource
private CnareaMapper mapper;
/**
* 获取所有省份
*/
@Override
public List<Map<String, Object>> getProvinces() {
return mapper.getProvinces();
}
/**
* 根据省份代码获取城市列表
*
* @param provinceCode
*/
@Override
public List<Map<String, Object>> getCities(String provinceCode) {
return mapper.getCities(provinceCode);
}
}

View File

@ -134,4 +134,7 @@ public class MaDevInfoController extends BaseController {
}
}
}

View File

@ -54,6 +54,8 @@ public interface DevMergeMapper {
int updateDevice(List<MapBean> list);
int updateChangeStatus(List<MapBean> list);
int getDevNoCheck(String id);
@MapKey("value")

View File

@ -129,6 +129,10 @@ public class DevMergeServiceImpl implements DevMergeService {
for (String s : split) {
list.add(new MapBean(s, o.getStatus()));
}
if (o.getStatus().equals("1")) {
devMergeMapper.updateChangeStatus(list);
}
int i = devMergeMapper.updateDevice(list);
//判断有没有审批完
int b = devMergeMapper.getDevNoCheck(o.getId());
@ -225,6 +229,8 @@ public class DevMergeServiceImpl implements DevMergeService {
@Override
public AjaxResult interDevice(MaDevInfo maDevInfo) {
try {
Long thisLoginUserDeptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
maDevInfo.setPropertyUnitId(Math.toIntExact(thisLoginUserDeptId));
maDevInfo.setCode(getString());
Integer i = devMergeMapper.interDevice(maDevInfo);
if (i > 0) {

View File

@ -0,0 +1,20 @@
<?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.bonus.material.cnarea.mapper.CnareaMapper">
<select id="getProvinces" resultType="java.util.Map">
SELECT name AS label,
area_code AS value
FROM sys_cnarea
WHERE parent_code = 0
ORDER BY area_code
</select>
<select id="getCities" resultType="java.util.Map">
SELECT name AS label,
area_code AS value
FROM sys_cnarea
WHERE parent_code = #{provinceCode}
ORDER BY area_code
</select>
</mapper>

View File

@ -318,13 +318,15 @@
mdi.buy_price AS originalValue,
mdi.unit AS unit,
mdq.next_check_time AS nextMaintenanceDate,
mdi.max_working_hours AS maxServiceLifeYears
mdi.max_working_hours AS maxServiceLifeYears,
sc.name AS province
from ma_dev_info mdi
LEFT JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN ma_dev_qc mdq ON mdq.ma_id = mdi.ma_id
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.supplier_id
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
<where>
mdi.is_active = '1'
<if test="name != null and name != ''">
@ -334,6 +336,12 @@
<if test="specificationModel != null and specificationModel != ''">
and mdi.item_type_model like concat('%', #{specificationModel}, '%')
</if>
<if test="province != null and province != ''">
and sc.area_code = #{province}
</if>
<if test="majorId != null and majorId != ''">
and mtv.maxTypeId = #{majorId}
</if>

View File

@ -96,6 +96,7 @@
code,
ma_status,
province_id,
on_company,
<!-- 非必填字段:有值才插入 -->
<if test="originalCode != null and originalCode != ''">identify_code,</if>
<if test="typeId != null">type_id,</if>
@ -118,7 +119,8 @@
#{manageType},
#{code},
'0',
'34',
'340000000000',
#{propertyUnitId},
<!-- 非必填字段对应值 -->
<if test="originalCode != null and originalCode != ''">#{originalCode},</if>
<if test="typeId != null">#{typeId},</if>
@ -179,6 +181,12 @@
</foreach>
</update>
<update id="updateChangeStatus">
<foreach collection="list" item="data" separator=";">
UPDATE ma_dev_info SET change_status = #{data.value} WHERE ma_id = #{data.key}
</foreach>
</update>
<select id="getDevNoCheck" resultType="int">
select count(1)
from ma_dev_info
@ -321,7 +329,8 @@
sd.dept_name AS propertyUnit,
mdi.buy_price AS originalValue,
mdq.next_check_time AS nextMaintenanceDate,
mdi.max_working_hours AS maxServiceLifeYears
mdi.max_working_hours AS maxServiceLifeYears,
sc.name AS province
from cs_device_status cds
LEFT JOIN cs_device_real_dev cdrd ON cdrd.cs_id = cds.id
LEFT JOIN ma_dev_info mdi ON cdrd.dev_id = mdi.ma_id
@ -330,11 +339,15 @@
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN ma_dev_qc mdq ON mdq.ma_id = mdi.ma_id
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.supplier_id
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
<where>
mdi.is_active = '1'
<if test="name != null and name != ''">
and mdi.device_name like concat('%', #{name}, '%')
</if>
<if test="province != null and province != ''">
and sc.area_code = #{province}
</if>
<if test="specificationModel != null and specificationModel != ''">
and mdi.item_type_model like concat('%', #{specificationModel}, '%')
@ -414,7 +427,8 @@
mdi.buy_price AS originalValue,
mdq.next_check_time AS nextMaintenanceDate,
mdi.max_working_hours AS maxServiceLifeYears,
mdi.entry_status AS entryStatus
mdi.entry_status AS entryStatus,
sc.name AS province
from cs_device_status cds
LEFT JOIN cs_device_real_dev cdrd ON cdrd.cs_id = cds.id
LEFT JOIN ma_dev_info mdi ON cdrd.dev_id = mdi.ma_id
@ -423,12 +437,15 @@
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN ma_dev_qc mdq ON mdq.ma_id = mdi.ma_id
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.supplier_id
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
<where>
mdi.is_active = '1' and cds.id = #{orderId}
<if test="name != null and name != ''">
and mdi.device_name like concat('%', #{name}, '%')
</if>
<if test="province != null and province != ''">
and sc.area_code = #{province}
</if>
<if test="specificationModel != null and specificationModel != ''">
and mdi.item_type_model like concat('%', #{specificationModel}, '%')
</if>