| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673 |
- <?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.chinaitop.depot.agent.bgz.mapper.BusinessAgentBgmxzMapper">
- <resultMap id="BaseResultMap" type="com.chinaitop.depot.agent.bgz.model.BusinessAgentBgmxz">
- <id column="id" jdbcType="INTEGER" property="id" />
- <result column="org_id" jdbcType="INTEGER" property="orgId" />
- <result column="agent_id" jdbcType="INTEGER" property="agentId" />
- <result column="szlk_org_id" jdbcType="INTEGER" property="szlkOrgId" />
- <result column="house_id" jdbcType="VARCHAR" property="houseId" />
- <result column="ware_id" jdbcType="VARCHAR" property="wareId" />
- <result column="lspz" jdbcType="INTEGER" property="lspz" />
- <result column="lsxz" jdbcType="INTEGER" property="lsxz" />
- <result column="lsdj" jdbcType="INTEGER" property="lsdj" />
- <result column="fssj" jdbcType="TIMESTAMP" property="fssj" />
- <result column="srsl" jdbcType="DECIMAL" property="srsl" />
- <result column="zcsl" jdbcType="DECIMAL" property="zcsl" />
- <result column="kcsl" jdbcType="DECIMAL" property="kcsl" />
- <result column="lqgs_org_id" jdbcType="INTEGER" property="lqgsOrgId" />
- <result column="is_jz" jdbcType="INTEGER" property="isJz" />
- <result column="sjly" jdbcType="INTEGER" property="sjly" />
- <result column="create_person" jdbcType="VARCHAR" property="createPerson" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
- </resultMap>
- <sql id="Example_Where_Clause">
- <where>
- <foreach collection="oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Update_By_Example_Where_Clause">
- <where>
- <foreach collection="example.oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Base_Column_List">
- id, org_id, agent_id, szlk_org_id, house_id, ware_id, lspz, lsxz, lsdj, fssj, srsl,
- zcsl, kcsl, lqgs_org_id, is_jz, sjly, create_person, create_date, updatetime
- </sql>
- <select id="selectByExample" parameterType="com.chinaitop.depot.agent.bgz.model.BusinessAgentBgmxzExample" resultMap="BaseResultMap">
- select
- <if test="distinct">
- distinct
- </if>
- <include refid="Base_Column_List" />
- from business_agent_bgmxz
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null">
- order by ${orderByClause}
- </if>
- </select>
- <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from business_agent_bgmxz
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
- delete from business_agent_bgmxz
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <delete id="deleteByExample" parameterType="com.chinaitop.depot.agent.bgz.model.BusinessAgentBgmxzExample">
- delete from business_agent_bgmxz
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </delete>
- <insert id="insert" parameterType="com.chinaitop.depot.agent.bgz.model.BusinessAgentBgmxz">
- insert into business_agent_bgmxz (id, org_id, agent_id,
- szlk_org_id, house_id, ware_id,
- lspz, lsxz, lsdj, fssj,
- srsl, zcsl, kcsl, lqgs_org_id,
- is_jz, sjly, create_person,
- create_date, updatetime)
- values (#{id,jdbcType=INTEGER}, #{orgId,jdbcType=INTEGER}, #{agentId,jdbcType=INTEGER},
- #{szlkOrgId,jdbcType=INTEGER}, #{houseId,jdbcType=VARCHAR}, #{wareId,jdbcType=VARCHAR},
- #{lspz,jdbcType=INTEGER}, #{lsxz,jdbcType=INTEGER}, #{lsdj,jdbcType=INTEGER}, #{fssj,jdbcType=TIMESTAMP},
- #{srsl,jdbcType=DECIMAL}, #{zcsl,jdbcType=DECIMAL}, #{kcsl,jdbcType=DECIMAL}, #{lqgsOrgId,jdbcType=INTEGER},
- #{isJz,jdbcType=INTEGER}, #{sjly,jdbcType=INTEGER}, #{createPerson,jdbcType=VARCHAR},
- #{createDate,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP})
- </insert>
- <insert id="insertSelective" parameterType="com.chinaitop.depot.agent.bgz.model.BusinessAgentBgmxz">
- insert into business_agent_bgmxz
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="orgId != null">
- org_id,
- </if>
- <if test="agentId != null">
- agent_id,
- </if>
- <if test="szlkOrgId != null">
- szlk_org_id,
- </if>
- <if test="houseId != null">
- house_id,
- </if>
- <if test="wareId != null">
- ware_id,
- </if>
- <if test="lspz != null">
- lspz,
- </if>
- <if test="lsxz != null">
- lsxz,
- </if>
- <if test="lsdj != null">
- lsdj,
- </if>
- <if test="fssj != null">
- fssj,
- </if>
- <if test="srsl != null">
- srsl,
- </if>
- <if test="zcsl != null">
- zcsl,
- </if>
- <if test="kcsl != null">
- kcsl,
- </if>
- <if test="lqgsOrgId != null">
- lqgs_org_id,
- </if>
- <if test="isJz != null">
- is_jz,
- </if>
- <if test="sjly != null">
- sjly,
- </if>
- <if test="createPerson != null">
- create_person,
- </if>
- <if test="createDate != null">
- create_date,
- </if>
- <if test="updatetime != null">
- updatetime,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=INTEGER},
- </if>
- <if test="orgId != null">
- #{orgId,jdbcType=INTEGER},
- </if>
- <if test="agentId != null">
- #{agentId,jdbcType=INTEGER},
- </if>
- <if test="szlkOrgId != null">
- #{szlkOrgId,jdbcType=INTEGER},
- </if>
- <if test="houseId != null">
- #{houseId,jdbcType=VARCHAR},
- </if>
- <if test="wareId != null">
- #{wareId,jdbcType=VARCHAR},
- </if>
- <if test="lspz != null">
- #{lspz,jdbcType=INTEGER},
- </if>
- <if test="lsxz != null">
- #{lsxz,jdbcType=INTEGER},
- </if>
- <if test="lsdj != null">
- #{lsdj,jdbcType=INTEGER},
- </if>
- <if test="fssj != null">
- #{fssj,jdbcType=TIMESTAMP},
- </if>
- <if test="srsl != null">
- #{srsl,jdbcType=DECIMAL},
- </if>
- <if test="zcsl != null">
- #{zcsl,jdbcType=DECIMAL},
- </if>
- <if test="kcsl != null">
- #{kcsl,jdbcType=DECIMAL},
- </if>
- <if test="lqgsOrgId != null">
- #{lqgsOrgId,jdbcType=INTEGER},
- </if>
- <if test="isJz != null">
- #{isJz,jdbcType=INTEGER},
- </if>
- <if test="sjly != null">
- #{sjly,jdbcType=INTEGER},
- </if>
- <if test="createPerson != null">
- #{createPerson,jdbcType=VARCHAR},
- </if>
- <if test="createDate != null">
- #{createDate,jdbcType=TIMESTAMP},
- </if>
- <if test="updatetime != null">
- #{updatetime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.chinaitop.depot.agent.bgz.model.BusinessAgentBgmxzExample" resultType="java.lang.Integer">
- select count(*) from business_agent_bgmxz
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map">
- update business_agent_bgmxz
- <set>
- <if test="record.id != null">
- id = #{record.id,jdbcType=INTEGER},
- </if>
- <if test="record.orgId != null">
- org_id = #{record.orgId,jdbcType=INTEGER},
- </if>
- <if test="record.agentId != null">
- agent_id = #{record.agentId,jdbcType=INTEGER},
- </if>
- <if test="record.szlkOrgId != null">
- szlk_org_id = #{record.szlkOrgId,jdbcType=INTEGER},
- </if>
- <if test="record.houseId != null">
- house_id = #{record.houseId,jdbcType=VARCHAR},
- </if>
- <if test="record.wareId != null">
- ware_id = #{record.wareId,jdbcType=VARCHAR},
- </if>
- <if test="record.lspz != null">
- lspz = #{record.lspz,jdbcType=INTEGER},
- </if>
- <if test="record.lsxz != null">
- lsxz = #{record.lsxz,jdbcType=INTEGER},
- </if>
- <if test="record.lsdj != null">
- lsdj = #{record.lsdj,jdbcType=INTEGER},
- </if>
- <if test="record.fssj != null">
- fssj = #{record.fssj,jdbcType=TIMESTAMP},
- </if>
- <if test="record.srsl != null">
- srsl = #{record.srsl,jdbcType=DECIMAL},
- </if>
- <if test="record.zcsl != null">
- zcsl = #{record.zcsl,jdbcType=DECIMAL},
- </if>
- <if test="record.kcsl != null">
- kcsl = #{record.kcsl,jdbcType=DECIMAL},
- </if>
- <if test="record.lqgsOrgId != null">
- lqgs_org_id = #{record.lqgsOrgId,jdbcType=INTEGER},
- </if>
- <if test="record.isJz != null">
- is_jz = #{record.isJz,jdbcType=INTEGER},
- </if>
- <if test="record.sjly != null">
- sjly = #{record.sjly,jdbcType=INTEGER},
- </if>
- <if test="record.createPerson != null">
- create_person = #{record.createPerson,jdbcType=VARCHAR},
- </if>
- <if test="record.createDate != null">
- create_date = #{record.createDate,jdbcType=TIMESTAMP},
- </if>
- <if test="record.updatetime != null">
- updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
- </if>
- </set>
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExample" parameterType="map">
- update business_agent_bgmxz
- set id = #{record.id,jdbcType=INTEGER},
- org_id = #{record.orgId,jdbcType=INTEGER},
- agent_id = #{record.agentId,jdbcType=INTEGER},
- szlk_org_id = #{record.szlkOrgId,jdbcType=INTEGER},
- house_id = #{record.houseId,jdbcType=VARCHAR},
- ware_id = #{record.wareId,jdbcType=VARCHAR},
- lspz = #{record.lspz,jdbcType=INTEGER},
- lsxz = #{record.lsxz,jdbcType=INTEGER},
- lsdj = #{record.lsdj,jdbcType=INTEGER},
- fssj = #{record.fssj,jdbcType=TIMESTAMP},
- srsl = #{record.srsl,jdbcType=DECIMAL},
- zcsl = #{record.zcsl,jdbcType=DECIMAL},
- kcsl = #{record.kcsl,jdbcType=DECIMAL},
- lqgs_org_id = #{record.lqgsOrgId,jdbcType=INTEGER},
- is_jz = #{record.isJz,jdbcType=INTEGER},
- sjly = #{record.sjly,jdbcType=INTEGER},
- create_person = #{record.createPerson,jdbcType=VARCHAR},
- create_date = #{record.createDate,jdbcType=TIMESTAMP},
- updatetime = #{record.updatetime,jdbcType=TIMESTAMP}
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.agent.bgz.model.BusinessAgentBgmxz">
- update business_agent_bgmxz
- <set>
- <if test="orgId != null">
- org_id = #{orgId,jdbcType=INTEGER},
- </if>
- <if test="agentId != null">
- agent_id = #{agentId,jdbcType=INTEGER},
- </if>
- <if test="szlkOrgId != null">
- szlk_org_id = #{szlkOrgId,jdbcType=INTEGER},
- </if>
- <if test="houseId != null">
- house_id = #{houseId,jdbcType=VARCHAR},
- </if>
- <if test="wareId != null">
- ware_id = #{wareId,jdbcType=VARCHAR},
- </if>
- <if test="lspz != null">
- lspz = #{lspz,jdbcType=INTEGER},
- </if>
- <if test="lsxz != null">
- lsxz = #{lsxz,jdbcType=INTEGER},
- </if>
- <if test="lsdj != null">
- lsdj = #{lsdj,jdbcType=INTEGER},
- </if>
- <if test="fssj != null">
- fssj = #{fssj,jdbcType=TIMESTAMP},
- </if>
- <if test="srsl != null">
- srsl = #{srsl,jdbcType=DECIMAL},
- </if>
- <if test="zcsl != null">
- zcsl = #{zcsl,jdbcType=DECIMAL},
- </if>
- <if test="kcsl != null">
- kcsl = #{kcsl,jdbcType=DECIMAL},
- </if>
- <if test="lqgsOrgId != null">
- lqgs_org_id = #{lqgsOrgId,jdbcType=INTEGER},
- </if>
- <if test="isJz != null">
- is_jz = #{isJz,jdbcType=INTEGER},
- </if>
- <if test="sjly != null">
- sjly = #{sjly,jdbcType=INTEGER},
- </if>
- <if test="createPerson != null">
- create_person = #{createPerson,jdbcType=VARCHAR},
- </if>
- <if test="createDate != null">
- create_date = #{createDate,jdbcType=TIMESTAMP},
- </if>
- <if test="updatetime != null">
- updatetime = #{updatetime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.agent.bgz.model.BusinessAgentBgmxz">
- update business_agent_bgmxz
- set org_id = #{orgId,jdbcType=INTEGER},
- agent_id = #{agentId,jdbcType=INTEGER},
- szlk_org_id = #{szlkOrgId,jdbcType=INTEGER},
- house_id = #{houseId,jdbcType=VARCHAR},
- ware_id = #{wareId,jdbcType=VARCHAR},
- lspz = #{lspz,jdbcType=INTEGER},
- lsxz = #{lsxz,jdbcType=INTEGER},
- lsdj = #{lsdj,jdbcType=INTEGER},
- fssj = #{fssj,jdbcType=TIMESTAMP},
- srsl = #{srsl,jdbcType=DECIMAL},
- zcsl = #{zcsl,jdbcType=DECIMAL},
- kcsl = #{kcsl,jdbcType=DECIMAL},
- lqgs_org_id = #{lqgsOrgId,jdbcType=INTEGER},
- is_jz = #{isJz,jdbcType=INTEGER},
- sjly = #{sjly,jdbcType=INTEGER},
- create_person = #{createPerson,jdbcType=VARCHAR},
- create_date = #{createDate,jdbcType=TIMESTAMP},
- updatetime = #{updatetime,jdbcType=TIMESTAMP}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <!-- 查询分仓保管账列表 -->
- <select id="selectFcbgzList" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT datas.* FROM (
- select
- a.org_id orgId,
- DATE_FORMAT(a.fssj,'%Y-%m-%d') as fssj,
- a.agent_id agentId,
- b.agent_name agentName,
- a.szlk_org_id dckId,
- c.agent_depot_name agentDepotName,
- a.house_id houseId,
- d.storehouse_name houseName,
- a.ware_id wareId,
- e.warehouse_name wareName,
- a.lsxz,
- a.lspz,
- a.lsdj,
- sum(a.srsl) as srsl,
- sum(a.zcsl) as zcsl,
- a.kcsl,
- c.depot_id isJz
- from (SELECT * from business_agent_bgmxz WHERE 1=1 AND SUBSTR(house_id,1,2)!='YG' ORDER BY fssj DESC) a
- LEFT JOIN business_agent b ON b.id=a.agent_id
- LEFT JOIN business_agent_depot c ON c.id=a.szlk_org_id
- LEFT JOIN basic_storehouse d ON d.storehouse_id=a.house_id
- LEFT JOIN basic_warehouse e ON e.warehouse_id=a.ware_id
- where 1=1
- group by a.agent_id, a.szlk_org_id, a.house_id, a.ware_id, a.lsxz, a.lspz, DATE_FORMAT(a.fssj,'%Y-%m-%d')
- UNION
- select
- a.org_id orgId,
- DATE_FORMAT(a.fssj,'%Y-%m-%d') as fssj,
- a.agent_id agentId,
- b.agent_name agentName,
- a.szlk_org_id dckId,
- c.agent_depot_name agentDepotName,
- a.house_id houseId,
- d.storageTank_name houseName,
- a.house_id wareId,
- '' wareName,
- a.lsxz,
- a.lspz,
- a.lsdj,
- sum(a.srsl) as srsl,
- sum(a.zcsl) as zcsl,
- a.kcsl,
- c.depot_id isJz
- from (SELECT * from business_agent_bgmxz WHERE 1=1 AND SUBSTR(house_id,1,2)='YG' AND sjly=1 ORDER BY fssj DESC) a
- LEFT JOIN business_agent b ON b.id=a.agent_id
- LEFT JOIN business_agent_depot c ON c.id=a.szlk_org_id
- LEFT JOIN basic_tank d ON d.id=a.house_id
- where 1=1
- group by a.agent_id, a.szlk_org_id, a.house_id, a.ware_id, a.lsxz, a.lspz, DATE_FORMAT(a.fssj,'%Y-%m-%d')
- UNION
- select
- a.org_id orgId,
- DATE_FORMAT(a.fssj,'%Y-%m-%d') as fssj,
- a.agent_id agentId,
- b.agent_name agentName,
- a.szlk_org_id dckId,
- c.agent_depot_name agentDepotName,
- a.house_id houseId,
- d.tank_name houseName,
- a.house_id wareId,
- '' wareName,
- a.lsxz,
- a.lspz,
- a.lsdj,
- sum(a.srsl) as srsl,
- sum(a.zcsl) as zcsl,
- a.kcsl,
- c.depot_id isJz
- from (SELECT * from business_agent_bgmxz WHERE 1=1 AND SUBSTR(house_id,1,2)='YG' AND sjly=0 ORDER BY fssj DESC) a
- LEFT JOIN business_agent b ON b.id=a.agent_id
- LEFT JOIN business_agent_depot c ON c.id=a.szlk_org_id
- LEFT JOIN business_agent_tank d ON d.id=a.house_id
- where 1=1
- group by a.agent_id, a.szlk_org_id, a.house_id, a.ware_id, a.lsxz, a.lspz, DATE_FORMAT(a.fssj,'%Y-%m-%d')
- ) datas WHERE 1=1
- <if test="orgId != null">
- AND datas.orgId = #{orgId,jdbcType=INTEGER}
- </if>
- <if test="agentId != null">
- AND datas.agentId = #{agentId,jdbcType=INTEGER}
- </if>
- <if test="szlkOrgId != null">
- AND datas.dckId = #{szlkOrgId,jdbcType=INTEGER}
- </if>
- <if test="houseId != null">
- AND datas.houseId = #{houseId,jdbcType=VARCHAR}
- </if>
- <if test="wareId != null">
- AND datas.wareId = #{wareId,jdbcType=VARCHAR}
- </if>
- <if test="lspz != null">
- AND datas.lspz = #{lspz,jdbcType=INTEGER}
- </if>
- <if test="lsxz != null">
- AND datas.lsxz = #{lsxz,jdbcType=INTEGER}
- </if>
- <if test="fssj != null">
- AND datas.fssj = #{fssj}
- </if>
- ORDER BY datas.fssj DESC
- </select>
- <select id="selectByExampleNew" parameterType="java.util.Map" resultMap="BaseResultMap">
- select datas.* from (
- select
- <if test="distinct">
- distinct
- </if>
- a.*,b.agent_name agentName,c.agent_depot_name agentDepotName,d.storehouse_name houseName,e.warehouse_name wareName
- from business_agent_bgmxz a
- LEFT JOIN business_agent b ON b.id=a.agent_id
- LEFT JOIN business_agent_depot c ON c.id=a.szlk_org_id
- LEFT JOIN basic_storehouse d ON d.storehouse_id=a.house_id
- LEFT JOIN basic_warehouse e ON e.warehouse_id=a.ware_id
- WHERE 1=1
- AND SUBSTR(a.house_id, 1, 2) != 'YG'
- AND a.ware_id != ''
- AND a.ware_id is not null
- <if test="agentId != null">
- and a.agent_id = ${agentId}
- </if>
- <if test="szlkOrgId != null">
- and a.szlk_org_id = ${szlkOrgId}
- </if>
- <if test="houseId != null">
- and a.house_id = #{houseId,jdbcType=VARCHAR}
- </if>
- <if test="wareId != null">
- and a.ware_id = #{wareId,jdbcType=VARCHAR}
- </if>
- <if test="orgId != null">
- and a.org_id = ${orgId}
- </if>
- <if test="startTime != null">
- and a.fssj >= DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endTime != null">
- and a.fssj <= DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s')
- </if>
- UNION
- select
- <if test="distinct">
- distinct
- </if>
- a.*,b.agent_name agentName,c.agent_depot_name agentDepotName,d.storageTank_name houseName,'' wareName
- from business_agent_bgmxz a
- LEFT JOIN business_agent b ON b.id=a.agent_id
- LEFT JOIN business_agent_depot c ON c.id=a.szlk_org_id
- LEFT JOIN basic_tank d ON d.id=a.house_id
- WHERE 1=1
- AND a.sjly=1
- AND SUBSTR(a.house_id,1,2) = 'YG'
- <if test="agentId != null">
- and a.agent_id = ${agentId}
- </if>
- <if test="szlkOrgId != null">
- and a.szlk_org_id = ${szlkOrgId}
- </if>
- <if test="houseId != null">
- and a.house_id = #{houseId,jdbcType=VARCHAR}
- </if>
- <if test="wareId != null">
- and a.ware_id = #{wareId,jdbcType=VARCHAR}
- </if>
- <if test="orgId != null">
- and a.org_id = ${orgId}
- </if>
- <if test="startTime != null">
- and a.fssj >= DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endTime != null">
- and a.fssj <= DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s')
- </if>
- UNION
- select
- <if test="distinct">
- distinct
- </if>
- a.*,b.agent_name agentName,c.agent_depot_name agentDepotName,d.tank_name houseName,'' wareName
- from business_agent_bgmxz a
- LEFT JOIN business_agent b ON b.id=a.agent_id
- LEFT JOIN business_agent_depot c ON c.id=a.szlk_org_id
- LEFT JOIN business_agent_tank d ON d.id=a.house_id
- WHERE 1=1
- AND a.sjly=0
- AND (a.ware_id='' OR a.ware_id is NULL)
- <if test="agentId != null">
- and a.agent_id = ${agentId}
- </if>
- <if test="szlkOrgId != null">
- and a.szlk_org_id = ${szlkOrgId}
- </if>
- <if test="houseId != null">
- and a.house_id = #{houseId,jdbcType=VARCHAR}
- </if>
- <if test="wareId != null">
- and a.ware_id = #{wareId,jdbcType=VARCHAR}
- </if>
- <if test="orgId != null">
- and a.org_id = ${orgId}
- </if>
- <if test="startTime != null">
- and a.fssj >= DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s')
- </if>
- <if test="endTime != null">
- and a.fssj <= DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s')
- </if>
- ) datas where 1=1
- <if test="orderByClause != null">
- order by ${orderByClause}
- </if>
- </select>
- <!-- 查询代储库仓房货位和油罐信息 -->
- <select id="selectAgentHouseWareList" parameterType="java.util.Map" resultType="java.util.Map">
- SELECT
- a.depot_id unitid,
- c.warehouse_id hwh,
- c.bgmxz_tbsj modifydate
- FROM business_agent_depot a
- LEFT JOIN business_agent_storehouse b ON b.agent_depot_id=a.id
- LEFT JOIN business_agent_warehouse c ON c.agent_storehouse_id=b.id AND c.del_flag=1
- WHERE a.depot_id != 0 AND b.storehouse_id IS NOT NULL AND c.warehouse_id IS NOT NULL
- <if test="orgId != null">
- and c.org_id=#{orgId,jdbcType=INTEGER}
- </if>
- UNION
- SELECT
- a.depot_id unitid,
- b.tank_id hwh,
- b.bgmxz_tbsj modifydate
- FROM business_agent_depot a
- INNER JOIN business_agent_tank_exist b ON b.agent_depot_id = a.id
- <if test="orgId != null">
- AND b.org_id = #{orgId,jdbcType=INTEGER}
- </if>
- </select>
-
- </mapper>
|