全量提交

This commit is contained in:
林华觞
2025-05-21 08:59:12 +08:00
parent 2bf962399b
commit 08924f2b28
634 changed files with 59141 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?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.AccompanyMealMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
am.accompany_meal_id, am.school_id, am.meal_type, am.leader_name, am.staff_name, am.address, am.cuisine_same, am.quality_normal, am.service_good, am.adverse_effective, am.feed_back, am.accompany_image as accompany_image_str , am.create_time, am.update_time, am.accompany_time
</sql>
<select id="queryAccompanyMealVO" resultType="com.zf.foodpurchase.fdsafe.vo.AccompanyMealVO">
select
<include refid="Base_Column_List"/>,
s.school_name
from accompany_meal am left join school s on am.school_id = s.school_id
<where>
<if test="accompanyMealId != null ">
and am.accompany_meal_id = #{accompanyMealId}
</if>
<if test="schoolId != null ">
and am.school_id = #{schoolId}
</if>
<if test="mealType != null ">
and am.meal_type = #{mealType}
</if>
<if test="leaderName != null and leaderName != ''">
and am.leader_name like CONCAT('%', #{leaderName}, '%')
</if>
<if test="staffName != null and staffName != ''">
and am.staff_name like CONCAT('%', #{staffName}, '%')
</if>
<if test="schoolName != null and schoolName != ''">
and s.school_name like CONCAT('%', #{schoolName}, '%')
</if>
<if test="beginTime != null ">
and date_format(am.create_time, '%Y-%m-%d') &gt;= date_format(#{beginTime}, '%Y-%m-%d')
</if>
<if test="endTime != null ">
and date_format(am.create_time, '%Y-%m-%d') &lt;= date_format(#{endTime}, '%Y-%m-%d')
</if>
</where>
order by am.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,32 @@
<?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.CattenMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
ca.catten_id, ca.school_id, ca.catten_name, ca.catten_type, ca.concat_name, ca.concat_phone, ca.license_img, ca.food_license_img, ca.remarkt, ca.create_time, ca.update_time, ca.del_flag
</sql>
<select id="queryCattenVO" resultType="com.zf.foodpurchase.fdsafe.vo.CattenVO">
select
ca.catten_id, ca.school_id, ca.catten_name, ca.catten_type, ca.concat_name, ca.concat_phone, ca.license_img as license_img_str, ca.food_license_img as food_license_img_str, ca.remark, ca.create_time, ca.update_time, ca.del_flag,
sc.school_name
from catten ca
left join school sc on ca.school_id = sc.school_id
<where>
ca.del_flag = '0'
<if test="cattenId != null">
and ca.catten_id = #{cattenId}
</if>
<if test="cattenName != null and cattenName != ''">
and ca.catten_name like CONCAT('%', #{cattenName}, '%')
</if>
<if test="schoolName != null and schoolName != ''">
and sc.school_name like CONCAT('%', #{schoolName}, '%')
</if>
<if test="schoolId != null">
and ca.school_id = #{schoolId}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,28 @@
<?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.DishFoodRelationMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
di.di_fd_id, di.dish_id, di.food_id, di.weight, di.create_time, di.update_time
</sql>
<select id="queryRelationVO" resultType="com.zf.foodpurchase.fdsafe.vo.DishFoodRelationVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.DishFoodRelationVO">
select <include refid="Base_Column_List"></include>,
f.food_name
from dish_food_relation di left join food f on di.food_id = f.food_id
<where>
<if test="diFdId != null">
and di.di_fd_id = #{diFdId}
</if>
<if test="dishId != null">
and di.dish_id = #{dishId}
</if>
<if test="foodName != null and foodName != ''">
and f.food_name like concat('%',#{foodName},'%')
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,33 @@
<?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.DishMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
dh.dish_id, dh.dish_name, dh.school_id, dh.total_weight, dh.del_flag, dh.create_time, dh.update_time
</sql>
<select id="queryDishVO" resultType="com.zf.foodpurchase.fdsafe.vo.DishVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.DishVO">
select <include refid="Base_Column_List"/>,
s.school_name
from dish dh left join school s on dh.school_id = s.school_id
<where>
dh.del_flag = 0
<if test="dishId != null">
and dh.dish_id = #{dishId}
</if>
<if test="schoolId != null">
and dh.school_id = #{schoolId}
</if>
<if test="schoolName != null and schoolName !=''">
and s.school_name like concat('%',#{schoolName},'%')
</if>
<if test="dishName != null and dishName != ''">
and dh.dish_name like concat('%',#{dishName},'%')
</if>
</where>
order by dh.update_time desc
</select>
</mapper>

View File

@@ -0,0 +1,36 @@
<?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.EduMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
e.edu_id, e.edu_name, e.area_code as area_code_str, e.parent_id, e.create_time, e.update_time, e.del_flag,e.remark
</sql>
<select id="queryEduList" resultType="com.zf.foodpurchase.fdsafe.vo.EduVO">
select
<include refid="Base_Column_List"/>
from edu e
where e.del_flag = '0'
<if test="eduId!=null">
and e.edu_id = #{eduId}
</if>
<if test="eduName != null and eduName != ''">
and e.edu_name like concat('%', #{eduName}, '%')
</if>
<if test="areaCode != null and areaCode != ''">
and e.area_code = #{areaCode}
</if>
<if test="parentId != null and parentId != ''">
and e.parent_id = #{parentId}
</if>
<if test="beginTime != null ">
and e.create_time &gt;= #{beginTime}
</if>
<if test="endTime != null ">
and e.create_time &lt;= #{endTime}
</if>
order by e.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,10 @@
<?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.EduSupplierRelationMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
edu_supplier_id, edu_id, supplier_id, status, create_time, update_time
</sql>
</mapper>

View File

@@ -0,0 +1,39 @@
<?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.FoodBookMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
bk.book_id, bk.school_id, bk.meal_type, bk.dish_ids, bk.book_date, bk.create_time, bk.update_time,bk.del_flag
</sql>
<select id="queryFoodBookVO" resultType="com.zf.foodpurchase.fdsafe.vo.FoodBookVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.FoodBookVO">
select
<include refid="Base_Column_List"/>,
s.school_name
from food_book bk
left join school s on bk.school_id = s.school_id
<where>
<if test="bookId !=null">
and bk.book_id = #{bookId}
</if>
<if test="schoolId != null">
and bk.school_id = #{schoolId}
</if>
<if test="bookDate != null">
and date_format(bk.book_date, '%Y-%m-%d') = date_format(#{bookDate}, '%Y-%m-%d')
</if>
<if test="mealType != null">
and bk.meal_type = #{mealType}
</if>
<if test="schoolName!= null and schoolName != ''">
and s.school_name like concat('%',#{schoolName},'%')
</if>
<if test="delFlag!=null">
and bk.del_flag = #{delFlag}
</if>
</where>
order by bk.book_id desc
</select>
</mapper>

View File

@@ -0,0 +1,39 @@
<?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.FoodMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
fd.food_id, fd.food_name, fd.type_id, fd.unit_id, fd.limit_price, fd.edu_id, fd.del_flag, fd.create_time, fd.update_time
</sql>
<select id="queryFoodVO" resultType="com.zf.foodpurchase.fdsafe.vo.FoodVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.FoodVO">
select <include refid="Base_Column_List"></include>,
ty.type_label,
un.unit_label,
ed.edu_name
from food fd
left join food_type ty on fd.type_id = ty.type_id
left join food_unit un on fd.unit_id = un.unit_id
left join edu ed on ed.edu_id = fd.edu_id
<where>
<if test="foodId != null">
and fd.food_id = #{foodId}
</if>
<if test="foodName != null and foodName != ''">
and fd.food_name like concat('%',#{foodName},'%')
</if>
<if test="typeId != null">
and fd.type_id = #{typeId}
</if>
<if test="eduId!=null">
and fd.edu_id = #{eduId}
</if>
<if test="delFlag!=null">
and fd.del_flag = #{delFlag}
</if>
</where>
order by fd.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,48 @@
<?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.FoodProductMapper">
<!-- 通用查询结果列 -->
<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
</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
<where>
sp.status = 1 and sp.del_flag = 0 and f.del_flag = 0
<if test="foodProductId != null">
and fp.food_product_id = #{foodProductId}
</if>
<if test="foodId != null">
and fp.food_id = #{foodId}
</if>
<if test="typeId !=null">
and ft.type_id = #{typeId}
</if>
<if test="supplierId != null">
and fp.supplier_id = #{supplierId}
</if>
<if test="checkStatus != null">
and fp.check_status = #{checkStatus}
</if>
<if test="foodName !=null and foodName !=''">
and f.food_name like concat('%',#{foodName},'%')
</if>
<if test="delFlag">
and fp.del_flag = #{delFlag}
</if>
</where>
order by fp.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,35 @@
<?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.FoodSampleMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sa.sample_id, sa.book_id, sa.book_date, sa.meal_type, sa.save_person, sa.school_id, sa.save_img as save_img_str, sa.status, sa.remark, sa.create_time, sa.update_time
</sql>
<select id="queryFoodSampleVO" resultType="com.zf.foodpurchase.fdsafe.vo.FoodSampleVO">
select
sa.sample_id, sa.book_id, sa.book_date, sa.meal_type, sa.save_person, sa.school_id, sa.save_img as save_img_str, sa.status,
sa.remark, sa.create_time, sa.update_time
from food_sample sa
left join school sc on sc.school_id = sa.school_id
<where>
<if test="sampleId != null">
and sa.sample_id = #{sampleId}
</if>
<if test="schoolId != null">
and sa.school_id = #{schoolId}
</if>
<if test="schoolName != null and schoolName != ''">
and sc.school_name like concat('%',#{schoolName},'%')
</if>
<if test="beginTime !=null">
AND date_format(sc.create_time,'%Y%m%d') &lt;= date_format(#{beginTime},'%Y%m%d')
</if>
<if test="endTime !=null">
AND date_format(sc.create_time,'%Y%m%d') &gt;= date_format(#{endTime})
</if>
</where>
order by sa.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,28 @@
<?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.FoodTypeMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
type_id, type_label, del_flag, create_time, update_time,status
</sql>
<select id="queryFoodTypeVO" resultType="com.zf.foodpurchase.fdsafe.vo.FoodTypeVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.FoodTypeVO">
select <include refid="Base_Column_List"/>
from food_type
<where>
del_flag = 0
<if test="typeId != null">
and type_id = #{typeId}
</if>
<if test="typeLabel != null">
and type_label like concat('%',#{typeLabel},'%')
</if>
<if test="status != null">
and status = #{status}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,27 @@
<?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.FoodUnitMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
unit_id, unit_label, del_flag, create_time, update_time,status
</sql>
<select id="queryFoodUnitVO" resultType="com.zf.foodpurchase.fdsafe.vo.FoodUnitVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.FoodUnitVO">
select
<include refid="Base_Column_List"/>
from food_unit
<where>
<if test="unitId != null and unitId != ''">
and unit_id = #{unitId}
</if>
<if test="unitLabel != null and unitLabel != ''">
and unit_label like concat('%',#{unitLabel},'%')
</if>
<if test="delFlag != null">
and del_flag = #{delFlag}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,36 @@
<?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.MorningCheckInMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
ch.check_in_id, ch.school_id, ch.check_person, ch.check_result, ch.remark,ch.edu_id, ch.create_time, ch.update_time
</sql>
<select id="queryMorningCheckInVO" resultType="com.zf.foodpurchase.fdsafe.vo.MorningCheckInVO">
select<include refid="Base_Column_List"/>,
s.school_name,
e.edu_name
from morning_check_in ch
left join school s on ch.school_id = s.school_id
left join edu e on ch.edu_id = e.edu_id
<where>
<if test="checkInId != null">
and ch.check_in_id = #{checkInId}
</if>
<if test="schoolId != null">
and ch.school_id = #{schoolId}
</if>
<if test="schoolName != null and schoolName !=''">
and s.school_name like concat('%',#{schoolName},'%')
</if>
<if test="checkResult != null">
and ch.check_result = #{checkResult}
</if>
<if test="eduId != null">
and ch.edu_id = #{eduId}
</if>
</where>
order by ch.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,35 @@
<?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.MorningInspectionContentMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
ins.inspection_id, ins.inspection_content, ins.inspection_standard, ins.remark, ins.edu_id, ins.create_time, ins.update_time, ins.del_flag
</sql>
<select id="queryMorningInspectionContentVO"
resultType="com.zf.foodpurchase.fdsafe.vo.MorningInspectionContentVO">
select
<include refid="Base_Column_List"/>,
edu.edu_name
from morning_inspection_content ins
left join edu edu on ins.edu_id = edu.edu_id
<where>
ins.del_flag = 0
<if test="inspectionId != null">
and ins.inspection_id = #{inspectionId}
</if>
<if test="eduId != null">
and edu.edu_id = #{eduId}
</if>
<if test="inspectionContent != null and inspectionContent != ''">
and ins.inspection_content like concat('%', #{inspectionContent}, '%')
</if>
<if test="eduName != null and eduName != ''">
and edu.edu_name like concat('%', #{eduName}, '%')
</if>
</where>
order by ins.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,27 @@
<?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.MorningInspectionDetailMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
md.morning_detail_id, md.check_in_id, md.person_name, md.person_sex, md.remark, md.abnormal_img as abnormal_img_str, md.create_time, md.update_time
</sql>
<select id="queryMorningInspectionDetailVO"
resultType="com.zf.foodpurchase.fdsafe.vo.MorningInspectionDetailVO">
select <include refid="Base_Column_List"/>
from morning_inspection_detail md
<where>
<if test="morningDetailId != null">
and md.morning_detail_id = #{morningDetailId}
</if>
<if test="checkInId != null">
and md.check_in_id = #{checkInId}
</if>
<if test="personName != null and personName != ''">
and md.person_name like concat('%', #{personName}, '%')
</if>
</where>
order by md.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,15 @@
<?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.MorningResultMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
morning_result_id, content_id, result, create_time, update_time, morning_detail_id
</sql>
<select id="listVOBydetailId" resultType="com.zf.foodpurchase.fdsafe.vo.MorningResultVO">
select <include refid="Base_Column_List"/>
from morning_result
where morning_detail_id = #{morningDetailId}
</select>
</mapper>

View File

@@ -0,0 +1,42 @@
<?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.RubbishDealMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
rb.deal_id, rb.school_id, rb.deal_way, rb.recycle_weight, rb.deal_person, rb.recycle_person, rb.recycle_company, rb.deal_img as deal_img_str, rb.create_time, rb.update_time, rb.deal_time,rb.remark
</sql>
<select id="queryRubbishDealVO" resultType="com.zf.foodpurchase.fdsafe.vo.RubbishDealVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.RubbishDealVO">
select <include refid="Base_Column_List"></include>,
sc.school_name
from rubbish_deal rb
left join school sc on rb.school_id = sc.school_id
<where>
<if test="dealId != null">
and rb.deal_id = #{dealId}
</if>
<if test="schoolId != null">
and rb.school_id = #{schoolId}
</if>
<if test="schoolName != null and schoolName != ''">
and sc.schoolName like concat('%', #{schoolName}, '%')
</if>
<if test="dealPerson != null and dealPerson != ''">
and rb.deal_person = #{dealPerson}
</if>
<if test="dealWay != null and dealWay != ''">
and rb.deal_way = #{dealWay}
</if>
<if test="beginTime != null ">
and date_format(rb.create_time, '%Y-%m-%d') &gt;= date_format(#{beginTime}, '%Y-%m-%d')
</if>
<if test="endTime != null ">
and date_format(rb.create_time, '%Y-%m-%d') &lt;= date_format(#{endTime}, '%Y-%m-%d')
</if>
</where>
order by rb.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,46 @@
<?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.SchoolCartItemMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
ci.cart_item_id, ci.school_id, ci.food_product_id, ci.product_num, ci.supplier_id, ci.item_remark, ci.create_time, ci.update_time
</sql>
<select id="querySchoolCartItemVO" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolCartItemVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.SchoolCartItemVO">
select
<include refid="Base_Column_List"/>,
f.food_name, ft.type_id , ft.type_label , fp.price , fu.unit_id , fu.unit_label , su.supplier_name,
fp.check_status,fp.del_flag,fp.remark,f.del_flag as foodDelFlag
from school_cart_item ci
left join food_product fp on ci.food_product_id = fp.food_product_id
left join food f on fp.food_id = f.food_id
left join food_type ft on f.type_id = ft.type_id
left join food_unit fu on f.unit_id = fu.unit_id
left join supplier su on ci.supplier_id = su.supplier_id
left join school s on ci.school_id = s.school_id
<where>
<if test="cartItemId != null">
and ci.cart_item_id = #{cartItemId}
</if>
<if test="schoolId != null">
and ci.school_id = #{schoolId}
</if>
<if test="foodProductId != null">
and ci.food_product_id = #{foodProductId}
</if>
<if test="foodName != null and foodName !='' ">
and f.food_name like concat('%',#{foodName},'%')
</if>
<if test="supplierId != null">
and ci.supplier_id = #{supplierId}
</if>
<if test="supplierName != null and supplierName !=''">
and su.supplier_name like concat('%',#{supplierName},'%')
</if>
</where>
order by ci.update_time desc
</select>
</mapper>

View File

@@ -0,0 +1,37 @@
<?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.SchoolMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sc.school_id, sc.school_name,sc.student_count, sc.concat_name, sc.concat_phone, sc.school_master, sc.school_type_id, sc.school_nature, sc.area_code as area_code_str, sc.edu_id, sc.address, sc.create_time, sc.update_time, sc.del_flag, sc.remark
</sql>
<select id="querySchoolList" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolVO">
select <include refid="Base_Column_List"></include>,
st.school_type_name, ed.edu_name
from school sc
left join school_type st on sc.school_type_id = st.school_type_id
left join edu ed on sc.edu_id = ed.edu_id
where sc.del_flag = '0'
<if test="schoolId!=null">
and sc.school_id = #{schoolId}
</if>
<if test="schoolName != null and schoolName != ''">
and sc.school_name like concat('%', #{schoolName}, '%')
</if>
<if test="schoolTypeId != null ">
and sc.school_type_id =#{schoolTypeId}
</if>
<if test="schoolNature != null ">
and sc.school_nature =#{schoolNature}
</if>
<if test="eduId != null ">
and sc.edu_id =#{eduId}
</if>
<if test="eduName != null ">
and ed.edu_name like concat('%', #{eduName}, '%')
</if>
order by sc.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,57 @@
<?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.SchoolOrderItemMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
soi.order_item_no, soi.order_no,soi.food_id, soi.school_id, soi.edu_id, soi.supplier_id, soi.food_product_id, soi.food_name, soi.price, soi.product_num, soi.type_id, soi.unit_id, soi.order_item_status, soi.create_time, soi.update_time, soi.order_item_remark,soi.refund_num
</sql>
<select id="querySchoolOrderItemVO" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO">
select<include refid="Base_Column_List"/>,
ft.type_label,fu.unit_label,fp.remark as food_product_remark
from school_order_item soi
left join school_order so on soi.order_no = so.order_no
left join food_product fp on soi.food_product_id = fp.food_product_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
<where>
<if test="orderItemNo != null and orderItemNo != ''">
and soi.order_item_no = #{orderItemNo}
</if>
<if test="orderNo != null and orderNo != ''">
and soi.order_no = #{orderNo}
</if>
<if test="schoolId != null">
and soi.school_id = #{schoolId}
</if>
<if test="eduId != null">
and soi.edu_id = #{eduId}
</if>
<if test="supplierId != null">
and soi.supplier_id = #{supplierId}
</if>
<if test="foodProductId != null">
and soi.food_product_id = #{foodProductId}
</if>
<if test="foodName != null and foodName != ''">
and f.food_name like concat('%',#{foodName},'%')
</if>
<if test="foodId">
and soi.food_id = #{foodId}
</if>
<if test="orderItemStatus != null">
and soi.order_item_status = #{orderItemStatus}
</if>
<if test="beginTime != null">
AND date_format(soi.create_time,'%Y%m%d') &gt;= date_format(#{beginTime},'%Y%m%d')
</if>
<if test="endTime != null">
and date_format(soi.create_time,'%Y%m%d') &lt;=date_format(#{endTime},'%Y%m%d')
</if>
</where>
order by soi.order_item_no desc
</select>
</mapper>

View File

@@ -0,0 +1,46 @@
<?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.SchoolOrderMapper">
<!-- 通用查询结果列 -->
<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
</sql>
<select id="querySchoolOrderVO" 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') &gt;= date_format(#{beginTime},'%Y%m%d')
</if>
<if test="endTime != null">
and date_format(so.create_time,'%Y%m%d') &lt;=date_format(#{endTime},'%Y%m%d')
</if>
<if test = 'orderSettleStatus !=null'>
and so.order_settle_status = #{orderSettleStatus}
</if>
</where>
order by so.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,17 @@
<?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.SchoolRefundItemMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sri.refund_item_no, sri.food_id, sri.food_name, sri.price, sri.refund_num, sri.unit_id, sri.refund_money, sri.refund_image, sri.create_time, sri.update_time, sri.refund_status, sri.refund_no, sri.order_item_no, sri.refund_item_remark
</sql>
<select id="queryRefundItem" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolRefundItemVO">
select <include refid="Base_Column_List"/>,
fu.unit_label
from school_refund_item sri
left join food_unit fu on fu.unit_id = sri.unit_id
where sri.refund_no = #{refundNo}
</select>
</mapper>

View File

@@ -0,0 +1,55 @@
<?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.SchoolRefundMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sr
.
refund_no
, sr.delivery_no, sr.order_no, sr.total_refund_money, sr.supplier_id, sr.school_id, sr.edu_id, sr.refund_reason, sr.create_time, sr.check_time, sr.update_time, sr.refund_status, sr.check_remark
</sql>
<select id="querySchoolRefund" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolRefundVO">
select
<include refid="Base_Column_List"/>,
s.school_name,
e.edu_name,
su.supplier_name
from school_refund sr
left join school s on sr.school_id = s.school_id
left join edu e on sr.edu_id = e.edu_id
left join supplier su on sr.supplier_id = su.supplier_id
<where>
<if test="refundNo != null and refundNo != ''">
and sr.refund_no = #{refundNo}
</if>
<if test="orderNo != null and orderNo != ''">
and sr.order_no = #{orderNo}
</if>
<if test="deliveryNo != null and deliveryNo != ''">
and sr.delivery_no = #{deliveryNo}
</if>
<if test="eduId != null">
and sr.edu_id = #{eduId}
</if>
<if test="schoolId != null">
and sr.school_id = #{schoolId}
</if>
<if test="supplierId != null">
and sr.supplier_id = #{supplierId}
</if>
<if test="refundStatus != null">
and sr.refund_status = #{refundStatus}
</if>
<if test="beginTime != null">
AND date_format(sr.create_time,'%Y%m%d') &gt;= date_format(#{beginTime},'%Y%m%d')
</if>
<if test="endTime != null">
and date_format(sr.create_time,'%Y%m%d') &lt;=date_format(#{endTime},'%Y%m%d')
</if>
</where>
order by sr.refund_no desc
</select>
</mapper>

View File

@@ -0,0 +1,42 @@
<?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.SchoolSettleMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
ss.settle_no, ss.edu_id, ss.school_id, ss.supplier_id, ss.create_time, ss.update_time, ss.settle_status, ss.settle_total_money, ss.del_flag, ss.settle_remark
</sql>
<select id="qeurySettleVO" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolSettleVO">
select <include refid="Base_Column_List"/>,
s.school_name, e.edu_name, su.supplier_name
from school_settle ss
left join school s on ss.school_id = s.school_id
left join edu e on ss.edu_id = e.edu_id
left join supplier su on ss.supplier_id = su.supplier_id
<where>
<if test="settleNo != null and settleNo != ''">
and ss.settle_no = #{settleNo}
</if>
<if test="eduId != null">
and ss.edu_id = #{eduId}
</if>
<if test="schoolId != null">
and ss.school_id = #{schoolId}
</if>
<if test="supplierId != null">
and ss.supplier_id = #{supplierId}
</if>
<if test="settleStatus != null">
and ss.settle_status = #{settleStatus}
</if>
<if test="beginTime != null">
AND date_format(ss.create_time,'%Y%m%d') &gt;= date_format(#{beginTime},'%Y%m%d')
</if>
<if test="endTime != null">
and date_format(ss.create_time,'%Y%m%d') &lt;=date_format(#{endTime},'%Y%m%d')
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,10 @@
<?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.SchoolSettleOrderRelationMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
settle_order_relation_id, settle_no, order_no, settle_status, create_time, update_time
</sql>
</mapper>

View File

@@ -0,0 +1,36 @@
<?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.SchoolStaffMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sa.staff_id, sa.staff_name, sa.sex, sa.health_cert_no, sa.cert_expire_date, sa.staff_type, sa.staff_phone, sa.school_id, sa.catten_id, sa.health_cert_img as health_cert_img_str, sa.remark, sa.create_time, sa.update_time, sa.del_flag,sa.cert_expire
</sql>
<select id="querySchoolStaffVO" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolStaffVO">
select
<include refid="Base_Column_List"/>,
s.school_name, c.catten_name
from school_staff sa
left join school s on sa.school_id = s.school_id
left join catten c on sa.catten_id = c.catten_id
<where>
sa.del_flag = 0
<if test="schoolId != null">
and sa.school_id = #{schoolId}
</if>
<if test="staffType != null ">
and sa.staff_type = #{staffType}
</if>
<if test="staffName != null and staffName != ''">
and sa.staff_name like concat('%',#{staffName},'%')
</if>
<if test="schoolName != null and schoolName != ''">
and s.school_name like concat('%',#{schoolName},'%')
</if>
</where>
order by sa.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,31 @@
<?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.SchoolTypeMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
st.school_type_id, st.school_type_name, st.create_time, st.update_time, st.del_flag
</sql>
<select id="querySchoolTypeVO" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolTypeVO">
select <include refid="Base_Column_List"></include>
from school_type st
<where>
st.del_flag = 0
<if test="schoolTypeId != null">
and st.school_type_id = #{schoolTypeId}
</if>
<if test="schoolTypeName != null and schoolTypeName != ''">
and st.school_type_name like concat('%',#{schoolTypeName},'%')
</if>
<if test="beginTime != null">
and st.create_time &gt;= #{beginTime}
</if>
<if test="endTime != null">
and st.create_time &lt;= #{endTime}
</if>
</where>
order by st.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,33 @@
<?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.SelfInspectionContentMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sf.self_inspection_id, sf.self_inspection_content, sf.self_inspection_standard, sf.remark, sf.edu_id, sf.create_time, sf.update_time, sf.del_flag
</sql>
<select id="querySelfInspectionContentVO"
resultType="com.zf.foodpurchase.fdsafe.vo.SelfInspectionContentVO">
select
<include refid="Base_Column_List"/>,
e.edu_name
from self_inspection_content sf
left join edu e on e.edu_id = sf.edu_id
<where>
sf.del_flag=0
<if test="selfInspectionId != null and selfInspectionId != ''">
and sf.self_inspection_id = #{selfInspectionId}
</if>
<if test="selfInspectionContent != null and selfInspectionContent != ''">
and sf.self_inspection_content like concat('%', #{selfInspectionContent}, '%')
</if>
<if test="eduId !=null">
and sf.edu_id = #{eduId}
</if>
<if test="eduName != null and eduName !=''">
and e.edu_name like concat('%', #{selfInspectionContent}, '%')
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,19 @@
<?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.SelfInspectionDetailMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sd.self_detail_id, sd.self_record_id, sd.self_content_id, sd.result, sd.remark, sd.abnormal_img as abnormal_img_str, sd.create_time, sd.update_time
</sql>
<select id="getDetail" resultType="com.zf.foodpurchase.fdsafe.vo.SelfInspectionDetailVO"
parameterType="java.lang.Long">
select<include refid="Base_Column_List"/>,
sic.self_inspection_content,
sic.self_inspection_standard
from self_inspection_detail sd
LEFT JOIN self_inspection_content sic ON sic.self_inspection_id = sd.self_content_id
where sd.self_record_id = #{selfRecordId}
</select>
</mapper>

View File

@@ -0,0 +1,39 @@
<?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.SelfInspectionRecordMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sl.self_record_id, sl.school_id, sl.check_person, sl.check_result, sl.edu_id, sl.create_time, sl.update_time
</sql>
<select id="querySelfInspectionRecordVO" resultType="com.zf.foodpurchase.fdsafe.vo.SelfInspectionRecordVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.SelfInspectionRecordVO">
select <include refid="Base_Column_List"/>,
s.school_name, e.edu_name
from self_inspection_record sl
left join school s on sl.school_id = s.school_id
left join edu e on sl.edu_id = e.edu_id
<where>
<if test="selfRecordId !=null">
and sl.self_record_id = #{selfRecordId}
</if>
<if test="schoolId != null and schoolId != ''">
and sl.school_id = #{schoolId}
</if>
<if test="eduId != null and eduId != ''">
and sl.edu_id = #{eduId}
</if>
<if test="checkResult != null and checkResult != ''">
and sl.check_result = #{checkResult}
</if>
<if test="checkPerson != null and checkPerson != ''">
and sl.check_person like concat('%',#{checkPerson},'%')
</if>
<if test="schoolName != null and schoolName != ''">
and sl.school_name like concat('%',#{schoolName},'%')
</if>
</where>
order by sl.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,48 @@
<?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.SupplierDeliveryItemMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
dei.delivery_item_no, dei.delivery_no, dei.order_no, dei.order_item_no, dei.product_time, dei.expire_time, dei.in_image, dei.check_report_image, dei.create_time, dei.update_time, dei.delivery_item_remark
</sql>
<select id="querySupplierDeliveryItemVO" resultType="com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryItemVO">
select
<include refid="Base_Column_List"/>,
soe.product_num, soe.price, soe.unit_id, fu.unit_label,
soe.edu_id, soe.school_id, soe.supplier_id,
e.edu_name, s.school_name, su.supplier_name, so.total_money, so.refund_money
from supplier_delivery_item dei
left join school_order_item soe on soe.order_item_no = dei.order_item_no
left join edu e on e.edu_id = soe.edu_id
left join school s on s.school_id = soe.school_id
left join supplier su on su.supplier_id = soe.supplier_id
left join school_order so on so.order_no = dei.order_no
left join food_unit fu on fu.unit_id = soe.unit_id
<where>
<if test="deliveryItemNo != null and deliveryItemNo != ''">
and dei.delivery_item_no = #{deliveryItemNo}
</if>
<if test="deliveryNo != null and deliveryNo != ''">
and dei.delivery_no = #{deliveryNo}
</if>
<if test="orderNo != null and orderNo != ''">
and dei.order_no = #{orderNo}
</if>
<if test="orderItemNo != null and orderItemNo != ''">
and dei.order_item_no = #{orderItemNo}
</if>
<if test="eduId != null">
and soe.edu_id = #{eduId}
</if>
<if test="schoolId != null">
and soe.school_id = #{schoolId}
</if>
<if test="supplierId != null">
and soe.supplier_id = #{supplierId}
</if>
</where>
order by dei.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,51 @@
<?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.SupplierDeliveryMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
de.delivery_no, de.order_no, de.school_id, de.edu_id, de.supplier_id, de.delivery_person, de.delivery_phone, de.delivery_car, de.delivery_status, de.create_time, de.update_time, de.receiver, de.sign_image as sign_image_str, de.delivery_remark
</sql>
<select id="querySupplierDeliveryVO" resultType="com.zf.foodpurchase.fdsafe.vo.SupplierDeliveryVO">
select
<include refid="Base_Column_List"></include>,
s.school_name,
e.edu_name,
su.supplier_name,
so.total_money,
so.refund_money
from supplier_delivery de
left join edu e on e.edu_id = de.edu_id
left join school s on s.school_id = de.school_id
left join supplier su on su.supplier_id = de.supplier_id
left join school_order so on so.order_no = de.order_no
<where>
<if test="deliveryNo != null and deliveryNo != ''">
and de.delivery_no = #{deliveryNo}
</if>
<if test="orderNo != null and orderNo != ''">
and de.order_no = #{orderNo}
</if>
<if test="schoolId != null">
and de.school_id = #{schoolId}
</if>
<if test="eduId != null">
and de.edu_id = #{eduId}
</if>
<if test="supplierId != null">
and de.supplier_id = #{supplierId}
</if>
<if test="deliveryStatus!=null">
and de.delivery_status = #{deliveryStatus}
</if>
<if test="beginTime != null">
AND date_format(de.create_time,'%Y%m%d') &gt;= date_format(#{beginTime},'%Y%m%d')
</if>
<if test="endTime != null">
and date_format(de.create_time,'%Y%m%d') &lt;=date_format(#{endTime},'%Y%m%d')
</if>
</where>
order by de.create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,44 @@
<?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.SupplierMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
sp.supplier_id, sp.supplier_name, sp.area_code as area_code_str, sp.address, sp.uscc, sp.concat_name, sp.concat_phone, sp.license_img as license_img_str, sp.food_license_img as food_license_img_str, sp.create_time, sp.update_time, sp.del_flag, sp.remark, sp.edu_id,sp.status
</sql>
<select id="querySupplierVO" resultType="com.zf.foodpurchase.fdsafe.vo.SupplierVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.SupplierVO">
select
<include refid="Base_Column_List"/>,
ar.name as area_name,
ed.edu_name
from supplier sp
left join area ar on sp.area_code = ar.area_code
left join edu ed on sp.edu_id = ed.edu_id
<where>
sp.del_flag = 0
<if test="supplierId != null">
and sp.supplier_id = #{supplierId}
</if>
<if test="supplierName != null and supplierName != ''">
and sp.supplier_name like concat('%',#{supplierName},'%')
</if>
<if test="concatName != null and concatName != ''">
and sp.concat_name like concat('%',#{concatName})
</if>
<if test="uscc !=null and uscc!=''">
and sp.uscc= #{uscc}
</if>
<if test="eduId !=null">
and sp.edu_id = #{eduId}
</if>
<if test="eduName != null and eduName !=''">
and ed.edu_name like concat('%',#{eduName},'%')
</if>
<if test="status!=null">
and sp.status = #{status}
</if>
</where>
</select>
</mapper>

View 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.WxAppUserMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
wa.id, wa.phone,wa.real_name, wa.password, wa.nickname, wa.avatar_url, wa.gender, wa.del_flag, wa.status, wa.create_time, wa.update_time, wa.login_time, wa.login_ip, wa.account_type, wa.dept_id
</sql>
<select id="queryWxAppUserViewVO" resultType="com.zf.foodpurchase.fdsafe.vo.WxAppUserViewVO">
select<include refid="Base_Column_List"/>,
(
CASE
WHEN wa.account_type = 1 THEN ( SELECT school_name FROM school WHERE school_id = wa.dept_id )
WHEN wa.account_type = 2 THEN ( SELECT supplier_name FROM supplier WHERE supplier_id = wa.dept_id )
WHEN wa.account_type = 3 THEN ( SELECT edu_name FROM edu WHERE edu_id = wa.dept_id )
ELSE NULL
END
) AS dept_name
from wx_app_user wa
<where>
wa.del_flag=0
<if test="id !=null">
and wa.id=#{id}
</if>
<if test="phone !=null and phone != ''">
and wa.phone=#{phone}
</if>
<if test="accountType != null">
and wa.account_type = #{accountType}
</if>
<if test="deptId != null">
and wa.dept_id = #{deptId}
</if>
</where>
order by wa.id desc
</select>
</mapper>

View File

@@ -0,0 +1,117 @@
<?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.system.mapper.SysConfigMapper">
<resultMap type="SysConfig" id="SysConfigResult">
<id property="configId" column="config_id" />
<result property="configName" column="config_name" />
<result property="configKey" column="config_key" />
<result property="configValue" column="config_value" />
<result property="configType" column="config_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectConfigVo">
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
from sys_config
</sql>
<!-- 查询条件 -->
<sql id="sqlwhereSearch">
<where>
<if test="configId !=null">
and config_id = #{configId}
</if>
<if test="configKey !=null and configKey != ''">
and config_key = #{configKey}
</if>
</where>
</sql>
<select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/>
</select>
<select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<where>
<if test="configName != null and configName != ''">
AND config_name like concat('%', #{configName}, '%')
</if>
<if test="configType != null and configType != ''">
AND config_type = #{configType}
</if>
<if test="configKey != null and configKey != ''">
AND config_key like concat('%', #{configKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
</select>
<select id="selectConfigById" parameterType="Long" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_id = #{configId}
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_key = #{configKey} limit 1
</select>
<insert id="insertConfig" parameterType="SysConfig">
insert into sys_config (
<if test="configName != null and configName != '' ">config_name,</if>
<if test="configKey != null and configKey != '' ">config_key,</if>
<if test="configValue != null and configValue != '' ">config_value,</if>
<if test="configType != null and configType != '' ">config_type,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="configName != null and configName != ''">#{configName},</if>
<if test="configKey != null and configKey != ''">#{configKey},</if>
<if test="configValue != null and configValue != ''">#{configValue},</if>
<if test="configType != null and configType != ''">#{configType},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateConfig" parameterType="SysConfig">
update sys_config
<set>
<if test="configName != null and configName != ''">config_name = #{configName},</if>
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
<if test="configType != null and configType != ''">config_type = #{configType},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where config_id = #{configId}
</update>
<delete id="deleteConfigById" parameterType="Long">
delete from sys_config where config_id = #{configId}
</delete>
<delete id="deleteConfigByIds" parameterType="Long">
delete from sys_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")">
#{configId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,124 @@
<?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.system.mapper.SysDictDataMapper">
<resultMap type="SysDictData" id="SysDictDataResult">
<id property="dictCode" column="dict_code" />
<result property="dictSort" column="dict_sort" />
<result property="dictLabel" column="dict_label" />
<result property="dictValue" column="dict_value" />
<result property="dictType" column="dict_type" />
<result property="cssClass" column="css_class" />
<result property="listClass" column="list_class" />
<result property="isDefault" column="is_default" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDictDataVo">
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
from sys_dict_data
</sql>
<select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
<where>
<if test="dictType != null and dictType != ''">
AND dict_type = #{dictType}
</if>
<if test="dictLabel != null and dictLabel != ''">
AND dict_label like concat('%', #{dictLabel}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
order by dict_sort asc
</select>
<select id="selectDictDataByType" parameterType="String" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where status = '0' and dict_type = #{dictType} order by dict_sort asc
</select>
<select id="selectDictLabel" resultType="String">
select dict_label from sys_dict_data
where dict_type = #{dictType} and dict_value = #{dictValue}
</select>
<select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where dict_code = #{dictCode}
</select>
<select id="countDictDataByType" resultType="Integer">
select count(1) from sys_dict_data where dict_type=#{dictType}
</select>
<delete id="deleteDictDataById" parameterType="Long">
delete from sys_dict_data where dict_code = #{dictCode}
</delete>
<delete id="deleteDictDataByIds" parameterType="Long">
delete from sys_dict_data where dict_code in
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
#{dictCode}
</foreach>
</delete>
<update id="updateDictData" parameterType="SysDictData">
update sys_dict_data
<set>
<if test="dictSort != null">dict_sort = #{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="cssClass != null">css_class = #{cssClass},</if>
<if test="listClass != null">list_class = #{listClass},</if>
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dict_code = #{dictCode}
</update>
<update id="updateDictDataType" parameterType="String">
update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
</update>
<insert id="insertDictData" parameterType="SysDictData">
insert into sys_dict_data(
<if test="dictSort != null">dict_sort,</if>
<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
<if test="dictValue != null and dictValue != ''">dict_value,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="cssClass != null and cssClass != ''">css_class,</if>
<if test="listClass != null and listClass != ''">list_class,</if>
<if test="isDefault != null and isDefault != ''">is_default,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="dictSort != null">#{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
<if test="listClass != null and listClass != ''">#{listClass},</if>
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>

View File

@@ -0,0 +1,105 @@
<?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.system.mapper.SysDictTypeMapper">
<resultMap type="SysDictType" id="SysDictTypeResult">
<id property="dictId" column="dict_id" />
<result property="dictName" column="dict_name" />
<result property="dictType" column="dict_type" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDictTypeVo">
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
from sys_dict_type
</sql>
<select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
<where>
<if test="dictName != null and dictName != ''">
AND dict_name like concat('%', #{dictName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="dictType != null and dictType != ''">
AND dict_type like concat('%', #{dictType}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
</select>
<select id="selectDictTypeAll" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
</select>
<select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_id = #{dictId}
</select>
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType}
</select>
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType} limit 1
</select>
<delete id="deleteDictTypeById" parameterType="Long">
delete from sys_dict_type where dict_id = #{dictId}
</delete>
<delete id="deleteDictTypeByIds" parameterType="Long">
delete from sys_dict_type where dict_id in
<foreach collection="array" item="dictId" open="(" separator="," close=")">
#{dictId}
</foreach>
</delete>
<update id="updateDictType" parameterType="SysDictType">
update sys_dict_type
<set>
<if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dict_id = #{dictId}
</update>
<insert id="insertDictType" parameterType="SysDictType">
insert into sys_dict_type(
<if test="dictName != null and dictName != ''">dict_name,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="dictName != null and dictName != ''">#{dictName},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>

View File

@@ -0,0 +1,57 @@
<?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.system.mapper.SysLogininforMapper">
<resultMap type="SysLogininfor" id="SysLogininforResult">
<id property="infoId" column="info_id" />
<result property="userName" column="user_name" />
<result property="status" column="status" />
<result property="ipaddr" column="ipaddr" />
<result property="loginLocation" column="login_location" />
<result property="browser" column="browser" />
<result property="os" column="os" />
<result property="msg" column="msg" />
<result property="loginTime" column="login_time" />
</resultMap>
<insert id="insertLogininfor" parameterType="SysLogininfor">
insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time)
values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate())
</insert>
<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">
select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time from sys_logininfor
<where>
<if test="ipaddr != null and ipaddr != ''">
AND ipaddr like concat('%', #{ipaddr}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="userName != null and userName != ''">
AND user_name like concat('%', #{userName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND login_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND login_time &lt;= #{params.endTime}
</if>
</where>
order by info_id desc
</select>
<delete id="deleteLogininforByIds" parameterType="Long">
delete from sys_logininfor where info_id in
<foreach collection="array" item="infoId" open="(" separator="," close=")">
#{infoId}
</foreach>
</delete>
<update id="cleanLogininfor">
truncate table sys_logininfor
</update>
</mapper>

View File

@@ -0,0 +1,206 @@
<?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.system.mapper.SysMenuMapper">
<resultMap type="SysMenu" id="SysMenuResult">
<id property="menuId" column="menu_id" />
<result property="menuName" column="menu_name" />
<result property="parentName" column="parent_name" />
<result property="parentId" column="parent_id" />
<result property="orderNum" column="order_num" />
<result property="path" column="path" />
<result property="component" column="component" />
<result property="query" column="query" />
<result property="routeName" column="route_name" />
<result property="isFrame" column="is_frame" />
<result property="isCache" column="is_cache" />
<result property="menuType" column="menu_type" />
<result property="visible" column="visible" />
<result property="status" column="status" />
<result property="perms" column="perms" />
<result property="icon" column="icon" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectMenuVo">
select menu_id, menu_name, parent_id, order_num, path, component, `query`, route_name, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
from sys_menu
</sql>
<select id="selectMenuList" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
<where>
<if test="menuName != null and menuName != ''">
AND menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND visible = #{visible}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
order by parent_id, order_num
</select>
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id
where ur.user_id = #{params.userId}
<if test="menuName != null and menuName != ''">
AND m.menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND m.visible = #{visible}
</if>
<if test="status != null and status != ''">
AND m.status = #{status}
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id
left join sys_user u on ur.user_id = u.user_id
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByRoleId" resultType="Long">
select m.menu_id
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
where rm.role_id = #{roleId}
<if test="menuCheckStrictly">
and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId})
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuPerms" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
</select>
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role r on r.role_id = ur.role_id
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
</select>
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
where m.status = '0' and rm.role_id = #{roleId}
</select>
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_id = #{menuId}
</select>
<select id="hasChildByMenuId" resultType="Integer">
select count(1) from sys_menu where parent_id = #{menuId}
</select>
<select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_name=#{menuName} and parent_id = #{parentId} limit 1
</select>
<update id="updateMenu" parameterType="SysMenu">
update sys_menu
<set>
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="path != null and path != ''">path = #{path},</if>
<if test="component != null">component = #{component},</if>
<if test="query != null">`query` = #{query},</if>
<if test="routeName != null">route_name = #{routeName},</if>
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
<if test="visible != null">visible = #{visible},</if>
<if test="status != null">status = #{status},</if>
<if test="perms !=null">perms = #{perms},</if>
<if test="icon !=null and icon != ''">icon = #{icon},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where menu_id = #{menuId}
</update>
<insert id="insertMenu" parameterType="SysMenu">
insert into sys_menu(
<if test="menuId != null and menuId != 0">menu_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="menuName != null and menuName != ''">menu_name,</if>
<if test="orderNum != null">order_num,</if>
<if test="path != null and path != ''">path,</if>
<if test="component != null and component != ''">component,</if>
<if test="query != null and query != ''">`query`,</if>
<if test="routeName != null">route_name,</if>
<if test="isFrame != null and isFrame != ''">is_frame,</if>
<if test="isCache != null and isCache != ''">is_cache,</if>
<if test="menuType != null and menuType != ''">menu_type,</if>
<if test="visible != null">visible,</if>
<if test="status != null">status,</if>
<if test="perms !=null and perms != ''">perms,</if>
<if test="icon != null and icon != ''">icon,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="menuId != null and menuId != 0">#{menuId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="menuName != null and menuName != ''">#{menuName},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="path != null and path != ''">#{path},</if>
<if test="component != null and component != ''">#{component},</if>
<if test="query != null and query != ''">#{query},</if>
<if test="routeName != null">#{routeName},</if>
<if test="isFrame != null and isFrame != ''">#{isFrame},</if>
<if test="isCache != null and isCache != ''">#{isCache},</if>
<if test="menuType != null and menuType != ''">#{menuType},</if>
<if test="visible != null">#{visible},</if>
<if test="status != null">#{status},</if>
<if test="perms !=null and perms != ''">#{perms},</if>
<if test="icon != null and icon != ''">#{icon},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<delete id="deleteMenuById" parameterType="Long">
delete from sys_menu where menu_id = #{menuId}
</delete>
</mapper>

View File

@@ -0,0 +1,89 @@
<?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.system.mapper.SysNoticeMapper">
<resultMap type="SysNotice" id="SysNoticeResult">
<result property="noticeId" column="notice_id" />
<result property="noticeTitle" column="notice_title" />
<result property="noticeType" column="notice_type" />
<result property="noticeContent" column="notice_content" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectNoticeVo">
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
from sys_notice
</sql>
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
where notice_id = #{noticeId}
</select>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
</if>
</where>
</select>
<insert id="insertNotice" parameterType="SysNotice">
insert into sys_notice (
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
<if test="status != null and status != '' ">status, </if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
<if test="status != null and status != ''">#{status}, </if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateNotice" parameterType="SysNotice">
update sys_notice
<set>
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>
<if test="status != null and status != ''">status = #{status}, </if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where notice_id = #{noticeId}
</update>
<delete id="deleteNoticeById" parameterType="Long">
delete from sys_notice where notice_id = #{noticeId}
</delete>
<delete id="deleteNoticeByIds" parameterType="Long">
delete from sys_notice where notice_id in
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
#{noticeId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,87 @@
<?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.system.mapper.SysOperLogMapper">
<resultMap type="SysOperLog" id="SysOperLogResult">
<id property="operId" column="oper_id" />
<result property="title" column="title" />
<result property="businessType" column="business_type" />
<result property="method" column="method" />
<result property="requestMethod" column="request_method" />
<result property="operatorType" column="operator_type" />
<result property="operName" column="oper_name" />
<result property="deptName" column="dept_name" />
<result property="operUrl" column="oper_url" />
<result property="operIp" column="oper_ip" />
<result property="operLocation" column="oper_location" />
<result property="operParam" column="oper_param" />
<result property="jsonResult" column="json_result" />
<result property="status" column="status" />
<result property="errorMsg" column="error_msg" />
<result property="operTime" column="oper_time" />
<result property="costTime" column="cost_time" />
</resultMap>
<sql id="selectOperLogVo">
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, cost_time
from sys_oper_log
</sql>
<insert id="insertOperlog" parameterType="SysOperLog">
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time, oper_time)
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
</insert>
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/>
<where>
<if test="operIp != null and operIp != ''">
AND oper_ip like concat('%', #{operIp}, '%')
</if>
<if test="title != null and title != ''">
AND title like concat('%', #{title}, '%')
</if>
<if test="businessType != null">
AND business_type = #{businessType}
</if>
<if test="businessTypes != null and businessTypes.length > 0">
AND business_type in
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
#{businessType}
</foreach>
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND oper_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND oper_time &lt;= #{params.endTime}
</if>
</where>
order by oper_id desc
</select>
<delete id="deleteOperLogByIds" parameterType="Long">
delete from sys_oper_log where oper_id in
<foreach collection="array" item="operId" open="(" separator="," close=")">
#{operId}
</foreach>
</delete>
<select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/>
where oper_id = #{operId}
</select>
<update id="cleanOperLog">
truncate table sys_oper_log
</update>
</mapper>

View File

@@ -0,0 +1,122 @@
<?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.system.mapper.SysPostMapper">
<resultMap type="SysPost" id="SysPostResult">
<id property="postId" column="post_id" />
<result property="postCode" column="post_code" />
<result property="postName" column="post_name" />
<result property="postSort" column="post_sort" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectPostVo">
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
from sys_post
</sql>
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/>
<where>
<if test="postCode != null and postCode != ''">
AND post_code like concat('%', #{postCode}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="postName != null and postName != ''">
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
</select>
<select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/>
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
select p.post_id
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId}
</select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_name = #{userName}
</select>
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_name=#{postName} limit 1
</select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_code=#{postCode} limit 1
</select>
<update id="updatePost" parameterType="SysPost">
update sys_post
<set>
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
<if test="postName != null and postName != ''">post_name = #{postName},</if>
<if test="postSort != null">post_sort = #{postSort},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where post_id = #{postId}
</update>
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if>
<if test="postCode != null and postCode != ''">post_code,</if>
<if test="postName != null and postName != ''">post_name,</if>
<if test="postSort != null">post_sort,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="postId != null and postId != 0">#{postId},</if>
<if test="postCode != null and postCode != ''">#{postCode},</if>
<if test="postName != null and postName != ''">#{postName},</if>
<if test="postSort != null">#{postSort},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId}
</delete>
<delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,34 @@
<?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.system.mapper.SysRoleDeptMapper">
<resultMap type="SysRoleDept" id="SysRoleDeptResult">
<result property="roleId" column="role_id" />
<result property="deptId" column="dept_id" />
</resultMap>
<delete id="deleteRoleDeptByRoleId" parameterType="Long">
delete from sys_role_dept where role_id=#{roleId}
</delete>
<select id="selectCountRoleDeptByDeptId" resultType="Integer">
select count(1) from sys_role_dept where dept_id=#{deptId}
</select>
<delete id="deleteRoleDept" parameterType="Long">
delete from sys_role_dept where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<insert id="batchRoleDept">
insert into sys_role_dept(role_id, dept_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.deptId})
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,152 @@
<?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.system.mapper.SysRoleMapper">
<resultMap type="SysRole" id="SysRoleResult">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="menuCheckStrictly" column="menu_check_strictly" />
<result property="deptCheckStrictly" column="dept_check_strictly" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
</sql>
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.del_flag = '0'
<if test="roleId != null and roleId != 0">
AND r.role_id = #{roleId}
</if>
<if test="roleName != null and roleName != ''">
AND r.role_name like concat('%', #{roleName}, '%')
</if>
<if test="status != null and status != ''">
AND r.status = #{status}
</if>
<if test="roleKey != null and roleKey != ''">
AND r.role_key like concat('%', #{roleKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(r.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(r.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by r.role_sort
</select>
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and ur.user_id = #{userId}
</select>
<select id="selectRoleAll" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
</select>
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
select r.role_id
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
where u.user_id = #{userId}
</select>
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_id = #{roleId}
</select>
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and u.user_name = #{userName}
</select>
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
</select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
insert into sys_role(
<if test="roleId != null and roleId != 0">role_id,</if>
<if test="roleName != null and roleName != ''">role_name,</if>
<if test="roleKey != null and roleKey != ''">role_key,</if>
<if test="roleSort != null">role_sort,</if>
<if test="dataScope != null and dataScope != ''">data_scope,</if>
<if test="menuCheckStrictly != null">menu_check_strictly,</if>
<if test="deptCheckStrictly != null">dept_check_strictly,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="roleId != null and roleId != 0">#{roleId},</if>
<if test="roleName != null and roleName != ''">#{roleName},</if>
<if test="roleKey != null and roleKey != ''">#{roleKey},</if>
<if test="roleSort != null">#{roleSort},</if>
<if test="dataScope != null and dataScope != ''">#{dataScope},</if>
<if test="menuCheckStrictly != null">#{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">#{deptCheckStrictly},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateRole" parameterType="SysRole">
update sys_role
<set>
<if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
<if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if>
<if test="roleSort != null">role_sort = #{roleSort},</if>
<if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
<if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where role_id = #{roleId}
</update>
<delete id="deleteRoleById" parameterType="Long">
update sys_role set del_flag = '2' where role_id = #{roleId}
</delete>
<delete id="deleteRoleByIds" parameterType="Long">
update sys_role set del_flag = '2' where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,34 @@
<?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.system.mapper.SysRoleMenuMapper">
<resultMap type="SysRoleMenu" id="SysRoleMenuResult">
<result property="roleId" column="role_id" />
<result property="menuId" column="menu_id" />
</resultMap>
<select id="checkMenuExistRole" resultType="Integer">
select count(1) from sys_role_menu where menu_id = #{menuId}
</select>
<delete id="deleteRoleMenuByRoleId" parameterType="Long">
delete from sys_role_menu where role_id=#{roleId}
</delete>
<delete id="deleteRoleMenu" parameterType="Long">
delete from sys_role_menu where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<insert id="batchRoleMenu">
insert into sys_role_menu(role_id, menu_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.menuId})
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,229 @@
<?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.system.mapper.SysUserMapper">
<resultMap type="SysUser" id="SysUserResult">
<id property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="password" column="password" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="accountType" column="account_type" />
<result property="accountDeptId" column="account_dept_id" />
<association property="dept" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
<resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="deptName" column="dept_name" />
<result property="ancestors" column="ancestors" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
</resultMap>
<resultMap id="RoleResult" type="SysRole">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="status" column="role_status" />
</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,
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
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, 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,d.dept_name, d.leader from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}
</if>
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(u.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
<if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time, u.account_type,u.account_dept_id
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
where u.del_flag = '0' and r.role_id = #{roleId}
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time, u.account_type,u.account_dept_id
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and ur.role_id = #{roleId})
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_name = #{userName} and u.del_flag = '0'
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_id = #{userId}
</select>
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1
</select>
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
</select>
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="password != null and password != ''">password,</if>
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="accountType != null ">account_type,</if>
<if test="accountDeptId != null ">account_dept_id,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="accountType != null ">#{accountType},</if>
<if test="accountDeptId != null ">#{accountDeptId},</if>
sysdate()
)
</insert>
<update id="updateUser" parameterType="SysUser">
update sys_user
<set>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="accountType != null ">account_type=#{accountType},</if>
<if test="accountDeptId != null ">account_dept_id=#{accountDeptId},</if>
update_time = sysdate()
</set>
where user_id = #{userId}
</update>
<update id="updateUserStatus" parameterType="SysUser">
update sys_user set status = #{status} where user_id = #{userId}
</update>
<update id="updateUserAvatar" parameterType="SysUser">
update sys_user set avatar = #{avatar} where user_name = #{userName}
</update>
<update id="resetUserPwd" parameterType="SysUser">
update sys_user set password = #{password} where user_name = #{userName}
</update>
<delete id="deleteUserById" parameterType="Long">
update sys_user set del_flag = '2' where user_id = #{userId}
</delete>
<delete id="deleteUserByIds" parameterType="Long">
update sys_user set del_flag = '2' where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,34 @@
<?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.system.mapper.SysUserPostMapper">
<resultMap type="SysUserPost" id="SysUserPostResult">
<result property="userId" column="user_id" />
<result property="postId" column="post_id" />
</resultMap>
<delete id="deleteUserPostByUserId" parameterType="Long">
delete from sys_user_post where user_id=#{userId}
</delete>
<select id="countUserPostById" resultType="Integer">
select count(1) from sys_user_post where post_id=#{postId}
</select>
<delete id="deleteUserPost" parameterType="Long">
delete from sys_user_post where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserPost">
insert into sys_user_post(user_id, post_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.postId})
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,44 @@
<?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.system.mapper.SysUserRoleMapper">
<resultMap type="SysUserRole" id="SysUserRoleResult">
<result property="userId" column="user_id" />
<result property="roleId" column="role_id" />
</resultMap>
<delete id="deleteUserRoleByUserId" parameterType="Long">
delete from sys_user_role where user_id=#{userId}
</delete>
<select id="countUserRoleByRoleId" resultType="Integer">
select count(1) from sys_user_role where role_id=#{roleId}
</select>
<delete id="deleteUserRole" parameterType="Long">
delete from sys_user_role where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserRole">
insert into sys_user_role(user_id, role_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.roleId})
</foreach>
</insert>
<delete id="deleteUserRoleInfo" parameterType="SysUserRole">
delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
</delete>
<delete id="deleteUserRoleInfos">
delete from sys_user_role where role_id=#{roleId} and user_id in
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,180 @@
<?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.system.mapper.SysDeptMapper">
<resultMap type="SysDept" id="SysDeptResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="address" column="address" />
<result property="licenseNo" column="licenseNo" />
<result property="merchantFlag" column="merchant_flag" />
<result property="mchid" column="mchid" />
</resultMap>
<sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,
d.address, d.licenseNo,d.merchant_flag,d.mchid
from sys_dept d
</sql>
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="merchantFlag != null and merchantFlag != ''">
AND merchant_flag = #{merchantFlag}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from sys_dept d
left join sys_role_dept rd on d.dept_id = rd.dept_id
where rd.role_id = #{roleId}
<if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.address,d.licenseNo,d.merchant_flag,d.mchid,
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
from sys_dept d
where d.dept_id = #{deptId}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
</select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept
where del_flag = '0' and parent_id = #{deptId} limit 1
</select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<insert id="insertDept" parameterType="SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="address != null and address != ''">address,</if>
<if test="licenseNo != null and licenseNo != ''">licenseNo,</if>
<if test="merchantFlag != null and merchantFlag != ''">merchant_flag,</if>
<if test="mchid != null and mchid != ''">mchid,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="address != null and address != ''">#{address},</if>
<if test="licenseNo != null and licenseNo != ''">#{licenseNo},</if>
<if test="merchantFlag != null and merchantFlag != ''">#{merchantFlag},</if>
<if test="mchid != null and mchid != ''">#{mchid},</if>
sysdate()
)
</insert>
<update id="updateDept" parameterType="SysDept">
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="address != null and address != ''">address = #{address},</if>
<if test="licenseNo != null and licenseNo != ''">licenseNo = #{licenseNo},</if>
<if test="merchantFlag != null and merchantFlag != ''">merchant_flag=#{merchantFlag},</if>
<if test="mchid != null and mchid != ''">mchid=#{mchid},</if>
update_time = sysdate()
</set>
where dept_id = #{deptId}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatusNormal" parameterType="Long">
update sys_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
<delete id="deleteDeptById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
</mapper>