123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- <?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="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 = #{tldId}
- </if>
- <if test="typeVal != null and typeVal != ''">
- and type = #{typeVal}
- </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
- code,
- name,
- if(part_type = '', null , part_type),
- if(wllb_class = '', null , wllb_class),
- if(size = '', null , size),
- if(max_num = '', null , max_num),
- if(min_num = '', null , min_num),
- if(is_not_disable = '1', '是' , '否'),
- if(is_recommend = '1', '是' , '否' )
- from tld_material
- <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 = #{tldId}
- </if>
- </trim>
- order by 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="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>
- <if test="typeVal != null and typeVal != ''">
- and a.type = #{typeVal}
- </if>
- </trim>
- order by a.id desc
- </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>
- <!-- 删除字典内容 -->
- <delete id="deleteDictionary">
- delete
- from ${tableName}
- where id = #{id}
- </delete>
- <!--删除所有gs库存-->
- <delete id="deleteRepertory">
- delete
- from tld_inventory_gs
- </delete>
- <!-- 新增日志 -->
- <insert id="addAccess">
- insert into tld_access(type, data, scrq) value (#{type},#{data},now())
- </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>
- </mapper>
|