1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153 |
- <?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.platform.dao.mapper.sb.SbInfoMapper">
- <sql id="Base_Column_List">
- id
- , no,
- financing_no,
- position_no,pp_no,
- financing_no_two,
- financing_no_third,
- financing_no_four,
- financing_no_five,
- param_list,
- name, model_id,
- is_child, is_measure, measure_status,is_self,
- is_show,
- is_financing,
- type_id, level, initial_value, current_value, cut_value,
- producer_id, source_type, source_sb_id, parent_id, unit, position_id,
- use_area,
- check_id,
- rate,
- month,
- used_month,
- card_no,
- use_company,
- use_project,
- use_dept,
- use_group,
- use_user,
- save_dept,
- save_user,
- repair_user,
- buy_date, start_date, next_check_date, guarantee_date, work_year, retirement_date,
- depreciation_type, wb_file, use_file, check_file, sb_image, qr_code, status, remark,
- created_user_id, update_user_id, created_time, update_time,
- zzh,
- fdjxh,
- fdjh,
- cph,
- dph,
- zz,
- zaiz,
- last_repaire_time,
- repaire_times,
- last_baoyang_time,
- last_baoyang_hours,
- last_baoyang_miles,
- baoyang_times,
- rl_type,
- color,
- use_type,
- seat_number,
- zjm,
- sp_date,
- jbdh,
- sbdh,
- jbd_date,
- sbd_date,
- bxgs,
- sb_date,
- check_date,
- check_period,
- register_no,
- character_type,
- used_no,
- supplier,
- repair_user_second,
- batch_no,
- register_date,
- zbh,
- refuse_reason,
- apply_time,
- audit_time,
- submit_time,
- process_instance_id,
- audit_node,
- remark,
- apply_comment,
- scrap_user_id,
- scrap_user_name
- </sql>
- <sql id="Left_Column">
- sb.id, sb.no,sb.sort_num,
- sb.financing_no_two,
- sb.financing_no_third,
- sb.financing_no_four,
- sb.financing_no_five,
- sb.financing_no,
- sb.position_no,
- sb.pp_no,
- sb.name, sb.initial_value,
- sb.current_value, sb.cut_value,
- sb.is_child, sb.is_measure, sb.measure_status,sb.is_self,
- sb.is_financing,
- sb.parent_id,
- sb.param_list,
- sb.is_show,
- sb.unit, sb.position_id,
- sb.use_area,
- sb.rate,
- sb.month,
- sb.used_month,
- sb.card_no,
- sb.check_id,
- sb.use_company,
- sb.use_project,
- sb.use_dept,
- sb.use_group,
- sb.use_user,
- sb.save_dept,
- sb.save_user,
- sb.repair_user,
- sb.buy_date, sb.start_date, sb.next_check_date, sb.guarantee_date, sb.work_year,
- sb.retirement_date,
- sb.depreciation_type, sb.wb_file, sb.use_file, sb.check_file, sb.sb_image, sb.qr_code, sb.status, sb.remark,
- sb.created_user_id, sb.update_user_id, sb.created_time, sb.update_time,
- sb.model_id,
- sb.zzh,
- sb.fdjxh,
- sb.fdjh,
- sb.cph,
- sb.dph,
- sb.zz,
- sb.zaiz,
- sb.last_repaire_time,
- sb.repaire_times,
- sb.last_baoyang_time,
- sb.last_baoyang_hours,
- sb.last_baoyang_miles,
- sb.use_type,
- sb.baoyang_times,
- sb.rl_type,
- sb.color,
- sb.seat_number,
- sb.zjm,
- sb.sp_date,
- sb.jbdh,
- sb.sbdh,
- sb.total_hours,
- sb.total_miles,
- sb.jbd_date,
- sb.sbd_date,
- sb.bxgs,
- sb.sb_date,
- sb.type_id as typeId,
- sb.name_model as nameModel,
- sb.model,
- sb.producer_id as producerId,
- sb.level,
- sb.unit,
- sb.use_type as useType,
- sbType.name as typeName,
- position.name as positionName,
- sb.check_date,
- sb.check_period,
- sb.register_no,
- sb.character_type,
- sb.used_no,
- sb.zbh,
- sb.supplier,
- sb.repair_user_second,
- sb.batch_no,
- sb.register_date,
- sb.refuse_reason,
- sb.apply_time,
- sb.audit_time,
- sb.submit_time,
- sb.process_instance_id,
- sb.audit_node,
- sb.remark,
- sb.apply_comment,
- sb.scrap_user_id,
- sb.scrap_user_name,sb.repair_dept_id,sb.sort_num,
- sb.identify_no,
- sb.use_no,
- sb.sb_code,
- sb.install_unit,
- sb.exam_result,
- sb.use_position,
- sb.sb_register_no,
- sb.check_type
- </sql>
- <sql id="deptSql">
- <if test="saveDept != null and saveDept != ''">
- and sb.save_dept = #{saveDept}
- </if>
- </sql>
- <select id="selectVOList" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
- resultType="com.platform.dao.vo.sb.SbInfoVO">
- select
- <include refid="Left_Column"/>
- from t_sb_info sb
- left join t_sb_type sbType on sb.type_id = sbType.id
- left join t_sb_position position on sb.position_id = position.id
- left join t_sys_dept sdDept on sb.save_dept = sdDept.dept_id
- where
- 1 = 1
- <if test="keyword != null and keyword != ''">
- and (
- sb.name like concat('%',#{keyword},'%')
- or sb.no like concat('%',#{keyword},'%')
- or sb.position_no like concat('%',#{keyword},'%')
- or sb.remark like concat('%',#{keyword},'%')
- )
- </if>
- <if test="name != null and name!=''">
- and sb.name like concat('%',#{name},'%')
- </if>
- <if test="zbh != null and zbh!=''">
- and sb.zbh like concat('%',#{zbh},'%')
- </if>
- <if test="producerName != null and producerName!=''">
- and sb.producer_id like concat('%',#{producerName},'%')
- </if>
- <if test="producerId != null and producerId!=''">
- and sb.producer_id like concat('%',#{producerId},'%')
- </if>
- <if test="positionId != null and positionId!=''">
- and sb.position_id = #{positionId}
- </if>
- <if test="positionNo != null and positionNo!=''">
- and sb.position_no like concat('%',#{positionNo},'%')
- </if>
- <if test="ppNo != null and ppNo!=''">
- and sb.pp_no like concat('%',#{ppNo},'%')
- </if>
- <if test="likeDeptCode != null and likeDeptCode!=''">
- and sdDept.dept_code like concat(#{likeDeptCode},'%')
- </if>
- <if test="financingNo != null and financingNo!=''">
- and sb.financing_no like concat(#{financingNo},'%')
- </if>
- <if test="positionIds != null">
- AND sb.position_id in
- <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="ids != null">
- AND sb.id in
- <foreach item="item" index="index" collection="ids" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="typeList != null">
- AND sb.type_id in
- <foreach item="item" index="index" collection="typeList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="useType != null">
- and sb.use_type = #{useType}
- </if>
- <if test="id != null">
- and sb.id = #{id}
- </if>
- <if test="checkId != null">
- and sb.check_id = #{checkId}
- </if>
- <if test="isChild != null">
- and sb.is_child = #{isChild}
- </if>
- <if test="isMeasure != null">
- and sb.is_measure = #{isMeasure}
- </if>
- <if test="isSelf != null">
- and sb.is_self = #{isSelf}
- </if>
- <if test="measureStatus != null">
- and sb.measure_status = #{measureStatus}
- </if>
- <if test="isShow != null">
- and sb.is_show = #{isShow}
- </if>
- <if test="isFinancing != null">
- and sb.is_financing = #{isFinancing}
- </if>
- <if test="useArea != null">
- and sb.use_area = #{useArea}
- </if>
- <if test="useCompany != null">
- and sb.use_company = #{useCompany}
- </if>
- <if test="useProject != null">
- and sb.use_project = #{useProject}
- </if>
- <if test="baoyangTimes != null">
- and sb.baoyang_times = #{baoyangTimes}
- </if>
- <if test="typeId != null and typeId != ''">
- and sb.type_id = #{typeId}
- </if>
- <if test="parentId != null">
- and sb.parent_id = #{parentId}
- </if>
- <if test="model != null">
- and sb.model like concat('%',#{model},'%')
- </if>
- <if test="cph != null">
- and sb.model like concat('%',#{cph},'%')
- </if>
- <if test="useDept != null">
- and sb.use_dept = #{useDept}
- </if>
- <if test="useGroup != null">
- and sb.use_group = #{useGroup}
- </if>
- <if test="saveDept != null">
- and sb.save_dept = #{saveDept}
- </if>
- <if test="saveUser != null">
- and sb.save_user = #{saveUser}
- </if>
- <if test="checkDateStart != null">
- and sb.check_date <![CDATA[ >= ]]> #{checkDateStart}
- </if>
- <if test="checkDateEnd != null">
- and sb.check_date <![CDATA[ <= ]]> #{checkDateEnd}
- </if>
- <if test="nextCheckDateStart != null">
- and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
- </if>
- <if test="nextCheckDateEnd != null">
- and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
- </if>
- <if test="repairUser != null">
- and sb.repair_user = #{repairUser}
- </if>
- <if test="repairUserSecond != null">
- and sb.repair_user_second = #{repairUserSecond}
- </if>
- <if test="repairUserSearch != null">
- and (
- sb.repair_user = #{repairUserSearch}
- or
- sb.repair_user_second = #{repairUserSearch}
- )
- </if>
- <if test="status != null">
- and sb.status = #{status}
- </if>
- <if test="modelId != null">
- and sb.model_id = #{modelId}
- </if>
- <if test="notStatusList != null and notStatusList.size > 0">
- AND sb.status not in
- <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="statusList != null and statusList.size > 0">
- AND sb.status in
- <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="sbIds != null and sbIds.size > 0">
- AND sb.id in
- <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="checkType!=null">
- and sb.check_type = #{checkType}
- </if>
- <if test="ascriptionDept != null and ascriptionDept">
- <include refid="deptSql"/>
- </if>
- <if test="notSbIds != null and notSbIds.size > 0">
- <foreach collection="notSbIds" item="item">
- and sb.id !=#{item}
- </foreach>
- </if>
- </select>
- <select id="selectVOListStandard" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
- resultType="com.platform.dao.vo.sb.SbInfoVO">
- SELECT
- sb.id,
- sb.no,
- sbType.name as typeName,
- sb.NAME,
- sb.zbh,
- sb.status,
- sb.use_type,
- sb.type_id,
- count( standard.id ) as standardNum,
- FROM
- t_sb_info sb
- LEFT JOIN t_check_standard standard ON sb.id = standard.sb_id
- left join t_sb_type sbType on sb.type_id = sbType.id
- where
- 1 = 1
- <if test="keyword != null and keyword != ''">
- and (
- sb.name like concat('%',#{keyword},'%')
- or
- sb.no like concat('%',#{keyword},'%')
- )
- </if>
- <if test="name != null and name!=''">
- and sb.name like concat('%',#{name},'%')
- </if>
- <if test="zbh != null and zbh!=''">
- and sb.zbh like concat('%',#{zbh},'%')
- </if>
- <if test="useType != null">
- and sb.use_type = #{useType}
- </if>
- <if test="baoyangTimes != null">
- and sb.baoyang_times = #{baoyangTimes}
- </if>
- <if test="id != null">
- and sb.id = #{id}
- </if>
- <if test="checkId != null">
- and sb.check_id = #{checkId}
- </if>
- <if test="isChild != null">
- and sb.is_child = #{isChild}
- </if>
- <if test="isFinancing != null">
- and sb.is_financing = #{isFinancing}
- </if>
- <if test="isShow != null">
- and sb.is_show = #{isShow}
- </if>
- <if test="useArea != null">
- and sb.use_area = #{useArea}
- </if>
- <if test="useCompany != null">
- and sb.use_company = #{useCompany}
- </if>
- <if test="useProject != null">
- and sb.use_project = #{useProject}
- </if>
- <if test="typeId != null">
- and sb.type_id = #{typeId}
- </if>
- <if test="isMeasure != null">
- and sb.is_measure = #{isMeasure}
- </if>
- <if test="isSelf != null">
- and sb.is_self = #{isSelf}
- </if>
- <if test="positionNo != null and positionNo!=''">
- and sb.position_no like concat('%',#{positionNo},'%')
- </if>
- <if test="ppNo != null and ppNo!=''">
- and sb.pp_no like concat('%',#{ppNo},'%')
- </if>
- <if test="measureStatus != null">
- and sb.measure_status = #{measureStatus}
- </if>
- <if test="parentId != null">
- and sb.parent_id = #{parentId}
- </if>
- <if test="model != null">
- and sb.model like concat('%',#{model},'%')
- </if>
- <if test="useDept != null">
- and sb.use_dept = #{useDept}
- </if>
- <if test="useGroup != null">
- and sb.use_group = #{useGroup}
- </if>
- <if test="saveDept != null">
- and sb.save_dept = #{saveDept}
- </if>
- <if test="saveUser != null">
- and sb.save_user = #{saveUser}
- </if>
- <if test="nextCheckDateStart != null">
- and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
- </if>
- <if test="nextCheckDateEnd != null">
- and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
- </if>
- <if test="status != null">
- and sb.status = #{status}
- </if>
- <if test="modelId != null">
- and sb.model_id = #{modelId}
- </if>
- group by sb.id
- </select>
- <select id="selectScreenDetailVOList"
- parameterType="com.platform.dao.dto.sb.SbInfoDTO"
- resultType="com.platform.dao.vo.sb.SbInfoScreenDetailVO">
- select
- sb.id, sb.no, sb.zjm, sb.jbdh, sb.level
- from t_sb_info sb
- <where>
- sb.zjm is not null
- and sb.jbdh is not null
- and is_show = true
- </where>
- </select>
- <select id="selectPageInfoForWarn" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
- resultType="com.platform.dao.vo.sb.SbInfoVO">
- select sb.*
- from t_sb_info sb
- where
- TIMESTAMPDIFF( DAY, CURDATE( ), sb.next_check_date ) <![CDATA[ <= ]]> sb.seat_number
- <if test="keyword != null and keyword != ''">
- and (
- sb.name like concat('%',#{keyword},'%')
- or
- sb.no like concat('%',#{keyword},'%')
- )
- </if>
- <if test="name != null and name!=''">
- and sb.name like concat('%',#{name},'%')
- </if>
- <if test="financingNo != null and financingNo!=''">
- and sb.financing_no like concat(#{financingNo},'%')
- </if>
- <if test="positionIds != null">
- AND sb.position_id in
- <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="useTypeList != null">
- AND sb.use_type in
- <foreach item="item" index="index" collection="useTypeList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="useType != null">
- and sb.use_type = #{useType}
- </if>
- <if test="isMeasure != null">
- and sb.is_measure = #{isMeasure}
- </if>
- <if test="isSelf != null">
- and sb.is_self = #{isSelf}
- </if>
- <if test="positionNo != null and positionNo!=''">
- and sb.position_no like concat('%',#{positionNo},'%')
- </if>
- <if test="ppNo != null and ppNo!=''">
- and sb.pp_no like concat('%',#{ppNo},'%')
- </if>
- <if test="measureStatus != null">
- and sb.measure_status = #{measureStatus}
- </if>
- <if test="id != null">
- and sb.id = #{id}
- </if>
- <if test="checkId != null">
- and sb.check_id = #{checkId}
- </if>
- <if test="isChild != null">
- and sb.is_child = #{isChild}
- </if>
- <if test="isFinancing != null">
- and sb.is_financing = #{isFinancing}
- </if>
- <if test="isShow != null">
- and sb.is_show = #{isShow}
- </if>
- <if test="useArea != null">
- and sb.use_area = #{useArea}
- </if>
- <if test="useCompany != null">
- and sb.use_company = #{useCompany}
- </if>
- <if test="useProject != null">
- and sb.use_project = #{useProject}
- </if>
- <if test="typeId != null">
- and sb.type_id = #{typeId}
- </if>
- <if test="model != null">
- and sb.model like concat('%',#{model},'%')
- </if>
- <if test="useDept != null">
- and sb.use_dept = #{useDept}
- </if>
- <if test="useGroup != null">
- and sb.use_group = #{useGroup}
- </if>
- <if test="baoyangTimes != null">
- and sb.baoyang_times = #{baoyangTimes}
- </if>
- <if test="nextCheckDateStart != null">
- and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
- </if>
- <if test="nextCheckDateEnd != null">
- and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
- </if>
- <if test="saveDept != null">
- and sb.save_dept = #{saveDept}
- </if>
- <if test="saveUser != null">
- and sb.save_user = #{saveUser}
- </if>
- <if test="status != null">
- and sb.status = #{status}
- </if>
- <if test="modelId != null">
- and sb.model_id = #{modelId}
- </if>
- <if test="notStatusList != null and notStatusList.size > 0">
- AND sb.status not in
- <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="statusList != null and statusList.size > 0">
- AND sb.status in
- <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="sbIds != null and sbIds.size > 0">
- AND sb.id in
- <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="ascriptionDept != null and ascriptionDept">
- <include refid="deptSql"/>
- </if>
- </select>
- <select id="getById" parameterType="java.lang.Object" resultType="com.platform.dao.vo.sb.SbInfoVO">
- select
- <include refid="Left_Column"/>,parentPosition.name as parentPositionName,parentPosition.id as parentPositionId,
- sbType.name as sbTypeName,parentSbType.name as parentSbTypeName
- from t_sb_info sb
- left join t_sb_type sbType on sb.type_id = sbType.id
- left join t_sb_position position on sb.position_id = position.id
- left join t_sb_type parentSbType on parentSbType.id = sbType.parent_id
- left join t_sb_position parentPosition on parentPosition.id = position.parent_id
- where sb.id = #{value}
- </select>
- <select id="getByNo" parameterType="java.lang.Object" resultType="com.platform.dao.vo.sb.SbInfoVO">
- select
- <include refid="Left_Column"/>
- from t_sb_info sb
- left join t_sb_type sbType on sb.type_id = sbType.id
- left join t_sb_position position on sb.position_id = position.id
- where sb.no = #{value}
- </select>
- <select id="getByIds" parameterType="java.util.List" resultType="com.platform.dao.vo.sb.SbInfoVO">
- select
- <include refid="Left_Column"/>
- from t_sb_info sb
- where sb.id in
- <foreach item="item" index="index" collection="ids" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="selectNameById" parameterType="Object" resultType="java.lang.String">
- select name
- from t_sb_info
- where id = #{value}
- </select>
- <select id="selectNoById" parameterType="Object" resultType="java.lang.String">
- select no
- from t_sb_info
- where id = #{value}
- </select>
- <update id="updateBatch" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update t_sb_info
- <set>
- <if test="item.measureStatus != null">
- measure_status= #{item.measureStatus}
- </if>
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <update id="updateBatchQrCode" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update t_sb_info
- <set>
- qr_code=#{item.qrCode}
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <update id="updateBatchChild" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update t_sb_info
- <set>
- parent_id = #{item.parentId}
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <update id="updateBatchValue" parameterType="java.util.List">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update t_sb_info
- <set>
- initial_value=#{item.initialValue},
- current_value=#{item.currentValue},
- cut_value=#{item.cutValue},
- month=#{item.month},
- rate=#{item.rate},
- used_month=#{item.usedMonth}
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <update id="updateStatusByIds" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
- update t_sb_info
- <set>
- status=${status}, update_time=#{updateTime,jdbcType=TIMESTAMP}
- </set>
- where
- id in
- <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </update>
- <update id="updateTotalById" parameterType="java.util.List">
- <foreach collection="sbInfos" item="item" index="index" open="" close="" separator=";">
- update t_sb_info
- <set>
- <if test="item.totalHours != null">
- total_hours= total_hours+#{item.totalHours},
- </if>
- <if test="item.totalMiles != null">
- total_miles=total_miles+#{item.totalMiles},
- </if>
- </set>
- where id = #{item.id}
- </foreach>
- </update>
- <update id="updateBySbIds" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
- update t_sb_info
- <set>
- <if test="useArea != null">
- use_area = #{useArea},
- </if>
- <if test="useCompany != null">
- use_company = #{useCompany},
- </if>
- <if test="useCompanyName != null">
- use_company_name = #{useCompanyName},
- </if>
- <if test="useProject != null">
- use_project = #{useProject},
- </if>
- <if test="useProjectName != null">
- use_project_name = #{useProjectName},
- </if>
- <if test="useDept != null">
- use_dept = #{useDept},
- </if>
- <if test="useDeptName != null">
- use_dept_name = #{useDeptName},
- </if>
- <if test="useGroup != null">
- use_group = #{useGroup},
- </if>
- <if test="useGroupName != null">
- use_group_name = #{useGroupName},
- </if>
- <if test="saveDept != null">
- save_dept = #{saveDept},
- </if>
- <if test="saveDeptName != null">
- save_dept_name = #{saveDeptName},
- </if>
- <if test="saveUser != null">
- save_user = #{saveUser},
- </if>
- <if test="status != null">
- status = #{status},
- </if>
- <if test="updateTime != null">
- update_time=#{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateUserId != null">
- update_user_id = #{updateUserId},
- </if>
- <if test="updateUserName != null">
- update_user_name = #{updateUserName},
- </if>
- <if test="saveUserNull != null and saveUserNull">
- save_user = null,
- </if>
- </set>
- where
- id in
- <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </update>
- <select id="getSbTree" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
- resultType="com.platform.dao.vo.sb.SbTreeVO">
- SELECT info.id,info.name,bom.* FROM
- t_sb_info info JOIN t_sb_model_spare_bom bom ON
- info.id=bom.`sb_id`
- WHERE bom.sb_id=#{id}
- </select>
- <select id="getSubSb" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
- resultType="com.platform.dao.vo.sb.SbInfoVO">
- select id,name from t_sb_info where parent_id=#{id}
- </select>
- <select id="selectCountByPosition" parameterType="java.lang.String"
- resultType="java.lang.Integer">
- select count(info.id)
- from t_sb_info info
- left join t_sb_position position on info.position_id = position.id
- where position.code like concat(#{code},'%')
- </select>
- <select id="selectCountByPositionGroup" parameterType="java.lang.String"
- resultType="java.util.Map">
- select position.id, position.name, position.code, position.type, position.parent_id parentId,
- count(info.id) as num
- from t_sb_position position
- left join t_sb_info info on info.position_id=position.id
- where position.type in (1, 2) and position.del_flag=0
- group By position.id
- </select>
- <select id="selectByPositionNo" parameterType="java.lang.String"
- resultType="com.platform.dao.vo.sb.SbInfoVO">
- select info.*
- from t_sb_info info
- where info.position_no = #{code}
- </select>
- <select id="selectCountByStatusGroup" parameterType="java.lang.String"
- resultType="java.util.Map">
- select info.status, count(info.id) as num
- from t_sb_info info, t_sb_position position
- where
- info.position_id = position.id
- and position.code like concat(#{code},'%') and position.del_flag=0
- group By info.status
- </select>
- <select id="selectCountByUseTypeGroup" parameterType="java.lang.String"
- resultType="java.util.Map">
- select info.use_type useType, count(info.id) as num
- from t_sb_info info, t_sb_position position
- where
- info.position_id = position.id
- and position.code like concat(#{code},'%') and position.del_flag=0
- group By info.use_type
- </select>
- <select id="selectCountMap" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
- resultType="java.util.Map">
- select count(*) as num, type_id as typeId from t_sb_info
- <where>
- <if test="useType != null">
- and use_type = #{useType}
- </if>
- <if test="typeId!=null">
- and type_id = #{typeId}
- </if>
- <if test="typeList!=null and typeList.size>0">
- and type_id in
- <foreach collection="typeList" close=")" separator="," open="(" item="item">
- #{item}
- </foreach>
- </if>
- </where>
- GROUP BY type_id
- </select>
- <update id="updateLongYanForInStore" parameterType="com.platform.dao.dto.sb.SbInfoDTO">
- update t_sb_info set status = #{status},position_id = null,positionNo = null,ppNo = null,parentId = null where id = #{id}
- </update>
- <select id="countNum" parameterType="com.platform.dao.dto.sb.SbInfoDTO" resultType="java.lang.Integer">
- <if test="typeFlag != null">
- select count(1) from (
- </if>
- select count(1) from t_sb_info
- <where>
- <if test="positionId != null and positionId != ''">
- and position_id = #{positionId}
- </if>
- <if test="useType != null">
- and use_type = #{useType}
- </if>
- <if test="isMeasure != null">
- and is_measure = #{isMeasure}
- </if>
- <if test="measureStatus != null">
- and measure_status = #{measureStatus}
- </if>
- <choose>
- <when test="replenishFlag != null">
- <if test="replenishFlag == 1">
- and (position_no is null or position_no = '' or position_no = '暂无')
- </if>
- <if test="replenishFlag == 2">
- and (model is null or model = '' or model = '暂无')
- </if>
- <if test="replenishFlag == 3">
- and (financing_no is null or financing_no = '')
- </if>
- <if test="replenishFlag == 4">
- and (type_id is null or type_id = '' or type_id = '暂无')
- </if>
- </when>
- </choose>
- </where>
- <if test="typeFlag != null">
- group by type_id ) t
- </if>
- </select>
- <select id="getsbNumsByType" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
- resultType="com.platform.dao.vo.report.SbInfoTypeReportVO2">
- select type.id as id count(1) as totalNum,type.name as typeName from t_sb_info info inner join t_sb_type type
- on info.type_id = type.id
- <where>
- <if test="useType!=null">
- info.use_type = #{useType}
- </if>
- </where>
- group by type.id
- </select>
- <select id="getChildIds" parameterType="java.lang.String"
- resultType="java.lang.String">
- select id from t_sb_type
- <where>
- <if test="sbIds!=null">
- and parent_id in
- <foreach collection="sbIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- <!-- <select id="getPositionNoHistory" parameterType="com.platform.dao.dto.sb.SbInfoDTO"-->
- <!-- resultType="com.platform.dao.vo.sb.SbInfoVO">-->
- <!-- select record.sb_no_id,sb.name as sbName,record.created_time ,record.created_user_id,record.creaed_user_name,-->
- <!-- from t_sb_info sb left join t_sb_change_record record-->
- <!-- on sb.id = record.sb_id-->
- <!-- <where>-->
- <!-- <if test="useType!=null">-->
- <!-- sb.use_type=#{useType}-->
- <!-- </if>-->
- <!-- </where>-->
- <!-- </select>-->
- <select id="selectList2" parameterType="com.platform.dao.dto.sb.SbInfoDTO"
- resultType="java.lang.String">
- select distinct (info.id) from t_sb_info info inner join t_long_yan_purchase_order orders
- on info.id = orders.sb_id
- <where>
- 1 = 1
- <if test="keyword != null and keyword != ''">
- and (
- sb.name like concat('%',#{keyword},'%')
- or sb.no like concat('%',#{keyword},'%')
- or sb.position_no like concat('%',#{keyword},'%')
- or sb.remark like concat('%',#{keyword},'%')
- )
- </if>
- <if test="name != null and name!=''">
- and sb.name like concat('%',#{name},'%')
- </if>
- <if test="zbh != null and zbh!=''">
- and sb.zbh like concat('%',#{zbh},'%')
- </if>
- <if test="producerName != null and producerName!=''">
- and sb.producer_id like concat('%',#{producerName},'%')
- </if>
- <if test="producerId != null and producerId!=''">
- and sb.producer_id like concat('%',#{producerId},'%')
- </if>
- <if test="positionId != null and positionId!=''">
- and sb.position_id = #{positionId}
- </if>
- <if test="positionNo != null and positionNo!=''">
- and sb.position_no like concat('%',#{positionNo},'%')
- </if>
- <if test="ppNo != null and ppNo!=''">
- and sb.pp_no like concat('%',#{ppNo},'%')
- </if>
- <if test="likeDeptCode != null and likeDeptCode!=''">
- and sdDept.dept_code like concat(#{likeDeptCode},'%')
- </if>
- <if test="financingNo != null and financingNo!=''">
- and sb.financing_no like concat(#{financingNo},'%')
- </if>
- <if test="positionIds != null">
- AND sb.position_id in
- <foreach item="item" index="index" collection="positionIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="ids != null">
- AND sb.id in
- <foreach item="item" index="index" collection="ids" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="typeList != null">
- AND sb.type_id in
- <foreach item="item" index="index" collection="typeList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="useType != null">
- and sb.use_type = #{useType}
- </if>
- <if test="id != null">
- and sb.id = #{id}
- </if>
- <if test="checkId != null">
- and sb.check_id = #{checkId}
- </if>
- <if test="isChild != null">
- and sb.is_child = #{isChild}
- </if>
- <if test="isMeasure != null">
- and sb.is_measure = #{isMeasure}
- </if>
- <if test="isSelf != null">
- and sb.is_self = #{isSelf}
- </if>
- <if test="measureStatus != null">
- and sb.measure_status = #{measureStatus}
- </if>
- <if test="isShow != null">
- and sb.is_show = #{isShow}
- </if>
- <if test="isFinancing != null">
- and sb.is_financing = #{isFinancing}
- </if>
- <if test="useArea != null">
- and sb.use_area = #{useArea}
- </if>
- <if test="useCompany != null">
- and sb.use_company = #{useCompany}
- </if>
- <if test="useProject != null">
- and sb.use_project = #{useProject}
- </if>
- <if test="baoyangTimes != null">
- and sb.baoyang_times = #{baoyangTimes}
- </if>
- <if test="typeId != null and typeId != ''">
- and sb.type_id = #{typeId}
- </if>
- <if test="parentId != null">
- and sb.parent_id = #{parentId}
- </if>
- <if test="model != null">
- and sb.model like concat('%',#{model},'%')
- </if>
- <if test="cph != null">
- and sb.model like concat('%',#{cph},'%')
- </if>
- <if test="useDept != null">
- and sb.use_dept = #{useDept}
- </if>
- <if test="useGroup != null">
- and sb.use_group = #{useGroup}
- </if>
- <if test="saveDept != null">
- and sb.save_dept = #{saveDept}
- </if>
- <if test="saveUser != null">
- and sb.save_user = #{saveUser}
- </if>
- <if test="checkDateStart != null">
- and sb.check_date <![CDATA[ >= ]]> #{checkDateStart}
- </if>
- <if test="checkDateEnd != null">
- and sb.check_date <![CDATA[ <= ]]> #{checkDateEnd}
- </if>
- <if test="nextCheckDateStart != null">
- and sb.next_check_date <![CDATA[ >= ]]> #{nextCheckDateStart}
- </if>
- <if test="nextCheckDateEnd != null">
- and sb.next_check_date <![CDATA[ <= ]]> #{nextCheckDateEnd}
- </if>
- <if test="repairUser != null">
- and sb.repair_user = #{repairUser}
- </if>
- <if test="repairUserSecond != null">
- and sb.repair_user_second = #{repairUserSecond}
- </if>
- <if test="repairUserSearch != null">
- and (
- sb.repair_user = #{repairUserSearch}
- or
- sb.repair_user_second = #{repairUserSearch}
- )
- </if>
- <if test="status != null">
- and sb.status = #{status}
- </if>
- <if test="modelId != null">
- and sb.model_id = #{modelId}
- </if>
- <if test="notStatusList != null and notStatusList.size > 0">
- AND sb.status not in
- <foreach item="item" index="index" collection="notStatusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="statusList != null and statusList.size > 0">
- AND sb.status in
- <foreach item="item" index="index" collection="statusList" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="sbIds != null and sbIds.size > 0">
- AND sb.id in
- <foreach item="item" index="index" collection="sbIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="checkType!=null">
- and sb.check_type = #{checkType}
- </if>
- <if test="ascriptionDept != null and ascriptionDept">
- <include refid="deptSql"/>
- </if>
- </where>
- </select>
- </mapper>
|