207 lines
8.4 KiB
XML
207 lines
8.4 KiB
XML
|
|
<?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.devchange.mapper.MaDevInfoMapper">
|
||
|
|
<resultMap id="BaseResultMap" type="com.bonus.material.devchange.domain.MaDevInfo">
|
||
|
|
<id column="ma_id" property="maId" />
|
||
|
|
<result column="device_name" property="deviceName" />
|
||
|
|
<result column="device_weight" property="deviceWeight" />
|
||
|
|
<result column="device_count" property="deviceCount" />
|
||
|
|
<result column="code" property="code" />
|
||
|
|
<result column="identify_code" property="identifyCode" />
|
||
|
|
<result column="type_id" property="typeId" />
|
||
|
|
<result column="ma_status" property="maStatus" />
|
||
|
|
<result column="lease_scope" property="leaseScope" />
|
||
|
|
<result column="location" property="location" />
|
||
|
|
<result column="brand" property="brand" />
|
||
|
|
<result column="model_name" property="modelName" />
|
||
|
|
<result column="production_date" property="productionDate" />
|
||
|
|
<result column="working_hours" property="workingHours" />
|
||
|
|
<result column="serial_number" property="serialNumber" />
|
||
|
|
<result column="month_lease_price" property="monthLeasePrice" />
|
||
|
|
<result column="day_lease_price" property="dayLeasePrice" />
|
||
|
|
<result column="pic_url" property="picUrl" />
|
||
|
|
<result column="js_month_price" property="jsMonthPrice" />
|
||
|
|
<result column="js_day_price" property="jsDayPrice" />
|
||
|
|
<result column="description" property="description" />
|
||
|
|
<result column="gps_code" property="gpsCode" />
|
||
|
|
<result column="own_co" property="ownCo" />
|
||
|
|
<result column="person" property="person" />
|
||
|
|
<result column="person_phone" property="personPhone" />
|
||
|
|
<result column="create_time" property="createTime" />
|
||
|
|
<result column="creator" property="creator" />
|
||
|
|
<result column="deposit" property="deposit" />
|
||
|
|
<result column="is_active" property="isActive" />
|
||
|
|
<result column="update_time" property="updateTime" />
|
||
|
|
<result column="update_by" property="updateBy" />
|
||
|
|
<result column="is_operator" property="isOperator" />
|
||
|
|
<result column="specification" property="specification" />
|
||
|
|
<result column="province_id" property="provinceId" />
|
||
|
|
<result column="city_id" property="cityId" />
|
||
|
|
<result column="area_id" property="areaId" />
|
||
|
|
<result column="video_url" property="videoUrl" />
|
||
|
|
<result column="own_id" property="ownId" />
|
||
|
|
<result column="check_date" property="checkDate" />
|
||
|
|
<result column="check_cycle" property="checkCycle" />
|
||
|
|
<result column="is_qc" property="isQc" />
|
||
|
|
<result column="is_safe_book" property="isSafeBook" />
|
||
|
|
<result column="is_zone" property="isZone" />
|
||
|
|
<result column="zone_id" property="zoneId" />
|
||
|
|
<result column="total_up_day" property="totalUpDay" />
|
||
|
|
<result column="total_lease_day" property="totalLeaseDay" />
|
||
|
|
<result column="origina_value" property="originaValue" />
|
||
|
|
<result column="change_status" jdbcType="CHAR" property="changeStatus" />
|
||
|
|
<result column="expiration_time" jdbcType="DATE" property="expirationTime" />
|
||
|
|
<result column="entry_status" jdbcType="CHAR" property="entryStatus" />
|
||
|
|
<result column="up_down_status" jdbcType="CHAR" property="upDownStatus" />
|
||
|
|
<result column="json_data" property="jsonData" />
|
||
|
|
<result column="buy_price" property="buyPrice" />
|
||
|
|
<result column="item_type_model" property="itemTypeModel" />
|
||
|
|
<result column="on_project" property="onProject" />
|
||
|
|
<result column="childGx" property="childGx"/>
|
||
|
|
<result column="company_name" property="companyName"/>
|
||
|
|
<result column="devCategory" property="devCategory"/>
|
||
|
|
<result column="devModel" property="devModel"/>
|
||
|
|
<result column="devName" property="devName"/>
|
||
|
|
<result column="devSubcategory" property="devSubcategory"/>
|
||
|
|
<result column="mainGx" property="mainGx"/>
|
||
|
|
<result column="next_check_time" property="nextCheckTime"/>
|
||
|
|
<result column="proType" property="proType"/>
|
||
|
|
<result column="unit_name" property="unitName"/>
|
||
|
|
</resultMap>
|
||
|
|
<sql id="Base_Column_List">
|
||
|
|
ma_id, device_name, device_weight, device_count, code, identify_code, type_id, ma_status,
|
||
|
|
lease_scope, `location`, brand, model_name, production_date, working_hours, serial_number,
|
||
|
|
month_lease_price, day_lease_price, pic_url, js_month_price, js_day_price, description,
|
||
|
|
gps_code, own_co, person, person_phone, create_time, creator, deposit, is_active,
|
||
|
|
update_time, update_by, is_operator, specification, province_id, city_id, area_id,
|
||
|
|
video_url, own_id, check_date, check_cycle, is_qc, is_safe_book, is_zone, zone_id,
|
||
|
|
total_up_day, total_lease_day, origina_value, change_status, expiration_time, entry_status,
|
||
|
|
up_down_status, json_data, buy_price, item_type_model, on_project
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="list" resultMap="BaseResultMap">
|
||
|
|
SELECT
|
||
|
|
mtv.proType,
|
||
|
|
mtv.mainGx,
|
||
|
|
mtv.childGx,
|
||
|
|
mtv.devCategory,
|
||
|
|
mtv.devSubcategory,
|
||
|
|
mtv.devName,
|
||
|
|
mtv.devModel,
|
||
|
|
mtv.unit_name,
|
||
|
|
mdi.ma_id,
|
||
|
|
mdi.device_name,
|
||
|
|
mdi.model_name,
|
||
|
|
mdi.ma_status,
|
||
|
|
mdi.`code`,
|
||
|
|
mdi.expiration_time,
|
||
|
|
c.company_name,
|
||
|
|
mdi.buy_price,
|
||
|
|
mdi.production_date,
|
||
|
|
mdi.working_hours,
|
||
|
|
mdi.on_project,
|
||
|
|
mdi.person,
|
||
|
|
mdi.person_phone,
|
||
|
|
mdi.change_status,
|
||
|
|
mdi.up_down_status,
|
||
|
|
mdq.next_check_time,
|
||
|
|
mdi.brand,
|
||
|
|
mdi.pic_url
|
||
|
|
FROM
|
||
|
|
ma_dev_info mdi
|
||
|
|
LEFT JOIN ma_dev_qc mdq ON mdq.ma_id = mdi.ma_id
|
||
|
|
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.own_co
|
||
|
|
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
|
||
|
|
LEFT JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
|
||
|
|
WHERE mdi.is_active = 1 and mdi.entry_status = 1
|
||
|
|
<if test="typeId != null">
|
||
|
|
and (
|
||
|
|
mtv.mainGxId = #{typeId}
|
||
|
|
or mtv.childGxId = #{typeId}
|
||
|
|
or mtv.devCategoryId = #{typeId}
|
||
|
|
or mtv.devSubcategoryId = #{typeId}
|
||
|
|
or mtv.devNameId = #{typeId}
|
||
|
|
or mtv.devModelId = #{typeId}
|
||
|
|
or mtv.maxTypeId = #{typeId}
|
||
|
|
)
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<update id="updateDeviceStatus">
|
||
|
|
<foreach collection="list" item="data" index="index" separator=";">
|
||
|
|
UPDATE ma_dev_info SET up_down_status = #{data.value} where ma_id =#{data.key}
|
||
|
|
</foreach>
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="delDevice" resultType="java.lang.Integer">
|
||
|
|
UPDATE ma_dev_info SET is_active = 0 where ma_id in
|
||
|
|
<foreach item="item" index="index" collection="list" separator="," close=")" open="(">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="deviceTree" resultType="com.bonus.material.devchange.domain.DeviceTreeBean">
|
||
|
|
SELECT
|
||
|
|
mt.type_id as id,
|
||
|
|
mt.type_name as name,
|
||
|
|
mt.level,
|
||
|
|
mt.parent_id as pId
|
||
|
|
FROM
|
||
|
|
ma_type mt
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="deviceCount" resultType="com.bonus.material.devchange.domain.DeviceCountBean">
|
||
|
|
SELECT
|
||
|
|
count(distinct if(mdi.change_status = '1', mdi.ma_id, null)) as inStock,
|
||
|
|
count(distinct if(mdi.change_status = '2', mdi.ma_id, null)) as ownUse,
|
||
|
|
count(distinct if(mdi.change_status = '3', mdi.ma_id, null)) as share,
|
||
|
|
count(distinct if(mdi.change_status = '5', mdi.ma_id, null)) as underRepair
|
||
|
|
FROM
|
||
|
|
ma_dev_info mdi
|
||
|
|
LEFT JOIN ma_dev_qc mdq ON mdq.ma_id = mdi.ma_id
|
||
|
|
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.own_co
|
||
|
|
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
|
||
|
|
LEFT JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
|
||
|
|
WHERE mdi.is_active = 1
|
||
|
|
<if test="typeId != null">
|
||
|
|
and (
|
||
|
|
mtv.mainGxId = #{typeId}
|
||
|
|
or mtv.childGxId = #{typeId}
|
||
|
|
or mtv.devCategoryId = #{typeId}
|
||
|
|
or mtv.devSubcategoryId = #{typeId}
|
||
|
|
or mtv.devNameId = #{typeId}
|
||
|
|
or mtv.devModelId = #{typeId}
|
||
|
|
or mtv.maxTypeId = #{typeId}
|
||
|
|
)
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getProperties" resultType="com.bonus.material.device.domain.vo.DevInfoPropertyVo">
|
||
|
|
select property_name propertyName,property_value propertyValue
|
||
|
|
from ma_dev_info_properties
|
||
|
|
where ma_id=#{maId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="deviceLocationSel" resultType="com.bonus.material.devchange.domain.MapBean">
|
||
|
|
SELECT
|
||
|
|
'0' as `key`,
|
||
|
|
location as `value`
|
||
|
|
FROM
|
||
|
|
ma_dev_info
|
||
|
|
WHERE is_active = 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="companySel" resultType="com.bonus.material.devchange.domain.MapBean">
|
||
|
|
SELECT
|
||
|
|
bci.id as `key`,
|
||
|
|
bci.company_name as `value`
|
||
|
|
FROM
|
||
|
|
bm_company_info bci
|
||
|
|
<where>
|
||
|
|
<if test="id != null">
|
||
|
|
and bci.id = #{id}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
</mapper>
|