Commit 1be9e686 authored by lilei's avatar lilei

高端定制Mapper

parent c143166c
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetAccountProductRelation;
import com.zfxftech.telmarket.common.pojo.dao.high.HighAccountProductRelation;
import com.zfxftech.telmarket.common.pojo.dto.ProductCustomerFansDto;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 账户和产品关联信息表
*
* @author jianghua
* @version 1.0
* @date 2021-08-24 15:55
*/
@Repository
public interface HighAccountProductRelationMapper extends BaseMapper<HighAccountProductRelation> {
@Select("select" +
" pr.product_id as productId," +
" pr.customer_id as customerId," +
" u.name as customerName," +
" p.product_name as productName," +
" f.id as tpFansId," +
" f.openid as tpFansOpenId," +
" f.unionid as tpFansUnionidId," +
" f.status as status," +
" pr.wid as wid" +
" from high_account_product_relation as pr" +
" left join tp_fans as f on pr.tp_fans_id = f.id" +
" left join us_member_base as u on pr.customer_id=u.id" +
" left join high_product as p on pr.product_id = p.id" +
" where pr.product_id= #{productId} and pr.status>0 and f.id is not null")
List<ProductCustomerFansDto> queryProductUserList(Long productId);
}
\ No newline at end of file
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.CodeInquiry;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetCodeInquiry;
import com.zfxftech.telmarket.common.pojo.dao.high.HighCodeInquiry;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @version V1.0
* @title: CodeInquiryMapper
* @description:
* @author: zw
* @date: 2021/12/64:04 下午
*/
@Repository
public interface HighCodeInquiryMapper extends BaseMapper<HighCodeInquiry> {
List<HighCodeInquiry> getCodeInquiryList(Map<String, Object> pram);
List<HighCodeInquiry> getCodeInquirySimulatedList(Map<String, Object> pram);
}
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetCommonReviews;
import com.zfxftech.telmarket.common.pojo.dao.high.HighCommonReviews;
import org.springframework.stereotype.Repository;
/**
* @version V1.0
* @title: CommonReviewsMapper
* @description:
* @author: zw
* @date: 2022/2/246:05 下午
*/
@Repository
public interface HighCommonReviewsMapper extends BaseMapper<HighCommonReviews> {
}
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.CustomerInquiryPage;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetCustomerInquiryPage;
import com.zfxftech.telmarket.common.pojo.dao.high.HighCustomerInquiryPage;
import com.zfxftech.telmarket.common.pojo.request.facade.customer.inquiry.QueryCustomerInquiryFacadeListVO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* 账户和产品关联信息表
*
* @author jianghua
* @version 1.0
* @date 2021-08-24 15:55
*/
@Repository
public interface HighCustomerInquiryMapper extends BaseMapper<HighCustomerInquiryPage> {
List<HighCustomerInquiryPage> selectCustomerInquiryPageList(Map<String, Object> pram);
List<QueryCustomerInquiryFacadeListVO> selectCustomerInquiryList(Map<String, Object> pram);
}
\ No newline at end of file
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetFrozenRecord;
import com.zfxftech.telmarket.common.pojo.dao.high.HighFrozenRecord;
import org.springframework.stereotype.Repository;
@Repository
public interface HighFrozenRecordMapper extends BaseMapper<HighFrozenRecord> {
}
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.InitialFundAdjustmentLog;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetInitialFundAdjustmentLog;
import com.zfxftech.telmarket.common.pojo.dao.high.HighInitialFundAdjustmentLog;
public interface HighInitialFundAdjustmentLogMapper extends BaseMapper<HighInitialFundAdjustmentLog> {
}
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.IntelligentSendNum;
import com.zfxftech.telmarket.common.pojo.dao.PushRule;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetIntelligentSendNum;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetPushRule;
import com.zfxftech.telmarket.common.pojo.dao.high.HighIntelligentSendNum;
import com.zfxftech.telmarket.common.pojo.dao.high.HighPushRule;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @version V1.0
* @title: IntelligentSendServiceMapper
* @description:
* @author: zw
* @date: 2021/11/1810:54 上午
*/
@Repository
public interface HighIntelligentSendMapper extends BaseMapper<HighPushRule> {
List<HighPushRule> queryIntelligentSendList(Map<String, Object> params);
List<HighIntelligentSendNum> querySendUserNum(Map<String, Object> params);
}
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetMarketProfitLog;
import com.zfxftech.telmarket.common.pojo.dao.high.HighMarketProfitLog;
import org.springframework.stereotype.Repository;
@Repository
public interface HighMarketProfitLogMapper extends BaseMapper<HighMarketProfitLog> {
}
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetMessageLogger;
import com.zfxftech.telmarket.common.pojo.dao.high.HighMessageLogger;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @version V1.0
* @title: CommonMessageLoggerMapper
* @description:
* @author: zw
* @date: 2021/11/265:06 下午
*/
@Repository
public interface HighMessageLoggerMapper extends BaseMapper<HighMessageLogger> {
int insertListBatch(List<HighMessageLogger> messageLoggerList);
}
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.PositionTradeInfoRecord;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetPositionTradeInfoRecord;
import com.zfxftech.telmarket.common.pojo.dao.high.HighPositionTradeInfoRecord;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @version V1.0
* @title: PositionTradeInfoRecordMapper
* @description:
* @author: zw
* @date: 2022/1/289:32 上午
*/
@Repository
public interface HighPositionTradeInfoRecordMapper extends BaseMapper<HighPositionTradeInfoRecord> {
List<HighPositionTradeInfoRecord> pagePositionTradeInfoRecordGroupByBatch(Map<String, Object> columnMap);
}
package com.zfxftech.telmarket.mapper.business.high;
import com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRule;
import com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface HighProductConfigRuleMapper {
long countByExample(HighProductConfigRuleExample example);
int deleteByExample(HighProductConfigRuleExample example);
int deleteByPrimaryKey(Integer id);
int insert(HighProductConfigRule record);
int insertSelective(HighProductConfigRule record);
List<HighProductConfigRule> selectByExample(HighProductConfigRuleExample example);
HighProductConfigRule selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") HighProductConfigRule record, @Param("example") HighProductConfigRuleExample example);
int updateByExample(@Param("record") HighProductConfigRule record, @Param("example") HighProductConfigRuleExample example);
int updateByPrimaryKeySelective(HighProductConfigRule record);
int updateByPrimaryKey(HighProductConfigRule record);
}
\ No newline at end of file
package com.zfxftech.telmarket.mapper.business.high;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetProductConfigRuleRel;
import com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleRel;
import com.zfxftech.telmarket.common.pojo.dao.product.ProductConfigRuleRel;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface HighProductConfigRuleRelMapper {
// int deleteByExample(ProductConfigRuleRelExample example);
int deleteByPrimaryKey(Integer id);
int deleteByRuleId(@Param("ruleId") Integer ruleId);
int insert(HighProductConfigRuleRel record);
int insertSelective(HighProductConfigRuleRel record);
// List<ProductConfigRuleRel> selectByExample(ProductConfigRuleRelExample example);
HighProductConfigRuleRel selectByPrimaryKey(Integer id);
// int updateByExampleSelective(@Param("record") ProductConfigRuleRel record, @Param("example") ProductConfigRuleRelExample example);
// int updateByExample(@Param("record") ProductConfigRuleRel record, @Param("example") ProductConfigRuleRelExample example);
int updateByPrimaryKeySelective(HighProductConfigRuleRel record);
int updateByPrimaryKey(HighProductConfigRuleRel record);
List<HighProductConfigRuleRel> selectByRuleId(@Param("ruleId") Integer ruleId);
List<HighProductConfigRuleRel> selectByProductIdAndOrderBy(@Param("productId")Integer productId, @Param("orderByColumn") String orderByColumn, @Param("orderByDirection") String orderByDirection );
List<HighProductConfigRuleRel> selectByRuleIdAndRuleType(@Param("ruleId")Integer ruleId, @Param("ruleType")Integer type);
List<HighProductConfigRuleRel> selectByProductId(@Param("productId")Integer productId);
List<HighProductConfigRuleRel> selectByProductIdListAndRuleType(@Param("productIdList") List<Integer> idList, @Param("ruleType") Integer type);
}
\ No newline at end of file
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetProduct;
import org.springframework.stereotype.Repository;
/**
* @author jianghua
* @version 1.0
* @date 2021-08-24 15:55
*/
@Repository
public interface HighProductMapper extends BaseMapper<AssetProduct> {
}
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetSendFromLog;
public interface HighSendFromLogMapper extends BaseMapper<AssetSendFromLog> {
}
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetSendFromPositionLog;
public interface HighSendFromPositionLogMapper extends BaseMapper<AssetSendFromPositionLog> {
}
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetStockInputLog;
import com.zfxftech.telmarket.common.pojo.dao.high.HighStockInputLog;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* 用户股票持仓
*
* @author jianghua
* @version 1.0
* @date 2021-08-24 15:55
*/
@Repository
public interface HighStockInputLogMapper extends BaseMapper<HighStockInputLog> {
List<HighStockInputLog> queryStockInputLogs(Map<String, Object> param);
}
\ No newline at end of file
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.MemberStockPage;
import com.zfxftech.telmarket.common.pojo.dao.StockPosition;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetMemberStockPage;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetStockPosition;
import com.zfxftech.telmarket.common.pojo.dao.high.HighMemberStockPage;
import com.zfxftech.telmarket.common.pojo.dao.high.HighStockPosition;
import com.zfxftech.telmarket.common.pojo.dto.remind.FullStockPositionTask;
import com.zfxftech.telmarket.common.pojo.dto.remind.StockPositionTask;
import com.zfxftech.telmarket.common.pojo.request.statistics.CurrDayRiseDownDataList;
import com.zfxftech.telmarket.common.pojo.request.statistics.RealTimeCodeQueryDataList;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* 用户股票持仓
*
* @author jianghua
* @version 1.0
* @date 2021-08-24 15:55
*/
@Repository
public interface HighStockPositionMapper extends BaseMapper<HighStockPosition> {
List<HighMemberStockPage> selectCustomerPositionList(Map<String, Object> pram);
List<HighStockPosition> queryStockPositionsContainIsDeleted(Long marketId);
List<StockPositionTask> getStockPositionTask(@Param("productId") Long productId, @Param("code") String code);
List<FullStockPositionTask> getProductCheckFullStopTask();
Integer selectCurrDayRiseDownStockNum(Map<String, Object> pram);
List<CurrDayRiseDownDataList> selectCurrDayRiseDownDataList(Map<String, Object> pram);
List<RealTimeCodeQueryDataList> selectRealTimeCodeQueryDataList(Map<String, Object> pram);
}
\ No newline at end of file
package com.zfxftech.telmarket.mapper.business.high;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zfxftech.telmarket.common.pojo.dao.asset.AssetStockProfitLog;
import com.zfxftech.telmarket.common.pojo.dao.high.HighStockProfitLog;
/**
* @Description TODO
* @Author Dell
* @Date 2021/11/23 15:40
*/
public interface HighStockProfitLogMapper extends BaseMapper<HighStockProfitLog> {
}
<?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.zfxftech.telmarket.mapper.business.high.HighCodeInquiryMapper">
<resultMap id="BaseResultMap" type="com.zfxftech.telmarket.common.pojo.dao.high.HighCodeInquiry">
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="real_market_id" property="realMarketId" jdbcType="VARCHAR"/>
<result column="simulated_market_id" property="simulatedMarketId" jdbcType="VARCHAR"/>
<result column="accountType" property="accountType" jdbcType="VARCHAR"/>
<result column="product_name" property="productName" jdbcType="VARCHAR"/>
<result column="product_type" property="productType" jdbcType="BIGINT"/>
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="stockName" property="stockName" jdbcType="VARCHAR"/>
<result column="cost" property="cost" jdbcType="DECIMAL"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="recent_closing_price" property="recentClosingPrice" jdbcType="DECIMAL"/>
<result column="riseDownRange" property="riseDownRange" jdbcType="DECIMAL"/>
<result column="profitLossRatio" property="profitLossRatio" jdbcType="DECIMAL"/>
<result column="days" property="days" jdbcType="VARCHAR"/>
<result column="industry" property="industry" jdbcType="VARCHAR"/>
<result column="ydayRiseDownRange" property="ydayRiseDownRange" jdbcType="DECIMAL"/>
</resultMap>
<select id="getCodeInquiryList" resultMap="BaseResultMap" parameterType="java.util.Map">
select
f.*
from (select umb.name ,
"simulated" as accountType,
apr.simulated_market_id,
apr.real_market_id,
apr.product_name,
apr.product_type,
sp.`code`,
sp.name as stockName,
sp.cost,
sp.rise_down_range as riseDownRange,
sp.profit_loss_ratio as profitLossRatio,
sp.created_time,
sc.recent_closing_price,
sc.industry,
sp.yday_rise_down_range as ydayRiseDownRange,
DATEDIFF(now(),sp.created_time) as days
from high_stock_position sp
INNER JOIN high_account_product_relation apr on sp.market_id = apr.simulated_market_id
INNER JOIN us_member_base umb ON sp.customer_id = umb.id
INNER JOIN stocks_code sc ON sp.`code` = sc.symbol
INNER JOIN high_product p ON p.`id` = sp.product_id
<where>
<if test="companyId != null">
AND umb.company_id = #{companyId}
</if>
<if test="userId != null">
AND p.analyst = #{userId}
</if>
<if test="stockCode != null">
AND (sp.code = #{stockCode} OR sp.name = #{stockCode})
</if>
<if test="productId != null">
AND apr.product_id = #{productId}
</if>
<if test="productType != null">
AND apr.product_type = #{productType}
</if>
<if test="industry != null">
AND sc.industry = #{industry}
</if>
<if test="profitLossUp != null">
AND profitLoss <![CDATA[<=]]> #{profitLossUp}
</if>
<if test="profitLossLow != null">
AND profitLoss <![CDATA[>=]]> #{profitLossLow}
</if>
<if test="dayIncreaseUp != null">
AND dayIncrease <![CDATA[<=]]> #{dayIncreaseUp}
</if>
<if test="dayIncreaseLow != null">
AND dayIncrease <![CDATA[>=]]> #{dayIncreaseLow}
</if>
<if test="bugTimeLow != null">
AND sp.created_time <![CDATA[>=]]> #{bugTimeLow}
</if>
<if test="bugTimeUp != null">
AND sp.created_time <![CDATA[<=]]> #{bugTimeUp}
</if>
AND sp.is_deleted = 0
</where>
UNION
select umb.name ,
"real" as accountType,
apr.simulated_market_id,
apr.real_market_id,
apr.product_name,
apr.product_type,
sp.`code`,
sp.name,
sp.cost,
sp.rise_down_range as riseDownRange,
sp.profit_loss_ratio as profitLossRatio,
sp.created_time,
sc.recent_closing_price,
sc.industry,
sp.yday_rise_down_range as ydayRiseDownRange,
DATEDIFF(now(),sp.created_time) as days
from high_stock_position sp
INNER JOIN high_account_product_relation apr on sp.market_id = apr.real_market_id
INNER JOIN us_member_base umb ON sp.customer_id = umb.id
INNER JOIN stocks_code sc ON sp.`code` = sc.symbol
INNER JOIN high_product p ON p.`id` = sp.product_id
<where>
<if test="companyId != null">
AND umb.company_id = #{companyId}
</if>
<if test="userId != null">
AND p.analyst = #{userId}
</if>
<if test="stockCode != null">
AND (sp.code = #{stockCode} OR sp.name = #{stockCode})
</if>
<if test="productId != null">
AND apr.product_id = #{productId}
</if>
<if test="productType != null">
AND apr.product_type = #{productType}
</if>
<if test="industry != null">
AND sc.industry = #{industry}
</if>
<if test="profitLossUp != null">
AND profitLoss <![CDATA[<=]]> #{profitLossUp}
</if>
<if test="profitLossLow != null">
AND profitLoss <![CDATA[>=]]> #{profitLossLow}
</if>
<if test="dayIncreaseUp != null">
AND dayIncrease <![CDATA[<=]]> #{dayIncreaseUp}
</if>
<if test="dayIncreaseLow != null">
AND dayIncrease <![CDATA[>=]]> #{dayIncreaseLow}
</if>
<if test="buyStartTime != null">
AND sp.created_time <![CDATA[>=]]> #{bugTimeLow}
</if>
<if test="buyEndTime != null">
AND sp.created_time <![CDATA[<=]]> #{bugTimeUp}
</if>
AND sp.is_deleted = 0
</where>
) f
<where>
<if test="accountType != null">
AND f.accountType = #{accountType}
</if>
</where>
<if test="orderBy != null ">
ORDER BY ${orderBy[0]} ${orderBy[1]}
<!-- <foreach item="item" index="index" collection="orderBy" open=" " separator="," close=" ">-->
<!-- ${item}-->
<!-- </foreach>-->
</if>
</select>
<select id="getCodeInquirySimulatedList" resultMap="BaseResultMap" parameterType="java.util.Map">
select
f.*
from (select umb.name ,
"simulated" as accountType,
apr.simulated_market_id,
apr.real_market_id,
apr.product_name,
apr.product_type,
sp.`code`,
sp.name as stockName,
sp.cost,
sp.rise_down_range as riseDownRange,
sp.profit_loss_ratio as profitLossRatio,
sp.created_time,
sc.recent_closing_price,
DATEDIFF(now(),sp.created_time) as days
from stock_position sp
INNER JOIN account_product_relation apr on sp.market_id = apr.simulated_market_id
INNER JOIN us_member_base umb ON sp.customer_id = umb.id
INNER JOIN stocks_code sc ON sp.`code` = sc.symbol
INNER JOIN product p ON p.`id` = sp.product_id
<where>
<if test="companyId != null">
AND umb.company_id = #{companyId}
</if>
<if test="userId != null">
AND p.analyst = #{userId}
</if>
<if test="stockCode != null">
AND (sp.code = #{stockCode} OR sp.name = #{stockCode})
</if>
<if test="productId != null">
AND apr.product_id = #{productId}
</if>
<if test="productType != null">
AND apr.product_type = #{productType}
</if>
<if test="profitLossUp != null">
AND profitLoss <![CDATA[<=]]> #{profitLossUp}
</if>
<if test="profitLossLow != null">
AND profitLoss <![CDATA[>=]]> #{profitLossLow}
</if>
<if test="dayIncreaseUp != null">
AND dayIncrease <![CDATA[<=]]> #{dayIncreaseUp}
</if>
<if test="dayIncreaseLow != null">
AND dayIncrease <![CDATA[>=]]> #{dayIncreaseLow}
</if>
<if test="bugTimeLow != null">
AND sp.created_time <![CDATA[>=]]> #{bugTimeLow}
</if>
<if test="bugTimeUp != null">
AND sp.created_time <![CDATA[<=]]> #{bugTimeUp}
</if>
AND sp.is_deleted = 0
</where>
) f
<where>
<if test="accountType != null">
AND f.accountType = #{accountType}
</if>
</where>
<if test="orderBy != null ">
ORDER BY ${orderBy[0]} ${orderBy[1]}
</if>
</select>
</mapper>
\ No newline at end of file
<?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.zfxftech.telmarket.mapper.business.high.HighCustomerInquiryMapper">
<resultMap id="BaseResultMap" type="com.zfxftech.telmarket.common.pojo.dao.high.HighCustomerInquiryPage">
<result column="id" property="id" jdbcType="BIGINT"/>
<result column="customer_id" property="customerId" jdbcType="BIGINT"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="product_name" property="productName" jdbcType="VARCHAR"/>
<result column="accountType" property="accountType" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="VARCHAR"/>
<result column="market_id" property="marketId" jdbcType="VARCHAR"/>
<result column="real_market_id" property="realId" jdbcType="VARCHAR"/>
<result column="simulated_market_id" property="simulatedId" jdbcType="VARCHAR"/>
<result column="common_funding" property="commonFunding" jdbcType="DECIMAL"/>
<result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/>
<result column="expired_at" property="expiredAt" jdbcType="TIMESTAMP"/>
<result column="common_position" property="commonPosition" jdbcType="DECIMAL"/>
<result column="common_position_count" property="commonPositionCount" jdbcType="INTEGER"/>
<result column="position_count" property="positionCount" jdbcType="INTEGER"/>
<result column="profit_count" property="profitCount" jdbcType="INTEGER"/>
<result column="common_proportion" property="commonProportion" jdbcType="DECIMAL"/>
<result column="common_total_price" property="commonTotalPrice" jdbcType="DECIMAL"/>
<result column="profitLossPrice" property="profitLossPrice" jdbcType="DECIMAL"/>
<result column="stockPosition" property="stockPosition" jdbcType="DECIMAL"/>
</resultMap>
<resultMap id="BaseResultMapForDataSource" extends="BaseResultMap" type="com.zfxftech.telmarket.common.pojo.request.facade.customer.inquiry.QueryCustomerInquiryFacadeListVO">
<result column="data_source" property="dataSource" jdbcType="VARCHAR"/>
</resultMap>
<sql id="columns">
id,
customer_id,
name,
product_name,
product_type,
status,
market_id,
common_funding,
created_at,
expired_at,
common_position,
common_position_count,
position_count,
profit_count,
investment_style,
account_limit,
created_time,
common_total_price,
common_proportion
</sql>
<select id="selectCustomerInquiryPageList" resultMap="BaseResultMap" parameterType="java.util.Map">
select * from (select * from (select
id,
"simulated" as accountType,
customer_id,
name,
product_name,
product_type,
status,
market_id,
real_market_id,
simulated_market_id,
common_funding,
initial_funding,
created_at,
expired_at,
common_position,
common_position_count,
position_count,
profit_count,
investment_style,
account_limit,
created_time,
CONVERT (IFNULL(common_position,0) / (IFNULL(common_position,0) + common_funding),DECIMAL (15, 2)) AS stockPosition,
CONVERT ((IFNULL(common_position,0) + common_funding),DECIMAL (15, 2)) AS common_total_price,
CONVERT ((IFNULL(common_position,0) + common_funding)-initial_funding,DECIMAL (15, 2)) AS profitLossPrice,
CONVERT (((IFNULL(common_position,0) + common_funding)-initial_funding)/ initial_funding,DECIMAL (15, 4)) AS common_proportion
FROM
(SELECT
a.id,
a.customer_id,
e.`name`,
p.product_name,
p.product_type,
a.initial_funding,
a.status,
a.simulated_market_id as market_id,
a.real_market_id AS real_market_id,
a.simulated_market_id AS simulated_market_id,
a.simulated_funding as common_funding,
a.created_at,
a.expired_at,
(SELECT sum((select recent_closing_price from stocks_code as sc where sc.symbol = b.code ) * count) FROM high_stock_position b WHERE a.simulated_market_id = b.market_id and a.is_deleted='0') AS common_position,
(SELECT count(b.code) FROM high_stock_position b WHERE a.simulated_market_id = b.market_id) AS common_position_count,
(SELECT count(b.code) FROM high_stock_position b WHERE a.simulated_market_id = b.market_id and b.is_deleted = '0') AS
position_count,
(SELECT count(spl.code) FROM high_stock_profit_log spl WHERE a.simulated_market_id = spl.market_id and
spl.profit_price>0) AS profit_count,
e.investment_style,
e.account_limit,
e.created_time
FROM
high_account_product_relation a
INNER JOIN us_member_base e ON a.customer_id = e.id
INNER JOIN high_product p ON a.product_id = p.id
left join us_team_user as t on a.sales_id = t.admin_user_id
<where>
<if test="salesDirector != null">
AND t.team_leader_id = #{salesDirector}
</if>
<if test="salesManager != null">
AND t.parent_leader_id = #{salesManager}
</if>
<if test="analystId != null">
AND p.analyst = #{analystId}
</if>
<if test="companyId != null">
AND e.company_id = #{companyId}
</if>
<if test="customerName != null">
AND e.name = #{customerName}
</if>
<if test="productStatus != null">
AND a.status = #{productStatus}
</if>
<if test="productId != null">
AND p.id = #{productId}
</if>
<if test="buyStartTime != null">
AND a.created_at <![CDATA[>=]]> #{buyStartTime}
</if>
<if test="buyEndTime != null">
AND a.created_at <![CDATA[<=]]> #{buyEndTime}
</if>
<if test="expStartTime != null">
AND a.expired_at <![CDATA[>=]]> #{expStartTime}
</if>
<if test="expEndTime != null">
AND a.expired_at <![CDATA[<=]]> #{expEndTime}
</if>
</where>
) f
) g
<where>
<if test="positionUpper != null">
AND g.stockPosition <![CDATA[<=]]> #{positionUpper}
</if>
<if test="positionLower != null">
AND g.stockPosition <![CDATA[>=]]> #{positionLower}
</if>
<if test="profitAndLossUpper != null">
AND g.common_proportion <![CDATA[<=]]> #{profitAndLossUpper}
</if>
<if test="profitAndLossLower != null">
AND g.common_proportion <![CDATA[>=]]> #{profitAndLossLower}
</if>
<if test="sumAssetsUpper != null">
AND g.common_total_price <![CDATA[<=]]> #{sumAssetsUpper}
</if>
<if test="sumAssetsLower != null">
AND g.common_total_price <![CDATA[>=]]> #{sumAssetsLower}
</if>
</where>
union
select * from (select
id,
"real" as accountType,
customer_id,
name,
product_name,
product_type,
status,
market_id,
real_market_id,
simulated_market_id,
common_funding,
initial_funding,
created_at,
expired_at,
common_position,
common_position_count,
position_count,
profit_count,
investment_style,
account_limit,
created_time,
CONVERT (common_position / (common_position + common_funding),DECIMAL (15, 2)) AS stockPosition,
CONVERT ((common_position + common_funding),DECIMAL (15, 2)) AS common_total_price,
CONVERT ((common_position + common_funding)-initial_funding,DECIMAL (15, 2)) AS profitLossPrice,
CONVERT (((common_position + common_funding)-initial_funding)/ initial_funding,DECIMAL (15, 4)) AS common_proportion
FROM
(SELECT
a.id,
a.customer_id,
e.`name`,
p.product_name,
p.product_type,
a.initial_funding,
a.status,
a.real_market_id as market_id,
a.real_market_id AS real_market_id,
a.simulated_market_id AS simulated_market_id,
a.real_funding as common_funding,
a.created_at,
a.expired_at,
(SELECT sum((select recent_closing_price from stocks_code as sc where sc.symbol = b.code ) * count) FROM high_stock_position b WHERE a.real_market_id = b.market_id and a.is_deleted='0') AS common_position,
(SELECT count(b.code) FROM high_stock_position b WHERE a.real_market_id = b.market_id) AS common_position_count,
(SELECT count(b.code) FROM high_stock_position b WHERE a.real_market_id = b.market_id and b.is_deleted = '0') AS
position_count,
(SELECT count(spl.code) FROM high_stock_profit_log spl WHERE a.real_market_id = spl.market_id and
spl.profit_price>0) AS profit_count,
e.investment_style,
e.account_limit,
e.created_time
FROM
high_account_product_relation a
INNER JOIN us_member_base e ON a.customer_id = e.id
INNER JOIN high_product p ON a.product_id = p.id
left join us_team_user as t on a.sales_id = t.admin_user_id
<where>
<if test="salesDirector != null">
AND t.team_leader_id = #{salesDirector}
</if>
<if test="salesManager != null">
AND t.parent_leader_id = #{salesManager}
</if>
<if test="analystId != null">
AND p.analyst = #{analystId}
</if>
<if test="companyId != null">
AND e.company_id = #{companyId}
</if>
<if test="customerName != null">
AND e.name = #{customerName}
</if>
<if test="productStatus != null">
AND a.status = #{productStatus}
</if>
<if test="productId != null">
AND p.id = #{productId}
</if>
<if test="buyStartTime != null">
AND a.created_at <![CDATA[>=]]> #{buyStartTime}
</if>
<if test="buyEndTime != null">
AND a.created_at <![CDATA[<=]]> #{buyEndTime}
</if>
<if test="expStartTime != null">
AND a.expired_at <![CDATA[>=]]> #{expStartTime}
</if>
<if test="expEndTime != null">
AND a.expired_at <![CDATA[<=]]> #{expEndTime}
</if>
</where>
) f
) g
<where>
<if test="positionUpper != null">
AND g.stockPosition <![CDATA[<=]]> #{positionUpper}
</if>
<if test="positionLower != null">
AND g.stockPosition <![CDATA[>=]]> #{positionLower}
</if>
<if test="profitAndLossUpper != null">
AND g.common_proportion <![CDATA[<=]]> #{profitAndLossUpper}
</if>
<if test="profitAndLossLower != null">
AND g.common_proportion <![CDATA[>=]]> #{profitAndLossLower}
</if>
<if test="sumAssetsUpper != null">
AND g.common_total_price <![CDATA[<=]]> #{sumAssetsUpper}
</if>
<if test="sumAssetsLower != null">
AND g.common_total_price <![CDATA[>=]]> #{sumAssetsLower}
</if>
</where>
ORDER BY id) h
<where>
<if test="accountType != null">
AND h.accountType = #{accountType}
</if>
</where>
<if test="orderBy != null ">
ORDER BY
<foreach item="item" index="index" collection="orderBy" open=" " separator="," close=" ">
#{item}
</foreach>
</if>
</select>
<select id="selectCustomerInquiryList" resultMap="BaseResultMapForDataSource" parameterType="java.util.Map">
select * from (select * from (select
id,
"simulated" as accountType,
customer_id,
name,
product_name,
product_type,
status,
market_id,
real_market_id,
simulated_market_id,
common_funding,
initial_funding,
created_at,
expired_at,
common_position,
common_position_count,
position_count,
profit_count,
investment_style,
account_limit,
created_time,
CONVERT (IFNULL(common_position,0) / (IFNULL(common_position,0) + common_funding),DECIMAL (15, 2)) AS stockPosition,
CONVERT ((IFNULL(common_position,0) + common_funding),DECIMAL (15, 2)) AS common_total_price,
CONVERT ((IFNULL(common_position,0) + common_funding)-initial_funding,DECIMAL (15, 2)) AS profitLossPrice,
CONVERT (((IFNULL(common_position,0) + common_funding)-initial_funding)/ initial_funding,DECIMAL (15, 4)) AS common_proportion,
data_source
FROM
(SELECT
a.id,
a.customer_id,
e.`name`,
p.product_name,
p.product_type,
a.initial_funding,
a.status,
a.simulated_market_id as market_id,
a.real_market_id AS real_market_id,
a.simulated_market_id AS simulated_market_id,
a.simulated_funding as common_funding,
a.created_at,
a.expired_at,
(SELECT sum((select recent_closing_price from stocks_code as sc where sc.symbol = b.code ) * count) FROM high_stock_position b WHERE a.simulated_market_id = b.market_id and a.is_deleted='0') AS common_position,
(SELECT count(b.code) FROM high_stock_position b WHERE a.simulated_market_id = b.market_id) AS common_position_count,
(SELECT count(b.code) FROM high_stock_position b WHERE a.simulated_market_id = b.market_id and b.is_deleted = '0') AS
position_count,
(SELECT count(spl.code) FROM high_stock_profit_log spl WHERE a.simulated_market_id = spl.market_id and
spl.profit_price>0) AS profit_count,
e.investment_style,
e.account_limit,
e.created_time,
e.data_source
FROM
high_account_product_relation a
INNER JOIN us_member_base e ON a.customer_id = e.id
INNER JOIN high_product p ON a.product_id = p.id
left join us_team_user as t on a.sales_id = t.admin_user_id
<where>
<if test="salesDirector != null">
AND (
t.team_leader_id = #{salesDirector}
<if test="dataSource != null">
or e.data_source in
<foreach collection="dataSource" item="d2"
index="index" open="(" close=")" separator=",">
#{d2}
</foreach>
</if>
)
</if>
<if test="salesManager != null">
AND (
t.parent_leader_id = #{salesManager}
<if test="dataSource != null">
or e.data_source in
<foreach collection="dataSource" item="d2"
index="index" open="(" close=")" separator=",">
#{d2}
</foreach>
</if>
)
</if>
<if test="clientDataSource != null">
AND e.data_source = #{clientDataSource}
</if>
<if test="analystId != null">
AND p.analyst = #{analystId}
</if>
<if test="companyId != null">
AND (
e.company_id in
<foreach collection="companyId" item="cid2"
index="index" open="(" close=")" separator=",">
#{cid2}
</foreach>
<if test="dataSource != null">
or e.data_source in
<foreach collection="dataSource" item="d2"
index="index" open="(" close=")" separator=",">
#{d2}
</foreach>
</if>
)
</if>
<if test="customerName != null">
AND e.name = #{customerName}
</if>
<if test="productStatus != null">
AND a.status = #{productStatus}
</if>
<if test="productId != null">
AND p.id = #{productId}
</if>
<if test="buyStartTime != null">
AND a.created_at <![CDATA[>=]]> #{buyStartTime}
</if>
<if test="buyEndTime != null">
AND a.created_at <![CDATA[<=]]> #{buyEndTime}
</if>
<if test="expStartTime != null">
AND a.expired_at <![CDATA[>=]]> #{expStartTime}
</if>
<if test="expEndTime != null">
AND a.expired_at <![CDATA[<=]]> #{expEndTime}
</if>
</where>
) f
) g
<where>
<if test="positionUpper != null">
AND g.stockPosition <![CDATA[<=]]> #{positionUpper}
</if>
<if test="positionLower != null">
AND g.stockPosition <![CDATA[>=]]> #{positionLower}
</if>
<if test="profitAndLossUpper != null">
AND g.common_proportion <![CDATA[<=]]> #{profitAndLossUpper}
</if>
<if test="profitAndLossLower != null">
AND g.common_proportion <![CDATA[>=]]> #{profitAndLossLower}
</if>
<if test="sumAssetsUpper != null">
AND g.common_total_price <![CDATA[<=]]> #{sumAssetsUpper}
</if>
<if test="sumAssetsLower != null">
AND g.common_total_price <![CDATA[>=]]> #{sumAssetsLower}
</if>
</where>
union
select * from (select
id,
"real" as accountType,
customer_id,
name,
product_name,
product_type,
status,
market_id,
real_market_id,
simulated_market_id,
common_funding,
initial_funding,
created_at,
expired_at,
common_position,
common_position_count,
position_count,
profit_count,
investment_style,
account_limit,
created_time,
CONVERT (common_position / (common_position + common_funding),DECIMAL (15, 2)) AS stockPosition,
CONVERT ((common_position + common_funding),DECIMAL (15, 2)) AS common_total_price,
CONVERT ((common_position + common_funding)-initial_funding,DECIMAL (15, 2)) AS profitLossPrice,
CONVERT (((common_position + common_funding)-initial_funding)/ initial_funding,DECIMAL (15, 4)) AS common_proportion,
data_source
FROM
(SELECT
a.id,
a.customer_id,
e.`name`,
p.product_name,
p.product_type,
a.initial_funding,
a.status,
a.real_market_id as market_id,
a.real_market_id AS real_market_id,
a.simulated_market_id AS simulated_market_id,
a.real_funding as common_funding,
a.created_at,
a.expired_at,
(SELECT sum((select recent_closing_price from stocks_code as sc where sc.symbol = b.code ) * count) FROM high_stock_position b WHERE a.real_market_id = b.market_id and a.is_deleted='0') AS common_position,
(SELECT count(b.code) FROM high_stock_position b WHERE a.real_market_id = b.market_id) AS common_position_count,
(SELECT count(b.code) FROM high_stock_position b WHERE a.real_market_id = b.market_id and b.is_deleted = '0') AS
position_count,
(SELECT count(spl.code) FROM high_stock_profit_log spl WHERE a.real_market_id = spl.market_id and
spl.profit_price>0) AS profit_count,
e.investment_style,
e.account_limit,
e.created_time,
e.data_source
FROM
high_account_product_relation a
INNER JOIN us_member_base e ON a.customer_id = e.id
INNER JOIN high_product p ON a.product_id = p.id
left join us_team_user as t on a.sales_id = t.admin_user_id
<where>
<if test="salesDirector != null">
AND (
t.team_leader_id = #{salesDirector}
<if test="dataSource != null">
or e.data_source in
<foreach collection="dataSource" item="d2"
index="index" open="(" close=")" separator=",">
#{d2}
</foreach>
</if>
)
</if>
<if test="salesManager != null">
AND (
t.parent_leader_id = #{salesManager}
<if test="dataSource != null">
or e.data_source in
<foreach collection="dataSource" item="d2"
index="index" open="(" close=")" separator=",">
#{d2}
</foreach>
</if>
)
</if>
<if test="analystId != null">
AND p.analyst = #{analystId}
</if>
<if test="clientDataSource != null">
AND e.data_source = #{clientDataSource}
</if>
<if test="companyId != null">
AND (
e.company_id in
<foreach collection="companyId" item="c1"
index="index" open="(" close=")" separator=",">
#{c1}
</foreach>
<if test="dataSource != null">
or e.data_source in
<foreach collection="dataSource" item="d2"
index="index" open="(" close=")" separator=",">
#{d2}
</foreach>
</if>
)
</if>
<if test="customerName != null">
AND e.name = #{customerName}
</if>
<if test="productStatus != null">
AND a.status = #{productStatus}
</if>
<if test="productId != null">
AND p.id = #{productId}
</if>
<if test="buyStartTime != null">
AND a.created_at <![CDATA[>=]]> #{buyStartTime}
</if>
<if test="buyEndTime != null">
AND a.created_at <![CDATA[<=]]> #{buyEndTime}
</if>
<if test="expStartTime != null">
AND a.expired_at <![CDATA[>=]]> #{expStartTime}
</if>
<if test="expEndTime != null">
AND a.expired_at <![CDATA[<=]]> #{expEndTime}
</if>
</where>
) f
) g
<where>
<if test="positionUpper != null">
AND g.stockPosition <![CDATA[<=]]> #{positionUpper}
</if>
<if test="positionLower != null">
AND g.stockPosition <![CDATA[>=]]> #{positionLower}
</if>
<if test="profitAndLossUpper != null">
AND g.common_proportion <![CDATA[<=]]> #{profitAndLossUpper}
</if>
<if test="profitAndLossLower != null">
AND g.common_proportion <![CDATA[>=]]> #{profitAndLossLower}
</if>
<if test="sumAssetsUpper != null">
AND g.common_total_price <![CDATA[<=]]> #{sumAssetsUpper}
</if>
<if test="sumAssetsLower != null">
AND g.common_total_price <![CDATA[>=]]> #{sumAssetsLower}
</if>
</where>
ORDER BY id) h
<where>
<if test="accountType != null">
AND h.accountType = #{accountType}
</if>
</where>
<if test="orderBy != null ">
ORDER BY
<foreach item="item" index="index" collection="orderBy" open=" " separator="," close=" ">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
<?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.zfxftech.telmarket.mapper.business.high.HighIntelligentSendMapper">
<resultMap id="BaseResultMap" type="com.zfxftech.telmarket.common.pojo.dao.high.HighPushRule">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="customer_id" property="customerId" jdbcType="INTEGER"/>
<result column="stock_pool_id" property="stockPoolId" jdbcType="INTEGER"/>
<result column="push_name" property="pushName" jdbcType="VARCHAR"/>
<result column="product_type" property="productType" jdbcType="VARCHAR"/>
<result column="product_id" property="productId" jdbcType="VARCHAR"/>
<result column="product_name" property="productName" jdbcType="VARCHAR"/>
<result column="buy_time_up" property="buyTimeUp" jdbcType="TIMESTAMP"/>
<result column="buy_time_low" property="buyTimeLow" jdbcType="TIMESTAMP"/>
<result column="pos_time_up" property="posTimeUp" jdbcType="TIMESTAMP"/>
<result column="pos_time_low" property="posTimeLow" jdbcType="TIMESTAMP"/>
<result column="simulate_market_fund_up" property="simulateMarketFundUp" jdbcType="VARCHAR"/>
<result column="simulate_market_fund_low" property="simulateMarketFundLow" jdbcType="VARCHAR"/>
<result column="simulate_market_up" property="simulateMarketUp" jdbcType="INTEGER"/>
<result column="simulate_market_low" property="simulateMarketLow" jdbcType="INTEGER"/>
<result column="max_num" property="maxNum" jdbcType="INTEGER"/>
<result column="day_num" property="dayNum" jdbcType="INTEGER"/>
<result column="push_proportion" property="pushProportion" jdbcType="VARCHAR"/>
<result column="is_deleted" property="isDeleted" jdbcType="VARCHAR"/>
<result column="is_daybuy" property="isDaybuy" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="VARCHAR"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="modify_by" property="modifyBy" jdbcType="VARCHAR"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
<result column="send_time" property="sendTime" jdbcType="TIMESTAMP"/>
<result column="position_count_up" property="positionCountUp" jdbcType="INTEGER"/>
<result column="position_count_low" property="positionCountLow" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="sendResultMap" type="com.zfxftech.telmarket.common.pojo.dao.high.HighIntelligentSendNum">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="customer_id" property="customerId" jdbcType="VARCHAR"/>
<result column="umbName" property="customerName" jdbcType="VARCHAR"/>
<result column="product_id" property="productId" jdbcType="VARCHAR"/>
<result column="product_name" property="productName" jdbcType="VARCHAR"/>
<result column="product_type" property="productType" jdbcType="VARCHAR"/>
<result column="simulated_funding" property="simulatedFunding" jdbcType="DECIMAL"/>
<result column="real_funding" property="realFunding" jdbcType="DECIMAL"/>
<result column="simulated_market_id" property="simulatedMarketId" jdbcType="BIGINT"/>
<result column="real_market_id" property="realMarketId" jdbcType="BIGINT"/>
<result column="union_id" property="unionId" jdbcType="VARCHAR"/>
<result column="investment_style" property="investmentStyle" jdbcType="VARCHAR"/>
<result column="account_limit" property="accountLimit" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
<result column="initial_funding" property="initialFunding" jdbcType="VARCHAR"/>
<collection property="list"
ofType="com.zfxftech.telmarket.common.pojo.dao.StockPosition">
<result column="spId" property="id" jdbcType="INTEGER"/>
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="count" property="count" jdbcType="INTEGER"/>
<result column="cost" property="cost" jdbcType="VARCHAR"/>
<result column="is_deleted" property="isDeleted" jdbcType="BOOLEAN"/>
<result column="market_id" property="marketId" jdbcType="BIGINT"/>
</collection>
</resultMap>
<sql id="columns">
pr.id,customer_id,stock_pool_id,push_name,product_type,product_id,product_name,buy_time_up,
position_count_low,position_count_up,buy_time_low,pos_time_up,pos_time_low,pos_time_up,pos_time_low,simulate_market_fund_up,
simulate_market_fund_low,real_market_up,real_market_low,simulate_market_up,simulate_market_low,
max_num,day_num,push_proportion,is_deleted,is_daybuy,pr.status,created_by,created_time,send_time
</sql>
<select id="queryIntelligentSendList" resultMap="BaseResultMap" parameterType="java.util.Map">
select
<include refid="columns"/>
from high_push_rule AS pr inner join us_admin ua on pr.customer_id = ua.id
<where>
<if test="pushName != null and pushName != ''">
AND pr.push_name like concat('%',#{pushName},'%')
</if>
<if test="status != null and status != ''">
AND pr.status = #{status}
</if>
<if test="createAtStartTime != null">
AND pr.created_time <![CDATA[>=]]> #{createAtStartTime}
</if>
<if test="createAtEndTime != null">
AND pr.created_time <![CDATA[<=]]> #{createAtEndTime}
</if>
<if test="sendAtStartTime != null">
AND pr.send_time <![CDATA[>=]]> #{sendAtStartTime}
</if>
<if test="sendAtEndTime != null">
AND pr.send_time <![CDATA[<=]]> #{sendAtEndTime}
</if>
<if test="flag != null and flag != ''">
AND pr.stock_pool_id IN
(select stock_pool_id from stock_pool_details as spd
<where>
<if test="stockName != null and stockName != ''">
AND spd.stock_name like concat('%',#{stockName},'%')
</if>
<if test="stockCode != null and stockCode != ''">
AND spd.stock_code = #{stockCode}
</if>
</where>
)
</if>
<if test="customerId != null">
AND pr.customer_id = #{customerId}
</if>
<if test="companyId != null">
AND ua.company_id = #{companyId}
</if>
AND pr.is_deleted = '0'
</where>
<if test="orderBy != null ">
ORDER BY pr.${orderBy}
</if>
-- order by pr.created_time DESC
</select>
<select id="querySendUserNum" resultMap="sendResultMap" parameterType="java.util.Map">
SELECT
apr.id,apr.customer_id,apr.product_id,apr.product_type,apr.product_name,apr.real_funding,apr.simulated_funding,
apr.simulated_market_id,apr.real_market_id,sp2.created_time as modify_time,
sp.code,sp.is_deleted,sp.count,sp.cost,sp.id as spId,sp.market_id,
umb.name as umbName, umb.union_id,umb.investment_style,umb.account_limit
,(
select count(1) from high_stock_position as s
where s.market_id=apr.simulated_market_id and s.is_deleted = '0'
) as currPositionNum,
sp2.created_time as buyTime
,apr.initial_funding
from high_account_product_relation as apr
left JOIN high_stock_position as sp
on (apr.product_id = sp.product_id) and (apr.customer_id = sp.customer_id)
left join us_member_base as umb on apr.customer_id = umb.id
left join high_stock_position as sp2 on apr.simulated_market_id = sp2.market_id and sp2.id = (
select max(id)
from high_stock_position
where market_id = apr.simulated_market_id
)
<where>
apr.is_problem = '0'
<if test="buyTimeUp != null">
AND apr.created_time <![CDATA[<=]]> #{buyTimeUp}
</if>
<if test="buyTimeLow != null">
AND apr.created_time <![CDATA[>=]]> #{buyTimeLow}
</if>
<if test="posTimeUp != null">
AND sp.created_time <![CDATA[<=]]> #{posTimeUp}
</if>
<if test="posTimeLow != null">
AND sp.created_time <![CDATA[>=]]> #{posTimeLow}
</if>
<if test="companyId != null">
AND umb.company_id = #{companyId}
</if>
<if test="productList != null">
AND apr.product_id in
<foreach collection="productList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
AND apr.expired_at <![CDATA[>]]> now()
-- AND sp.is_deleted = '0'
</where>
order by sp2.created_time asc,currPositionNum asc
</select>
</mapper>
\ No newline at end of file
<?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.zfxftech.telmarket.mapper.business.high.HighMessageLoggerMapper">
<insert id="insertListBatch" parameterType="java.util.List">
INSERT INTO high_message_log (push_rule_id,
customer_id,
stock_pool_id,
stock_id,
customer_name,
created_by,
modify_by)
VALUE
<foreach collection="messageLoggerList" index="key" item="item" separator="," >
(#{item.pushRuleId},
#{item.customerId},
#{item.stockPoolId},
#{item.stockId},
#{item.customerName},
#{item.createdBy},
null)
</foreach>
</insert>
</mapper>
<?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.zfxftech.telmarket.mapper.business.high.HighPositionTradeInfoRecordMapper">
<resultMap id="BaseResultMap" type="com.zfxftech.telmarket.common.pojo.dao.high.HighPositionTradeInfoRecord">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="operation" property="operation" jdbcType="VARCHAR"/>
<result column="buyingTime" property="buyingTime" jdbcType="TIMESTAMP"/>
<result column="sellingTime" property="sellingTime" jdbcType="TIMESTAMP"/>
<result column="cost" property="cost" jdbcType="DECIMAL"/>
<result column="sellingPrice" property="sellingPrice" jdbcType="DECIMAL"/>
<result column="productIds" property="productIds" jdbcType="VARCHAR"/>
<result column="productType" property="productType" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="VARCHAR"/>
<result column="holdingDays" property="holdingDays" jdbcType="INTEGER"/>
<result column="profitRatio" property="profitRatio" jdbcType="DECIMAL"/>
<result column="companyId" property="companyId" jdbcType="INTEGER"/>
<result column="entrustWay" property="entrustWay" jdbcType="INTEGER"/>
<result column="customerIds" property="customerIds" jdbcType="VARCHAR"/>
<result column="trust_source" property="trustSource" jdbcType="INTEGER"/>
<result column="trust_source_name" property="trustSourceName" jdbcType="VARCHAR"/>
<result column="industry" property="industry" jdbcType="VARCHAR"/>
</resultMap>
<sql id="columns">
id
,buying_batch,code,operation,buying_time,selling_time,cost,selling_price,position_id
,product_id,product_type,customer_id,status,holding_days,profitRatio,companyId,trust_source_name,trust_source
</sql>
<select id="pagePositionTradeInfoRecordGroupByBatch" resultMap="BaseResultMap" parameterType="java.util.Map">
select
buying_batch,
group_concat(distinct apr.customer_id) as customerIds,
max(code) as code,
max(industry) as industry,
max(operation) as operation,
max(buying_time) as buyingTime,
max(selling_time) as sellingTime,
max(cost) as cost,
max(selling_price) as sellingPrice,
group_concat(distinct apr.product_id) as productIds,
max(ptir.product_type) as productType,
max(ptir.status) as status,
max(holding_days) as holdingDays,
max(profit_ratio) as profitRatio,
max(companyId) as companyId,
max(trust_source_name) as trust_source_name,
count(buying_batch) as customerNum
from high_position_trade_info_record as ptir
left join high_product as p on ptir.product_id=p.id
inner join high_account_product_relation as apr on ptir.product_id=apr.product_id and ptir.customer_id=apr.customer_id
left join us_member_base as c on apr.customer_id=c.id
where 1= 1
and ((ptir.CODE = "601005"
AND(( ptir.buying_time &lt; "2022-02-10 00:00:00" ) or (ptir.buying_time &gt; "2022-04-17 23:59:59"))) or (
ptir.CODE != "601005"
) )
<if test="productId != null">
AND ptir.product_id = #{productId}
</if>
<if test="code != null">
AND ptir.code = #{code}
</if>
<if test="companyId != null">
AND p.company_id = #{companyId}
AND c.company_id = #{companyId}
</if>
<if test="productType != null and productType != ''">
AND ptir.product_type = #{productType}
</if>
<if test="industry != null and industry != ''">
AND ptir.industry = #{industry}
</if>
<if test="status != null">
AND ptir.status = #{status}
</if>
<if test="buyingTimeUpperLimit != null">
AND ptir.buying_time <![CDATA[<=]]> #{buyingTimeUpperLimit}
</if>
<if test="buyingTimeLowerLimit != null">
AND ptir.buying_time <![CDATA[>=]]> #{buyingTimeLowerLimit}
</if>
<if test="sellingTimeUpperLimit != null">
AND ptir.selling_time <![CDATA[<=]]> #{sellingTimeUpperLimit}
</if>
<if test="sellingTimeLowerLimit != null">
AND ptir.selling_time <![CDATA[>=]]> #{sellingTimeLowerLimit}
</if>
<if test="profitUpperLimit != null">
AND ptir.profit_ratio <![CDATA[<=]]> #{profitUpperLimit}
</if>
<if test="profitLowerLimit != null">
AND ptir.profit_ratio <![CDATA[>=]]> #{profitLowerLimit}
</if>
<if test="analyst != null">
AND p.analyst = #{analyst}
</if>
<if test="trustSource != null">
AND ptir.trust_source = #{trustSource}
</if>
GROUP BY buying_batch
<if test="filterOneMore != null">
HAVING customerNum > 1
</if>
<if test="orderBy != null and orderBy != ''">
<![CDATA[ORDER BY ${orderBy}]]>
</if>
</select>
</mapper>
\ No newline at end of file
<?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.zfxftech.telmarket.mapper.business.high.HighProductConfigRuleMapper">
<resultMap id="BaseResultMap" type="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRule">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="CREATED_BY" jdbcType="INTEGER" property="CREATED_BY"/>
<result column="CREATED_TIME" jdbcType="TIMESTAMP" property="CREATED_TIME"/>
<result column="UPDATED_BY" jdbcType="INTEGER" property="UPDATED_BY"/>
<result column="UPDATED_TIME" jdbcType="TIMESTAMP" property="UPDATED_TIME"/>
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="yields" jdbcType="DECIMAL" property="yields"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="comments" jdbcType="VARCHAR" property="comments"/>
<result column="abortDate" jdbcType="TIMESTAMP" property="abortDate"/>
</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,CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, type, yields, status, comments,abortDate
</sql>
<select id="selectByExample" parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List"/>
from high_product_config_rule
<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 high_product_config_rule
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from high_product_config_rule
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample"
parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleExample">
delete from high_product_config_rule
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRule"
useGeneratedKeys="true" keyProperty="id">
insert into high_product_config_rule (id, CREATED_BY, CREATED_TIME,
UPDATED_BY, UPDATED_TIME, type,
yields, status, comments, abortDate)
values (#{id,jdbcType=INTEGER}, #{CREATED_BY,jdbcType=INTEGER}, #{CREATED_TIME,jdbcType=TIMESTAMP},
#{UPDATED_BY,jdbcType=INTEGER}, #{UPDATED_TIME,jdbcType=TIMESTAMP}, #{type,jdbcType=INTEGER},
#{yields,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, #{comments,jdbcType=VARCHAR},
#{abortDate,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRule">
insert into high_product_config_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="CREATED_BY != null">
CREATED_BY,
</if>
<if test="CREATED_TIME != null">
CREATED_TIME,
</if>
<if test="UPDATED_BY != null">
UPDATED_BY,
</if>
<if test="UPDATED_TIME != null">
UPDATED_TIME,
</if>
<if test="type != null">
type,
</if>
<if test="yields != null">
yields,
</if>
<if test="status != null">
status,
</if>
<if test="comments != null">
comments,
</if>
<if test="abortDate != null">
abortDate,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="CREATED_BY != null">
#{CREATED_BY,jdbcType=INTEGER},
</if>
<if test="CREATED_TIME != null">
#{CREATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="UPDATED_BY != null">
#{UPDATED_BY,jdbcType=INTEGER},
</if>
<if test="UPDATED_TIME != null">
#{UPDATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
<if test="yields != null">
#{yields,jdbcType=DECIMAL},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="comments != null">
#{comments,jdbcType=VARCHAR},
</if>
<if test="abortDate != null">
#{abortDate,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleExample"
resultType="java.lang.Long">
select count(*) from high_product_config_rule
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update high_product_config_rule
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.CREATED_BY != null">
CREATED_BY = #{record.CREATED_BY,jdbcType=INTEGER},
</if>
<if test="record.CREATED_TIME != null">
CREATED_TIME = #{record.CREATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="record.UPDATED_BY != null">
UPDATED_BY = #{record.UPDATED_BY,jdbcType=INTEGER},
</if>
<if test="record.UPDATED_TIME != null">
UPDATED_TIME = #{record.UPDATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="record.type != null">
type = #{record.type,jdbcType=INTEGER},
</if>
<if test="record.yields != null">
yields = #{record.yields,jdbcType=DECIMAL},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.comments != null">
comments = #{record.comments,jdbcType=VARCHAR},
</if>
<if test="record.abortDate != null">
abortDate = #{record.abortDate,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update high_product_config_rule
set id = #{record.id,jdbcType=INTEGER},
CREATED_BY = #{record.CREATED_BY,jdbcType=INTEGER},
CREATED_TIME = #{record.CREATED_TIME,jdbcType=TIMESTAMP},
UPDATED_BY = #{record.UPDATED_BY,jdbcType=INTEGER},
UPDATED_TIME = #{record.UPDATED_TIME,jdbcType=TIMESTAMP},
abortDate = #{record.abortDate,jdbcType=TIMESTAMP},
type = #{record.type,jdbcType=INTEGER},
yields = #{record.yields,jdbcType=DECIMAL},
status = #{record.status,jdbcType=INTEGER},
comments = #{record.comments,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective"
parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRule">
update high_product_config_rule
<set>
<if test="CREATED_BY != null">
CREATED_BY = #{CREATED_BY,jdbcType=INTEGER},
</if>
<if test="CREATED_TIME != null">
CREATED_TIME = #{CREATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="UPDATED_BY != null">
UPDATED_BY = #{UPDATED_BY,jdbcType=INTEGER},
</if>
<if test="UPDATED_TIME != null">
UPDATED_TIME = #{UPDATED_TIME,jdbcType=TIMESTAMP},
</if>
abortDate = #{abortDate,jdbcType=TIMESTAMP},
<if test="type != null">
type = #{type,jdbcType=INTEGER},
</if>
<if test="yields != null">
yields = #{yields,jdbcType=DECIMAL},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="comments != null">
comments = #{comments,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRule">
update high_product_config_rule
set CREATED_BY = #{CREATED_BY,jdbcType=INTEGER},
CREATED_TIME = #{CREATED_TIME,jdbcType=TIMESTAMP},
abortDate = #{abortDate,jdbcType=TIMESTAMP},
UPDATED_BY = #{UPDATED_BY,jdbcType=INTEGER},
UPDATED_TIME = #{UPDATED_TIME,jdbcType=TIMESTAMP},
type = #{type,jdbcType=INTEGER},
yields = #{yields,jdbcType=DECIMAL},
status = #{status,jdbcType=INTEGER},
comments = #{comments,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
<?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.zfxftech.telmarket.mapper.business.high.HighProductConfigRuleRelMapper">
<resultMap id="BaseResultMap" type="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleRel">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="CREATED_BY" jdbcType="INTEGER" property="CREATED_BY"/>
<result column="CREATED_TIME" jdbcType="TIMESTAMP" property="CREATED_TIME"/>
<result column="UPDATED_BY" jdbcType="INTEGER" property="UPDATED_BY"/>
<result column="UPDATED_TIME" jdbcType="TIMESTAMP" property="UPDATED_TIME"/>
<result column="productId" jdbcType="INTEGER" property="productId"/>
<result column="productName" jdbcType="VARCHAR" property="productName"/>
<result column="ruleId" jdbcType="INTEGER" property="ruleId"/>
<result column="ruleType" jdbcType="INTEGER" property="ruleType"/>
</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
, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, productId, productName,
ruleId, ruleType
</sql>
<select id="selectByExample"
parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleRelExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List"/>
from high_product_config_rule_rel
<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 high_product_config_rule_rel
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from high_product_config_rule_rel
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByRuleId" parameterType="java.lang.Integer">
delete
from high_product_config_rule_rel
where ruleId = #{ruleId,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample"
parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleRelExample">
delete from high_product_config_rule_rel
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleRel">
insert into high_product_config_rule_rel (id, CREATED_BY, CREATED_TIME,
UPDATED_BY, UPDATED_TIME, productId,
productName, ruleId, ruleType)
values (#{id,jdbcType=INTEGER}, #{CREATED_BY,jdbcType=INTEGER}, #{CREATED_TIME,jdbcType=TIMESTAMP},
#{UPDATED_BY,jdbcType=INTEGER}, #{UPDATED_TIME,jdbcType=TIMESTAMP}, #{productId,jdbcType=INTEGER},
#{productName,jdbcType=VARCHAR}, #{ruleId,jdbcType=INTEGER}, #{ruleType,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleRel">
insert into high_product_config_rule_rel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="CREATED_BY != null">
CREATED_BY,
</if>
<if test="CREATED_TIME != null">
CREATED_TIME,
</if>
<if test="UPDATED_BY != null">
UPDATED_BY,
</if>
<if test="UPDATED_TIME != null">
UPDATED_TIME,
</if>
<if test="productId != null">
productId,
</if>
<if test="productName != null">
productName,
</if>
<if test="ruleId != null">
ruleId,
</if>
<if test="ruleType != null">
ruleType,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="CREATED_BY != null">
#{CREATED_BY,jdbcType=INTEGER},
</if>
<if test="CREATED_TIME != null">
#{CREATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="UPDATED_BY != null">
#{UPDATED_BY,jdbcType=INTEGER},
</if>
<if test="UPDATED_TIME != null">
#{UPDATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="productId != null">
#{productId,jdbcType=INTEGER},
</if>
<if test="productName != null">
#{productName,jdbcType=VARCHAR},
</if>
<if test="ruleId != null">
#{ruleId,jdbcType=INTEGER},
</if>
<if test="ruleType != null">
#{ruleType,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByExampleSelective" parameterType="map">
update high_product_config_rule_rel
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.CREATED_BY != null">
CREATED_BY = #{record.CREATED_BY,jdbcType=INTEGER},
</if>
<if test="record.CREATED_TIME != null">
CREATED_TIME = #{record.CREATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="record.UPDATED_BY != null">
UPDATED_BY = #{record.UPDATED_BY,jdbcType=INTEGER},
</if>
<if test="record.UPDATED_TIME != null">
UPDATED_TIME = #{record.UPDATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="record.productId != null">
productId = #{record.productId,jdbcType=INTEGER},
</if>
<if test="record.productName != null">
productName = #{record.productName,jdbcType=VARCHAR},
</if>
<if test="record.ruleId != null">
ruleId = #{record.ruleId,jdbcType=INTEGER},
</if>
<if test="record.ruleType != null">
ruleType = #{record.ruleType,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update high_product_config_rule_rel
set id = #{record.id,jdbcType=INTEGER},
CREATED_BY = #{record.CREATED_BY,jdbcType=INTEGER},
CREATED_TIME = #{record.CREATED_TIME,jdbcType=TIMESTAMP},
UPDATED_BY = #{record.UPDATED_BY,jdbcType=INTEGER},
UPDATED_TIME = #{record.UPDATED_TIME,jdbcType=TIMESTAMP},
productId = #{record.productId,jdbcType=INTEGER},
productName = #{record.productName,jdbcType=VARCHAR},
ruleId = #{record.ruleId,jdbcType=INTEGER},
ruleType = #{record.ruleType,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective"
parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleRel">
update high_product_config_rule_rel
<set>
<if test="CREATED_BY != null">
CREATED_BY = #{CREATED_BY,jdbcType=INTEGER},
</if>
<if test="CREATED_TIME != null">
CREATED_TIME = #{CREATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="UPDATED_BY != null">
UPDATED_BY = #{UPDATED_BY,jdbcType=INTEGER},
</if>
<if test="UPDATED_TIME != null">
UPDATED_TIME = #{UPDATED_TIME,jdbcType=TIMESTAMP},
</if>
<if test="productId != null">
productId = #{productId,jdbcType=INTEGER},
</if>
<if test="productName != null">
productName = #{productName,jdbcType=VARCHAR},
</if>
<if test="ruleId != null">
ruleId = #{ruleId,jdbcType=INTEGER},
</if>
<if test="ruleType != null">
ruleType = #{ruleType,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.zfxftech.telmarket.common.pojo.dao.high.HighProductConfigRuleRel">
update high_product_config_rule_rel
set CREATED_BY = #{CREATED_BY,jdbcType=INTEGER},
CREATED_TIME = #{CREATED_TIME,jdbcType=TIMESTAMP},
UPDATED_BY = #{UPDATED_BY,jdbcType=INTEGER},
UPDATED_TIME = #{UPDATED_TIME,jdbcType=TIMESTAMP},
productId = #{productId,jdbcType=INTEGER},
productName = #{productName,jdbcType=VARCHAR},
ruleId = #{ruleId,jdbcType=INTEGER},
ruleType = #{ruleType,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByRuleId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from high_product_config_rule_rel
where ruleId = #{ruleId}
</select>
<select id="selectByProductIdAndOrderBy" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from high_product_config_rule_rel
where productId = #{productId}
<if test="orderByColumn != null">
order by ${orderByColumn} ${orderByDirection}
</if>
</select>
<select id="selectByRuleIdAndRuleType" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from high_product_config_rule_rel
where ruleId = #{ruleId} and ruleType =#{ruleType}
</select>
<select id="selectByProductId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from high_product_config_rule_rel
where productId = #{productId}
</select>
<select id="selectByProductIdListAndRuleType" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from high_product_config_rule_rel
where ruleType = #{ruleType}
and productId in
<foreach collection="productIdList" item="productId"
index="index" open="(" close=")" separator=",">
#{productId}
</foreach>
</select>
</mapper>
\ No newline at end of file
<?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.zfxftech.telmarket.mapper.business.high.HighStockInputLogMapper">
<resultMap id="BaseResultMap" type="com.zfxftech.telmarket.common.pojo.dao.high.HighStockInputLog">
<!--
WARNING - @mbg.generated
-->
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="product_id" property="productId" jdbcType="INTEGER"/>
<result column="customer_id" property="customerId" jdbcType="INTEGER"/>
<result column="nick_name" property="nickName" jdbcType="VARCHAR"/>
<result column="operation" property="operation" jdbcType="INTEGER"/>
<result column="count" property="count" jdbcType="INTEGER"/>
<result column="stock_name" property="stockName" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
<result column="modify_by" property="modifyBy" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="product_name" property="productName" jdbcType="VARCHAR"/>
<result column="product_type" property="productType" jdbcType="VARCHAR"/>
<result column="name" property="customerName" jdbcType="VARCHAR"/>
<result column="nick_name" property="nickName" jdbcType="VARCHAR"/>
<result column="trust_source_name" property="trustSourceName" jdbcType="VARCHAR"/>
</resultMap>
<sql id="columns">id,union_id,`name`,investment_style,nick_name,remark,initial_funding,account_limit,company_id,is_deleted,created_by,created_time,modify_by,modify_time</sql>
<select id="queryStockInputLogs" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT
a.*,
b.product_name,
b.product_type,
c.`name`,
c.nick_name
FROM
high_stock_input_log a
LEFT JOIN high_product b ON a.product_id = b.id
LEFT JOIN us_member_base c ON a.customer_id = c.id
<where>
<if test="companyId != null">
AND c.company_id = #{companyId}
</if>
<if test="marketId != null">
AND a.market_id = #{marketId}
</if>
<if test="customerId != null and customerId != ''">
AND a.customer_id = #{customerId}
</if>
<if test="productId != null">
AND a.product_id = #{productId}
</if>
<if test="code != null and code != ''">
AND a.code = #{code}
</if>
<if test="operation != null">
AND a.operation = #{operation}
</if>
<if test="tradingTimeLowerLimit != null">
AND a.trading_time <![CDATA[>=]]> FROM_UNIXTIME(#{tradingTimeLowerLimit})
</if>
<if test="tradingTimeUpperLimit != null">
AND a.trading_time <![CDATA[<=]]> FROM_UNIXTIME(#{tradingTimeUpperLimit})
</if>
<if test="marketType != null">
AND a.market_type = #{marketType}
</if>
AND a.is_deleted = '0'
<if test="marketId == null">
AND a.created_by != ''
</if>
</where>
<if test="orderBy != null and orderBy != ''">
<![CDATA[ORDER BY ${orderBy}]]>
</if>
</select>
</mapper>
\ No newline at end of file
<?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.zfxftech.telmarket.mapper.business.high.HighStockPositionMapper">
<resultMap id="BaseResultMap" type="com.zfxftech.telmarket.common.pojo.dao.high.HighMemberStockPage">
<!--
WARNING - @mbg.generated
-->
<!-- <id column="id" property="id" jdbcType="BIGINT"/>-->
<result column="customer_id" property="customerId" jdbcType="BIGINT"/>
<result column="real_market_id" property="realMarketId" jdbcType="BIGINT"/>
<result column="simulated_market_id" property="simulatedMarketId" jdbcType="BIGINT"/>
<result column="customer_name" property="customerName" jdbcType="VARCHAR"/>
<result column="investment_style" property="investmentStyle" jdbcType="VARCHAR"/>
<result column="product_name" property="productName" jdbcType="VARCHAR"/>
<result column="account_limit" property="accountLimit" jdbcType="INTEGER"/>
<!-- <result column="real_funding" property="realFunding" jdbcType="DECIMAL"/>-->
<result column="simulated_funding" property="simulatedFunding" jdbcType="DECIMAL"/>
<!-- <result column="real_position" property="realPosition" jdbcType="DECIMAL"/>-->
<result column="simulated_position" property="simulatedPosition" jdbcType="DECIMAL"/>
<result column="product_expired_time" property="productExpiredTime" jdbcType="TIMESTAMP"/>
<result column="customer_created_time" property="customerCreatedTime" jdbcType="TIMESTAMP"/>
<result column="simulated_latest_buy_time" property="simulatedLatestBuyTime" jdbcType="TIMESTAMP"/>
<!-- <result column="real_total_price" property="realTotalPrice" jdbcType="DECIMAL"/>-->
<result column="simulated_total_price" property="simulatedTotalPrice" jdbcType="DECIMAL"/>
<!-- <result column="real_proportion" property="realProportion" jdbcType="DECIMAL"/>-->
<result column="simulated_proportion" property="simulatedProportion" jdbcType="DECIMAL"/>
<result column="company_id" property="companyId" jdbcType="BIGINT"/>
<!-- <result column="real_total_profit" property="realTotalProfit" jdbcType="DECIMAL"/>-->
<result column="simulated_total_profit" property="simulatedTotalProfit" jdbcType="DECIMAL"/>
<result column="status" property="status" jdbcType="INTEGER"/>
<result column="product_id" property="productId" jdbcType="BIGINT"/>
<result column="profitLossRatio" property="profitLossRatio" jdbcType="DECIMAL"/>
<result column="holdDay" property="holdDay" jdbcType="INTEGER"/>
<result column="stockPosition" property="stockPosition" jdbcType="DECIMAL"/>
<result column="is_problem" property="isProblem" jdbcType="VARCHAR"/>
<result column="simulatedPositionTotal" property="simulatedPositionTotal" jdbcType="INTEGER"/>
</resultMap>
<select id="selectCustomerPositionList" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT * from ( SELECT
id,
customer_id,
real_market_id,
simulated_market_id,
customer_name,
product_name,
product_id,
investment_style,
account_limit,
simulated_funding,
simulated_position,
product_expired_time,
product_created_time,
company_id,
simulated_total_price,
simulated_proportion,
`status`,
is_problem,
(
SELECT
max(trading_time)
FROM
high_stock_input_log k
WHERE
g.simulated_market_id = k.market_id
AND k.operation =1
) AS simulated_latest_buy_time,
simulated_total_profit
,profitLossRatio
,holdDay
,stockPosition
,simulatedPositionTotal
FROM
(
SELECT
id,
customer_id,
company_id,
product_name,
product_id,
real_market_id,
simulated_market_id,
`name` AS customer_name,
investment_style,
account_limit,
simulated_funding,
simulated_position,
is_problem,
simulatedPositionTotal,
created_at AS product_created_time,
`status`,
expired_at AS product_expired_time,
(
simulated_position + simulated_funding
) AS simulated_total_price,
CONVERT (
simulated_position / (
simulated_position + simulated_funding
),
DECIMAL (15, 4)
) AS simulated_proportion,
CONVERT (
((simulated_position + simulated_funding-initial_funding)/initial_funding),
DECIMAL (15, 4)
) AS simulated_total_profit
,profitLossRatio
,holdDay
,stockPosition
FROM
(
SELECT
a.id,
a.customer_id,
a.real_market_id,
a.product_name,
a.product_id,
a.simulated_market_id,
a.initial_funding,
e.`name`,
e.investment_style,
e.account_limit,
e.company_id,
a.simulated_funding,
a.created_at,
a.expired_at,
a.`status`,
a.is_problem,
(
select count(*) from high_stock_position as sp
where sp.market_id=a.simulated_market_id
and sp.is_deleted = '0'
) as simulatedPositionTotal,
IFNULL((
SELECT
sum(
b1.recent_closing_price * b.count
)
FROM
high_stock_position b
LEFT JOIN stocks_code b1 ON b.`code` = b1.`symbol`
WHERE
a.simulated_market_id = b.market_id
and b.is_deleted = '0'
),0) AS simulated_position,
(select profit_loss_ratio as profitLossRatio from stock_position as sp where sp.market_id = a.simulated_market_id AND sp.code = #{code} AND sp.is_deleted = "0") as profitLossRatio,
(select DATEDIFF(now(),sp.created_time) as holdDay from stock_position as sp where sp.market_id = a.simulated_market_id AND sp.code = #{code} AND sp.is_deleted = "0") as holdDay,
(select stock_position as stockPosition from stock_position as sp where sp.market_id = a.simulated_market_id AND sp.code = #{code} AND sp.is_deleted = "0") as stockPosition
FROM
high_account_product_relation a
LEFT JOIN us_member_base e ON a.customer_id = e.id
LEFT JOIN high_product p ON a.product_id = p.id
<where>
<if test="isSelling == false" >
AND a.status in(1,2)
</if>
<if test="customerIds!=null">
AND a.customer_id IN
<foreach collection="customerIds" item="customerId"
index="index" open="(" close=")" separator=",">
#{customerId}
</foreach>
</if>
<if test="productIds!=null">
AND a.product_id IN
<foreach collection="productIds" item="productId"
index="index" open="(" close=")" separator=",">
#{productId}
</foreach>
</if>
<if test="investmentStyle != null">
AND e.investment_style = #{investmentStyle}
</if>
<if test="companyId != null">
AND e.company_id = #{companyId}
</if>
<if test="analyst != null">
AND p.analyst = #{analyst}
</if>
<if test="accountLimit != null">
AND e.account_limit = #{accountLimit}
</if>
<if test="isHolding == true and isHolding == true and isSelling == false" >
AND a.simulated_market_id IN (
<include refid="commSql"/>
)
</if>
<if test="productType != null">
AND a.product_type = #{productType}
</if>
<if test="isHolding == true and isHolding == true and isSelling == true" >
AND a.simulated_market_id IN (
<include refid="commSql2"/>
)
</if>
<if test="isHolding == false">
AND a.simulated_market_id NOT IN (
<include refid="commSql"/>
)
</if>
</where>
) f
) g
)h
<where>
<if test="customerNames != null and customerNames.size()>0">
AND h.customer_name IN
<foreach item="item" index="index" collection="customerNames" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<!-- <if test="positionUpperLimit != null">-->
<!-- AND h.simulated_position <![CDATA[<=]]> #{positionUpperLimit}-->
<!-- </if>-->
<!-- <if test="positionLowerLimit != null">-->
<!-- AND h.simulated_position <![CDATA[>=]]> #{positionLowerLimit}-->
<!-- </if>-->
<if test="positionUpperLimit != null">
AND h.simulated_proportion <![CDATA[<=]]> #{positionUpperLimit}
</if>
<if test="positionLowerLimit != null">
AND h.simulated_proportion <![CDATA[>=]]> #{positionLowerLimit}
</if>
<if test="profitAndLossUpperLimit != null">
AND h.simulated_total_profit <![CDATA[<=]]> #{profitAndLossUpperLimit}
</if>
<if test="profitAndLossLowerLimit != null">
AND h.simulated_total_profit <![CDATA[>=]]> #{profitAndLossLowerLimit}
</if>
</where>
<if test="orderBy != null ">
ORDER BY h.${orderBy}
</if>
</select>
<sql id="commSql">
SELECT
c.market_id
FROM
high_stock_position c
LEFT JOIN account_product_relation d ON c.market_id = d.simulated_market_id
<where>
c.`code` = #{code} AND c.is_deleted = 0
</where>
</sql>
<sql id="commSql2">
SELECT
i.market_id
FROM
(
SELECT
c.market_id,
c.count AS count1,
IFNULL(
(
SELECT
h.count
FROM
high_frozen_record h
WHERE
c.market_id = h.market_id
AND h.is_deleted = 0
AND h.`code` = #{code}
),
0
) AS count2
FROM
high_stock_position c
LEFT JOIN high_account_product_relation d ON c.market_id = d.simulated_market_id
WHERE
c.`code` = #{code}
AND c.is_deleted = 0
) i
WHERE
(i.count1 - i.count2) > 0
</sql>
<sql id="Base_Column_List">
id
,modify_by,modify_time,cost,`code`,is_deleted,product_id,created_by,`count`,`name`,customer_id,created_time,market_id,stop_profit,
is_stop_profit,stop_loss , is_stop_loss
</sql>
<select id="queryStockPositionsContainIsDeleted" resultType="com.zfxftech.telmarket.common.pojo.dao.high.HighStockPosition" parameterType="java.lang.Long">
SELECT
<include refid="Base_Column_List"/>
FROM
high_stock_position
WHERE
market_id = #{marketId}
</select>
<select id="getStockPositionTask" resultType="com.zfxftech.telmarket.common.pojo.dto.remind.StockPositionTask">
SELECT
a.id as id,
a.customer_id as customerId,
p.tp_fans_id as tpFansId,
a.product_id as productId,
a.code as code,
a.name as name,
a.cost as cost,
a.rise_down_range as riseDownRange,
a.profit_loss_ratio as profitLossRatio,
a.created_time as createdTime ,
r.remindId as remindId,
c.changeType as changeType,
c.sendCustomerState as sendCustomerState,
c.hyperlinkState as hyperlinkState
FROM
high_stock_position a
INNER join
high_account_product_relation p on a.market_id = p.simulated_market_id
left join
remind_product r on r.productId = a.product_id
left join
change_remind c on(c.id= r.remindId)
WHERE
a.is_deleted = 0 and a.count >0 and c.isDelete = 1 and c.status =1
and r.productType = "Premium"
<if test="productId != null">
AND a.product_id = #{productId}
</if>
</select>
<!--私人定制自动自赢止损-->
<select id="getProductCheckFullStopTask"
resultType="com.zfxftech.telmarket.common.pojo.dto.remind.FullStockPositionTask">
SELECT a.id as id,
pc.ruleId as ruleId,
a.product_id as productId,
a.code as code,
a.name as name,
a.cost as cost,
pcr.type as type,
pcr.yields as yields,
pcr.abortDate as abortDate,
a.created_time as createdTime,
a.profit_loss_ratio as profitLossRatio,
a.market_id as marketId
FROM high_stock_position a
left join
high_account_product_relation p on a.market_id = p.simulated_market_id
left join
high_product_config_rule_rel pc on pc.productId = p.product_id
left join
high_product_config_rule pcr on pcr.id = pc.ruleId
WHERE a.is_deleted = 0
and a.count > 0
and pc.ruleType = 1
</select>
<select id="selectCurrDayRiseDownDataList" resultType="com.zfxftech.telmarket.common.pojo.request.statistics.CurrDayRiseDownDataList" parameterType="java.util.Map">
select s.code as stockCode,
s.name as stockName,
s.count as stockPositionCount,
s.cost,
s.market_id as marketId,
s.profit_loss_ratio as profitLossRatio,
s.rise_down_range as riseDownRange,
c.`name` as customerName,
a.customer_id as customerId,
a.product_name as productName,
a.product_id as productId,
a.is_problem as isProblem
from high_stock_position s
left join high_account_product_relation as a on s.market_id = a.simulated_market_id
LEFT JOIN us_member_base c ON a.customer_id = c.id
LEFT JOIN high_product p ON a.product_id = p.id
where s.code in (
select code
from (
select code
from high_stock_position as s
inner join high_account_product_relation as pr on s.market_id=pr.simulated_market_id
inner join high_product as p on pr.product_id = p.id
inner join stocks_code c on s.code = c.symbol
where s.is_deleted = '0'
and pr.is_deleted='0'
and p.is_deleted ='0'
<if test="stockCode != null">
AND s.code = #{stockCode}
</if>
<if test="industry != null">
AND c.industry = #{industry}
</if>
group by code, rise_down_range
order by s.rise_down_range ${orderByType}
limit ${limit}
) as s
)
<if test="companyId != null">
AND c.company_id = #{companyId}
</if>
<if test="analyst != null">
AND p.analyst = #{analyst}
</if>
<if test="productId != null">
AND a.product_id = #{productId}
</if>
<if test="customerIds != null">
AND a.customer_id IN
<foreach collection="customerIds" item="customerId"
index="index" open="(" close=")" separator=",">
#{customerId}
</foreach>
</if>
and a.is_deleted = '0'
and s.is_deleted = '0'
and a.status in (1, 2)
and p.is_deleted = '0'
<if test="orderByType != null and orderByType == 'asc'">
AND s.rise_down_range &lt;0
</if>
<if test="orderByType != null and orderByType == 'desc'">
AND s.rise_down_range &gt;=0
</if>
order by s.rise_down_range ${orderByType};
</select>
<select id="selectCurrDayRiseDownStockNum" resultType="java.lang.Integer" parameterType="java.util.Map">
select count(distinct code)
from high_stock_position s
left join high_account_product_relation as a on s.market_id = a.simulated_market_id
LEFT JOIN us_member_base c ON a.customer_id = c.id
LEFT JOIN high_product p ON a.product_id = p.id
<where>
s.is_deleted = '0'
<if test="companyId != null">
AND c.company_id = #{companyId}
</if>
<if test="analyst != null">
AND p.analyst = #{analyst}
</if>
and a.is_deleted = '0'
and a.status in (1, 2)
and p.is_deleted = '0'
</where>
</select>
<select id="selectRealTimeCodeQueryDataList" resultType="com.zfxftech.telmarket.common.pojo.request.statistics.RealTimeCodeQueryDataList" parameterType="java.util.Map">
select s.code as stockCode,
s.name as stockName,
s.count as stockPositionCount,
s.cost,
s.market_id as marketId,
s.profit_loss_ratio as profitLossRatio,
s.rise_down_range as riseDownRange,
c.`name` as customerName,
a.customer_id as customerId,
a.product_name as productName,
a.product_id as productId,
a.is_problem as isProblem
from high_product p
LEFT JOIN high_account_product_relation as a on a.product_id = p.id
LEFT JOIN high_stock_position s ON s.market_id = a.simulated_market_id
LEFT JOIN us_member_base c ON a.customer_id = c.id
LEFT join stocks_code sc on s.code = sc.symbol
<where>
a.is_deleted = '0'
<if test="stockCode != null">
AND s.code = #{stockCode}
</if>
<if test="industry != null">
AND sc.industry = #{industry}
</if>
<if test="companyId != null">
AND c.company_id = #{companyId}
</if>
<if test="analyst != null">
AND p.analyst = #{analyst}
</if>
<if test="productId != null">
AND a.product_id = #{productId}
</if>
<if test="customerIds != null">
AND a.customer_id IN
<foreach collection="customerIds" item="customerId"
index="index" open="(" close=")" separator=",">
#{customerId}
</foreach>
</if>
and s.is_deleted = '0'
and a.status in (1, 2)
and p.is_deleted = '0'
order by s.rise_down_range ${orderByType};
</where>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment