2023-12-02 15:18:58 +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.zlpt.equip.mapper.DevInfoMapper" >
2023-12-03 17:18:17 +08:00
<resultMap type= "com.bonus.zlpt.common.core.domain.equip.DevInfo" id= "DevInfoResult" >
2023-12-02 15:18:58 +08:00
<result property= "maId" column= "ma_id" />
<result property= "code" column= "code" />
<result property= "typeId" column= "type_id" />
<result property= "maStatus" column= "ma_status" />
<result property= "leaseScope" column= "lease_scope" />
<result property= "location" column= "location" />
<result property= "brand" column= "brand" />
<result property= "modelName" column= "model_name" />
<result property= "productionDate" column= "production_date" />
<result property= "workingHours" column= "working_hours" />
<result property= "serialNumber" column= "serial_number" />
<result property= "monthLeasePrice" column= "month_lease_price" />
<result property= "dayLeasePrice" column= "day_lease_price" />
<result property= "picUrl" column= "pic_url" />
<result property= "jsMonthPrice" column= "js_month_price" />
<result property= "jsDayPrice" column= "js_day_price" />
<result property= "description" column= "description" />
<result property= "gpsCode" column= "gps_code" />
<result property= "ownCo" column= "own_co" />
<result property= "createTime" column= "create_time" />
<result property= "creator" column= "creator" />
<result property= "deposit" column= "deposit" />
2023-12-05 11:21:09 +08:00
<result property= "isOperator" column= "is_operator" />
2023-12-02 15:18:58 +08:00
<result property= "isActive" column= "is_active" />
<result property= "updateTime" column= "update_time" />
<result property= "updateBy" column= "update_by" />
</resultMap>
<sql id= "selectDevInfoVo" >
2023-12-05 11:21:09 +08:00
select ma_id, 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, create_time, creator, deposit, is_operator, is_active, update_time, update_by from ma_dev_info
2023-12-02 15:18:58 +08:00
</sql>
2023-12-04 11:36:46 +08:00
<select id= "selectDevInfoList" parameterType= "com.bonus.zlpt.common.core.domain.equip.vo.DevInfoVo" resultType= "com.bonus.zlpt.common.core.domain.equip.vo.DevInfoVo" >
2023-12-04 19:41:21 +08:00
select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name
2023-12-04 11:36:46 +08:00
from ma_dev_info d
2023-12-04 19:41:21 +08:00
left join (select t.*, p.type_name as parent_name
from ma_type_info t
left join ma_type_info p on t.parent_id=p.type_id) t on d.type_id = t.type_id
left join bm_company_info c on d.own_co = c.company_id
2023-12-02 15:18:58 +08:00
<where >
2023-12-04 11:36:46 +08:00
<if test= "maId != null " > and d.ma_id = #{maId}</if>
<if test= "code != null and code != ''" > and d.code = #{code}</if>
<if test= "typeId != null " > and d.type_id = #{typeId}</if>
<if test= "maStatus != null and maStatus != ''" > and d.ma_status = #{maStatus}</if>
<if test= "leaseScope != null " > and d.lease_scope = #{leaseScope}</if>
<if test= "location != null and location != ''" > and d.location = #{location}</if>
<if test= "brand != null and brand != ''" > and d.brand = #{brand}</if>
<if test= "modelName != null and modelName != ''" > and d.model_name like concat('%', #{modelName}, '%')</if>
<if test= "productionDate != null and productionDate != ''" > and d.production_date = #{productionDate}</if>
<if test= "workingHours != null and workingHours != ''" > and d.working_hours = #{workingHours}</if>
<if test= "serialNumber != null and serialNumber != ''" > and d.serial_number = #{serialNumber}</if>
<if test= "monthLeasePrice != null and monthLeasePrice != ''" > and d.month_lease_price = #{monthLeasePrice}</if>
<if test= "dayLeasePrice != null and dayLeasePrice != ''" > and d.day_lease_price = #{dayLeasePrice}</if>
<if test= "picUrl != null and picUrl != ''" > and d.pic_url = #{picUrl}</if>
<if test= "jsMonthPrice != null and jsMonthPrice != ''" > and d.js_month_price = #{jsMonthPrice}</if>
<if test= "jsDayPrice != null and jsDayPrice != ''" > and d.js_day_price = #{jsDayPrice}</if>
<if test= "description != null and description != ''" > and d.description = #{description}</if>
<if test= "gpsCode != null and gpsCode != ''" > and d.gps_code = #{gpsCode}</if>
<if test= "ownCo != null " > and d.own_co = #{ownCo}</if>
<if test= "creator != null " > and d.creator = #{creator}</if>
<if test= "deposit != null " > and d.deposit = #{deposit}</if>
<if test= "isActive != null and isActive != ''" > and d.is_active = #{isActive}</if>
2023-12-04 14:45:23 +08:00
<if test= "keyWord != null and keyWord != ''" >
and (
locate(#{typeName},t.type_name) > 0
or locate(#{companyName},c.company_name) > 0
or locate(#{maId},d.ma_id) > 0
or locate(#{modelName},d.model_name) > 0
or locate(#{serialNumber},d.serial_number) > 0
or locate(#{description},d.description) > 0
)
</if>
2023-12-02 15:18:58 +08:00
</where>
</select>
2023-12-04 13:21:07 +08:00
<select id= "selectDevInfoByMaId" parameterType= "Long" resultType= "com.bonus.zlpt.common.core.domain.equip.vo.DevInfoVo" >
2023-12-05 13:56:18 +08:00
select d.*,c.company_name,c.auth_phone,ty.type_name as device_name,ty.parent_name as group_name,ty.grandpa_name as type_name,col.id as collect_id, up.status as is_audit
2023-12-04 13:21:07 +08:00
from ma_dev_info d
2023-12-04 19:41:21 +08:00
left join bm_company_info c on d.own_co = c.company_id
2023-12-04 20:21:27 +08:00
left join ma_user_collect col on d.ma_id = col.ma_id
2023-12-05 13:56:18 +08:00
left join ma_up_off up on d.ma_id = up.ma_id
2023-12-04 20:00:36 +08:00
left join (
select tt.*, pp.type_name as grandpa_name from
(select t.*, p.type_name as parent_name,p.type_id as p_type_id, p.parent_id as p_parent_id
from ma_type_info t
left join ma_type_info p on t.parent_id=p.type_id) tt
left join ma_type_info pp on tt.p_parent_id = pp.type_id
) ty on d.type_id=ty.type_id
2023-12-04 13:21:07 +08:00
where d.ma_id = #{maId}
2023-12-02 15:18:58 +08:00
</select>
2023-12-05 13:22:36 +08:00
<select id= "getPicturesByMaId" parameterType= "Long" resultType= "String" >
SELECT GROUP_CONCAT(sys.file_url)
from ma_dev_info d
left join sys_file_info sys on d.ma_id = sys.model_id
WHERE d.ma_id = #{maId}
GROUP BY d.ma_id
</select>
2023-12-02 15:18:58 +08:00
2023-12-03 17:18:17 +08:00
<insert id= "insertDevInfo" parameterType= "com.bonus.zlpt.common.core.domain.equip.DevInfo" >
2023-12-02 15:18:58 +08:00
insert into ma_dev_info
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "maId != null" > ma_id,</if>
<if test= "code != null" > code,</if>
<if test= "typeId != null" > type_id,</if>
<if test= "maStatus != null" > ma_status,</if>
<if test= "leaseScope != null" > lease_scope,</if>
<if test= "location != null" > location,</if>
<if test= "brand != null" > brand,</if>
<if test= "modelName != null" > model_name,</if>
<if test= "productionDate != null" > production_date,</if>
<if test= "workingHours != null" > working_hours,</if>
<if test= "serialNumber != null" > serial_number,</if>
<if test= "monthLeasePrice != null" > month_lease_price,</if>
<if test= "dayLeasePrice != null" > day_lease_price,</if>
<if test= "picUrl != null" > pic_url,</if>
<if test= "jsMonthPrice != null" > js_month_price,</if>
<if test= "jsDayPrice != null" > js_day_price,</if>
<if test= "description != null" > description,</if>
<if test= "gpsCode != null" > gps_code,</if>
<if test= "ownCo != null" > own_co,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "creator != null" > creator,</if>
<if test= "deposit != null" > deposit,</if>
2023-12-05 11:21:09 +08:00
<if test= "isOperator != null" > is_operator,</if>
2023-12-02 15:18:58 +08:00
<if test= "isActive != null" > is_active,</if>
<if test= "updateTime != null" > update_time,</if>
<if test= "updateBy != null" > update_by,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "maId != null" > #{maId},</if>
<if test= "code != null" > #{code},</if>
<if test= "typeId != null" > #{typeId},</if>
<if test= "maStatus != null" > #{maStatus},</if>
<if test= "leaseScope != null" > #{leaseScope},</if>
<if test= "location != null" > #{location},</if>
<if test= "brand != null" > #{brand},</if>
<if test= "modelName != null" > #{modelName},</if>
<if test= "productionDate != null" > #{productionDate},</if>
<if test= "workingHours != null" > #{workingHours},</if>
<if test= "serialNumber != null" > #{serialNumber},</if>
<if test= "monthLeasePrice != null" > #{monthLeasePrice},</if>
<if test= "dayLeasePrice != null" > #{dayLeasePrice},</if>
<if test= "picUrl != null" > #{picUrl},</if>
<if test= "jsMonthPrice != null" > #{jsMonthPrice},</if>
<if test= "jsDayPrice != null" > #{jsDayPrice},</if>
<if test= "description != null" > #{description},</if>
<if test= "gpsCode != null" > #{gpsCode},</if>
<if test= "ownCo != null" > #{ownCo},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "creator != null" > #{creator},</if>
<if test= "deposit != null" > #{deposit},</if>
2023-12-05 11:21:09 +08:00
<if test= "isOperator != null" > #{isOperator},</if>
2023-12-02 15:18:58 +08:00
<if test= "isActive != null" > #{isActive},</if>
<if test= "updateTime != null" > #{updateTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
</trim>
</insert>
2023-12-03 17:18:17 +08:00
<update id= "updateDevInfo" parameterType= "com.bonus.zlpt.common.core.domain.equip.DevInfo" >
2023-12-02 15:18:58 +08:00
update ma_dev_info
<trim prefix= "SET" suffixOverrides= "," >
<if test= "code != null" > code = #{code},</if>
<if test= "typeId != null" > type_id = #{typeId},</if>
<if test= "maStatus != null" > ma_status = #{maStatus},</if>
<if test= "leaseScope != null" > lease_scope = #{leaseScope},</if>
<if test= "location != null" > location = #{location},</if>
<if test= "brand != null" > brand = #{brand},</if>
<if test= "modelName != null" > model_name = #{modelName},</if>
<if test= "productionDate != null" > production_date = #{productionDate},</if>
<if test= "workingHours != null" > working_hours = #{workingHours},</if>
<if test= "serialNumber != null" > serial_number = #{serialNumber},</if>
<if test= "monthLeasePrice != null" > month_lease_price = #{monthLeasePrice},</if>
<if test= "dayLeasePrice != null" > day_lease_price = #{dayLeasePrice},</if>
<if test= "picUrl != null" > pic_url = #{picUrl},</if>
<if test= "jsMonthPrice != null" > js_month_price = #{jsMonthPrice},</if>
<if test= "jsDayPrice != null" > js_day_price = #{jsDayPrice},</if>
<if test= "description != null" > description = #{description},</if>
<if test= "gpsCode != null" > gps_code = #{gpsCode},</if>
<if test= "ownCo != null" > own_co = #{ownCo},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
<if test= "creator != null" > creator = #{creator},</if>
<if test= "deposit != null" > deposit = #{deposit},</if>
2023-12-05 11:21:09 +08:00
<if test= "isOperator != null" > is_active = #{isOperator},</if>
2023-12-02 15:18:58 +08:00
<if test= "isActive != null" > is_active = #{isActive},</if>
<if test= "updateTime != null" > update_time = #{updateTime},</if>
<if test= "updateBy != null" > update_by = #{updateBy},</if>
</trim>
where ma_id = #{maId}
</update>
<delete id= "deleteDevInfoByMaId" parameterType= "Long" >
delete from ma_dev_info where ma_id = #{maId}
</delete>
<delete id= "deleteDevInfoByMaIds" parameterType= "String" >
delete from ma_dev_info where ma_id in
<foreach item= "maId" collection= "array" open= "(" separator= "," close= ")" >
#{maId}
</foreach>
</delete>
</mapper>