Commit a51f5733 by 谢海旭

202601月底版本 策略中心:兜底目标、策略列表

1 parent 4622f50f
......@@ -6,6 +6,7 @@ import cn.com.glsx.dj.strategy.model.StrategyInfo;
import cn.com.glsx.framework.core.annotation.ApiMethod;
import cn.com.glsx.framework.core.annotation.ApiParam;
import cn.com.glsx.framework.core.annotation.ApiResponse;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import java.util.List;
......@@ -49,4 +50,9 @@ public interface StrategyInfoRemote {
@ApiMethod("新增或更新学习记录")
RpcResponse<Boolean> insertOrUpdateLearningRecord(LearningRecord learningRecord);
@ApiMethod("策略分页列表")
@ApiParam(name = "pagination", notes = "分页查询条件", dataType = ApiParam.DataTypeEnum.OBJECT, required = true)
@ApiResponse("策略分页列表")
RpcResponse<RpcPagination<StrategyInfo>> selectStrategyInfoPage(RpcPagination<StrategyInfo> pagination);
}
......@@ -4,6 +4,16 @@ import cn.com.glsx.dj.strategy.model.StrategyInfo;
import org.apache.ibatis.annotations.Mapper;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
import java.util.List;
@Mapper
public interface StrategyInfoMapper extends OreMapper<StrategyInfo> {
/**
* 分页查询策略信息,包含关联的人员、课程、录音信息
*
* @param strategyInfo 查询条件
* @return 策略信息列表
*/
List<StrategyInfo> selectStrategyInfoPage(StrategyInfo strategyInfo);
}
\ No newline at end of file
......@@ -6,9 +6,11 @@ import cn.com.glsx.dj.strategy.model.StrategyInfo;
import cn.com.glsx.dj.strategy.service.LearningRecordService;
import cn.com.glsx.dj.strategy.service.StrategyInfoService;
import cn.com.glsx.dj.strategy.service.StrategyMerchantTimelineService;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.github.pagehelper.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -133,4 +135,18 @@ public class StrategyInfoRemoteImpl implements StrategyInfoRemote {
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
@Override
public RpcResponse<RpcPagination<StrategyInfo>> selectStrategyInfoPage(RpcPagination<StrategyInfo> pagination) {
try {
Page<StrategyInfo> page = strategyInfoService.selectStrategyInfoPage(pagination);
return RpcResponse.success(RpcPagination.copyPage(page));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(DefaultErrorEnum.SERVICE_ERROR, e.getMessage());
}
}
}
......@@ -14,8 +14,11 @@ import cn.com.glsx.dj.strategy.model.StrategyInfo;
import cn.com.glsx.dj.strategy.model.StrategyRecordingRel;
import cn.com.glsx.dj.strategy.model.StrategyStaffRel;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.scrm.equity.enums.DeleteFlagEnum;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -182,4 +185,16 @@ public class StrategyInfoService {
return strategyInfo;
}
/**
* 分页查询策略信息
*
* @param pagination 分页参数
* @return 分页结果
*/
public Page<StrategyInfo> selectStrategyInfoPage(RpcPagination<StrategyInfo> pagination) {
Page<StrategyInfo> page = PageHelper.startPage(pagination.getPageNum(), pagination.getPageSize());
strategyInfoMapper.selectStrategyInfoPage(pagination.getCondition());
return page;
}
}
......@@ -8,6 +8,7 @@
<id column="id" property="id" jdbcType="INTEGER" />
<result column="strategy_id" property="strategyId" jdbcType="INTEGER" />
<result column="course_id" property="courseId" jdbcType="VARCHAR" />
<result column="course_name" property="courseName" jdbcType="VARCHAR" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
......@@ -20,4 +21,21 @@
-->
id, strategy_id, course_id, created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="selectByStrategyId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
SELECT
cr.id,
cr.strategy_id,
cr.course_id,
bc.title AS course_name,
cr.created_by,
cr.created_date,
cr.updated_by,
cr.updated_date,
cr.deleted_flag
FROM dj_car_life_strategy_course_rel cr
LEFT JOIN dj_beisen_course bc ON cr.course_id = bc.id
WHERE cr.strategy_id = #{strategyId,jdbcType=INTEGER}
AND cr.deleted_flag = 'N'
</select>
</mapper>
\ No newline at end of file
......@@ -23,6 +23,9 @@
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
<result column="biz" property="biz" />
<result column="push_flag" property="pushFlag"/>
<collection property="staffList" ofType="cn.com.glsx.dj.strategy.model.StrategyStaffRel" column="id" select="cn.com.glsx.dj.strategy.mapper.StrategyStaffRelMapper.selectByStrategyId" />
<collection property="courseList" ofType="cn.com.glsx.dj.strategy.model.StrategyCourseRel" column="id" select="cn.com.glsx.dj.strategy.mapper.StrategyCourseRelMapper.selectByStrategyId" />
<collection property="recordingList" ofType="cn.com.glsx.dj.strategy.model.StrategyRecordingRel" column="id" select="cn.com.glsx.dj.strategy.mapper.StrategyRecordingRelMapper.selectByStrategyId" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="cn.com.glsx.dj.strategy.model.StrategyInfo" extends="BaseResultMap" >
<!--
......@@ -43,4 +46,26 @@
-->
content
</sql>
<select id="selectStrategyInfoPage" parameterType="cn.com.glsx.dj.strategy.model.StrategyInfo" resultMap="ResultMapWithBLOBs">
SELECT
<include refid="Base_Column_List" />,
<include refid="Blob_Column_List" />
FROM dj_car_life_strategy_info
WHERE deleted_flag = 'N'
<if test="strategyType != null">
AND strategy_type = #{strategyType,jdbcType=INTEGER}
</if>
<if test="merchantId != null">
AND merchant_id = #{merchantId,jdbcType=INTEGER}
</if>
<if test="title != null and title != ''">
AND title LIKE CONCAT('%', #{title}, '%')
</if>
<if test="biz != null">
AND biz = #{biz,jdbcType=INTEGER}
</if>
ORDER BY created_date DESC
</select>
</mapper>
\ No newline at end of file
......@@ -23,4 +23,12 @@
id, strategy_id, recording_id, reception_staff_name, reception_date, created_by,
created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="selectByStrategyId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM dj_car_life_strategy_recording_rel
WHERE strategy_id = #{strategyId,jdbcType=INTEGER}
AND deleted_flag = 'N'
</select>
</mapper>
\ No newline at end of file
......@@ -22,4 +22,12 @@
id, strategy_id, user_uuid, user_name, created_by, created_date, updated_by, updated_date,
deleted_flag
</sql>
<select id="selectByStrategyId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM dj_car_life_strategy_staff_rel
WHERE strategy_id = #{strategyId,jdbcType=INTEGER}
AND deleted_flag = 'N'
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!