Zlpt-Cloud/zlpt-modules/zlpt-equip/src/main/resources/mapper/DevInfoMapper.xml

461 lines
28 KiB
XML
Raw Normal View History

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-08 14:01:39 +08:00
<resultMap type="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo" 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" />
2023-12-09 11:23:59 +08:00
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
2023-12-02 15:18:58 +08:00
<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" />
2023-12-05 14:21:48 +08:00
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="specification" column="specification" />
2023-12-02 15:18:58 +08:00
<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" />
2023-12-08 14:01:39 +08:00
<result property="deviceName" column="device_name" />
<result property="groupName" column="group_name" />
<result property="companyName" column="company_name" />
2023-12-02 15:18:58 +08:00
</resultMap>
<sql id="selectDevInfoVo">
2023-12-09 11:23:59 +08:00
select ma_id, code, type_id, ma_status, lease_scope, location, province_id, city_id, area_id, brand, model_name, production_date, working_hours, serial_number,
2023-12-05 14:21:48 +08:00
month_lease_price, day_lease_price, pic_url, js_month_price, js_day_price, description, gps_code, own_co, create_time,
creator, update_time, update_by, specification, deposit, is_operator, is_active, update_time, update_by from ma_dev_info
2023-12-02 15:18:58 +08:00
</sql>
2023-12-10 00:32:11 +08:00
2023-12-06 10:37:06 +08:00
<select id="selectDevInfoList" parameterType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">
2023-12-09 21:05:15 +08:00
select d.*,mt1.type_name as device_name, mt2.type_name as group_name, mt3.type_name as type_name,c.company_name
2023-12-04 11:36:46 +08:00
from ma_dev_info d
2023-12-09 20:04:36 +08:00
left join ma_type_info mt1 on d.type_id = mt1.type_id
left join ma_type_info mt2 on mt1.parent_id = mt2.type_id
left join ma_type_info mt3 on mt2.parent_id = mt3.type_id
2023-12-04 19:41:21 +08:00
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>
2023-12-08 17:52:22 +08:00
<if test="typeId != null">
<if test="level != null and level == 2">
and t.parent_id = #{typeId}
</if>
<if test="level != null and level == 3">
and d.type_id = #{typeId}
</if>
2023-12-08 16:39:44 +08:00
</if>
2023-12-04 11:36:46 +08:00
<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>
2023-12-09 11:23:59 +08:00
<if test="provinceId != null and provinceId != ''"> and d.province_id = #{provinceId}</if>
<if test="cityId != null and cityId != ''"> and d.city_id = #{cityId}</if>
<if test="areaId != null and areaId != ''"> and d.area_id = #{areaId}</if>
2023-12-04 11:36:46 +08:00
<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>
2023-12-06 17:16:39 +08:00
<if test="ageMin != null and ageMin != '' and ageMax != null and ageMax != ''">
and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) &gt;= #{ageMin} * 365
and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) &lt;= #{ageMax} * 365
</if>
2023-12-06 16:43:13 +08:00
<if test="workingHoursMin != null and workingHoursMin != '' and workingHoursMax != null and workingHoursMax != ''">
and d.working_hours &gt;= #{workingHoursMin} and d.working_hours &lt;= #{workingHoursMax}
</if>
2023-12-04 11:36:46 +08:00
<if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>
2023-12-08 16:39:44 +08:00
<if test="monthLeasePriceMin != null and monthLeasePriceMax != null">
2023-12-06 16:43:13 +08:00
and d.month_lease_price &gt;= #{monthLeasePriceMin} and d.month_lease_price &lt;= #{monthLeasePriceMax}
</if>
2023-12-04 11:36:46 +08:00
<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>
2023-12-05 14:21:48 +08:00
<if test="updateBy != null "> and d.update_by = #{updateBy}</if>
<if test="specification != null "> and d.specification = #{specification}</if>
2023-12-04 11:36:46 +08:00
<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 (
2023-12-09 20:04:36 +08:00
locate(#{keyWord},mt1.type_name) > 0
or locate(#{keyWord},mt2.type_name) > 0
or locate(#{keyWord},mt3.type_name) > 0
2023-12-08 17:35:24 +08:00
or locate(#{keyWord},c.company_name) > 0
or locate(#{keyWord},d.ma_id) > 0
or locate(#{keyWord},d.model_name) > 0
or locate(#{keyWord},d.specification) > 0
or locate(#{keyWord},d.serial_number) > 0
or locate(#{keyWord},d.description) > 0
2023-12-04 14:45:23 +08:00
)
</if>
2023-12-07 16:25:04 +08:00
and d.is_active='1'
2023-12-02 15:18:58 +08:00
</where>
2023-12-06 16:43:13 +08:00
order by
d.is_active
<if test="monthLeasePriceOrderBy != null and monthLeasePriceOrderBy == 'ASC'">
,d.month_lease_price
</if>
<if test="monthLeasePriceOrderBy != null and monthLeasePriceOrderBy == 'DESC'">
,d.month_lease_price DESC
</if>
2023-12-08 15:34:48 +08:00
<if test="updateTimeOrderBy != null and updateTimeOrderBy == 'ASC'">
2023-12-06 16:43:13 +08:00
,d.update_time
</if>
2023-12-08 15:34:48 +08:00
<if test="updateTimeOrderBy != null and updateTimeOrderBy == 'DESC'">
2023-12-06 16:43:13 +08:00
,d.update_time DESC
</if>
2023-12-02 15:18:58 +08:00
</select>
2023-12-05 20:56:22 +08:00
2023-12-09 17:44:13 +08:00
<!-- <select id="selectDevInfoList4Collect" parameterType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">-->
<!-- select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,u.type as type-->
<!-- from ma_dev_info d-->
<!-- 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-->
<!-- left join ma_up_off u on d.ma_id = u.ma_id-->
<!-- left join ma_user_collect col on d.ma_id = col.ma_id-->
<!-- &#45;&#45; select d.*,t.type_name,c.company_name ,u.type, u.id as up_id-->
<!-- &#45;&#45; from ma_dev_info d-->
<!-- &#45;&#45; left join ma_type_info t on d.type_id = t.type_id-->
<!-- &#45;&#45; left join bm_company_info c on d.own_co = c.company_id-->
<!-- &#45;&#45; left join ma_up_off u on d.ma_id = u.ma_id-->
<!-- <where>-->
<!-- <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">-->
<!-- <if test="level != null and level == 2">-->
<!-- and t.parent_id = #{typeId}-->
<!-- </if>-->
<!-- <if test="level != null and level == 3">-->
<!-- and d.type_id = #{typeId}-->
<!-- </if>-->
<!-- </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="provinceId != null and provinceId != ''"> and d.province_id = #{provinceId}</if>-->
<!-- <if test="cityId != null and cityId != ''"> and d.city_id = #{cityId}</if>-->
<!-- <if test="areaId != null and areaId != ''"> and d.area_id = #{areaId}</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="ageMin != null and ageMin != '' and ageMax != null and ageMax != ''">-->
<!-- and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) &gt;= #{ageMin} * 365-->
<!-- and DATEDIFF(DATE_FORMAT(now(), '%Y-%m-%d'), d.production_date) &lt;= #{ageMax} * 365-->
<!-- </if>-->
<!-- <if test="workingHoursMin != null and workingHoursMin != '' and workingHoursMax != null and workingHoursMax != ''">-->
<!-- and d.working_hours &gt;= #{workingHoursMin} and d.working_hours &lt;= #{workingHoursMax}-->
<!-- </if>-->
<!-- <if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>-->
<!-- <if test="monthLeasePriceMin != null and monthLeasePriceMax != null">-->
<!-- and d.month_lease_price &gt;= #{monthLeasePriceMin} and d.month_lease_price &lt;= #{monthLeasePriceMax}-->
<!-- </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="updateBy != null "> and d.update_by = #{updateBy}</if>-->
<!-- <if test="specification != null "> and d.specification = #{specification}</if>-->
<!-- <if test="deposit != null "> and d.deposit = #{deposit}</if>-->
<!-- <if test="isActive != null and isActive != ''"> and d.is_active = #{isActive}</if>-->
<!-- <if test="keyWord != null and keyWord != ''">-->
<!-- and (-->
<!-- locate(#{keyWord},t.type_name) > 0-->
<!-- or locate(#{keyWord},c.company_name) > 0-->
<!-- or locate(#{keyWord},d.ma_id) > 0-->
<!-- or locate(#{keyWord},d.model_name) > 0-->
<!-- or locate(#{keyWord},d.specification) > 0-->
<!-- or locate(#{keyWord},d.serial_number) > 0-->
<!-- or locate(#{keyWord},d.description) > 0-->
<!-- )-->
<!-- </if>-->
<!-- and d.is_active='1' and col.user_id = #{userId}-->
<!-- </where>-->
<!-- order by-->
<!-- d.is_active-->
<!-- <if test="monthLeasePriceOrderBy != null and monthLeasePriceOrderBy == 'ASC'">-->
<!-- ,d.month_lease_price-->
<!-- </if>-->
<!-- <if test="monthLeasePriceOrderBy != null and monthLeasePriceOrderBy == 'DESC'">-->
<!-- ,d.month_lease_price DESC-->
<!-- </if>-->
<!-- <if test="updateTimeOrderBy != null and updateTimeOrderBy == 'ASC'">-->
<!-- ,d.update_time-->
<!-- </if>-->
<!-- <if test="updateTimeOrderBy != null and updateTimeOrderBy == 'DESC'">-->
<!-- ,d.update_time DESC-->
<!-- </if>-->
<!-- </select>-->
2023-12-06 10:37:06 +08:00
<select id="selectDevInfoHotList" parameterType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">
2023-12-06 19:07:39 +08:00
select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,search_num
2023-12-05 20:56:22 +08:00
from ma_dev_info d
2023-12-06 19:07:39 +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
2023-12-06 15:33:17 +08:00
left join bm_company_info c on d.own_co = c.company_id
left join ma_hot_search h on d.ma_id = h.ma_id
2023-12-08 14:01:39 +08:00
left join ma_type_info ti on d.type_id = ti.type_id
2023-12-09 14:44:36 +08:00
<where>
d.is_active='1'
<if test="maStatus != null and maStatus != ''"> and d.ma_status = #{maStatus}</if>
</where>
2023-12-05 20:56:22 +08:00
order by h.search_num
</select>
2023-12-06 19:07:39 +08:00
2023-12-06 10:37:06 +08:00
<select id="selectDevInfoByMaId" parameterType="Long" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">
2023-12-05 15:25:27 +08:00
select d.*,c.company_name,c.create_time as company_create_time,c.logo_url as company_logo_url,
2023-12-09 19:29:31 +08:00
c.auth_phone, mt1.type_name as device_name,
mt2.type_name as group_name, mt3.type_name as type_name,
2023-12-09 21:05:15 +08:00
col.id as collect_id, h.search_num
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 14:40:39 +08:00
left join ma_hot_search h on d.ma_id = h.ma_id
2023-12-08 14:21:33 +08:00
left join ma_type_info t on d.type_id = t.type_id
2023-12-09 19:29:31 +08:00
left join ma_type_info mt1 on d.type_id = mt1.type_id
left join ma_type_info mt2 on mt1.parent_id = mt2.type_id
left join ma_type_info mt3 on mt2.parent_id = mt3.type_id
2023-12-08 14:21:33 +08:00
where d.ma_id = #{maId} and d.is_active='1'
2023-12-02 15:18:58 +08:00
</select>
2023-12-05 13:22:36 +08:00
2023-12-05 16:19:41 +08:00
<select id="getFilesByMaId" parameterType="Long" resultType="com.bonus.zlpt.common.core.domain.system.SysFile">
2023-12-05 20:15:10 +08:00
SELECT s.dic_id, s.file_name as name,s.file_url as url
2023-12-05 13:22:36 +08:00
from ma_dev_info d
2023-12-05 16:19:41 +08:00
left join sys_file_info s on d.ma_id = s.model_id
2023-12-08 19:23:26 +08:00
WHERE d.ma_id = #{maId} and d.is_active='1' and s.dic_id = 20
2023-12-05 13:22:36 +08:00
</select>
2023-12-05 15:09:13 +08:00
<select id="getCompanyUpNum" parameterType="Long" resultType="Long">
select count(up.ma_id) from ma_dev_info d
left join ma_up_off up on d.ma_id = up.ma_id and up.`status`=1
2023-12-07 16:25:04 +08:00
where d.own_co= #{ownCo} and d.is_active='1'
2023-12-05 15:09:13 +08:00
GROUP BY d.own_co
</select>
2023-12-02 15:18:58 +08:00
2023-12-09 20:43:17 +08:00
<insert id="insertDevInfo" parameterType="com.bonus.zlpt.equip.api.domain.DevInfo" useGeneratedKeys="true" keyProperty="maId">
2023-12-02 15:18:58 +08:00
insert into ma_dev_info
<trim prefix="(" suffix=")" suffixOverrides=",">
2023-12-09 20:43:17 +08:00
<if test="maId != null and maId != '' ">ma_id,</if>
<if test="code != null and code != '' ">code,</if>
<if test="typeId != null and typeId != ''">type_id,</if>
<if test="maStatus != null and maStatus != ''">ma_status,</if>
<if test="leaseScope != null and leaseScope != ''">lease_scope,</if>
<if test="location != null and location != ''" >location,</if>
<if test="provinceId != null and provinceId != ''">province_id,</if>
<if test="cityId != null and cityId != ''">city_id,</if>
<if test="areaId != null and areaId != ''">area_id,</if>
<if test="brand != null and brand != ''">brand,</if>
<if test="modelName != null and modelName != ''">model_name,</if>
<if test="productionDate != null and productionDate != ''">production_date,</if>
<if test="workingHours != null and workingHours != ''">working_hours,</if>
<if test="serialNumber != null and serialNumber != ''">serial_number,</if>
<if test="monthLeasePrice != null and monthLeasePrice != ''">month_lease_price,</if>
<if test="dayLeasePrice != null and dayLeasePrice != ''">day_lease_price,</if>
<if test="picUrl != null and picUrl != ''">pic_url,</if>
<if test="jsMonthPrice != null and jsMonthPrice != ''">js_month_price,</if>
<if test="jsDayPrice != null and jsDayPrice != ''">js_day_price,</if>
<if test="description != null and description != ''">description,</if>
<if test="gpsCode != null and gpsCode != ''">gps_code,</if>
<if test="ownCo != null and ownCo != ''">own_co,</if>
<if test="createTime != null and createTime != ''">create_time,</if>
<if test="creator != null and creator != ''">creator,</if>
<if test="updateTime != null and updateTime != ''">update_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="specification != null and specification != ''">specification,</if>
<if test="deposit != null and deposit != ''">deposit,</if>
<if test="isOperator != null and isOperator != ''">is_operator,</if>
<if test="isActive != null and isActive != ''">is_active,</if>
<if test="updateTime != null and updateTime != ''">update_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
2023-12-02 15:18:58 +08:00
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
2023-12-09 20:43:17 +08:00
<if test="maId != null and maId != ''">#{maId},</if>
<if test="code != null and code != ''">#{code},</if>
<if test="typeId != null and typeId != ''">#{typeId},</if>
<if test="maStatus != null and maStatus != ''">#{maStatus},</if>
<if test="leaseScope != null and leaseScope != ''">#{leaseScope},</if>
<if test="location != null and location != ''">#{location},</if>
<if test="provinceId != null and provinceId != ''">#{provinceId},</if>
<if test="cityId != null and cityId != ''">#{cityId},</if>
<if test="areaId != null and areaId != ''">#{areaId},</if>
<if test="brand != null and brand != ''">#{brand},</if>
<if test="modelName != null and modelName != ''">#{modelName},</if>
<if test="productionDate != null and productionDate != ''">#{productionDate},</if>
<if test="workingHours != null and workingHours != ''">#{workingHours},</if>
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
<if test="monthLeasePrice != null and monthLeasePrice != ''">#{monthLeasePrice},</if>
<if test="dayLeasePrice != null and dayLeasePrice != ''">#{dayLeasePrice},</if>
<if test="picUrl != null and picUrl != ''">#{picUrl},</if>
<if test="jsMonthPrice != null and jsMonthPrice != ''">#{jsMonthPrice},</if>
<if test="jsDayPrice != null and jsDayPrice != ''">#{jsDayPrice},</if>
<if test="description != null and description != ''">#{description},</if>
<if test="gpsCode != null and gpsCode != ''">#{gpsCode},</if>
<if test="ownCo != null and ownCo != ''">#{ownCo},</if>
<if test="createTime != null and createTime != ''">#{createTime},</if>
<if test="creator != null and creator != ''">#{creator},</if>
<if test="updateTime != null and updateTime != ''">#{update_time},</if>
<if test="updateBy != null and updateBy != ''">#{update_by},</if>
<if test="specification != null and specification != ''">#{specification},</if>
<if test="deposit != null and deposit != ''">#{deposit},</if>
<if test="isOperator != null and isOperator != ''">#{isOperator},</if>
<if test="isActive != null and isActive != ''">#{isActive},</if>
<if test="updateTime != null and updateTime != ''">#{updateTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
2023-12-02 15:18:58 +08:00
</trim>
</insert>
2023-12-05 15:28:52 +08:00
<insert id="insertLon">
insert into gps_real_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dto.gpsCode != null and dto.gpsCode != ''">gps_code,</if>
<if test="dto.lon != null and dto.lon !=''">lon,</if>
<if test="dto.lat != null and dto.lat != ''">lat,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dto.gpsCode != null and dto.gpsCode != ''">#{dto.gpsCode},</if>
<if test="dto.lon != null and dto.lon !=''">#{dto.lon},</if>
<if test="dto.lat != null and dto.lat != ''">#{dto.lat},</if>
</trim>
</insert>
2023-12-06 10:37:06 +08:00
<update id="updateDevInfo" parameterType="com.bonus.zlpt.equip.api.domain.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>
2023-12-09 11:23:59 +08:00
<if test="provinceId != null">province_id = #{provinceId},</if>
<if test="cityId != null">city_id = #{cityId},</if>
<if test="areaId != null">area_id = #{areaId},</if>
2023-12-02 15:18:58 +08:00
<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>
2023-12-05 14:21:48 +08:00
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="specification != null">specification = #{specification},</if>
2023-12-02 15:18:58 +08:00
<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>
2023-12-07 16:25:04 +08:00
<update id="deleteDevInfoByMaId" parameterType="Long">
update ma_dev_info set is_active='0' where ma_id = #{maId}
</update>
2023-12-02 15:18:58 +08:00
2023-12-07 16:25:04 +08:00
<update id="deleteDevInfoByMaIds" parameterType="String">
update ma_dev_info set is_active='0' where ma_id in
2023-12-02 15:18:58 +08:00
<foreach item="maId" collection="array" open="(" separator="," close=")">
#{maId}
</foreach>
2023-12-07 16:25:04 +08:00
</update>
2023-12-08 14:01:39 +08:00
<select id="productList" parameterType="com.bonus.zlpt.equip.api.domain.DevInfo" resultType="com.bonus.zlpt.equip.api.domain.vo.MaDevInfoVo">
select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name
from ma_dev_info d
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
</select>
2023-12-09 11:23:59 +08:00
2023-12-09 16:53:18 +08:00
<select id="selectUserCollectByUserId" parameterType="Long" resultType="com.bonus.zlpt.equip.api.domain.UserCollect">
select id, user_id, ma_id, time from ma_user_collect
where user_id = #{userId}
</select>
2023-12-09 22:42:05 +08:00
<select id="getHotSearchCountByMaId" resultType="Integer">
select count(1) from ma_hot_search
where ma_id = #{maId}
</select>
<insert id="insertHotSearch">
INSERT INTO ma_hot_search (ma_id, search_num)
VALUES (#{maId}, 1)
</insert>
2023-12-09 16:53:18 +08:00
<update id="updateHotSearchByMaId" parameterType="Long">
update ma_hot_search
set search_num = search_num + 1
where ma_id = #{maId}
</update>
2023-12-09 11:23:59 +08:00
<select id="getSysDic" resultType="com.bonus.zlpt.system.api.domain.SysDic">
select
id,p_id,code,`name`,description,`value`,sort,`level`,status,create_time,creator
from sys_dic
</select>
2023-12-09 11:37:31 +08:00
<select id="getSysDicById" resultType="com.bonus.zlpt.system.api.domain.SysDic">
select
id,p_id,code,`name`,description,`value`,sort,`level`,status,create_time,creator
from sys_dic
where id = #{id}
</select>
2023-12-09 14:19:55 +08:00
<select id="getBaseAddress" resultType="com.bonus.zlpt.system.api.domain.BaseAddress">
2023-12-10 00:32:11 +08:00
select id,name,code from base_address where status = 1
2023-12-09 14:19:55 +08:00
</select>
<select id="getBaseAddressById" resultType="String">
select name from base_address where status = 1 and id = #{id}
</select>
2023-12-09 20:43:17 +08:00
<select id="selectDevInfoLists" resultType="com.bonus.zlpt.equip.api.domain.vo.DevInfoVo">
select d.*,t.type_name as device_name,t.parent_name as group_name,c.company_name,u.type as type,t.group_name as type_name,t.p_id as group_id,t.group_id as company_id
from ma_dev_info d
left join (select t.*, p.type_name as parent_name, p.type_id as p_id,mt.type_name as group_name, mt.type_id as group_id
from ma_type_info t
left join ma_type_info p on t.parent_id=p.type_id
left join ma_type_info mt on p.parent_id = mt.type_id
) t on d.type_id = t.type_id
left join bm_company_info c on d.own_co = c.company_id
left join ma_up_off u on d.ma_id = u.ma_id ORDER BY d.create_time desc
</select>
2023-12-02 15:18:58 +08:00
</mapper>