| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 |
- <?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.gree.mall.manager.commonmapper.MaterialMapper">
- <select id="partsBasePage" resultType="com.gree.mall.manager.bean.material.base.PartsBaseVO">
- SELECT
- ${ex.selected}
- FROM websit_parts_base a
- ${ex.query}
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="materialCategoryPage" resultType="com.gree.mall.manager.bean.material.base.MaterialCategoryVO">
- SELECT
- ${ex.selected}
- FROM websit_goods_category a
- ${ex.query}
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.parent_category_id, a.sort, a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="mPage" resultType="com.gree.mall.manager.bean.material.base.WebsitGoodsMVO">
- SELECT
- ${ex.selected}
- FROM websit_goods a LEFT JOIN websit_goods_category b ON a.goods_category_id = b.category_id
- ${ex.query}
- AND a.goods_type = 'M'
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="pPage" resultType="com.gree.mall.manager.bean.material.base.WebsitGoodsPVO">
- SELECT
- ${ex.selected}
- FROM websit_goods a
- ${ex.query}
- AND a.goods_type = 'P'
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="workGoodsPage" resultType="com.gree.mall.manager.bean.material.base.WorkerGoodsVO">
- SELECT
- ${ex.selected}
- FROM worker_goods a LEFT JOIN websit_goods_category b ON a.category_id = b.category_id
- ${ex.query}
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="websitGoodsPricePage"
- resultType="com.gree.mall.manager.bean.material.manage.WebsitGoodsPriceVO">
- SELECT
- ${ex.selected}
- FROM websit_goods_price a LEFT JOIN websit_goods b ON a.goods_id = b.goods_id
- ${ex.query}
- <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
- AND a.websit_id IN
- <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="websitPriceUpdPage" resultType="com.gree.mall.manager.bean.material.manage.WebsitPriceUpdVO">
- SELECT
- ${ex.selected}
- FROM websit_price_upd a
- <!-- LEFT JOIN websit_price_upd_item b ON a.sheet_id = b.sheet_id -->
- ${ex.query}
- <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
- AND a.websit_id IN
- <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="websitPurchasePage" resultType="com.gree.mall.manager.bean.material.manage.WebsitPurchaseVO">
- SELECT
- ${ex.selected}
- FROM websit_purchase a LEFT JOIN storage b ON a.storage_id = b.storage_id
- ${ex.query}
- <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
- AND a.websit_id IN
- <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="websitPurchaseRetPage"
- resultType="com.gree.mall.manager.bean.material.manage.WebsitPurchaseRetVO">
- SELECT
- ${ex.selected}
- FROM websit_purchase_ret a LEFT JOIN storage b ON a.storage_id = b.storage_id
- ${ex.query}
- <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
- AND a.websit_id IN
- <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="websitVenderPage" resultType="com.gree.mall.manager.bean.material.vender.WebsitVenderVO">
- SELECT
- ${ex.selected}
- FROM websit_vender a
- ${ex.query}
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="websitNormChargePage" resultType="com.gree.mall.manager.bean.material.base.WebsitNormChargeVO">
- SELECT
- ${ex.selected}
- FROM websit_norm_charge a LEFT JOIN websit_goods_category b ON a.category_id = b.category_id
- ${ex.query}
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="websitSalesPage" resultType="com.gree.mall.manager.bean.material.manage.WebsitSalesVO">
- SELECT
- ${ex.selected}
- FROM websit_sales a
- join websit_sales_item b on a.sales_id = b.sales_id
- LEFT JOIN storage c on a.storage_id = c.storage_id
- ${ex.query}
- <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
- AND a.websit_id IN
- <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="goodsName != null and goodsName != ''">
- AND b.goods_name = #{goodsName}
- </if>
- <if test="goodsSpecification != null and goodsSpecification != ''">
- AND b.goods_specification = #{goodsSpecification}
- </if>
- <if test="isFilter != null and isFilter != ''">
- AND ( (a.goods_Type = 'M' and b.sales_qty != b.ret_qty) or
- (a.goods_Type = 'P' and (b.sales_qty != (b.ret_qty+ b.old_refund_qty)))
- )
- </if>
- GROUP BY a.sales_id
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="existStockCategory" resultType="com.gree.mall.manager.bean.material.stock.WebsitSalesCategoryVO">
- SELECT
- c.category_id,
- c.category_name,
- c.parent_category_id,
- c.parent_category_name
- FROM
- websit_stock a
- LEFT JOIN websit_goods b ON a.goods_id = b.goods_id
- LEFT JOIN websit_goods_category c ON b.goods_category_id = c.category_id
- WHERE
- a.company_wechat_id = #{companyWechatId}
- AND a.websit_id = #{websitId}
- AND a.goods_type = 'M'
- <!-- AND a.qty > 0 -->
- GROUP BY b.goods_category_id
- </select>
- <select id="existStockGoods" resultType="com.gree.mall.manager.bean.material.stock.WebsitSalesGoodsVO">
- SELECT
- a.goods_id,
- b.goods_name,
- <if test="goodsType=='M'.toString()">
- c.price,
- </if>
- <if test="goodsType=='P'.toString()">
- b.market_price AS price,
- </if>
- b.goods_code,
- b.goods_spell,
- b.goods_specification,
- b.goods_stock_unit,
- b.goods_sales_unit,
- b.brand_rela_name,
- b.product_rela_name,
- SUM(a.qty) AS qty,
- 'BASE' AS itemSourceType,
- a.goods_id AS itemSourceId,
- b.norm_type
- FROM
- websit_stock a
- JOIN websit_goods b ON a.goods_id = b.goods_id
- <if test="goodsType=='M'.toString()">
- LEFT JOIN websit_goods_price c ON a.goods_id = c.goods_id AND a.websit_id = c.websit_id
- </if>
- WHERE
- a.company_wechat_id = #{companyWechatId}
- <if test="goodsType=='M'.toString() and categoryId!=null and categoryId!=''">
- AND b.goods_category_id = #{categoryId}
- </if>
- <if test="goodsName!=null and goodsName!=''">
- AND b.goods_name LIKE CONCAT('%',#{goodsName},'%')
- </if>
- <if test="goodsSpecification!=null and goodsSpecification!=''">
- AND b.goods_specification LIKE CONCAT('%',#{goodsSpecification},'%')
- </if>
- AND a.websit_id = #{websitId}
- <if test="goodsType!=null and goodsType!=''">
- AND a.goods_type = #{goodsType}
- </if>
- <!-- AND a.qty > 0 -->
- GROUP BY a.goods_id
- LIMIT 100
- </select>
- <select id="notStockGoods" resultType="com.gree.mall.manager.bean.material.stock.WebsitSalesGoodsVO">
- SELECT
- b.goods_id,
- b.goods_name,
- b.market_price AS price,
- b.goods_code,
- b.goods_spell,
- b.goods_specification,
- b.goods_stock_unit,
- b.goods_sales_unit,
- b.brand_rela_name,
- b.product_rela_name,
- b.convert_bit_scale,
- b.goods_sales_convert_qty,
- b.manage_worker_stock,
- 0 AS qty
- FROM
- websit_goods b
- WHERE
- b.company_wechat_id = #{companyWechatId}
- <if test="goodsName!=null and goodsName!=''">
- AND b.goods_name LIKE CONCAT('%',#{goodsName},'%')
- </if>
- AND b.goods_type = #{goodsType}
- AND b.norm_type = 'M'
- </select>
- <select id="websitTradePage" resultType="com.gree.mall.manager.bean.material.manage.WebsitTradeVO">
- SELECT
- ${ex.selected}
- FROM websit_sales_pay_order a
- ${ex.query}
- <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
- AND a.websit_id IN
- <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="mAlonePage" resultType="com.gree.mall.manager.bean.material.base.WebsitGoodsAloneMVO">
- SELECT
- ${ex.selected}
- FROM websit_goods_alone a
- ${ex.query}
- AND a.goods_type = 'M'
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="pAlonePage" resultType="com.gree.mall.manager.bean.material.base.WebsitGoodsAlonePVO">
- SELECT
- ${ex.selected}
- FROM websit_goods_alone a
- ${ex.query}
- AND a.goods_type = 'P'
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="enginPayManageList" resultType="com.gree.mall.manager.bean.engin.EnginPayManageVO">
- SELECT
- ${ex.selected},
- IF((a.total_sales_amount - a.total_pay_amount) <![CDATA[ < ]]> 0, 0, (a.total_sales_amount - a.total_pay_amount)) AS totalNotPayAmount
- FROM engin_pay_manage a
- ${ex.query}
- <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
- AND a.websit_id IN
- <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="ex.orderBy == null or ex.orderBy ==''">
- ORDER BY a.create_time DESC
- </if>
- ${ex.orderBy}
- </select>
- <select id="enginPayManageGatherList" resultType="com.gree.mall.manager.bean.engin.EnginPayManageGatherVO">
- SELECT
- ${ex.selected},
- SUM(a.total_sales_amount) AS totalSalesAmount,
- SUM(a.total_pay_amount) AS totalPayAmount,
- IF((SUM(a.total_sales_amount) - SUM(a.total_pay_amount)) <![CDATA[ < ]]> 0, 0, (SUM(a.total_sales_amount) - SUM(a.total_pay_amount))) AS totalNotPayAmount
- FROM engin_pay_manage a
- ${ex.query}
- <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
- AND a.websit_id IN
- <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- GROUP BY a.company_wechat_id, a.project_no
- </select>
- <select id="enginPayManageGatherLastUpdate" resultType="com.gree.mall.manager.bean.engin.EnginPayManageGatherVO">
- SELECT a.project_no, a.last_update_time, a.last_update_by
- FROM engin_pay_manage a
- INNER JOIN (SELECT project_no, MAX(last_update_time) AS max_time
- FROM engin_pay_manage
- WHERE
- company_wechat_id = #{companyWechatId}
- AND project_no IN
- <foreach item="item" index="index" collection="projectList" open="(" separator=","
- close=")">
- #{item}
- </foreach>
- GROUP BY project_no) b
- ON a.project_no = b.project_no AND a.last_update_time = b.max_time AND a.company_wechat_id = #{companyWechatId}
- </select>
- </mapper>
|