| | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 过渡Mapper接口 |
| | |
| | | */ |
| | | public int deleteTbTransitionByIds(String[] ids); |
| | | |
| | | @Delete("DELETE FROM tb_transition WHERE cus_id=#{cusId}") |
| | | @Delete("DELETE FROM tb_transition WHERE cus_id=#{cusId} and isnull(tj_num)") |
| | | public boolean deletedTbTransitionByCusId(String cusId); |
| | | |
| | | |
| | | @Select("SELECT * FROM tb_transition WHERE cus_id=#{cusId} AND pac_id=#{pacId}") |
| | | @Delete("DELETE FROM tb_transition WHERE tj_num=#{tjNum}") |
| | | public boolean deletedTbTransitionByTjNum(String tjNum); |
| | | |
| | | @Delete("DELETE FROM tb_transition WHERE isnull(tj_num) and cus_id=#{cdId} and parent_pro_id=#{proId}") |
| | | public boolean delTbBycusCardIdAndProId(@Param("cdId") String cdId,@Param("proId")String proId); |
| | | |
| | | @Update("UPDATE tb_transition a SET "+ |
| | | "a.tj_num=null," + |
| | | "a.card_id=0" + |
| | | " WHERE a.tj_num=#{tjNum}") |
| | | boolean updateTbTransitionByTjNum(String tjNum); |
| | | |
| | | @Select("SELECT * FROM tb_transition WHERE cus_id=#{cusId} AND pac_id=#{pacId} and isnull(tj_num)") |
| | | public List<TbTransition> getTbTransitionListByCusIdAndPac(@Param("cusId") String cusId,@Param("pacId") String pacId); |
| | | |
| | | @Select("SELECT * FROM tb_transition WHERE cus_id=#{cusId} and card_id=#{cardId}") |
| | | public List<TbTransition> getTbTransitionListByCusId(@Param("cusId")String cusId,@Param("cardId")String cardId); |
| | | |
| | | @Delete("DELETE FROM tb_transition WHERE cus_id=#{cusId} AND !ISNULL(pac_id) and card_id=#{cardId}") |
| | | @Select("SELECT * FROM tb_transition WHERE cus_id=#{cusId} and card_id=#{cardId} and jxbz=#{jxbz}") |
| | | public List<TbTransition> getBlTbTransitionListByCusId(@Param("cusId")String cusId,@Param("cardId")String cardId,@Param("jxbz") String jxbz); |
| | | |
| | | @Delete("DELETE FROM tb_transition WHERE cus_id=#{cusId} AND !ISNULL(pac_id) and isnull(tj_num)") |
| | | public boolean deletedTbTransitionListByCusIdAndPac(@Param("cusId")String cusId,@Param("cardId")String cardId); |
| | | |
| | | @Delete("DELETE FROM tb_transition WHERE cus_id=#{cusId} AND ISNULL(tj_num)and card_id=#{cardId}") |
| | |
| | | // @Select("SELECT * FROM tb_transition WHERE cus_id=#{cusId} AND ISNULL(pac_id) AND pro_id =#{proId}") |
| | | // public List<TbTransition> getTbTransitionListByCusIdAndPacIdAndProId(@Param("cusId") String cusId,@Param("proId") String proId); |
| | | |
| | | @Select("SELECT * FROM tb_transition WHERE cus_id=#{cusId} AND pro_id =#{proId}") |
| | | @Select("SELECT * FROM tb_transition WHERE cus_id=#{cusId} AND pro_id =#{proId} and ISNULL(tj_num)") |
| | | public List<TbTransition> getTbTransitionListByCusIdAndPacIdAndProId(@Param("cusId") String cusId,@Param("proId") String proId); |
| | | |
| | | @Select("SELECT DISTINCT pac_id FROM tb_transition WHERE cus_id=#{cusId} AND !ISNULL(pac_id)") |
| | | @Select("SELECT DISTINCT pac_id FROM tb_transition WHERE cus_id=#{cusId} AND !ISNULL(pac_id) AND ISNULL(tj_num)") |
| | | String getTbTransitionPacIdByCusIdAndPac(String cusId); |
| | | |
| | | @Select("SELECT SUM(a.now_price) now_price FROM tb_transition a WHERE cus_id=#{cusId}") |
| | |
| | | |
| | | @Update("UPDATE tb_transition a SET \n" + |
| | | "a.ord_price=a.now_price,\n" + |
| | | "a.now_price=a.ord_price*#{discount}," + |
| | | "a.now_price=a.ord_price*(#{discount}/10)," + |
| | | "a.tj_num=#{tjNum}"+ |
| | | " WHERE a.cus_id=#{cusId} ") |
| | | " WHERE a.cus_id=#{cusId} AND ISNULL(a.tj_num) ") |
| | | boolean updateTbTransitionPriceByCusId(@Param("cusId")String cusId,@Param("discount")BigDecimal discount,@Param("tjNum")String tjNum); |
| | | |
| | | |
| | | @Update("UPDATE tb_transition a SET \n" + |
| | | "a.tj_num=#{tjNum}"+ |
| | | " WHERE a.cus_id=#{cusId} AND ISNULL(a.tj_num) ") |
| | | boolean updateTbTransitionTjNumByCusId(@Param("cusId")String cusId,@Param("tjNum")String tjNum); |
| | | |
| | | |
| | | @Update("UPDATE tb_transition a SET \n" + |
| | | " a.now_price=#{jg},\n" + |
| | | " a.tj_num=#{tjNum},\n" + |
| | | " a.card_id=#{cardId},\n" + |
| | | " a.jxbz=#{jxbz}\n" + |
| | | " WHERE a.id=#{id}") |
| | | public boolean updateTbTransitionById(@Param("id")String id,@Param("jxbz")String jxbz,@Param("tjNum")String tjNum,@Param("cardId")String cardId,@Param("jg")BigDecimal jg); |
| | | |
| | | |
| | | @Insert("INSERT INTO tb_transition(\n" + |
| | |
| | | " parent_pro_id,\n" + |
| | | " parent_pro_name,\n" + |
| | | " ord_price,\n" + |
| | | " discount,\n" + |
| | | " now_price,\n" + |
| | | " create_time,\n" + |
| | | " pro_check_method,\n" + |
| | | " pro_type\n" + |
| | | " pro_type,\n" + |
| | | " card_id\n" + |
| | | ")\n" + |
| | | "SELECT\n" + |
| | | "\t#{cusId},\n" + |
| | |
| | | "\tc.pro_name,\n" + |
| | | "\tb.pro_id,\n" + |
| | | "\tb.pro_name,\n" + |
| | | "\tTRUNCATE(c.pro_price * (TRUNCATE ( a.price_now / b.pro_price, 5 )),2),\n" + |
| | | "\tTRUNCATE(c.pro_price * (TRUNCATE ( a.price_now / b.pro_price, 5 )),2),\n" + |
| | | "\t(c.pro_price * c.sl),\n" + |
| | | "\ta.limits,\n" + |
| | | "\t((c.pro_price * c.sl) * (a.limits/10)),\n" + |
| | | "\tSYSDATE(),\n" + |
| | | "\tc.pro_check_method,\n" + |
| | | "\tIFNULL(c.pro_type,'')\n" + |
| | | "\tIFNULL(c.pro_type,''),\n" + |
| | | "\t#{cardId}\n" + |
| | | "FROM\n" + |
| | | "\ttj_package_project a\n" + |
| | | "\tLEFT JOIN tj_project b ON a.pro_id = b.pro_id\n" + |
| | | "\tLEFT JOIN tj_project c ON b.pro_id = c.pro_parent_id\n" + |
| | | "\tLEFT JOIN tj_package d ON a.pac_id=d.pac_id\n" + |
| | | "\t\n" + |
| | | "\tWHERE a.pac_id=#{pacId} and c.deleted=0") |
| | | void saveRedisTransitionByPacId(@Param("cusId") String cusId,@Param("pacId") Long pacId); |
| | | "\tWHERE a.pac_id=#{pacId} and c.deleted=0 and c.pro_status=0") |
| | | void saveRedisTransitionByPacId(@Param("cusId") String cusId,@Param("cardId")String cardId,@Param("pacId") Long pacId); |
| | | |
| | | |
| | | @Insert("INSERT INTO tb_transition \n" + |
| | | "(cus_id, pro_id, pro_name, parent_pro_id, parent_pro_name, ord_price, now_price, create_time, pro_check_method, pro_type ) \n" + |
| | | "(cus_id, pro_id, pro_name, parent_pro_id, parent_pro_name, ord_price, now_price, create_time, pro_check_method, pro_type,card_id ) \n" + |
| | | "SELECT\n" + |
| | | "#{cusId},\n" + |
| | | "a.pro_id,a.pro_name,b.pro_id,b.pro_name,a.pro_price,a.pro_price,SYSDATE(),a.pro_check_method,\n" + |
| | | "IFNULL ( a.pro_type, '' ) \n" + |
| | | "a.pro_id,a.pro_name,b.pro_id,b.pro_name,a.pro_price * a.sl,a.pro_price * a.sl,SYSDATE(),a.pro_check_method,\n" + |
| | | "IFNULL ( a.pro_type, '' ), \n" + |
| | | "#{cardId}\n" + |
| | | "FROM\n" + |
| | | "\ttj_project a\n" + |
| | | "\tLEFT JOIN \n" + |
| | | "\ttj_project b \n" + |
| | | "\tON a.pro_parent_id = b.pro_id \n" + |
| | | "WHERE\n" + |
| | | "\ta.pro_id = #{proId}") |
| | | void saveRedisTransitionByProId(@Param("cusId")String cusId,@Param("proId") Long proId); |
| | | "\ta.pro_id = #{proId} and a.pro_status=0") |
| | | void saveRedisTransitionByProId(@Param("cusId")String cusId,@Param("cardId")String cardId,@Param("proId") Long proId); |
| | | |
| | | |
| | | @Insert("INSERT INTO tb_transition(\n" + |
| | |
| | | " parent_pro_id,\n" + |
| | | " parent_pro_name,\n" + |
| | | " ord_price,\n" + |
| | | " discount,\n" + |
| | | " now_price,\n" + |
| | | " create_time,\n" + |
| | | " pro_check_method,\n" + |
| | |
| | | "c.pro_name,\n" + |
| | | "b.pro_id,\n" + |
| | | "b.pro_name,\n" + |
| | | "c.pro_price * (a.limits/10),\n" + |
| | | "c.pro_price * (a.limits/10),\n" + |
| | | "(c.pro_price * c.sl),\n" + |
| | | "a.limits,\n" + |
| | | "((c.pro_price * c.sl) * (a.limits/10)),\n" + |
| | | "SYSDATE(),\n" + |
| | | "c.pro_check_method,\n" + |
| | | "c.pro_type\n" + |
| | |
| | | "\ttj_grouping_pro a\n" + |
| | | "\tLEFT JOIN tj_project b ON a.pro_id = b.pro_id \n" + |
| | | "\tLEFT JOIN tj_project c ON c.pro_parent_id=b.pro_id\n" + |
| | | "WHERE 1=1 AND a.grouping_id =#{groupingId} and c.deleted=0 ") |
| | | "WHERE 1=1 AND a.grouping_id =#{groupingId} and c.deleted=0 and c.pro_status=0") |
| | | boolean saveTemoTransitionByGroupingId(@Param("cusId")String cusId,@Param("groupingId")String groupingId); |
| | | |
| | | |
| | | @Insert("INSERT INTO tb_transition(\n" + |
| | | " cus_id,\n" + |
| | | " pac_id,\n" + |
| | | " pac_name,\n" + |
| | | " pro_id,\n" + |
| | | " pro_name,\n" + |
| | | " parent_pro_id,\n" + |
| | | " parent_pro_name,\n" + |
| | | " ord_price,\n" + |
| | | " discount,\n" + |
| | | " now_price,\n" + |
| | | " create_time,\n" + |
| | | " pro_check_method,\n" + |
| | | " pro_type,\n" + |
| | | " card_id\n" + |
| | | ")\n" + |
| | | "SELECT\n" + |
| | | "#{cusId},\n" + |
| | | "#{groupingId},\n" + |
| | | "d.grouping_name,\n" + |
| | | "c.pro_id,\n" + |
| | | "c.pro_name,\n" + |
| | | "b.pro_id,\n" + |
| | | "b.pro_name,\n" + |
| | | "(c.pro_price * c.sl),\n" + |
| | | "a.limits,\n" + |
| | | "((c.pro_price * c.sl) * (a.limits/10)),\n" + |
| | | "SYSDATE(),\n" + |
| | | "c.pro_check_method,\n" + |
| | | "c.pro_type,\n" + |
| | | "\t#{cardId}\n" + |
| | | "FROM\n" + |
| | | "\ttj_grouping_pro a \n" + |
| | | "JOIN tj_dw_grouping d ON d.id=a.grouping_id \n" + |
| | | "\tLEFT JOIN tj_project b ON a.pro_id = b.pro_id \n" + |
| | | "\tLEFT JOIN tj_project c ON c.pro_parent_id=b.pro_id\n" + |
| | | "WHERE 1=1 AND a.grouping_id =#{groupingId} and c.deleted=0 and c.pro_status=0") |
| | | boolean ttsaveTemoTransitionByGroupingId(@Param("cusId")String cusId,@Param("cardId") String cardId,@Param("groupingId") String groupingId); |
| | | |
| | | |
| | | // @Select("SELECT b.price_now FROM \n" + |
| | |
| | | // "\tON aa.pac_id=b.pac_id WHERE b.pro_id=#{proId} ") |
| | | // BigDecimal getTbTransitionPriceAndOrdPrice(@Param("cusId")String cusId,@Param("proId")Long proId); |
| | | |
| | | @Select("SELECT SUM(a.now_price) FROM tb_transition a WHERE a.cus_id=#{cusId} AND a.parent_pro_id=#{proId}") |
| | | BigDecimal getTbTransitionPriceAndOrdPrice(@Param("cusId")String cusId,@Param("proId")Long proId); |
| | | @Select("SELECT SUM(a.now_price) FROM tb_transition a WHERE a.cus_id=#{cusId} and isnull(a.tj_num) AND a.parent_pro_id=#{proId}") |
| | | BigDecimal getTbTransitionPriceAndOrdPrice(@Param("cusId")String cusId,@Param("proId")String proId); |
| | | |
| | | |
| | | @Select("SELECT SUM(c.pro_price) FROM tj_project c WHERE c.pro_id IN " + |
| | |
| | | |
| | | @Select("SELECT DISTINCT a.pac_id FROM tb_transition a WHERE a.tj_num=#{tjNum}AND a.card_id=#{cardId} AND !ISNULL(a.pac_id)") |
| | | String selectPacIdByTbTransitionTjNumAndProId(@Param("tjNum")String tjNum,@Param("cardId")String cardId); |
| | | |
| | | @Select("SELECT SUM(a.now_price) FROM tb_transition a WHERE a.cus_id=#{cusId} AND a.parent_pro_id=#{proId} and a.card_id=#{cardId} and a.pac_id=#{pacId} GROUP BY a.parent_pro_id") |
| | | BigDecimal getTbTransitionDxPriceByPac(@Param("cusId")String cusId,@Param("proId")Long proId,@Param("cardId")String cardId,@Param("pacId")Long pacId); |
| | | |
| | | |
| | | @Update("UPDATE tb_transition a \n" + |
| | | "SET \n" + |
| | | "a.card_id=#{cardId}\n" + |
| | | "WHERE\n" + |
| | | "\ta.cus_id =#{idCard}\n" + |
| | | "\tAND a.tj_num = #{tjNumber}") |
| | | boolean updateCardIdByTjNumAndIdCard(@Param("idCard")String idCard,@Param("cardId")String cardId,@Param("tjNumber") String tjNumber); |
| | | |
| | | |
| | | @Delete("DELETE FROM tb_transition WHERE jxbz=#{bldh}") |
| | | void deleteTjOrderDetailByjxbz(String bldh); |
| | | |
| | | /** |
| | | * 根据tjNum和parentProId查询总价 |
| | | * @param tjNum |
| | | * @param parentProId |
| | | * @return |
| | | */ |
| | | @Select("SELECT SUM(now_price) FROM `tb_transition` WHERE `tj_num` = #{tjNum} AND `parent_pro_id` = #{parentProId}") |
| | | BigDecimal getLisPriceByTjNumAndParentProId(@Param("tjNum")String tjNum,@Param("parentProId")String parentProId); |
| | | |
| | | /** |
| | | * 根据tjNum和parentProId查询总价 |
| | | * @param tjNum |
| | | * @param parentProId |
| | | * @return |
| | | */ |
| | | @Select({ |
| | | "<script>", |
| | | "SELECT SUM(now_price) FROM `tb_transition`", |
| | | "WHERE `tj_num` = #{tjNum}", |
| | | "AND `parent_pro_id` IN", |
| | | "<foreach item='item' index='index' collection='parentProId' open='(' separator=',' close=')'>", |
| | | "#{item}", |
| | | "</foreach>", |
| | | "</script>" |
| | | }) |
| | | BigDecimal getLisPriceByTjNumAndInParentProId(@Param("tjNum") String tjNum, @Param("parentProId") List<String> parentProId); |
| | | |
| | | @Select({ |
| | | "<script>", |
| | | "SELECT SUM(now_price) FROM `tb_transition`", |
| | | "WHERE `tj_num` = #{tjNum}", |
| | | "AND `pro_id` IN", |
| | | "<foreach item='item' index='index' collection='proId' open='(' separator=',' close=')'>", |
| | | "#{item}", |
| | | "</foreach>", |
| | | "</script>" |
| | | }) |
| | | BigDecimal getLisPriceByTjNumAndInProId(@Param("tjNum") String tjNum, @Param("proId") List<Long> parentProId); |
| | | |
| | | |
| | | |
| | | @Select("SELECT GROUP_CONCAT(c.pro_name SEPARATOR ' ; ' ) FROM tj_package_project b JOIN tj_project c ON c.pro_id=b.pro_id\n" + |
| | | "\n" + |
| | | "WHERE b.pro_id IN(SELECT DISTINCT a.parent_pro_id FROM tb_transition a WHERE a.cus_id=#{idCard} AND ISNULL(a.tj_num))" + |
| | | "AND b.pac_id=#{pacId}") |
| | | String panduantaocanshifouchongfu(@Param("idCard") String idCard,@Param("pacId") Long pacId); |
| | | |
| | | |
| | | |
| | | @Select("SELECT GROUP_CONCAT(c.pro_name SEPARATOR ' ; ' ) FROM tj_grouping_pro b JOIN tj_project c ON c.pro_id=b.pro_id\n" + |
| | | "\n" + |
| | | "WHERE b.pro_id IN(SELECT DISTINCT a.parent_pro_id FROM tb_transition a WHERE a.cus_id=#{idCard} AND ISNULL(a.tj_num))" + |
| | | "AND b.grouping_id=#{pacId}") |
| | | String ttpanduantaocanshifouchongfu(@Param("idCard") String idCard,@Param("pacId") Long pacId); |
| | | |
| | | |
| | | @Select("SELECT a.parent_pro_id,a.cus_id,a.parent_pro_name pro_name,b.pro_type,SUM(a.now_price) now_price,SUM(a.ord_price) ord_price,b.pro_check_method,a.discount FROM tb_transition a " + |
| | | "LEFT JOIN tj_project b ON b.pro_id=a.parent_pro_id WHERE ISNULL(a.tj_num) AND a.cus_id=#{idCard} GROUP BY a.parent_pro_id") |
| | | List<TbTransition> newgetTransitionList(String cusId); |
| | | |
| | | |
| | | @Select("SELECT * FROM tb_transition a WHERE a.tj_num=#{tjNumber} AND a.cus_id=#{idCard} AND a.now_price>0 AND a.discount !=10 ORDER BY a.create_time DESC LIMIT 1 \n") |
| | | TbTransition getOnwTbTransition(@Param("idCard") String idCard,@Param("tjNumber")String tjNumber); |
| | | |
| | | |
| | | @Update("UPDATE tb_transition t JOIN (SELECT a.id FROM tb_transition a \n" + |
| | | "WHERE a.cus_id=#{idCard} AND a.pac_id=#{pacId} " + |
| | | "AND ISNULL(a.tj_num) AND a.now_price !=0 ORDER BY a.now_price DESC LIMIT 1)aa ON aa.id=t.id\n" + |
| | | "SET \n" + |
| | | "t.now_price=(t.now_price+#{cj})\n" + |
| | | "WHERE t.id=aa.id") |
| | | void buxiangmuchajia(@Param("idCard") String idCard,@Param("pacId") String pacId,@Param("proId") String proId,@Param("cj") BigDecimal cj); |
| | | |
| | | |
| | | @Select("SELECT a.pac_id FROM tb_transition a WHERE a.cus_id=#{idCard} AND isnull(a.tj_num) and !isnull(a.pac_id) LIMIT 1 ") |
| | | String getTbTransitionPacId(String cusId); |
| | | |
| | | |
| | | @Select("SELECT SUM(a.now_price) FROM tb_transition a WHERE a.tj_num=#{tjNum} AND a.parent_pro_id=#{proId}") |
| | | BigDecimal getTbTransitionNewPriceByTjNumAndParentId(@Param("tjNum")String tjNum,@Param("proId")String proId); |
| | | |
| | | |
| | | @Select("SELECT SUM(a.ord_price) FROM tb_transition a WHERE a.tj_num=#{tjNum} AND a.parent_pro_id=#{proId}") |
| | | BigDecimal getTbTransitionOrdPriceByTjNumAndParentId(@Param("tjNum")String tjNum,@Param("proId")String proId); |
| | | |
| | | @Select("SELECT SUM(a.ord_price) FROM tb_transition a WHERE a.tj_num=#{tjNum} ") |
| | | BigDecimal sumTbTransitionOrdPriceByTjNum(@Param("tjNum")String tjNum); |
| | | |
| | | @Select("SELECT SUM(a.ord_price) FROM tb_transition a WHERE a.cus_id=#{tjNum} and isnull(a.tj_num)") |
| | | BigDecimal sumTbTransitionOrdPriceByTjNumIsNull(@Param("tjNum")String tjNum); |
| | | |
| | | @Select("SELECT SUM(a.now_price) FROM tb_transition a WHERE a.tj_num=#{tjNum}") |
| | | BigDecimal sumTbTransitionNowPriceByTjNum(@Param("tjNum")String tjNum); |
| | | |
| | | @Select("SELECT SUM(a.now_price) FROM tb_transition a WHERE a.cus_id=#{tjNum} and isnull(a.tj_num)") |
| | | BigDecimal sumTbTransitionNowPriceByTjNumIsNull(@Param("tjNum")String tjNum); |
| | | |
| | | @Select("SELECT aa.parent_pro_id xmid,(g.price_now-aa.ys)cj FROM tj_package_project g JOIN (\n" + |
| | | " SELECT a.parent_pro_id,SUM(a.now_price)ys FROM tb_transition a WHERE a.cus_id=#{cusIdCard} " + |
| | | " AND pac_id=#{pacId} AND ISNULL(a.tj_num) GROUP BY a.parent_pro_id)aa\n" + |
| | | "ON\n" + |
| | | "trim(g.pro_id)=trim(aa.parent_pro_id ) where g.pac_id=#{pacId} AND (g.price_now-aa.ys)>0;") |
| | | List<Map<String,Object>> addTbhuoquxiangmuchajia(@Param("pacId") String pacId, @Param("cusIdCard") String cusIdCard); |
| | | |
| | | } |