123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <?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.hssx.cloudmodel.mapper.MouldMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.Mould">
- <id column="id" property="id" />
- <result column="model_no" property="modelNo" />
- <result column="model_name" property="modelName" />
- <result column="water_gap" property="waterGap" />
- <result column="tonnage" property="tonnage" />
- <result column="oc_cycle" property="ocCycle" />
- <result column="daily_output" property="dailyOutput" />
- <result column="company_id" property="companyId" />
- <result column="current_version_id" property="currentVersionId" />
- <result column="state" property="state" />
- <result column="is_delete" property="isDelete" />
- <result column="creator_id" property="creatorId" />
- <result column="project_id" property="projectId" />
- <result column="rfid" property="rfid" />
- <result column="setting_life" property="settingLife" />
- <result column="area" property="area" />
- <result column="produce_company_name" property="produceCompanyName" />
- <result column="initial_modulus" property="initialModulus" />
- <result column="equipment_id" property="equipmentId" />
- <result column="belong_project_grade" property="belongProjectGrade" />
- <result column="produce_company_id" property="produceCompanyId" />
- <result column="run_times" property="runTimes" />
- <result column="is_maintain" property="isMaintain" />
- <result column="maintain_count" property="maintainCount" />
- <result column="holes" property="holes" />
- <result column="pre_update_id" property="preUpdateId" />
- <result column="history_run_times" property="historyRunTimes" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, model_no, model_name, water_gap, tonnage, oc_cycle, daily_output, company_id, current_version_id, state, is_delete, creator_id, project_id, rfid, setting_life, area, produce_company_name, initial_modulus, equipment_id, belong_project_grade, produce_company_id, run_times, is_maintain, maintain_count, holes, pre_update_id, history_run_times
- </sql>
- <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.MouldVO">
- <id column="id" property="id"/>
- <result column="maintain_count" property="maintainCount" />
- <result column="model_no" property="modelNo"/>
- <result column="model_name" property="modelName"/>
- <result column="oc_cycle" property="ocCycle"/>
- <result column="daily_output" property="dailyOutput"/>
- <result column="company_id" property="companyId"/>
- <result column="current_version_id" property="currentVersionId"/>
- <result column="state" property="state"/>
- <result column="is_delete" property="isDelete"/>
- <result column="creator_id" property="creatorId"/>
- <result column="project_id" property="projectId"/>
- <result column="projectName" property="projectName"/>
- <result column="rfid" property="rfid"/>
- <result column="setting_life" property="settingLife"/>
- <result column="area" property="area"/>
- <result column="produce_company_name" property="produceCompanyName"/>
- <result column="initial_modulus" property="initialModulus"/>
- <result column="equipment_id" property="equipmentId"/>
- <result column="belong_project_grade" property="belongProjectGrade"/>
- <result column="produce_company_id" property="produceCompanyId"/>
- <result column="produceCompany" property="produceCompany"/>
- <result column="run_times" property="runTimes" />
- <result column="projectName" property="projectName"/>
- <result column="managerId" property="managerId" />
- <result column="mangerName" property="mangerName"/>
- <result column="equipmentNo" property="equipmentNo"/>
- <result column="stage" property="stage"/>
- <result column="endTime" property="endTime"/>
- <result column="lastopentime" property="lastOpenTime"/>
- <result column="hillNumber" property="hillNumber"/>
- <result column="temperature" property="temperature"/>
- <result column="ownerCompanyName" property="ownerCompanyName"/>
- <result column="companyName" property="companyName"/>
- <result column="is_maintain" property="isMaintain" />
- <result column="holes" property="holes" />
- <result column="lng" property="lng" />
- <result column="lat" property="lat" />
- <result column="equipmentName" property="equipmentName" />
- <result column="pre_update_id" property="preUpdateId" />
- </resultMap>
- <update id="updateMouldByProjectId">
- update tb_mould set project_id = null ,belong_project_grade = 0 where project_id = #{project.id}
- </update>
- <select id="selectListByCondition" resultMap="BaseResultMapVO">
- select
- tbm.id id,tbm.model_no model_no, tbm.model_name model_name,tbm.initial_modulus initial_modulus,tbm.rfid rfid,tbm.creator_id creator_id,tbm.equipment_id equipment_id,tbm.is_maintain,tbm.holes,
- tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbco.company_name produceCompany,tbm.pre_update_id,
- tbp.manager mangerName,tbco.company_address area,tbmp.hill_number hillNumber,tbm.oc_cycle oc_cycle,tbp.manager_id managerId,tbmp.equipment_name equipmentName,
- tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
- tbmp.lng,tbmp.lat,tbmp.stage,(SELECT indate FROM `mould_history` WHERE equipment_no=equipmentNo ORDER BY indate DESC LIMIT 1) lastopentime
- ,(SELECT battery FROM `mould_history` WHERE equipmentNo = equipment_no ORDER BY indate DESC LIMIT 1) hill_number,
- (SELECT temperature FROM `mould_history` WHERE equipment_no = equipmentNo ORDER BY indate DESC LIMIT 1) temperature
- from
- tb_mould tbm
- left join
- tb_mould_equipment tbmp
- on
- tbm.equipment_id = tbmp.id
- left join
- tb_project tbp
- on tbp.id = tbm.project_id
- left join
- tb_company tbc
- on
- tbc.id = tbm.company_id
- left join
- tb_company tbco
- on
- tbco.id = tbm.produce_company_id
- <where>
- <if test="userVO.parentId != 0">
- tbm.company_id = #{userVO.companyId}
- </if>
- <if test="userVO.searchType == 0 and userVO.keyName != '' and userVO.keyName != null">
- AND tbm.model_no like concat('%',#{userVO.keyName},'%')
- </if>
- <if test="userVO.searchType == 1 and userVO.keyName != '' and userVO.keyName != null">
- AND tbm.model_name like concat('%',#{userVO.keyName},'%')
- </if>
- <if test="userVO.projectId != -1">
- AND tbm.project_id = #{userVO.projectId}
- </if>
- <if test="userVO.type == 0">
- AND tbm.equipment_id is not null
- AND tbm.state != 4
- AND tbm.project_id is not null
- </if>
- <if test="userVO.mouleMap == -1">
- AND tbmp.lng IS NOT NULL and tbmp.lat IS NOT NULL
- </if>
- </where>
- </select>
- <select id="selectListByConditionByProject" resultMap="BaseResultMapVO">
- select
- tbm.id id,tbm.model_no model_no, tbm.model_name model_name,tbm.initial_modulus initial_modulus,tbm.rfid rfid,tbp.manager_id managerId,tbm.equipment_id equipment_id,is_maintain,
- tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbm.holes,tbm.pre_update_id,tbco.company_name produceCompany,
- tbp.manager mangerName,tbco.company_address area,tbm.oc_cycle oc_cycle,tbm.creator_id creator_id,tbmp.equipment_name equipmentName,
- tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
- tbmp.lng,tbmp.lat,tbmp.stage,(SELECT indate FROM `mould_history` WHERE equipment_no=equipmentNo ORDER BY indate DESC LIMIT 1) lastopentime,
- (SELECT battery FROM `mould_history` WHERE equipmentNo = equipment_no ORDER BY indate DESC LIMIT 1) hill_number,
- (SELECT temperature FROM `mould_history` WHERE equipment_no = equipmentNo ORDER BY indate DESC LIMIT 1) temperature
- from
- tb_mould tbm
- left join
- tb_mould_equipment tbmp
- on
- tbm.equipment_id = tbmp.id
- left join
- tb_project tbp
- on
- tbp.id = tbm.project_id
- left join
- tb_company tbc
- on
- tbc.id = tbm.company_id
- left join
- tb_company tbco
- on
- tbco.id = tbm.produce_company_id
- <where>
- <if test="userVO.searchType == 0 and userVO.keyName != '' and userVO.keyName != null">
- AND tbm.model_no like concat('%',#{userVO.keyName},'%')
- </if>
- <if test="userVO.searchType == 1 and userVO.keyName != '' and userVO.keyName != null">
- AND tbm.model_name like concat('%',#{userVO.keyName},'%')
- </if>
- <if test="userVO.mouleMap == -1">
- AND tbmp.lng IS NOT NULL and tbmp.lat IS NOT NULL
- </if>
- <if test="userVO.type == 0">
- AND tbm.equipment_id is not null
- AND tbm.state != 4
- AND tbm.project_id is not null
- </if>
- AND tbm.project_id in
- <foreach item="item" index="index" collection="list"
- open="(" separator="," close=")">
- #{item}
- </foreach>
- </where>
- </select>
- <select id="getDetailById" resultMap="BaseResultMapVO">
- select
- tbm.project_id project_id, tbm.setting_life setting_life,tbm.equipment_id equipment_id,tbm.maintain_count maintain_count,is_maintain,
- tbm.id id,tbm.model_no model_no, tbm.model_name,tbm.initial_modulus initial_modulus,tbp.manager_id managerId,tbm.produce_company_id produce_company_id,
- tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbco.company_name produceCompany,tbm.creator_id creator_id,tbm.holes,
- tbp.manager mangerName,tbco.company_address area,tbm.rfid rfid,tbm.oc_cycle oc_cycle,tbc.company_name companyName,tbm.pre_update_id,tbmp.equipment_name equipmentName,
- tbmp.equipment_no equipmentNo,(SELECT battery FROM `mould_history` WHERE tbmp.equipment_no = equipment_no ORDER BY indate DESC LIMIT 1) hill_number,
- (SELECT temperature FROM `mould_history` WHERE equipment_no = tbmp.equipment_no ORDER BY indate DESC LIMIT 1) temperature,tbm.setting_life setting_life,tbm.run_times run_times,tbmp.stage
- from
- tb_mould tbm
- left join
- tb_mould_equipment tbmp
- on
- tbm.equipment_id = tbmp.id
- left join
- tb_project tbp
- on tbp.id = tbm.project_id
- left join
- tb_company tbco
- on
- tbco.id = tbm.produce_company_id
- left join
- tb_company tbc
- on
- tbc.id = tbm.company_id
- where
- tbm.id = #{mouldVO.id}
- </select>
- <select id="selectListByCompanyId" resultMap="BaseResultMapVO">
- select
- tbm.id id,tbm.model_no model_no, tbm.model_name model_name,tbm.initial_modulus initial_modulus,tbm.rfid rfid,tbm.creator_id creator_id,tbm.equipment_id equipment_id,tbm.is_maintain,tbm.holes,
- tbmp.end_time endTime,tbm.state state,tbp.project_name projectName,tbc.company_name companyName,tbm.pre_update_id,tbm.company_id,tbco.company_name produce_company_name,tbm.produce_company_id,
- tbp.manager mangerName,tbco.company_address area,tbm.oc_cycle oc_cycle,tbp.manager_id managerId,
- tbmp.equipment_no equipmentNo,tbm.setting_life setting_life,tbp.owner_company_name ownerCompanyName,tbm.run_times run_times,
- tbmp.lng,tbmp.lat,tbmp.stage
- from
- tb_mould tbm
- left join
- tb_mould_equipment tbmp
- on
- tbm.equipment_id = tbmp.id
- left join
- tb_project tbp
- on tbp.id = tbm.project_id
- left join
- tb_company tbc
- on
- tbc.id = tbm.company_id
- left join
- tb_company tbco
- on
- tbco.id = tbm.produce_company_id
- where
- tbm.company_id = #{companyId}
- AND tbm.equipment_id is not null
- AND tbm.project_id is null
- <if test="projectId != null">
- OR tbm.project_id = #{projectId}
- </if>
- </select>
- <update id="updateModelProjectIdAndEquipmentIdToNullById">
- update
- tb_mould
- SET /*project_id = NULL , */equipment_id = NULL
- where id = #{model.id}
- </update>
- </mapper>
|