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

39 lines
2.2 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" />
<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" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="joinColumn">
select r.id, r.merchant_id,r.repo_name, r.area_code, r.detail_address, r.default_repo, r.create_time, r.update_time, r.oper_id,d.dept_name as merchant_name
from repository r left join sys_dept d on r.merchant_id = d.dept_id
</sql>
<select id="joinQueryList" resultType="com.zf.foodpurchase.fdsafe.entity.Repository"
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>
</where>
</select>
</mapper>