164 lines
10 KiB
XML
164 lines
10 KiB
XML
<?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.xdadan.erp.emis.mapper.EmisQuoteSendAreaMapper">
|
|
|
|
<resultMap type="EmisQuoteSendArea" id="EmisQuoteSendAreaResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<result property="areaId" column="area_id" />
|
|
<result property="areaName" column="area_name" />
|
|
|
|
<result property="useSiteCode" column="use_site_code" />
|
|
<result property="areaSite" column="area_site" />
|
|
<result property="areaSiteCode" column="area_site_code" />
|
|
<result property="areaSiteId" column="area_site_id" />
|
|
<result property="feeType" column="fee_type" />
|
|
<result property="areaType" column="area_type" />
|
|
<result property="sync" column="sync" />
|
|
<result property="status" column="status" />
|
|
|
|
|
|
<association property="useSite" column="use_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
|
|
|
</resultMap>
|
|
|
|
<sql id="selectEmisQuoteSendAreaVo">
|
|
select area_id, area_name, use_site, use_site_code, area_site, area_site_code, area_site_id, fee_type, area_type, sync, status, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_quote_send_area
|
|
</sql>
|
|
|
|
|
|
<select id="selectEmisQuoteSendAreaList" parameterType="EmisQuoteSendArea" resultMap="EmisQuoteSendAreaResult">
|
|
<include refid="selectEmisQuoteSendAreaVo"/>
|
|
<where>
|
|
<if test="areaId != null "> and area_id = #{areaId}</if>
|
|
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
|
|
<if test="useSite != null and useSite != ''"> and use_site like concat('%', #{useSite}, '%')</if>
|
|
<if test="useSiteCode != null and useSiteCode != ''"> and use_site_code like concat('%', #{useSiteCode}, '%')</if>
|
|
<if test="areaSite != null and areaSite != ''"> and area_site like concat('%', #{areaSite}, '%')</if>
|
|
<if test="areaSiteCode != null and areaSiteCode != ''"> and area_site_code like concat('%', #{areaSiteCode}, '%')</if>
|
|
<if test="areaSiteId != null and areaSiteId != ''"> and area_site_id like concat('%', #{areaSiteId}, '%')</if>
|
|
<if test="feeType != null and feeType != ''"> and fee_type like concat('%', #{feeType}, '%')</if>
|
|
<if test="areaType != null and areaType != ''"> and area_type like concat('%', #{areaType}, '%')</if>
|
|
<if test="sync != null and sync != ''"> and sync like concat('%', #{sync}, '%')</if>
|
|
<if test="status != null "> and status = #{status}</if>
|
|
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
|
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
|
|
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
|
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
|
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
|
|
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
|
<!-- <if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>-->
|
|
<!-- <if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>-->
|
|
|
|
<if test="createSite != null and createSite != ''">
|
|
<!-- 包含子网点 -->
|
|
AND use_site_code in (
|
|
SELECT t3.site_code FROM(
|
|
SELECT t1.site_code,t1.parent_site_code,t1.site_name,
|
|
IF( FIND_IN_SET( parent_site_code, @parent_ids ) > 0, @parent_ids := CONCAT( @parent_ids, ',', site_code ), '0' ) AS cids
|
|
FROM ( SELECT * FROM emis_site AS t WHERE t.del_flag = '0' ORDER BY t.site_code ASC ) t1,
|
|
( SELECT @parent_ids := #{createSite} ) t2
|
|
) t3
|
|
WHERE cids != '0'
|
|
UNION
|
|
SELECT #{createSite} FROM dual
|
|
)
|
|
</if>
|
|
|
|
|
|
</where>
|
|
order by create_time desc
|
|
</select>
|
|
|
|
<select id="selectEmisQuoteSendAreaByAreaId" parameterType="Long" resultMap="EmisQuoteSendAreaResult">
|
|
select area_id, area_name, use_site, use_site_code, area_site, area_site_code, area_site_id, fee_type, area_type, sync, status, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_quote_send_area a
|
|
where a.area_id = #{areaId}
|
|
</select>
|
|
|
|
<insert id="insertEmisQuoteSendArea" parameterType="EmisQuoteSendArea">
|
|
insert into emis_quote_send_area
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="areaId != null">area_id,</if>
|
|
<if test="areaName != null and areaName != ''">area_name,</if>
|
|
<if test="useSite != null and useSite != ''">use_site,</if>
|
|
<if test="useSiteCode != null and useSiteCode != ''">use_site_code,</if>
|
|
<if test="areaSite != null and areaSite != ''">area_site,</if>
|
|
<if test="areaSiteCode != null and areaSiteCode != ''">area_site_code,</if>
|
|
<if test="areaSiteId != null and areaSiteId != ''">area_site_id,</if>
|
|
<if test="feeType != null and feeType != ''">fee_type,</if>
|
|
<if test="areaType != null and areaType != ''">area_type,</if>
|
|
<if test="sync != null and sync != ''">sync,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="createSite != null and createSite != ''">create_site,</if>
|
|
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="areaId != null">#{areaId},</if>
|
|
<if test="areaName != null and areaName != ''">#{areaName},</if>
|
|
<if test="useSite != null and useSite != ''">#{useSite},</if>
|
|
<if test="useSiteCode != null and useSiteCode != ''">#{useSiteCode},</if>
|
|
<if test="areaSite != null and areaSite != ''">#{areaSite},</if>
|
|
<if test="areaSiteCode != null and areaSiteCode != ''">#{areaSiteCode},</if>
|
|
<if test="areaSiteId != null and areaSiteId != ''">#{areaSiteId},</if>
|
|
<if test="feeType != null and feeType != ''">#{feeType},</if>
|
|
<if test="areaType != null and areaType != ''">#{areaType},</if>
|
|
<if test="sync != null and sync != ''">#{sync},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
|
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="createSite != null and createSite != ''">#{createSite},</if>
|
|
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmisQuoteSendArea" parameterType="EmisQuoteSendArea">
|
|
update emis_quote_send_area
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
|
|
<if test="useSite != null and useSite != ''">use_site = #{useSite},</if>
|
|
<if test="useSiteCode != null and useSiteCode != ''">use_site_code = #{useSiteCode},</if>
|
|
<if test="areaSite != null and areaSite != ''">area_site = #{areaSite},</if>
|
|
<if test="areaSiteCode != null and areaSiteCode != ''">area_site_code = #{areaSiteCode},</if>
|
|
<if test="areaSiteId != null and areaSiteId != ''">area_site_id = #{areaSiteId},</if>
|
|
<if test="feeType != null and feeType != ''">fee_type = #{feeType},</if>
|
|
<if test="areaType != null and areaType != ''">area_type = #{areaType},</if>
|
|
<if test="sync != null and sync != ''">sync = #{sync},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
|
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
|
|
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
|
</trim>
|
|
where area_id = #{areaId}
|
|
</update>
|
|
|
|
<delete id="deleteEmisQuoteSendAreaByAreaId" parameterType="Long">
|
|
delete from emis_quote_send_area where area_id = #{areaId}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisQuoteSendAreaByAreaIds" parameterType="String">
|
|
delete from emis_quote_send_area where area_id in
|
|
<foreach item="areaId" collection="array" open="(" separator="," close=")">
|
|
#{areaId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |