|
|
@@ -4,17 +4,21 @@
|
|
|
<mapper namespace="com.tld.mapper.DictionaryMapper">
|
|
|
<!-- 查询字典表明 -->
|
|
|
<select id="getTableName" resultType="String">
|
|
|
- select table_name from tld_dictionary_pulic where name = #{type}
|
|
|
+ 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 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 into ${tableName}(code, name, tld_id, type)
|
|
|
+ values (#{code}, #{name}, #{tldId}, #{typeVal})
|
|
|
</insert>
|
|
|
<!-- 查询字典内容 -->
|
|
|
<select id="getDictionary" resultType="com.tld.model.Dictionary">
|
|
|
@@ -37,14 +41,26 @@
|
|
|
<!-- 查询字典内容分页 -->
|
|
|
<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}
|
|
|
+ and name like CONCAT(CONCAT('%', #{name}), '%')
|
|
|
</if>
|
|
|
<if test="code != null and code != ''">
|
|
|
- and code = #{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}
|
|
|
@@ -57,25 +73,31 @@
|
|
|
</select>
|
|
|
<!-- 库账对存字典新增 -->
|
|
|
<insert id="addTreasuryAccount">
|
|
|
- insert into tld_treasury_account(material_id,code,name,num,type)
|
|
|
- values(#{materialId},#{code},#{name},#{num},#{typeVal})
|
|
|
+ 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 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 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 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
|
|
|
+ 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
|
|
|
@@ -96,90 +118,165 @@
|
|
|
</select>
|
|
|
<!--判断是否是重复数据-->
|
|
|
<select id="getTableNameList" resultType="com.tld.model.Dictionary">
|
|
|
- select * from ${tableName} where code = #{code}
|
|
|
+ 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 and code != ''">
|
|
|
+ <if test="code != null">
|
|
|
code = #{code},
|
|
|
</if>
|
|
|
- <if test="name != null and name != ''">
|
|
|
+ <if test="name != null">
|
|
|
name = #{name},
|
|
|
</if>
|
|
|
- <if test="tldId != null and tldId != ''">
|
|
|
+ <if test="tldId != null">
|
|
|
tld_id = #{tldId},
|
|
|
</if>
|
|
|
- <if test="specificationAndModel != null and specificationAndModel != ''">
|
|
|
+ <if test="specificationAndModel != null">
|
|
|
specification_and_model = #{specificationAndModel},
|
|
|
</if>
|
|
|
- <if test="unitOfMeasurement != null and unitOfMeasurement != ''">
|
|
|
+ <if test="unitOfMeasurement != null">
|
|
|
unit_of_measurement = #{unitOfMeasurement},
|
|
|
</if>
|
|
|
- <if test="size != null and size != ''">
|
|
|
+ <if test="size != null">
|
|
|
size = #{size},
|
|
|
</if>
|
|
|
- <if test="wllbClass != null and wllbClass != ''">
|
|
|
+ <if test="wllbClass != null">
|
|
|
wllb_class = #{wllbClass},
|
|
|
</if>
|
|
|
- <if test="isNotDisable != null and isNotDisable != ''">
|
|
|
+ <if test="isNotDisable != null">
|
|
|
is_not_disable = #{isNotDisable},
|
|
|
</if>
|
|
|
- <if test="isRecommend != null and isRecommend != ''">
|
|
|
+ <if test="isRecommend != null">
|
|
|
is_recommend = #{isRecommend},
|
|
|
</if>
|
|
|
- <if test="partType != null and partType != ''">
|
|
|
+ <if test="partType != null">
|
|
|
part_type = #{partType},
|
|
|
</if>
|
|
|
- <if test="minNum != null and minNum != ''">
|
|
|
+ <if test="minNum != null">
|
|
|
min_num = #{minNum},
|
|
|
</if>
|
|
|
- <if test="maxNum != null and maxNum != ''">
|
|
|
+ <if test="maxNum != null">
|
|
|
max_num = #{maxNum},
|
|
|
</if>
|
|
|
- <if test="companyNumber != null and companyNumber != ''">
|
|
|
+ <if test="companyNumber != null">
|
|
|
company_number = #{companyNumber},
|
|
|
</if>
|
|
|
modify_user = #{modifyUser},modify_time=now(),
|
|
|
</trim>
|
|
|
</set>
|
|
|
- where id = #{id}
|
|
|
+ where id = #{id}
|
|
|
</update>
|
|
|
<!-- 库存对账 -->
|
|
|
<update id="updateTreasuryAccount">
|
|
|
update tld_material
|
|
|
<set>
|
|
|
- <if test="materialId != null and materialId != ''">
|
|
|
+ <if test="materialId != null">
|
|
|
material_id = #{materialId},
|
|
|
</if>
|
|
|
- <if test="code != null and code != ''">
|
|
|
+ <if test="code != null">
|
|
|
code = #{code},
|
|
|
</if>
|
|
|
- <if test="name != null and name != ''">
|
|
|
+ <if test="name != null">
|
|
|
name = #{name},
|
|
|
</if>
|
|
|
- <if test="tldId != null and tldId != ''">
|
|
|
+ <if test="tldId != null">
|
|
|
tld_id = #{tldId},
|
|
|
</if>
|
|
|
</set>
|
|
|
- where id = #{id}
|
|
|
+ where id = #{id}
|
|
|
</update>
|
|
|
<!-- 修改字典内容 -->
|
|
|
<update id="updateDictionary">
|
|
|
update ${tableName}
|
|
|
<set>
|
|
|
- <if test="materialId != null and materialId != ''">
|
|
|
+ <if test="materialId != null">
|
|
|
material_id = #{materialId},
|
|
|
</if>
|
|
|
- <if test="code != null and code != ''">
|
|
|
+ <if test="code != null">
|
|
|
code = #{code},
|
|
|
</if>
|
|
|
- <if test="name != null and name != ''">
|
|
|
+ <if test="name != null">
|
|
|
name = #{name},
|
|
|
</if>
|
|
|
- <if test="tldId != null and tldId != ''">
|
|
|
+ <if test="tldId != null">
|
|
|
tld_id = #{tldId},
|
|
|
</if>
|
|
|
</set>
|
|
|
@@ -187,18 +284,20 @@
|
|
|
</update>
|
|
|
<!-- 删除字典内容 -->
|
|
|
<delete id="deleteDictionary">
|
|
|
- delete from ${tableName} where id = #{id}
|
|
|
+ delete
|
|
|
+ from ${tableName}
|
|
|
+ where id = #{id}
|
|
|
</delete>
|
|
|
<!-- 新增日志 -->
|
|
|
<insert id="addAccess">
|
|
|
- insert into tld_access(type,data,scrq) value(#{type},#{data},now())
|
|
|
+ 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 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 into tld_storage_location(storage_location_code, storage_location_name, warehouse_where) value (#{storageLocationCode},#{storageLocationName},#{warehouseWhere})
|
|
|
</insert>
|
|
|
</mapper>
|