Files
SchoolFood/fp-system/src/main/resources/mapper/RepositoryMapper.xml

52 lines
2.9 KiB
XML
Raw Normal View History

<?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.RepositoryMapper">
<resultMap id="joinMap" type="com.zf.foodpurchase.fdsafe.entity.Repository">
<id column="id" property="id" />
<result column="merchant_id" property="merchantId" />
<result column="merchant_name" property="merchantName" />
2026-07-15 15:17:50 +08:00
<result column="repo_num" property="repoNum" />
<result column="repo_name" property="repoName" />
<result column="area_code" property="areaCode" />
<result column="detail_address" property="detailAddress" />
<result column="default_repo" property="defaultRepo" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="oper_id" property="operId" />
2026-07-15 15:17:50 +08:00
<result column="manager" property="manager" />
<result column="order_num" property="orderNum" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="joinColumn">
2026-07-15 15:17:50 +08:00
select r.id, r.merchant_id,r.repo_num, r.repo_name, r.area_code, r.detail_address, r.default_repo, r.create_time, r.update_time, r.oper_id,
r.manager, r.order_num, d.dept_name as merchant_name
from repository r left join sys_dept d on r.merchant_id = d.dept_id
</sql>
2026-07-15 15:17:50 +08:00
<select id="queryRepoList" resultType="com.zf.foodpurchase.fdsafe.entity.Repository"
parameterType="com.zf.foodpurchase.fdsafe.entity.Repository">
<include refid="joinColumn"/>
<where>
<if test="id != null ">and r.id = #{id}</if>
<if test="merchantId != null ">and r.merchant_id = #{merchantId}</if>
<if test="areaCode != null ">and r.area_code = #{areaCode}</if>
<if test="detailAddress != null ">and r.detail_address = #{detailAddress}</if>
<if test="defaultRepo != null ">and r.default_repo = #{defaultRepo}</if>
<if test="operId != null ">and r.oper_id = #{operId}</if>
<if test="createTime != null ">and r.create_time = #{createTime}</if>
<if test="updateTime != null ">and r.update_time = #{updateTime}</if>
<if test="merchantName != null and merchantName !='' ">and d.dept_name like concat('%', #{merchantName}, '%') </if>
2026-07-15 15:17:50 +08:00
<if test="repoNum != null and repoNum !='' ">and r.repo_num =#{repoNum} </if>
<if test="manager != null ">and r.manager = #{manager}</if>
<if test="orderNum != null ">and r.order_num = #{orderNum}</if>
<if test="deptIds != null and deptIds.size() > 0">
and d.dept_id in
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
</where>
</select>
</mapper>