2025-09-15 21:56:18 +08:00
|
|
|
<?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.device.mapper.DevMergeMapper">
|
|
|
|
|
<select id="list" resultType="com.bonus.material.device.domain.vo.DevMergeVo">
|
|
|
|
|
select id,create_user,create_time,status,count(bbb.dev_id) as dev_count
|
|
|
|
|
from cs_device_status aaa
|
|
|
|
|
left join cs_device_real_dev bbb on aaa.id = bbb.cs_id
|
|
|
|
|
where is_active = 1
|
|
|
|
|
<if test="status != null and status != ''">
|
|
|
|
|
and status = #{status}
|
|
|
|
|
</if>
|
|
|
|
|
group by aaa.id
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="devList" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
|
|
|
|
SELECT
|
2025-09-22 18:53:28 +08:00
|
|
|
mtv.proType,
|
|
|
|
|
mtv.mainGx,
|
|
|
|
|
mtv.childGx,
|
|
|
|
|
mtv.devCategory,
|
|
|
|
|
mtv.devSubcategory,
|
|
|
|
|
mtv.devName,
|
|
|
|
|
mtv.devModel,
|
|
|
|
|
mtv.unit_name,
|
|
|
|
|
d.ma_id as maId,
|
|
|
|
|
d.code as code,
|
|
|
|
|
d.identify_code as identifyCode,
|
|
|
|
|
d.device_name as deviceName,
|
|
|
|
|
d.device_count as deviceCount,
|
|
|
|
|
d.brand as brand,
|
|
|
|
|
d.model_name as modelName,
|
|
|
|
|
d.production_date as productionDate,
|
|
|
|
|
d.working_hours as workingHours,
|
|
|
|
|
d.serial_number as serialNumber,
|
|
|
|
|
d.person as person,
|
|
|
|
|
d.person_phone as personPhone,
|
|
|
|
|
d.create_time as createTime,
|
|
|
|
|
d.update_time as updateTime,
|
|
|
|
|
d.own_co as companyId,
|
|
|
|
|
sd.dept_name as companyName,
|
|
|
|
|
c.operate_address as operateAddress,
|
|
|
|
|
d.entry_status AS entryStatus
|
2025-09-15 21:56:18 +08:00
|
|
|
FROM
|
2025-09-22 18:53:28 +08:00
|
|
|
cs_device_real_dev cdrd
|
|
|
|
|
LEFT JOIN ma_dev_info d ON cdrd.dev_id = d.ma_id
|
|
|
|
|
LEFT JOIN sys_dept sd ON d.own_co = sd.dept_id
|
|
|
|
|
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
|
|
|
|
|
LEFT JOIN ma_type_view mtv ON mtv.typeId = d.type_id
|
|
|
|
|
|
2025-09-15 21:56:18 +08:00
|
|
|
<where>
|
2025-09-22 18:53:28 +08:00
|
|
|
d.is_active='1' and cdrd.cs_id = #{orderId}
|
2025-09-15 21:56:18 +08:00
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
and (
|
|
|
|
|
locate(#{keyWord},mtv.mainGx) > 0
|
|
|
|
|
or locate(#{keyWord},mtv.childGx) > 0
|
|
|
|
|
or locate(#{keyWord},mtv.devCategory) > 0
|
|
|
|
|
or locate(#{keyWord},mtv.devSubcategory) > 0
|
|
|
|
|
or locate(#{keyWord},mtv.devName) > 0
|
|
|
|
|
or locate(#{keyWord},mtv.devModel) > 0
|
|
|
|
|
or locate(#{keyWord},c.company_name) > 0
|
|
|
|
|
or locate(#{keyWord},d.device_name) > 0
|
|
|
|
|
or locate(#{keyWord},d.identify_code) > 0
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="addOrder" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
INSERT INTO cs_device_status (create_user) VALUES (#{createUser})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertOrderDevReal">
|
|
|
|
|
INSERT INTO cs_device_real_dev (cs_id,dev_id) VALUES (#{orderId},#{maId})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="submitOrder">
|
2025-09-22 18:53:28 +08:00
|
|
|
UPDATE cs_device_status
|
|
|
|
|
SET status = #{status}
|
|
|
|
|
WHERE id = #{id}
|
2025-09-15 21:56:18 +08:00
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="updateDeviceStatus">
|
2025-09-22 18:57:42 +08:00
|
|
|
UPDATE ma_dev_info
|
|
|
|
|
SET entry_status = 0
|
|
|
|
|
WHERE ma_id IN (select dev_id
|
|
|
|
|
from cs_device_real_dev
|
|
|
|
|
where cs_id = #{id})
|
2025-09-15 21:56:18 +08:00
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="delOrder">
|
|
|
|
|
update cs_device_status set is_active = 0 where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<update id="updateDevice">
|
|
|
|
|
<foreach collection="list" item="data" separator=";">
|
|
|
|
|
UPDATE ma_dev_info SET entry_status = #{data.value} WHERE ma_id = #{data.key}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="getDevNoCheck" resultType="int">
|
|
|
|
|
select count(1) from ma_dev_info where ma_id IN (
|
|
|
|
|
select dev_id from cs_device_real_dev where cs_id = #{id}
|
|
|
|
|
) and is_active = 1 and entry_status = 0
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|