|
@@ -352,19 +352,29 @@
|
|
|
|
|
|
|
|
<!-- 获取仓库 -->
|
|
<!-- 获取仓库 -->
|
|
|
<select id="getWarehouse" resultType="java.util.Map">
|
|
<select id="getWarehouse" resultType="java.util.Map">
|
|
|
- SELECT tmw.wh_id as "whId"
|
|
|
|
|
- ,tmw.wh_id AS "id"
|
|
|
|
|
- ,tmw.wh_name as "whName"
|
|
|
|
|
- ,tmw.wh_code as "whCode"
|
|
|
|
|
- ,tmw.flg_default as "flgDefault"
|
|
|
|
|
- FROM dkic_b.t_mst_warehouse tmw
|
|
|
|
|
- WHERE tmw.cp_id = #{cpId}
|
|
|
|
|
- and tmw.flg_valid
|
|
|
|
|
|
|
+ SELECT t.wh_id as "whId"
|
|
|
|
|
+ , t.wh_id AS "id"
|
|
|
|
|
+ , t.wh_name as "whName"
|
|
|
|
|
+ , t.wh_code as "whCode"
|
|
|
|
|
+ , t.flg_default as "flgDefault"
|
|
|
|
|
+ FROM dkic_b.t_mst_warehouse t
|
|
|
|
|
+ WHERE t.cp_id = #{cpId}
|
|
|
|
|
+ and t.flg_valid
|
|
|
<if test="whCode!=null and whCode!=''">
|
|
<if test="whCode!=null and whCode!=''">
|
|
|
- and position(#{whCode} in tmw.wh_code) > 0
|
|
|
|
|
|
|
+ and position(#{whCode} in t.wh_code) > 0
|
|
|
</if>
|
|
</if>
|
|
|
<if test="whName!=null and whName!=''">
|
|
<if test="whName!=null and whName!=''">
|
|
|
- and position(#{whName} in tmw.wh_name) > 0
|
|
|
|
|
|
|
+ and position(#{whName} in t.wh_name) > 0
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <!-- 部门上有仓库,只能选部门上的仓库;部门上没有仓库,可选所有仓库 -->
|
|
|
|
|
+ <if test="orgId != null">
|
|
|
|
|
+ and (select count(1)
|
|
|
|
|
+ from dkic_b.t_mst_org_wh as tmow
|
|
|
|
|
+ where tmow.org_id = #{orgId}::uuid) = 0
|
|
|
|
|
+ or (exists(select 1
|
|
|
|
|
+ from dkic_b.t_mst_org_wh as tmow
|
|
|
|
|
+ where tmow.org_id = #{orgId}::uuid
|
|
|
|
|
+ and tmow.wh_id = t.wh_id))
|
|
|
</if>
|
|
</if>
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
limit #{end} offset #{start}
|
|
@@ -837,21 +847,30 @@
|
|
|
|
|
|
|
|
<!--获取仓库档案-->
|
|
<!--获取仓库档案-->
|
|
|
<select id="getWarehouseByPage" resultType="java.util.Map">
|
|
<select id="getWarehouseByPage" resultType="java.util.Map">
|
|
|
- SELECT
|
|
|
|
|
- wh_id AS "whId",
|
|
|
|
|
- wh_code AS "whCode",
|
|
|
|
|
- wh_name AS "whName",
|
|
|
|
|
- supervisor AS "supervisor",
|
|
|
|
|
- contact_phone AS "contactPhone",
|
|
|
|
|
- flg_valid AS "flgValid"
|
|
|
|
|
- FROM dkic_b.t_mst_warehouse
|
|
|
|
|
|
|
+ SELECT t.wh_id AS "whId",
|
|
|
|
|
+ t.wh_code AS "whCode",
|
|
|
|
|
+ t.wh_name AS "whName",
|
|
|
|
|
+ t.supervisor AS "supervisor",
|
|
|
|
|
+ t.contact_phone AS "contactPhone",
|
|
|
|
|
+ t.flg_valid AS "flgValid"
|
|
|
|
|
+ FROM dkic_b.t_mst_warehouse as t
|
|
|
<where>
|
|
<where>
|
|
|
<if test="searchText !=null">
|
|
<if test="searchText !=null">
|
|
|
- AND ( wh_name LIKE concat('%', my_ex.likequery(#{searchText}), '%')
|
|
|
|
|
- or remarks LIKE concat('%', my_ex.likequery(#{searchText}), '%'))
|
|
|
|
|
|
|
+ AND ( t.wh_name LIKE concat('%', my_ex.likequery(#{searchText}), '%')
|
|
|
|
|
+ or t.remarks LIKE concat('%', my_ex.likequery(#{searchText}), '%'))
|
|
|
</if>
|
|
</if>
|
|
|
<if test="cpId != null">
|
|
<if test="cpId != null">
|
|
|
- AND cp_id = #{cpId}
|
|
|
|
|
|
|
+ AND t.cp_id = #{cpId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <!-- 部门上有仓库,只能选部门上的仓库;部门上没有仓库,可选所有仓库 -->
|
|
|
|
|
+ <if test="orgId != null">
|
|
|
|
|
+ and (select count(1)
|
|
|
|
|
+ from dkic_b.t_mst_org_wh as tmow
|
|
|
|
|
+ where tmow.org_id = #{orgId}::uuid) = 0
|
|
|
|
|
+ or (exists(select 1
|
|
|
|
|
+ from dkic_b.t_mst_org_wh as tmow
|
|
|
|
|
+ where tmow.org_id = #{orgId}::uuid
|
|
|
|
|
+ and tmow.wh_id = t.wh_id))
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
order by display_no asc
|
|
order by display_no asc
|
|
@@ -862,16 +881,25 @@
|
|
|
|
|
|
|
|
<!--获取仓库档案个数-->
|
|
<!--获取仓库档案个数-->
|
|
|
<select id="countWarehouseByPage" resultType="Long">
|
|
<select id="countWarehouseByPage" resultType="Long">
|
|
|
- SELECT
|
|
|
|
|
- count(1)
|
|
|
|
|
- FROM dkic_b.t_mst_warehouse
|
|
|
|
|
|
|
+ SELECT count(1)
|
|
|
|
|
+ FROM dkic_b.t_mst_warehouse as t
|
|
|
<where>
|
|
<where>
|
|
|
<if test="searchText !=null">
|
|
<if test="searchText !=null">
|
|
|
- AND ( wh_name LIKE concat('%', my_ex.likequery(#{searchText}), '%')
|
|
|
|
|
- or remarks LIKE concat('%', my_ex.likequery(#{searchText}), '%'))
|
|
|
|
|
|
|
+ AND ( t.wh_name LIKE concat('%', my_ex.likequery(#{searchText}), '%')
|
|
|
|
|
+ or t.remarks LIKE concat('%', my_ex.likequery(#{searchText}), '%'))
|
|
|
</if>
|
|
</if>
|
|
|
<if test="cpId != null">
|
|
<if test="cpId != null">
|
|
|
- AND cp_id = #{cpId}
|
|
|
|
|
|
|
+ AND t.cp_id = #{cpId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <!-- 部门上有仓库,只能选部门上的仓库;部门上没有仓库,可选所有仓库 -->
|
|
|
|
|
+ <if test="orgId != null">
|
|
|
|
|
+ and (select count(1)
|
|
|
|
|
+ from dkic_b.t_mst_org_wh as tmow
|
|
|
|
|
+ where tmow.org_id = #{orgId}::uuid) = 0
|
|
|
|
|
+ or (exists(select 1
|
|
|
|
|
+ from dkic_b.t_mst_org_wh as tmow
|
|
|
|
|
+ where tmow.org_id = #{orgId}::uuid
|
|
|
|
|
+ and tmow.wh_id = t.wh_id))
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|