| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508 |
- <?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.tld.mapper.DictionaryMapper">
- <!-- 查询字典表明 -->
- <select id="getTableName" resultType="String">
- select table_name
- from tld_dictionary_pulic
- where name = #{type}
- </select>
- <!-- 物料字典新增 -->
- <insert id="addMaterial">
- insert into tld_material(code, name, tld_id, specification_and_model, unit_of_measurement, size, is_not_disable,
- is_recommend, min_num, max_num, type, company_number)
- values (#{code}, #{name}, #{tldId}, #{specificationAndModel}, #{unitOfMeasurement}, '0', '0', '0', "0", "0",
- #{typeVal}, '0')
- </insert>
- <!-- 字典新增 -->
- <insert id="addDictionary">
- insert into ${tableName}(code, name, tld_id, type)
- values (#{code}, #{name}, #{tldId}, #{typeVal})
- </insert>
- <!-- 查询字典内容 -->
- <select id="getDictionary" resultType="com.tld.model.Dictionary">
- select * from ${tableName}
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="name != null and name != ''">
- and name like CONCAT(CONCAT('%', #{name}), '%')
- </if>
- <if test="code != null and code != ''">
- and code like CONCAT(CONCAT('%', #{code}), '%')
- </if>
- <if test="nameOrCode != null and nameOrCode != ''">
- and (code like CONCAT(CONCAT('%', #{nameOrCode}), '%') or name like CONCAT(CONCAT('%', #{nameOrCode}), '%'))
- </if>
- <if test="tldId != null and tldId != ''">
- and tld_id = #{tldId}
- </if>
- <if test="id != null and id != ''">
- and id = #{id}
- </if>
- </trim>
- </select>
- <!-- 查询字典内容分页 -->
- <select id="getDictionaryPage" resultType="com.tld.model.Dictionary">
- select
- *
- from ${tableName}
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="name != null and name != ''">
- and name like CONCAT(CONCAT('%', #{name}), '%')
- </if>
- <if test="code != null and code != ''">
- and code like CONCAT(CONCAT('%', #{code}), '%')
- </if>
- <if test="wllbClass != null and wllbClass != ''">
- and wllb_class like CONCAT(CONCAT('%', #{wllbClass}), '%')
- </if>
- <if test="materialType != null and materialType != ''">
- and part_type like CONCAT(CONCAT('%', #{materialType}), '%')
- </if>
- <if test="isNotDisable != null and isNotDisable != ''">
- and is_not_disable = #{isNotDisable}
- </if>
- <if test="isRecommend != null and isRecommend != ''">
- and is_recommend = #{isRecommend}
- </if>
- <if test="tldId != null and tldId != ''">
- and tld_id like CONCAT(CONCAT('%', #{tldId}), '%')
- </if>
- <if test="typeVal != null and typeVal != ''">
- and type = #{typeVal}
- </if>
- <if test="nameOrCode != null and nameOrCode != ''">
- and code like CONCAT(CONCAT('%', #{code}), '%') or name like CONCAT(CONCAT('%', #{name}), '%')
- </if>
- </trim>
- order by id desc
- </select>
- <!-- 库账对存字典新增 -->
- <insert id="addTreasuryAccount">
- insert into tld_inventory_gs(material_id, amount, account_sleeve)
- values (#{materialId}, #{num}, #{typeVal})
- </insert>
- <!-- 查询仓库id -->
- <select id="getWarehouse" resultType="String">
- select warehouse_where
- from tld_storage_location
- where storage_location_code = #{storageLocationCode}
- </select>
- <!-- 查询仓库字典 -->
- <select id="getWarehouseInfo" resultType="com.tld.model.Dictionary">
- select code, name, tld_id
- from tld_warehouse
- where tld_id = #{askGoodsWarehouseId}
- </select>
- <!-- 查询物料库存内容 -->
- <select id="getInventorySumAmount" resultType="int">
- select ifnull(sum(amount), 0)
- from tld_inventory
- where material_id = #{tldId}
- </select>
- <!-- 查询字典内容分页 -->
- <select id="getDictionaryMaterialPage" resultType="com.tld.model.Dictionary">
- select
- a.*,b.name as materialType,c.user_name as modifyUser
- from ${tableName} a
- left join tld_material_type b on a.wllb_class = b.tld_id
- left join tld_user c on a.modify_user = c.id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="name != null and name != ''">
- and a.name = #{name}
- </if>
- <if test="code != null and code != ''">
- and a.code = #{code}
- </if>
- <if test="tldId != null and tldId != ''">
- and a.tld_id = #{tldId}
- </if>
- <if test="typeVal != null and typeVal != ''">
- and a.type = #{typeVal}
- </if>
- </trim>
- </select>
- <!--判断是否是重复数据-->
- <select id="getTableNameList" resultType="com.tld.model.Dictionary">
- select *
- from ${tableName}
- where code = #{code}
- </select>
- <!--物料字典导出-->
- <select id="export" resultType="java.util.LinkedHashMap">
- select
- a.code,
- a.name,
- if(a.part_type = '', null , a.part_type) as partType ,
- if(a.wllb_class = '', null ,a.wllb_class) as wllbClass ,
- if(a.size = '', null , size) as size,
- if(a.max_num = '', null , a.max_num) as maxNum,
- if(a.min_num = '', null , a.min_num) as minNum,
- if(a.is_not_disable = '1', '是' , '否') as isNotdisable ,
- if(a.is_recommend = '1', '是' , '否' ) as isRecommend
- from tld_material a
- left join tld_user f on a.modify_user = f.id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="name != null and name != ''">
- and a.name like CONCAT(CONCAT('%', #{name}), '%')
- </if>
- <if test="code != null and code != ''">
- and a.code like CONCAT(CONCAT('%', #{code}), '%')
- </if>
- <if test="wllbClass != null and wllbClass != ''">
- and a.wllb_class like CONCAT(CONCAT('%', #{wllbClass}), '%')
- </if>
- <if test="materialType != null and materialType != ''">
- and a.part_type like CONCAT(CONCAT('%', #{materialType}), '%')
- </if>
- <if test="modifyUser != null and modifyUser != ''">
- and f.user_name like CONCAT(CONCAT('%', #{modifyUser}), '%')
- </if>
- <if test="isNotDisable != null and isNotDisable != ''">
- and a.is_not_disable = #{isNotDisable}
- </if>
- <if test="isRecommend != null and isRecommend != ''">
- and a.is_recommend = #{isRecommend}
- </if>
- <if test="tldId != null and tldId != ''">
- and a.tld_id = #{tldId}
- </if>
- </trim>
- order by a.id desc
- </select>
- <!-- 查询物料字典内容分页 -->
- <select id="getDictionaryPageMaterial" resultType="com.tld.model.Dictionary">
- select
- a.*,
- f.user_name as modifyUser
- from tld_material a
- left join tld_user f on a.modify_user = f.id
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="name != null and name != ''">
- and a.name like CONCAT(CONCAT('%', #{name}), '%')
- </if>
- <if test="code != null and code != ''">
- and a.code like CONCAT(CONCAT('%', #{code}), '%')
- </if>
- <if test="wllbClass != null and wllbClass != ''">
- and a.wllb_class like CONCAT(CONCAT('%', #{wllbClass}), '%')
- </if>
- <if test="materialType != null and materialType != ''">
- and a.part_type like CONCAT(CONCAT('%', #{materialType}), '%')
- </if>
- <if test="modifyUser != null and modifyUser != ''">
- and f.user_name like CONCAT(CONCAT('%', #{modifyUser}), '%')
- </if>
- <if test="isNotDisable != null and isNotDisable != ''">
- and a.is_not_disable = #{isNotDisable}
- </if>
- <if test="isRecommend != null and isRecommend != ''">
- and a.is_recommend = #{isRecommend}
- </if>
- <if test="tldId != null and tldId != ''">
- and a.tld_id like CONCAT(CONCAT('%', #{tldId}), '%')
- </if>
- <if test="typeVal != null and typeVal != ''">
- and a.type = #{typeVal}
- </if>
- <if test="nameOrCode != null and nameOrCode != ''">
- and code like CONCAT(CONCAT('%', #{nameOrCode}), '%') or name like CONCAT(CONCAT('%', #{nameOrCode}), '%')
- </if>
- </trim>
- order by a.id desc
- </select>
- <!--查询仓库字典分页内容-->
- <select id="getDictionaryPageWarehouse" resultType="com.tld.model.Dictionary">
- select
- a.id,
- a.code,
- a.name,
- a.tld_id,
- a.type,
- case a.warehouse_type when '0' then '原材料仓库' when '1' then '半成品仓库' when '2' then '产成品仓库'
- else null
- end as warehouseType
- from tld_warehouse a
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="name != null and name != ''">
- and a.name like CONCAT(CONCAT('%', #{name}), '%')
- </if>
- <if test="code != null and code != ''">
- and a.code like CONCAT(CONCAT('%', #{code}), '%')
- </if>
- <if test="wllbClass != null and wllbClass != ''">
- and a.wllb_class like CONCAT(CONCAT('%', #{wllbClass}), '%')
- </if>
- <if test="materialType != null and materialType != ''">
- and a.part_type like CONCAT(CONCAT('%', #{materialType}), '%')
- </if>
- <if test="isNotDisable != null and isNotDisable != ''">
- and a.is_not_disable = #{isNotDisable}
- </if>
- <if test="warehouseType != null and warehouseType != ''">
- and a.warehouse_type = #{warehouseType}
- </if>
- <if test="isRecommend != null and isRecommend != ''">
- and a.is_recommend = #{isRecommend}
- </if>
- <if test="tldId != null and tldId != ''">
- and a.tld_id like CONCAT(CONCAT('%', #{tldId}), '%')
- </if>
- <if test="typeVal != null and typeVal != ''">
- and a.type = #{typeVal}
- </if>
- </trim>
- order by a.id desc
- </select>
- <!--导出其他字典-->
- <select id="elseExport" resultType="java.util.LinkedHashMap">
- select
- code,
- name,
- tld_id
- from ${tableName}
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="name != null and name != ''">
- and name like CONCAT(CONCAT('%', #{name}), '%')
- </if>
- <if test="code != null and code != ''">
- and code like CONCAT(CONCAT('%', #{code}), '%')
- </if>
- <if test="wllbClass != null and wllbClass != ''">
- and wllb_class like CONCAT(CONCAT('%', #{wllbClass}), '%')
- </if>
- <if test="materialType != null and materialType != ''">
- and part_type like CONCAT(CONCAT('%', #{materialType}), '%')
- </if>
- <if test="isNotDisable != null and isNotDisable != ''">
- and is_not_disable = #{isNotDisable}
- </if>
- <if test="isRecommend != null and isRecommend != ''">
- and is_recommend = #{isRecommend}
- </if>
- <if test="tldId != null and tldId != ''">
- and tld_id like CONCAT(CONCAT('%', #{tldId}), '%')
- </if>
- <if test="typeVal != null and typeVal != ''">
- and type = #{typeVal}
- </if>
- </trim>
- order by id desc
- </select>
- <!--仓库字典导出-->
- <select id="warehouseExport" resultType="java.util.LinkedHashMap">
- select
- code,
- name,
- tld_id,
- case warehouse_type when '0' then '原材料仓库' when '1' then '半成品仓库' when '2' then '产成品仓库' else null end
- from tld_warehouse
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="name != null and name != ''">
- and name like CONCAT(CONCAT('%', #{name}), '%')
- </if>
- <if test="code != null and code != ''">
- and code like CONCAT(CONCAT('%', #{code}), '%')
- </if>
- <if test="wllbClass != null and wllbClass != ''">
- and wllb_class like CONCAT(CONCAT('%', #{wllbClass}), '%')
- </if>
- <if test="materialType != null and materialType != ''">
- and part_type like CONCAT(CONCAT('%', #{materialType}), '%')
- </if>
- <if test="isNotDisable != null and isNotDisable != ''">
- and is_not_disable = #{isNotDisable}
- </if>
- <if test="warehouseType != null and warehouseType != ''">
- and warehouse_type = #{warehouseType}
- </if>
- <if test="isRecommend != null and isRecommend != ''">
- and is_recommend = #{isRecommend}
- </if>
- <if test="tldId != null and tldId != ''">
- and tld_id like CONCAT(CONCAT('%', #{tldId}), '%')
- </if>
- <if test="typeVal != null and typeVal != ''">
- and type = #{typeVal}
- </if>
- </trim>
- order by id desc
- </select>
- <!--查询物料-->
- <select id="getMaterial" resultType="java.util.Map">
- select
- id,
- code,
- name,
- tld_id as tldId
- from tld_material
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="partType != null and partType != ''">
- and part_type like CONCAT(CONCAT('%', #{partType}), '%')
- </if>
- <if test="code != null and code != ''">
- and code like CONCAT(CONCAT('%', #{code}), '%')
- </if>
- <if test="name != null and name != ''">
- and name like CONCAT(CONCAT('%', #{name}), '%')
- </if>
- <if test="nameOrCode != null and nameOrCode != ''">
- and (code like CONCAT(CONCAT('%', #{nameOrCode}), '%') or name like CONCAT(CONCAT('%', #{nameOrCode}), '%'))
- </if>
- </trim>
- </select>
- <!-- 查询枪线内容 -->
- <select id="getGunLine" resultType="com.tld.model.GunLine">
- select
- id,
- code,
- name,
- type
- from tld_gun_line
- <trim prefix="WHERE" prefixOverrides="and |or">
- <if test="type != null and type != ''">
- and type = #{type}
- </if>
- <if test="code != null and code != ''">
- and code like CONCAT('%', #{code}, '%')
- </if>
- <if test="name != null and name != ''">
- and name like CONCAT('%', #{name}, '%')
- </if>
- </trim>
- </select>
- <!-- 修改物料字典内容 -->
- <update id="updateMaterial">
- update tld_material
- <set>
- <trim suffixOverrides=",">
- <if test="code != null">
- code = #{code},
- </if>
- <if test="name != null">
- name = #{name},
- </if>
- <if test="tldId != null">
- tld_id = #{tldId},
- </if>
- <if test="specificationAndModel != null">
- specification_and_model = #{specificationAndModel},
- </if>
- <if test="unitOfMeasurement != null">
- unit_of_measurement = #{unitOfMeasurement},
- </if>
- <if test="size != null">
- size = #{size},
- </if>
- <if test="wllbClass != null">
- wllb_class = #{wllbClass},
- </if>
- <if test="isNotDisable != null">
- is_not_disable = #{isNotDisable},
- </if>
- <if test="isRecommend != null">
- is_recommend = #{isRecommend},
- </if>
- <if test="partType != null">
- part_type = #{partType},
- </if>
- <if test="minNum != null">
- min_num = #{minNum},
- </if>
- <if test="maxNum != null">
- max_num = #{maxNum},
- </if>
- <if test="companyNumber != null">
- company_number = #{companyNumber},
- </if>
- modify_user = #{modifyUser},modify_time=now(),
- </trim>
- </set>
- where id = #{id}
- </update>
- <!-- 库存对账 -->
- <update id="updateTreasuryAccount">
- update tld_material
- <set>
- <if test="materialId != null">
- material_id = #{materialId},
- </if>
- <if test="code != null">
- code = #{code},
- </if>
- <if test="name != null">
- name = #{name},
- </if>
- <if test="tldId != null">
- tld_id = #{tldId},
- </if>
- </set>
- where id = #{id}
- </update>
- <!-- 修改字典内容 -->
- <update id="updateDictionary">
- update ${tableName}
- <set>
- <if test="materialId != null">
- material_id = #{materialId},
- </if>
- <if test="code != null">
- code = #{code},
- </if>
- <if test="name != null">
- name = #{name},
- </if>
- <if test="tldId != null">
- tld_id = #{tldId},
- </if>
- </set>
- where id = #{id}
- </update>
- <!-- 修改枪线内容 -->
- <update id="updateGunLine">
- update tld_gun_line
- <set>
- <if test="code != null">
- code = #{code},
- </if>
- <if test="name != null">
- name = #{name},
- </if>
- <if test="type != null">
- type = #{type},
- </if>
- </set>
- where id = #{id}
- </update>
- <!-- 删除字典内容 -->
- <delete id="deleteDictionary">
- delete
- from ${tableName}
- where id = #{id}
- </delete>
- <!--新增之前删除所有gs库存-->
- <delete id="deleteRepertory">
- delete
- from tld_inventory_gs
- </delete>
- <!-- 删除枪线内容 -->
- <delete id="delGunLine">
- delete from tld_gun_line where id = #{id}
- </delete>
- <!-- 新增日志 -->
- <insert id="addAccess">
- insert into tld_access(type, data, scrq,access_type) value (#{type},#{data},now(),#{accessType})
- </insert>
- <!-- 新增操作日志 -->
- <insert id="addLogdata">
- insert into tld_log_data(user_id, scrq, data, type, document_type) value (#{userId},now(),#{data},#{type},#{documentType})
- </insert>
- <!-- 增加仓库的时候新增库位信息-->
- <insert id="addStorageLocation">
- insert into tld_storage_location(storage_location_code, storage_location_name, warehouse_where) value (#{storageLocationCode},#{storageLocationName},#{warehouseWhere})
- </insert>
- <!-- 新增枪线内容 -->
- <insert id="addGunLine">
- insert into tld_gun_line(code,name,type) value(#{code},#{name},#{type})
- </insert>
- </mapper>
|