食品采购出入库
This commit is contained in:
@@ -4,28 +4,47 @@
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
fp.food_product_id, fp.food_id, fp.price, fp.supplier_id, fp.edu_id, fp.remark, fp.check_remark, fp.check_status, fp.create_time, fp.update_time, fp.check_time
|
||||
fp.food_product_id, fp.food_id, fp.price, fp.supplier_id, fp.edu_id, fp.remark, fp.check_remark, fp.check_status, fp.create_time, fp.update_time, fp.check_time,
|
||||
fp.num, fp.name, fp.type_id,fp.unit_id,fp.spec_id
|
||||
</sql>
|
||||
<select id="queryFoodProductVO" resultType="com.zf.foodpurchase.fdsafe.vo.FoodProductVO">
|
||||
select
|
||||
<include refid="Base_Column_List"/>,
|
||||
f.food_name, f.type_id,ft.type_label,f.unit_id, fu.unit_label, ed.edu_name,sp.supplier_name,sp.del_flag
|
||||
from food_product fp
|
||||
left join edu ed on ed.edu_id = fp.edu_id
|
||||
left join food f on f.food_id = fp.food_id
|
||||
left join food_type ft on ft.type_id = f.type_id
|
||||
left join food_unit fu on fu.unit_id = f.unit_id
|
||||
left join supplier sp on sp.supplier_id = fp.supplier_id
|
||||
|
||||
|
||||
SELECT
|
||||
ft.type_label,fu.unit_label,fs.spec_label,
|
||||
ed.edu_name,sp.supplier_name,sp.del_flag,fp.food_product_id,
|
||||
fp.food_id,fp.price,fp.supplier_id,fp.edu_id,fp.remark,
|
||||
fp.check_remark,fp.check_status,fp.create_time,fp.update_time,
|
||||
fp.check_time,fp.num,fp.name,fp.type_id,fp.unit_id,fp.spec_id,
|
||||
IFNULL(r.totalProductNum, 0) AS totalProductNum
|
||||
FROM food_product fp
|
||||
LEFT JOIN edu ed ON ed.edu_id = fp.edu_id
|
||||
LEFT JOIN food_type ft ON ft.type_id = fp.type_id
|
||||
LEFT JOIN food_unit fu ON fu.unit_id = fp.unit_id
|
||||
LEFT JOIN food_spec fs ON fs.spec_id = fp.spec_id
|
||||
-- 供货商过滤条件移到ON,保留无供货商商品
|
||||
LEFT JOIN supplier sp
|
||||
ON sp.supplier_id = fp.supplier_id
|
||||
AND sp.status = 1
|
||||
AND sp.del_flag = 0
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
food_product_id,
|
||||
SUM(food_product_num) AS totalProductNum
|
||||
FROM food_repo
|
||||
<where>
|
||||
<if test="repoId != null">
|
||||
repo_id = #{repoId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY food_product_id
|
||||
) r ON r.food_product_id = fp.food_product_id
|
||||
<where>
|
||||
sp.status = 1 and sp.del_flag = 0 and f.del_flag = 0
|
||||
<if test="foodProductId != null">
|
||||
and fp.food_product_id = #{foodProductId}
|
||||
fp.food_product_id = #{foodProductId}
|
||||
</if>
|
||||
<if test="foodId != null">
|
||||
and fp.food_id = #{foodId}
|
||||
</if>
|
||||
<!-- typeId过滤如果需要保留无分类商品 -->
|
||||
<if test="typeId !=null">
|
||||
and ft.type_id = #{typeId}
|
||||
</if>
|
||||
@@ -38,8 +57,8 @@
|
||||
<if test="checkStatus != null">
|
||||
and fp.check_status = #{checkStatus}
|
||||
</if>
|
||||
<if test="foodName !=null and foodName !=''">
|
||||
and f.food_name like concat('%',#{foodName},'%')
|
||||
<if test="name !=null and name !=''">
|
||||
and fp.name like concat('%',#{name},'%')
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
and fp.del_flag = #{delFlag}
|
||||
@@ -48,4 +67,17 @@
|
||||
order by fp.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="pageCKList" resultType="com.zf.foodpurchase.fdsafe.vo.FoodProductCKVO">
|
||||
select a.food_product_id,a.num,a.name,c.repo_name repoName,d.spec_label specName,
|
||||
b.food_product_num foodProductNum,e.unit_label unitName,a.supplier_id supplierId,
|
||||
a.type_id typeId,b.repo_id repoId,c.merchant_id deptId,a.price
|
||||
from food_product a
|
||||
left join food_repo b on a.food_product_id=b.food_product_id
|
||||
left join repository c on b.repo_id=c.id
|
||||
left join food_spec d on a.spec_id=d.spec_id
|
||||
left join food_unit e on a.unit_id=e.unit_id
|
||||
where b.repo_id=#{repoId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
38
fp-system/src/main/resources/mapper/FoodRepoMapper.xml
Normal file
38
fp-system/src/main/resources/mapper/FoodRepoMapper.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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.zf.foodpurchase.fdsafe.mapper.FoodRepoMapper">
|
||||
|
||||
<insert id="insert" parameterType="FoodRepo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into food_repo(
|
||||
<if test="foodProductId != null">food_product_id,</if>
|
||||
<if test="repoId != null">repo_id,</if>
|
||||
<if test="orderNo != null and orderNo != ''">order_no,</if>
|
||||
<if test="orderItemNo != null and orderItemNo != ''">order_item_no,</if>
|
||||
<if test="foodProductNum != null">food_product_num</if>
|
||||
)values(
|
||||
<if test="foodProductId != null">#{foodProductId},</if>
|
||||
<if test="repoId != null">#{repoId},</if>
|
||||
<if test="orderNo != null and orderNo != ''">#{orderNo},</if>
|
||||
<if test="orderItemNo != null and orderItemNo != ''">#{orderItemNo},</if>
|
||||
<if test="foodProductNum != null">#{foodProductNum}</if>)
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update food_repo
|
||||
<set>
|
||||
<if test="foodProductId != null">food_product_id=#{foodProductId},</if>
|
||||
<if test="repoId != null">repo_id=#{repoId},</if>
|
||||
<if test="orderNo != null and orderNo != ''">order_no=#{orderNo},</if>
|
||||
<if test="orderItemNo != null and orderItemNo != ''">order_item_no=#{orderItemNo},</if>
|
||||
<if test="foodProductNum != null">food_product_num=#{foodProductNum}</if>
|
||||
</set>
|
||||
where id=#{id}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectByProductIdAndRepoId" resultType="FoodRepo">
|
||||
select id, food_product_id foodProductId, repo_id repoId, order_no orderNo, order_item_no orderItemNo, food_product_num foodProductNum
|
||||
from food_repo where food_product_id=#{productId} and repo_id=#{repoId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
30
fp-system/src/main/resources/mapper/FoodSpecMapper.xml
Normal file
30
fp-system/src/main/resources/mapper/FoodSpecMapper.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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.zf.foodpurchase.fdsafe.mapper.FoodSpecMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
spec_id, spec_label, del_flag, create_time, update_time,status
|
||||
</sql>
|
||||
<select id="queryFoodSpecVO" resultType="com.zf.foodpurchase.fdsafe.vo.FoodSpecVO"
|
||||
parameterType="com.zf.foodpurchase.fdsafe.vo.FoodSpecVO">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from food_spec
|
||||
<where>
|
||||
<if test="specId != null and specId != ''">
|
||||
and spec_id = #{specId}
|
||||
</if>
|
||||
<if test="specLabel != null and specLabel != ''">
|
||||
and spec_label like concat('%',#{specLabel},'%')
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
and del_flag = #{delFlag}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,211 +0,0 @@
|
||||
<?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.zf.foodpurchase.fdsafe.mapper.ProductsMapper">
|
||||
|
||||
<resultMap type="com.zf.foodpurchase.fdsafe.entity.Products" id="ProductsResult">
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="merchantId" column="merchant_id" />
|
||||
<result property="merchantName" column="dept_name" />
|
||||
<result property="productName" column="product_name" />
|
||||
<result property="description" column="description" />
|
||||
<result property="basePrice" column="base_price" />
|
||||
<result property="totalStock" column="total_stock" />
|
||||
<result property="images" column="images" />
|
||||
<result property="categoryId" column="category_id" />
|
||||
<result property="status" column="status" />
|
||||
<result property="type" column="type" />
|
||||
<result property="baseIntegral" column="base_integral" />
|
||||
<result property="baseReturnIntergral" column="base_return_intergral" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="operId" column="oper_id" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="detailImages" column="detail_images" />
|
||||
<result property="isSpecs" column="is_specs" />
|
||||
<result property="sailCount" column="sail_count" />
|
||||
<result property="hot" column="hot" />
|
||||
<result property="recommend" column="recommend" />
|
||||
<result property="isNew" column="is_new" />
|
||||
<result property="version" column="version" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectProductsVo">
|
||||
select product_id, merchant_id,
|
||||
d.dept_name as dept_name, product_name,
|
||||
description, base_price, total_stock,
|
||||
images, category_id, p.status as status,
|
||||
type, base_integral, base_return_intergral,
|
||||
p.create_time, p.update_time, oper_id,
|
||||
p.del_flag as del_flag, detail_images ,
|
||||
is_specs,
|
||||
sail_count, hot, recommend,
|
||||
is_new,version
|
||||
from products p inner join sys_dept d on d.dept_id = p.merchant_id
|
||||
</sql>
|
||||
|
||||
<select id="selectProductsList" parameterType="com.zf.foodpurchase.fdsafe.entity.Products" resultMap="ProductsResult">
|
||||
<include refid="selectProductsVo"/>
|
||||
<where>
|
||||
<if test="merchantId != null "> and p.merchant_id = #{merchantId}</if>
|
||||
<if test="productName != null and productName != ''"> and p.product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="merchantName != null and merchantName != ''"> and d.dept_name like concat('%', #{merchantName}, '%')</if>
|
||||
<if test="params.beginBasePrice != null and params.beginBasePrice != '' and params.endBasePrice != null and params.endBasePrice != ''"> and p.base_price between #{params.beginBasePrice} and #{params.endBasePrice}</if>
|
||||
<if test="categoryId != null "> and p.category_id = #{categoryId}</if>
|
||||
<if test="status != null "> and p.status = #{status}</if>
|
||||
<if test="type != null "> and p.type = #{type}</if>
|
||||
<if test="basePrice != null "> and p.base_price <= #{basePrice}</if>
|
||||
<if test="sailCount != null">and p.sail_count= #{sailCount},</if>
|
||||
<if test="hot != null and hot!=''">and p.hot=#{hot},</if>
|
||||
<if test="recommend != null and recommend">and p.recommend=#{recommend},</if>
|
||||
<if test="isNew != null and isNew">and p.is_new=#{isNew},</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectHotProducts" parameterType="com.zf.foodpurchase.fdsafe.entity.Products" resultMap="ProductsResult">
|
||||
<include refid="selectProductsVo"/>
|
||||
<where>
|
||||
p.hot = '1'
|
||||
and p.status = '1'
|
||||
<if test="merchantId != null "> and p.merchant_id = #{merchantId}</if>
|
||||
order by p.create_time desc
|
||||
limit #{limitNum}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRecommendProducts" parameterType="com.zf.foodpurchase.fdsafe.entity.Products" resultMap="ProductsResult">
|
||||
<include refid="selectProductsVo"/>
|
||||
<where>
|
||||
p.recommend = '1'
|
||||
and p.status = '1'
|
||||
<if test="merchantId != null "> and p.merchant_id = #{merchantId}</if>
|
||||
order by p.create_time desc
|
||||
limit #{limitNum}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectNewProductsList" parameterType="com.zf.foodpurchase.fdsafe.entity.Products" resultMap="ProductsResult">
|
||||
<include refid="selectProductsVo"/>
|
||||
<where>
|
||||
p.status = '1'
|
||||
and p.is_new = '1'
|
||||
<if test="merchantId != null "> and p.merchant_id = #{merchantId}</if>
|
||||
order by p.create_time desc
|
||||
limit #{limitNum}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSailCountProducts" parameterType="com.zf.foodpurchase.fdsafe.entity.Products" resultMap="ProductsResult">
|
||||
<include refid="selectProductsVo"/>
|
||||
<where>
|
||||
p.status = '1'
|
||||
<if test="merchantId != null "> and p.merchant_id = #{merchantId}</if>
|
||||
order by p.sail_count desc
|
||||
limit #{limitNum}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="selectProductsByProductId" parameterType="Integer" resultMap="ProductsResult">
|
||||
<include refid="selectProductsVo"/>
|
||||
where product_id = #{productId} and p.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertProducts" parameterType="com.zf.foodpurchase.fdsafe.entity.Products" useGeneratedKeys="true" keyProperty="productId">
|
||||
insert into products
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="merchantId != null">merchant_id,</if>
|
||||
<if test="productName != null and productName != ''">product_name,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="basePrice != null">base_price,</if>
|
||||
<if test="totalStock != null">total_stock,</if>
|
||||
<if test="images != null">images,</if>
|
||||
<if test="categoryId != null">category_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="baseIntegral != null">base_integral,</if>
|
||||
<if test="baseReturnIntergral != null">base_return_intergral,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="operId != null">oper_id,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="detailImages != null">detail_images,</if>
|
||||
<if test="isSpecs != null">is_specs,</if>
|
||||
<if test="sailCount != null">sail_count,</if>
|
||||
<if test="hot != null and hot!=''">hot,</if>
|
||||
<if test="recommend != null and recommend!=''">recommend,</if>
|
||||
<if test="isNew != null and isNew!=''">is_new,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="merchantId != null">#{merchantId},</if>
|
||||
<if test="productName != null and productName != ''">#{productName},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="basePrice != null">#{basePrice},</if>
|
||||
<if test="totalStock != null">#{totalStock},</if>
|
||||
<if test="images != null">#{images},</if>
|
||||
<if test="categoryId != null">#{categoryId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="baseIntegral != null">#{baseIntegral},</if>
|
||||
<if test="baseReturnIntergral != null">#{baseReturnIntergral},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="operId != null">#{operId},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="detailImages != null">#{detailImages},</if>
|
||||
<if test="isSpecs != null">#{isSpecs},</if>
|
||||
<if test="sailCount != null">#{sailCount},</if>
|
||||
<if test="hot != null and recommend!=''">#{hot},</if>
|
||||
<if test="recommend != null and recommend!=''">#{recommend},</if>
|
||||
<if test="isNew != null and isNew!=''">#{isNew},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateProducts" parameterType="com.zf.foodpurchase.fdsafe.entity.Products">
|
||||
update products
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="merchantId != null">merchant_id = #{merchantId},</if>
|
||||
<if test="productName != null and productName != ''">product_name = #{productName},</if>
|
||||
<if test="description != null">description = #{description},</if>
|
||||
<if test="basePrice != null">base_price = #{basePrice},</if>
|
||||
<if test="totalStock != null">total_stock = #{totalStock},</if>
|
||||
<if test="images != null">images = #{images},</if>
|
||||
<if test="categoryId != null">category_id = #{categoryId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="baseIntegral != null">base_integral = #{baseIntegral},</if>
|
||||
<if test="baseReturnIntergral != null">base_return_intergral = #{baseReturnIntergral},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="operId != null">oper_id = #{operId},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="detailImages != null">detail_images = #{detailImages},</if>
|
||||
<if test="isSpecs != null">is_specs = #{isSpecs},</if>
|
||||
<if test="sailCount != null">sail_count= #{sailCount},</if>
|
||||
<if test="hot != null and hot!=''">hot=#{hot},</if>
|
||||
<if test="recommend != null and recommend!=''">recommend=#{recommend},</if>
|
||||
<if test="isNew != null and isNew!=''">is_new=#{isNew},</if>
|
||||
<if test="version != null">version=#{version}+1,</if>
|
||||
</trim>
|
||||
where product_id = #{productId} and version=#{version}
|
||||
</update>
|
||||
|
||||
<delete id="deleteProductsByProductId" parameterType="Long">
|
||||
delete from products where product_id = #{productId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteProductsByProductIds" parameterType="String">
|
||||
delete from products where product_id in
|
||||
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
||||
#{productId}
|
||||
</foreach>
|
||||
</delete>
|
||||
<update id="deleteProductsLogicByProductIds">
|
||||
update products set del_flag = '1' where product_id in
|
||||
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
||||
#{productId}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?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.zf.foodpurchase.fdsafe.mapper.ProductsSpecMapper">
|
||||
|
||||
<update id="updateProductsSpec">
|
||||
update products_spec
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="productId != null">product_id = #{productId},</if>
|
||||
<if test="specValues != null">spec_values = #{specValues},</if>
|
||||
<if test="price != null">price = #{price},</if>
|
||||
<if test="stock != null">stock = #{stock},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="integral != null">integral = #{integral},</if>
|
||||
<if test="returnIntegral != null">return_integral = #{returnIntegral},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="operId != null">oper_id = #{operId},</if>
|
||||
<if test="specImage != null">spec_image = #{specImage},</if>
|
||||
<if test="psVersion != null">ps_version = #{psVersion}+1,</if>
|
||||
</trim>
|
||||
where id = #{id} and ps_version=#{psVersion}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectMinOne" parameterType="Integer" resultType="java.util.Map">
|
||||
select min(integral) as integral, min(price) as price from products_spec where product_id=#{productId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
86
fp-system/src/main/resources/mapper/RepoRecordMapper.xml
Normal file
86
fp-system/src/main/resources/mapper/RepoRecordMapper.xml
Normal file
@@ -0,0 +1,86 @@
|
||||
<?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.zf.foodpurchase.fdsafe.mapper.RepoRecordMapper">
|
||||
|
||||
<resultMap id="RepoRecordResultMap" type="com.zf.foodpurchase.fdsafe.entity.RepoRecord">
|
||||
<id column="id" property="id"/>
|
||||
<result column="apply_date" property="applyDate"/>
|
||||
<result column="supplier_id" property="supplierId"/>
|
||||
<result column="category_id" property="categoryId"/>
|
||||
<result column="repo_id" property="repoId"/>
|
||||
<result column="product_id" property="productId"/>
|
||||
<result column="product_num" property="productNum"/>
|
||||
<result column="total_cost" property="totalCost"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="msg" property="msg"/>
|
||||
<result column="school_id" property="schoolId"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectRepoRecordByRepoRecordId" resultType="com.zf.foodpurchase.fdsafe.vo.RepoRecordVO">
|
||||
select re.id,re.apply_date,re.supplier_id,re.category_id,re.repo_id,re.product_id,
|
||||
re.product_num,p.name,re.total_cost,re.status,re.msg,fd.type_label categoryName,
|
||||
sd.dept_name merchantName, rep.repo_name repoName,re.total_cost totalCost from repo_record re
|
||||
left join food_type fd on re.category_id=fd.type_id
|
||||
left join sys_dept sd on re.supplier_id=sd.dept_id
|
||||
left join repository rep on re.repo_id = rep.id
|
||||
left join food_product p on re.product_id=p.food_product_id WHERE re.id = #{repoRecordId}
|
||||
</select>
|
||||
|
||||
<insert id="insertRepoRecord" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
INSERT INTO repo_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="applyDate != null">apply_date,</if>
|
||||
<if test="supplierId != null">supplier_id,</if>
|
||||
<if test="categoryId != null">category_id,</if>
|
||||
<if test="repoId != null">repo_id,</if>
|
||||
<if test="productId != null">product_id,</if>
|
||||
<if test="productNum != null">product_num,</if>
|
||||
<if test="totalCost != null">total_cost,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="msg != null and msg != ''">msg,</if>
|
||||
<if test="schoolId != null">school_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="applyDate != null">#{applyDate},</if>
|
||||
<if test="supplierId != null">#{supplierId,jdbcType=INTEGER},</if>
|
||||
<if test="categoryId != null">#{categoryId,jdbcType=INTEGER},</if>
|
||||
<if test="repoId != null">#{repoId,jdbcType=INTEGER},</if>
|
||||
<if test="productId != null">#{productId,jdbcType=INTEGER},</if>
|
||||
<if test="productNum != null">#{productNum,jdbcType=INTEGER},</if>
|
||||
<if test="totalCost != null">#{totalCost},</if>
|
||||
<if test="status != null">#{status,jdbcType=INTEGER},</if>
|
||||
<if test="msg != null and msg != ''">#{msg,jdbcType=VARCHAR},</if>
|
||||
<if test="schoolId != null">#{schoolId,jdbcType=BIGINT},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="selectRepoRecordList" resultType="com.zf.foodpurchase.fdsafe.vo.RepoRecordVO">
|
||||
select re.id,re.apply_date,re.supplier_id,re.category_id,re.repo_id,re.product_id,
|
||||
re.product_num,p.name,re.total_cost,re.status,re.msg,fd.type_label categoryName,
|
||||
sd.dept_name merchantName, rep.repo_name repoName,re.total_cost totalCost from repo_record re
|
||||
left join food_type fd on re.category_id=fd.type_id
|
||||
left join sys_dept sd on re.supplier_id=sd.dept_id
|
||||
left join repository rep on re.repo_id = rep.id
|
||||
left join food_product p on re.product_id=p.food_product_id
|
||||
<where>
|
||||
<if test="repoId != null">
|
||||
AND re.repo_id = #{repoId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND p.name LIKE CONCAT('%', #{productName,jdbcType=VARCHAR}, '%')
|
||||
</if>
|
||||
<if test="categoryId != null">
|
||||
AND fd.type_id = #{categoryId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
AND re.apply_date >= #{startTime,jdbcType=DATETIME}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
AND re.apply_date <= #{endTime,jdbcType=DATETIME}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -6,6 +6,7 @@
|
||||
<id column="id" property="id" />
|
||||
<result column="merchant_id" property="merchantId" />
|
||||
<result column="merchant_name" property="merchantName" />
|
||||
<result column="repo_num" property="repoNum" />
|
||||
<result column="repo_name" property="repoName" />
|
||||
<result column="area_code" property="areaCode" />
|
||||
<result column="detail_address" property="detailAddress" />
|
||||
@@ -13,13 +14,16 @@
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="oper_id" property="operId" />
|
||||
<result column="manager" property="manager" />
|
||||
<result column="order_num" property="orderNum" />
|
||||
</resultMap>
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="joinColumn">
|
||||
select r.id, r.merchant_id,r.repo_name, r.area_code, r.detail_address, r.default_repo, r.create_time, r.update_time, r.oper_id,d.dept_name as merchant_name
|
||||
select r.id, r.merchant_id,r.repo_num, r.repo_name, r.area_code, r.detail_address, r.default_repo, r.create_time, r.update_time, r.oper_id,
|
||||
r.manager, r.order_num, d.dept_name as merchant_name
|
||||
from repository r left join sys_dept d on r.merchant_id = d.dept_id
|
||||
</sql>
|
||||
<select id="joinQueryList" resultType="com.zf.foodpurchase.fdsafe.entity.Repository"
|
||||
<select id="queryRepoList" resultType="com.zf.foodpurchase.fdsafe.entity.Repository"
|
||||
parameterType="com.zf.foodpurchase.fdsafe.entity.Repository">
|
||||
<include refid="joinColumn"/>
|
||||
<where>
|
||||
@@ -32,6 +36,15 @@
|
||||
<if test="createTime != null ">and r.create_time = #{createTime}</if>
|
||||
<if test="updateTime != null ">and r.update_time = #{updateTime}</if>
|
||||
<if test="merchantName != null and merchantName !='' ">and d.dept_name like concat('%', #{merchantName}, '%') </if>
|
||||
<if test="repoNum != null and repoNum !='' ">and r.repo_num =#{repoNum} </if>
|
||||
<if test="manager != null ">and r.manager = #{manager}</if>
|
||||
<if test="orderNum != null ">and r.order_num = #{orderNum}</if>
|
||||
<if test="deptIds != null and deptIds.size() > 0">
|
||||
and d.dept_id in
|
||||
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -39,6 +39,12 @@
|
||||
<if test="supplierName != null and supplierName !=''">
|
||||
and su.supplier_name like concat('%',#{supplierName},'%')
|
||||
</if>
|
||||
<if test="deptIds != null and deptIds.size() > 0">
|
||||
and ci.school_id in
|
||||
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by ci.update_time desc
|
||||
</select>
|
||||
|
||||
@@ -53,5 +53,4 @@
|
||||
</where>
|
||||
order by soi.order_item_no desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
so.order_no, so.supplier_id, so.school_id, so.edu_id, so.operator_person, so.operator_phone, so.total_money, so.refund_money, so.order_status, so.delivery_date, so.create_time, so.update_time, so.cancel_time, so.cancel_reason,so.order_remark,so.order_settle_status
|
||||
so.order_no, so.supplier_id, so.school_id, so.edu_id, so.operator_person, so.operator_phone, so.total_money, so.refund_money, so.order_status, so.delivery_date, so.create_time, so.update_time, so.cancel_time, so.cancel_reason,so.order_remark,so.order_settle_status,
|
||||
so.sign_person,so.sign_time,so.sign_image
|
||||
</sql>
|
||||
|
||||
<select id="querySchoolOrderVO" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderVO"
|
||||
parameterType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderVO">
|
||||
select<include refid="Base_Column_List"/>,
|
||||
@@ -39,8 +41,68 @@
|
||||
<if test = 'orderSettleStatus !=null'>
|
||||
and so.order_settle_status = #{orderSettleStatus}
|
||||
</if>
|
||||
<if test="deptIds != null and deptIds.size() > 0">
|
||||
and s.school_id in
|
||||
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by so.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="querySupplierOrderVO" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderVO"
|
||||
parameterType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderVO">
|
||||
select<include refid="Base_Column_List"/>,
|
||||
e.edu_name, s.school_name, su.supplier_name
|
||||
from school_order so
|
||||
left join edu e on so.edu_id = e.edu_id
|
||||
left join school s on so.school_id = s.school_id
|
||||
left join supplier su on so.supplier_id = su.supplier_id
|
||||
<where>
|
||||
<if test="orderNo != null and orderNo != ''">
|
||||
and so.order_no = #{orderNo}
|
||||
</if>
|
||||
<if test="supplierId != null">
|
||||
and so.supplier_id = #{supplierId}
|
||||
</if>
|
||||
<if test="schoolId != null">
|
||||
and so.school_id = #{schoolId}
|
||||
</if>
|
||||
<if test="eduId != null">
|
||||
and so.edu_id = #{eduId}
|
||||
</if>
|
||||
<if test="orderStatus != null">
|
||||
and so.order_status = #{orderStatus}
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
AND date_format(so.create_time,'%Y%m%d') >= date_format(#{beginTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and date_format(so.create_time,'%Y%m%d') <=date_format(#{endTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test = 'orderSettleStatus !=null'>
|
||||
and so.order_settle_status = #{orderSettleStatus}
|
||||
</if>
|
||||
<if test="deptIds != null and deptIds.size() > 0">
|
||||
and su.supplier_id in
|
||||
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by so.create_time desc
|
||||
</select>
|
||||
|
||||
<update id="signOrder" parameterType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderVO">
|
||||
update school_order
|
||||
<set>
|
||||
<if test="orderStatus != null">order_status = #{orderStatus},</if>
|
||||
<if test="signPerson != null and signPerson != ''">sign_person = #{signPerson},</if>
|
||||
<if test="signTime != null">sign_time = #{signTime},</if>
|
||||
<if test="signImage != null and signImage != ''">sign_image = #{signImage},</if>
|
||||
</set>
|
||||
where order_no = #{orderNo}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?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.zf.foodpurchase.fdsafe.mapper.SpecTypesMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,57 +0,0 @@
|
||||
<?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.zf.foodpurchase.fdsafe.mapper.SpecValuesMapper">
|
||||
<sql id="baseColumn">
|
||||
select
|
||||
id,
|
||||
spec_type as specType,
|
||||
spec_value as specValue,
|
||||
spec_unit as specUnit,
|
||||
create_time as createTime,
|
||||
update_time as updateTime,
|
||||
oper_id as operId
|
||||
from spec_values
|
||||
</sql>
|
||||
<sql id="joinColumn">
|
||||
SELECT
|
||||
v.id,
|
||||
v.spec_type AS specType,
|
||||
v.spec_value AS specValue,
|
||||
v.spec_unit AS specUnit,
|
||||
v.create_time AS createTime,
|
||||
v.update_time AS updateTime,
|
||||
v.oper_id AS operId,
|
||||
t.spec_name AS specName
|
||||
FROM
|
||||
spec_values v
|
||||
LEFT JOIN spec_types t ON v.spec_type = t.spec_type
|
||||
</sql>
|
||||
|
||||
<select id="queryList" resultType="com.zf.foodpurchase.fdsafe.entity.SpecValues" parameterType="com.zf.foodpurchase.fdsafe.entity.SpecValues">
|
||||
<include refid="joinColumn"/>
|
||||
<where>
|
||||
<if test="specType != null">
|
||||
and v.spec_type = #{specType}
|
||||
</if>
|
||||
<if test="specValue != null">
|
||||
and v.spec_value = #{specValue}
|
||||
</if>
|
||||
<if test="specUnit != null">
|
||||
and v.spec_unit =#{specUnit}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryByIds" resultType="com.zf.foodpurchase.fdsafe.entity.SpecValues">
|
||||
<include refid="joinColumn"/>
|
||||
<where>
|
||||
<if test="list != null">
|
||||
id in
|
||||
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -30,5 +30,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
(#{item.roleId},#{item.deptId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="selectDeptIdsByRoleIds" resultType="Long">
|
||||
select distinct rd.dept_id from sys_role_dept rd left join sys_dept d on rd.dept_id=d.dept_id where d.del_flag='0' and d.status='0' and role_id in
|
||||
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -154,5 +154,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.tenant_id = #{tenantId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRolesByIds" parameterType="Long" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.del_flag='0' and r.status='0' and r.role_id in
|
||||
<foreach collection="roleIds" item="roleId" open="(" close=")" separator=",">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -54,7 +54,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.account_type ,u.account_dept_id,
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password,
|
||||
u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
u.account_type ,u.account_dept_id, u.organi_id, u.account_type,
|
||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||
from sys_user u
|
||||
|
||||
@@ -41,4 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectRoleIdsByUserId" resultType="Long">
|
||||
select role_id from sys_user_role where user_id=#{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -219,5 +219,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
<select id="selectIdByDeptIds" resultType="SysDept">
|
||||
|
||||
SELECT distinct dept_id, dept_name label, parent_id, status
|
||||
FROM sys_dept
|
||||
where del_flag = 0 and status = '0'
|
||||
<if test="deptIds != null and deptIds.size() > 0">
|
||||
and dept_id in
|
||||
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user