feat: 智聪记账管理,物价管理-物价记录代码提交。

This commit is contained in:
tianyongbao
2025-03-20 18:33:17 +08:00
parent f523aaf7f9
commit 3daada1e4b
8 changed files with 723 additions and 0 deletions

View File

@@ -0,0 +1,167 @@
<?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.intc.invest.mapper.ProductPriceRecordMapper">
<resultMap type="ProductPriceRecordVo" id="ProductPriceRecordResult">
<result property="id" column="id" />
<result property="productId" column="product_id" />
<result property="price" column="price" />
<result property="recordTime" column="record_time" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updatedBy" column="updated_by" />
<result property="address" column="address" />
<result property="delFlag" column="del_flag" />
<result property="merchant" column="merchant" />
<result property="fields" column="fields" />
<result property="unit" column="unit" />
<result property="kind" column="kind" />
<result property="category" column="category" />
<result property="productName" column="product_name" />
</resultMap>
<sql id="selectProductPriceRecordVo">
select
a.id,
a.product_id,
pi2."name" as product_name,
a.price,
a.record_time,
a.remark,
a.create_time,
a.create_by,
a.update_time,
a.updated_by,
a.address,
a.del_flag,
a.merchant,
a.fields,
a.unit,
a.kind,
a.category
from
product_price_record a
left join product_infor pi2 on
pi2.id = a.product_id
</sql>
<select id="selectProductPriceRecordList" parameterType="ProductPriceRecordDto" resultMap="ProductPriceRecordResult">
<include refid="selectProductPriceRecordVo"/>
<where>
a.del_flag='0'
<if test="productId != null "> and a.product_id = #{productId}</if>
<if test="price != null "> and a.price = #{price}</if>
<if test="recordTime != null "> and a.record_time = #{recordTime}</if>
<if test="address != null and address != ''"> and a.address = #{address}</if>
<if test="merchant != null and merchant != ''"> and a.merchant = #{merchant}</if>
<if test="kind != null and kind != ''"> and a.kind = #{kind}</if>
<if test="category != null and category != ''"> and a.category = #{category}</if>
<if test="endTime!=null and endTime !=''">
and #{endTime}>=to_char(a.record_time, 'yyyy-MM-dd')
</if>
<if test="startTime!=null and startTime !=''">
and to_char(a.record_time, 'yyyy-MM-dd')>=#{startTime}
</if>
<if test="endDateTime!=null">
and #{endDateTime}>=a.record_time
</if>
<if test="startDateTime!=null">
and a.record_time>=#{startDateTime}
</if>
</where>
order by a.create_time desc
</select>
<select id="selectProductPriceRecordById" parameterType="Long" resultMap="ProductPriceRecordResult">
<include refid="selectProductPriceRecordVo"/>
where a.id = #{id}
</select>
<insert id="insertProductPriceRecord" parameterType="ProductPriceRecord" useGeneratedKeys="true" keyProperty="id">
insert into product_price_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="productId != null">product_id,</if>
<if test="price != null">price,</if>
<if test="recordTime != null">record_time,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="address != null and address != ''">address,</if>
<if test="delFlag != null">del_flag,</if>
<if test="merchant != null">merchant,</if>
<if test="fields != null">fields,</if>
<if test="unit != null">unit,</if>
<if test="kind != null and kind != ''">kind,</if>
<if test="category != null and category != ''">category,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="productId != null">#{productId},</if>
<if test="price != null">#{price},</if>
<if test="recordTime != null">#{recordTime},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="address != null and address != ''">#{address},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="merchant != null">#{merchant},</if>
<if test="fields != null">#{fields},</if>
<if test="unit != null">#{unit},</if>
<if test="kind != null and kind != ''">#{kind},</if>
<if test="category != null and category != ''">#{category},</if>
</trim>
</insert>
<update id="updateProductPriceRecord" parameterType="ProductPriceRecord">
update product_price_record
<trim prefix="SET" suffixOverrides=",">
<if test="productId != null">product_id = #{productId},</if>
<if test="price != null">price = #{price},</if>
<if test="recordTime != null">record_time = #{recordTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="address != null and address != ''">address = #{address},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="merchant != null">merchant = #{merchant},</if>
<if test="fields != null">fields = #{fields},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="kind != null and kind != ''">kind = #{kind},</if>
<if test="category != null and category != ''">category = #{category},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteProductPriceRecordById" parameterType="Long">
delete from product_price_record where id = #{id}
</delete>
<delete id="deleteProductPriceRecordByIds" parameterType="String">
delete from product_price_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="removeProductPriceRecordById" parameterType="Long">
update product_price_record set del_flag='1' where id = #{id}
</update>
<update id="removeProductPriceRecordByIds" parameterType="String">
update product_price_record set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>