123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <?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,typ,company_number)
- values(#{code},#{name},#{tldId},#{specificationAndModel},#{unitOfMeasurement},'0','0','0',"0","0",#{typeVal},#{companyNumber})
- </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>
- </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 = #{name}
- </if>
- <if test="code != null and code != ''">
- and code = #{code}
- </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_treasury_account(material_id,code,name,num,type)
- values(#{materialId},#{code},#{name},#{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 code = #{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>
- <!-- 修改物料字典内容 -->
- <update id="updateMaterial">
- update tld_material
- <set>
- <trim suffixOverrides=",">
- <if test="code != null and code != ''">
- code = #{code},
- </if>
- <if test="name != null and name != ''">
- name = #{name},
- </if>
- <if test="tldId != null and tldId != ''">
- tld_id = #{tldId},
- </if>
- <if test="specificationAndModel != null and specificationAndModel != ''">
- specification_and_model = #{specificationAndModel},
- </if>
- <if test="unitOfMeasurement != null and unitOfMeasurement != ''">
- unit_of_measurement = #{unitOfMeasurement},
- </if>
- <if test="size != null and size != ''">
- size = #{size},
- </if>
- <if test="wllbClass != null and wllbClass != ''">
- wllb_class = #{wllbClass},
- </if>
- <if test="isNotDisable != null and isNotDisable != ''">
- is_not_disable = #{isNotDisable},
- </if>
- <if test="isRecommend != null and isRecommend != ''">
- is_recommend = #{isRecommend},
- </if>
- <if test="partType != null and partType != ''">
- part_type = #{partType},
- </if>
- <if test="minNum != null and minNum != ''">
- min_num = #{minNum},
- </if>
- <if test="maxNum != null and maxNum != ''">
- max_num = #{maxNum},
- </if>
- <if test="companyNumber != null and companyNumber != ''">
- 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 and materialId != ''">
- material_id = #{materialId},
- </if>
- <if test="code != null and code != ''">
- code = #{code},
- </if>
- <if test="name != null and name != ''">
- name = #{name},
- </if>
- <if test="tldId != null and tldId != ''">
- tld_id = #{tldId},
- </if>
- </set>
- where id = #{id}
- </update>
- <!-- 修改字典内容 -->
- <update id="updateDictionary">
- update ${tableName}
- <set>
- <if test="materialId != null and materialId != ''">
- material_id = #{materialId},
- </if>
- <if test="code != null and code != ''">
- code = #{code},
- </if>
- <if test="name != null and name != ''">
- name = #{name},
- </if>
- <if test="tldId != null and tldId != ''">
- tld_id = #{tldId},
- </if>
- </set>
- where id = #{id}
- </update>
- <!-- 删除字典内容 -->
- <delete id="deleteDictionary">
- delete from ${tableName} where id = #{id}
- </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>
- </mapper>
|