Commit a69ffa0b by yao.xiao

增加-保存经纪人商机目标

parent bc177ace
......@@ -15,6 +15,7 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.rank.PractitionerInfoForAchievement;
import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.salestarget.SalesTargetActions;
import com.yd.api.practitioner.vo.salestarget.SalesTargetMonth;
import com.yd.api.practitioner.vo.salestarget.SalesTargetSaveRequestVO;
import com.yd.api.practitioner.vo.salestarget.SalesTargetSaveResponseVO;
......@@ -53,9 +54,13 @@ import com.google.common.base.Strings;
import org.springframework.transaction.annotation.Transactional;
import javax.imageio.ImageIO;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -118,6 +123,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
private MktLeadsGoalsDALService mktLeadsGoalsDALService;
@Autowired
private MdDropMasterDALService mdDropMasterDALService;
@Autowired
private MdGoalsCalculateExpressionService mdGoalsCalculateExpressionService;
@Autowired
private MktLeadsGoalsActionsDALService mktLeadsGoalsActionsDALService;
@Override
public PractitionerLoginResponseVO practitionerLogin(PractitionerLoginRequestVO requestVO) {
......@@ -1331,6 +1340,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
}
@Override
@Transactional
public SalesTargetSaveResponseVO salesTargetSave(SalesTargetSaveRequestVO requestVO) {
SalesTargetSaveResponseVO responseVO = new SalesTargetSaveResponseVO();
//经纪人id
......@@ -1338,6 +1348,8 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//当前年份
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
//初始化之前数据 全部修改为不启用
initializationAction(practitionerId,year);
//保存年目标
Date date = new Date();
saveYearGoal(requestVO,practitionerId,date,year);
......@@ -1352,12 +1364,67 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
MdDropMaster mdDropMaster = mdDropMasterDALService.findByScenarioCode("bizchance_promotion_action");
Long masterId = mdDropMaster.getId();
//查询出所有计算公式
//件数 年总
Integer pieces = requestVO.getPieces();
int piecesMonth = BigDecimal.valueOf(pieces).divide(BigDecimal.valueOf(12),0, BigDecimal.ROUND_UP).intValue();
System.out.println("piecesMonth:"+piecesMonth);
ScriptEngine jScriptEngine=new ScriptEngineManager().getEngineByName("JavaScript");
List<MdGoalsCalculateExpression> list = mdGoalsCalculateExpressionService.findByMasterId(masterId);
List<SalesTargetActions> salesTargetActionsList = new ArrayList<>();
for (MdGoalsCalculateExpression info : list){
//保存经纪人商机活动量分摊细化设置 ag_mkt_leads_goals_actions
SalesTargetActions salesTargetAction = saveLeadsGoalsActions(info,jScriptEngine,year,piecesMonth,practitionerId,date);
salesTargetActionsList.add(salesTargetAction);
}
BeanUtils.copyProperties(requestVO,responseVO);
responseVO.setSalesTargetActions(salesTargetActionsList);
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
private void initializationAction(Long practitionerId, int year) {
//通过经纪人id 和 目标所属年度 去查询ag_mkt_leads_goals/ag_mkt_leads_goals_actions 并将is_active = 0
mktLeadsGoalsDALService.updateIsActiveIsNull(practitionerId,year);
mktLeadsGoalsActionsDALService.updateIsActiveIsNull(practitionerId,year);
}
private SalesTargetActions saveLeadsGoalsActions(MdGoalsCalculateExpression info, ScriptEngine jScriptEngine, int year, int piecesMonth, Long practitionerId , Date date) {
Long dropOptionId = info.getActionId();
String dropOptionName = info.getDropOptionName();
String calculateScriptExpression = info.getCalculateScriptExpression();
// System.out.println("calculateScriptExpression:"+calculateScriptExpression);
Integer actionStandards = null;
String replaceAll = calculateScriptExpression.replaceAll("num", String.valueOf(piecesMonth));
System.out.println(replaceAll);
try {
actionStandards = (Integer) jScriptEngine.eval(replaceAll);
} catch (ScriptException e) {
e.printStackTrace();
}
//保存信息至ag_mkt_leads_goals_actions
MktLeadsGoalsActions mktLeadsGoalsActions = new MktLeadsGoalsActions();
mktLeadsGoalsActions.setPractitionerId(practitionerId);
mktLeadsGoalsActions.setCurrentYear(year);
mktLeadsGoalsActions.setStatisticTimeUnit(3);
mktLeadsGoalsActions.setLeadsActionId(dropOptionId);
mktLeadsGoalsActions.setLeadsActionName(dropOptionName);
mktLeadsGoalsActions.setActionStandards(actionStandards);
mktLeadsGoalsActions.setCurrentVersion(date);
mktLeadsGoalsActions.setIsActive(1);
mktLeadsGoalsActions.setCreatedAt(new Date());
mktLeadsGoalsActions.setCreatedBy(practitionerId);
mktLeadsGoalsActions.setUpdatedAt(new Date());
mktLeadsGoalsActions.setUpdatedBy(practitionerId);
mktLeadsGoalsActionsDALService.save(mktLeadsGoalsActions);
SalesTargetActions salesTargetAction = new SalesTargetActions();
salesTargetAction.setStatisticTimeUnit(3);
salesTargetAction.setActionStandards(actionStandards);
salesTargetAction.setLeadsActionId(dropOptionId);
salesTargetAction.setLeadsActionName(dropOptionName);
return salesTargetAction;
}
/**
* 保存月度商机目标
* @param info
......
......@@ -5,7 +5,7 @@ import lombok.Data;
@Data
public class SalesTargetActions {
private Integer statisticTimeUnit;
private Integer leadsActionId;
private Integer leadsActionName;
private Long leadsActionId;
private String leadsActionName;
private Integer actionStandards;
}
......@@ -6,9 +6,21 @@ import java.util.List;
@Data
public class SalesTargetSaveRequestVO {
private Long practitionerId;
/**
* 保费
*/
private Integer premium;
/**
* 佣金
*/
private Integer commission;
/**
* 件数
*/
private Integer pieces;
/**
* 均价
*/
private Integer pieceAveragePremium;
private List<SalesTargetMonth> salesTargetMonths;
}
......@@ -4,68 +4,73 @@ import java.util.Date;
import lombok.Data;
/**
* 经纪人商机活动量分摊细化设置
*/
* 经纪人商机活动量分摊细化设置
*/
@Data
public class MktLeadsGoalsActions {
/**
* serial id
*/
* serial id
*/
private Long id;
/**
* FK ag_acl_practitioner.id 经纪人
*/
private String practitionerId;
* FK ag_acl_practitioner.id 经纪人
*/
private Long practitionerId;
/**
* 目标所属年度
*/
* 目标所属年度
*/
private Integer currentYear;
/**
* 2:季度,3:月度
*/
* 2:季度,3:月度
*/
private Integer statisticTimeUnit;
/**
* FK ag_md_drop_options.id 商机销售行动drop_master id = 14
*/
private Integer leadsActionId;
* FK ag_md_drop_options.id 商机销售行动drop_master id = 14
*/
private Long leadsActionId;
/**
* FK ag_md_drop_options.drop_option_name 团队长发掘活动drop_master id = 14
*/
private Integer leadsActionName;
* FK ag_md_drop_options.drop_option_name 团队长发掘活动drop_master id = 14
*/
private String leadsActionName;
/**
* 成交件数a
建议书数量b = a * 3
见面沟通次数c = b
电话/微信沟通次数d = c * 3
安排见面次数f = c * 3
获取商机次数g = f
*/
* 成交件数a
* 建议书数量b = a * 3
* 见面沟通次数c = b
* 电话/微信沟通次数d = c * 3
* 安排见面次数f = c * 3
* 获取商机次数g = f
*/
private Integer actionStandards;
/**
* 版本控制
*/
* 版本控制
*/
private Date currentVersion;
/**
* 创建时间
*/
* 0=No, 1=Yes
*/
private Integer isActive;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
* 创建人
*/
private Long createdBy;
/**
* 修改时间
*/
* 修改时间
*/
private Date updatedAt;
private Long updatedBy;
......
package com.yd.dal.entity.meta;
import java.util.Date;
import lombok.Data;
/**
* 经纪人商机增员目标分摊计算公式
*/
@Data
public class MdGoalsCalculateExpression {
/**
* serial id
*/
private Long id;
/**
* 目标所属年度
*/
private Integer currentYear;
/**
* FK ag_md_drop_master.id 商机销售行动drop_master id = 14 or 经纪人增员活动16
*/
private Long dropMasterId;
/**
* 商机销售行动 or 团队长发掘活动
*/
private String dropMasterName;
/**
* FK ag_md_drop_options.id 商机销售行动drop_master id = 14 or 16
*/
private Long actionId;
/**
* 商机销售行动 or 团队长发掘活动名称
*/
private String dropOptionName;
/**
* javascript计算公式,参数:成交件数,
* 成交件数a
* <p>
* 建议书数量b = a * 3
* 见面沟通次数c = a * 3
* 电话/微信沟通次数d = a * 9
* 安排见面次数f = a * 27
* 获取商机次数g = a * 27
* <p>
* 报聘(a)= 年目标增员对象/12
* 报聘面谈 b = a
* OPP创说会 c = a * 3
* 甄选面谈 d = a * 3
* 增员面谈 e = a * 9
* 建立名单 f = a * 9
*/
private String calculateScriptExpression;
/**
* 0=No, 1=Yes
*/
private Integer isActive;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
private Long createdBy;
/**
* 修改时间
*/
private Date updatedAt;
private Long updatedBy;
}
\ No newline at end of file
package com.yd.dal.mapper.marketing;
import com.yd.dal.entity.marketing.MktLeadsGoalsActions;
import org.apache.ibatis.annotations.Param;
public interface MktLeadsGoalsActionsMapper {
int deleteByPrimaryKey(Long id);
......@@ -14,4 +15,6 @@ public interface MktLeadsGoalsActionsMapper {
int updateByPrimaryKeySelective(MktLeadsGoalsActions record);
int updateByPrimaryKey(MktLeadsGoalsActions record);
void updateIsActiveIsNull(@Param("practitionerId") Long practitionerId,@Param("year") Integer year);
}
\ No newline at end of file
package com.yd.dal.mapper.marketing;
import com.yd.dal.entity.marketing.MktLeadsGoals;
import org.apache.ibatis.annotations.Param;
public interface MktLeadsGoalsMapper {
int deleteByPrimaryKey(Long id);
......@@ -14,4 +15,6 @@ public interface MktLeadsGoalsMapper {
int updateByPrimaryKeySelective(MktLeadsGoals record);
int updateByPrimaryKey(MktLeadsGoals record);
void updateIsActiveIsNull(@Param("practitionerId") Long practitionerId,@Param("year") Integer year);
}
\ No newline at end of file
package com.yd.dal.mapper.meta;
import com.yd.dal.entity.meta.MdGoalsCalculateExpression;import java.util.List;
public interface MdGoalsCalculateExpressionMapper {
int deleteByPrimaryKey(Long id);
int insert(MdGoalsCalculateExpression record);
int insertSelective(MdGoalsCalculateExpression record);
MdGoalsCalculateExpression selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(MdGoalsCalculateExpression record);
int updateByPrimaryKey(MdGoalsCalculateExpression record);
List<MdGoalsCalculateExpression> findByMasterId(Long masterId);
}
\ No newline at end of file
package com.yd.dal.service.marketing.Impl;
import com.yd.dal.entity.marketing.MktLeadsGoalsActions;
import com.yd.dal.mapper.marketing.MktLeadsGoalsActionsMapper;
import com.yd.dal.service.marketing.MktLeadsGoalsActionsDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service("mktLeadsGoalsActionsService")
public class MktLeadsGoalsActionsDALServiceImpl implements MktLeadsGoalsActionsDALService {
@Resource
private MktLeadsGoalsActionsMapper mktLeadsGoalsActionsMapper;
@Override
public void save(MktLeadsGoalsActions mktLeadsGoalsActions) {
mktLeadsGoalsActionsMapper.insertSelective(mktLeadsGoalsActions);
}
@Override
public void updateIsActiveIsNull(Long practitionerId, int year) {
mktLeadsGoalsActionsMapper.updateIsActiveIsNull(practitionerId, year);
}
}
......@@ -17,4 +17,9 @@ public class MktLeadsGoalsDALServiceImpl implements MktLeadsGoalsDALService {
public void saveMktLeadsGoals(MktLeadsGoals mktLeadsGoals) {
mktLeadsGoalsMapper.insertSelective(mktLeadsGoals);
}
@Override
public void updateIsActiveIsNull(Long practitionerId, Integer year) {
mktLeadsGoalsMapper.updateIsActiveIsNull(practitionerId, year) ;
}
}
package com.yd.dal.service.marketing;
import com.yd.dal.entity.marketing.MktLeadsGoalsActions;
public interface MktLeadsGoalsActionsDALService {
void save(MktLeadsGoalsActions mktLeadsGoalsActions);
void updateIsActiveIsNull(Long practitionerId, int year);
}
......@@ -4,4 +4,6 @@ import com.yd.dal.entity.marketing.MktLeadsGoals;
public interface MktLeadsGoalsDALService {
void saveMktLeadsGoals(MktLeadsGoals mktLeadsGoals);
void updateIsActiveIsNull(Long practitionerId, Integer year);
}
package com.yd.dal.service.meta;
import com.yd.dal.entity.meta.MdGoalsCalculateExpression;
import java.util.List;
public interface MdGoalsCalculateExpressionService {
List<MdGoalsCalculateExpression> findByMasterId(Long masterId);
}
package com.yd.dal.service.meta.impl;
import com.yd.dal.entity.meta.MdGoalsCalculateExpression;
import com.yd.dal.mapper.meta.MdGoalsCalculateExpressionMapper;
import com.yd.dal.service.meta.MdGoalsCalculateExpressionService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service("mdGoalsCalculateExpressionService")
public class MdGoalsCalculateExpressionServiceImpl implements MdGoalsCalculateExpressionService {
@Resource
private MdGoalsCalculateExpressionMapper mdGoalsCalculateExpressionMapper;
@Override
public List<MdGoalsCalculateExpression> findByMasterId(Long masterId) {
return mdGoalsCalculateExpressionMapper.findByMasterId(masterId);
}
}
......@@ -5,13 +5,14 @@
<!--@mbg.generated-->
<!--@Table ag_mkt_leads_goals_actions-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="practitioner_id" jdbcType="VARCHAR" property="practitionerId" />
<result column="practitioner_id" jdbcType="BIGINT" property="practitionerId" />
<result column="current_year" jdbcType="INTEGER" property="currentYear" />
<result column="statistic_time_unit" jdbcType="INTEGER" property="statisticTimeUnit" />
<result column="leads_action_id" jdbcType="INTEGER" property="leadsActionId" />
<result column="leads_action_name" jdbcType="INTEGER" property="leadsActionName" />
<result column="leads_action_id" jdbcType="BIGINT" property="leadsActionId" />
<result column="leads_action_name" jdbcType="VARCHAR" property="leadsActionName" />
<result column="action_standards" jdbcType="INTEGER" property="actionStandards" />
<result column="current_version" jdbcType="TIMESTAMP" property="currentVersion" />
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
......@@ -20,7 +21,8 @@
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, practitioner_id, current_year, statistic_time_unit, leads_action_id, leads_action_name,
action_standards, current_version, created_at, created_by, updated_at, updated_by
action_standards, current_version, is_active, created_at, created_by, updated_at,
updated_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
......@@ -38,12 +40,14 @@
<!--@mbg.generated-->
insert into ag_mkt_leads_goals_actions (practitioner_id, current_year, statistic_time_unit,
leads_action_id, leads_action_name, action_standards,
current_version, created_at, created_by,
updated_at, updated_by)
values (#{practitionerId,jdbcType=VARCHAR}, #{currentYear,jdbcType=INTEGER}, #{statisticTimeUnit,jdbcType=INTEGER},
#{leadsActionId,jdbcType=INTEGER}, #{leadsActionName,jdbcType=INTEGER}, #{actionStandards,jdbcType=INTEGER},
#{currentVersion,jdbcType=TIMESTAMP}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT},
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT})
current_version, is_active, created_at,
created_by, updated_at, updated_by
)
values (#{practitionerId,jdbcType=BIGINT}, #{currentYear,jdbcType=INTEGER}, #{statisticTimeUnit,jdbcType=INTEGER},
#{leadsActionId,jdbcType=BIGINT}, #{leadsActionName,jdbcType=VARCHAR}, #{actionStandards,jdbcType=INTEGER},
#{currentVersion,jdbcType=TIMESTAMP}, #{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.marketing.MktLeadsGoalsActions" useGeneratedKeys="true">
<!--@mbg.generated-->
......@@ -70,6 +74,9 @@
<if test="currentVersion != null">
current_version,
</if>
<if test="isActive != null">
is_active,
</if>
<if test="createdAt != null">
created_at,
</if>
......@@ -85,7 +92,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="practitionerId != null">
#{practitionerId,jdbcType=VARCHAR},
#{practitionerId,jdbcType=BIGINT},
</if>
<if test="currentYear != null">
#{currentYear,jdbcType=INTEGER},
......@@ -94,10 +101,10 @@
#{statisticTimeUnit,jdbcType=INTEGER},
</if>
<if test="leadsActionId != null">
#{leadsActionId,jdbcType=INTEGER},
#{leadsActionId,jdbcType=BIGINT},
</if>
<if test="leadsActionName != null">
#{leadsActionName,jdbcType=INTEGER},
#{leadsActionName,jdbcType=VARCHAR},
</if>
<if test="actionStandards != null">
#{actionStandards,jdbcType=INTEGER},
......@@ -105,6 +112,9 @@
<if test="currentVersion != null">
#{currentVersion,jdbcType=TIMESTAMP},
</if>
<if test="isActive != null">
#{isActive,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
......@@ -124,7 +134,7 @@
update ag_mkt_leads_goals_actions
<set>
<if test="practitionerId != null">
practitioner_id = #{practitionerId,jdbcType=VARCHAR},
practitioner_id = #{practitionerId,jdbcType=BIGINT},
</if>
<if test="currentYear != null">
current_year = #{currentYear,jdbcType=INTEGER},
......@@ -133,10 +143,10 @@
statistic_time_unit = #{statisticTimeUnit,jdbcType=INTEGER},
</if>
<if test="leadsActionId != null">
leads_action_id = #{leadsActionId,jdbcType=INTEGER},
leads_action_id = #{leadsActionId,jdbcType=BIGINT},
</if>
<if test="leadsActionName != null">
leads_action_name = #{leadsActionName,jdbcType=INTEGER},
leads_action_name = #{leadsActionName,jdbcType=VARCHAR},
</if>
<if test="actionStandards != null">
action_standards = #{actionStandards,jdbcType=INTEGER},
......@@ -144,6 +154,9 @@
<if test="currentVersion != null">
current_version = #{currentVersion,jdbcType=TIMESTAMP},
</if>
<if test="isActive != null">
is_active = #{isActive,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
......@@ -162,17 +175,27 @@
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.marketing.MktLeadsGoalsActions">
<!--@mbg.generated-->
update ag_mkt_leads_goals_actions
set practitioner_id = #{practitionerId,jdbcType=VARCHAR},
set practitioner_id = #{practitionerId,jdbcType=BIGINT},
current_year = #{currentYear,jdbcType=INTEGER},
statistic_time_unit = #{statisticTimeUnit,jdbcType=INTEGER},
leads_action_id = #{leadsActionId,jdbcType=INTEGER},
leads_action_name = #{leadsActionName,jdbcType=INTEGER},
leads_action_id = #{leadsActionId,jdbcType=BIGINT},
leads_action_name = #{leadsActionName,jdbcType=VARCHAR},
action_standards = #{actionStandards,jdbcType=INTEGER},
current_version = #{currentVersion,jdbcType=TIMESTAMP},
is_active = #{isActive,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateIsActiveIsNull">
UPDATE ag_mkt_leads_goals_actions
set
is_active = 0
where
practitioner_id = #{practitionerId,jdbcType=BIGINT}
and current_year = #{year,jdbcType=INTEGER}
and is_active =1;
</update>
</mapper>
\ No newline at end of file
......@@ -211,4 +211,11 @@
updated_by = #{updatedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateIsActiveIsNull">
UPDATE ag_mkt_leads_goals
SET is_active = 0
WHERE practitioner_id = #{practitionerId,jdbcType=BIGINT}
AND current_year = #{year,jdbcType=INTEGER}
AND is_active = 1;
</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.yd.dal.mapper.meta.MdGoalsCalculateExpressionMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.meta.MdGoalsCalculateExpression">
<!--@mbg.generated-->
<!--@Table ag_md_goals_calculate_expression-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="current_year" jdbcType="INTEGER" property="currentYear" />
<result column="drop_master_id" jdbcType="BIGINT" property="dropMasterId" />
<result column="drop_master_name" jdbcType="VARCHAR" property="dropMasterName" />
<result column="action_id" jdbcType="BIGINT" property="actionId" />
<result column="drop_option_name" jdbcType="VARCHAR" property="dropOptionName" />
<result column="calculate_script_expression" jdbcType="LONGVARCHAR" property="calculateScriptExpression" />
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, current_year, drop_master_id, drop_master_name, action_id, drop_option_name,
calculate_script_expression, is_active, created_at, created_by, updated_at, updated_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from ag_md_goals_calculate_expression
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from ag_md_goals_calculate_expression
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.meta.MdGoalsCalculateExpression" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_md_goals_calculate_expression (current_year, drop_master_id, drop_master_name,
action_id, drop_option_name, calculate_script_expression,
is_active, created_at, created_by,
updated_at, updated_by)
values (#{currentYear,jdbcType=INTEGER}, #{dropMasterId,jdbcType=BIGINT}, #{dropMasterName,jdbcType=VARCHAR},
#{actionId,jdbcType=BIGINT}, #{dropOptionName,jdbcType=VARCHAR}, #{calculateScriptExpression,jdbcType=LONGVARCHAR},
#{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT},
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.meta.MdGoalsCalculateExpression" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_md_goals_calculate_expression
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="currentYear != null">
current_year,
</if>
<if test="dropMasterId != null">
drop_master_id,
</if>
<if test="dropMasterName != null">
drop_master_name,
</if>
<if test="actionId != null">
action_id,
</if>
<if test="dropOptionName != null">
drop_option_name,
</if>
<if test="calculateScriptExpression != null">
calculate_script_expression,
</if>
<if test="isActive != null">
is_active,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="currentYear != null">
#{currentYear,jdbcType=INTEGER},
</if>
<if test="dropMasterId != null">
#{dropMasterId,jdbcType=BIGINT},
</if>
<if test="dropMasterName != null">
#{dropMasterName,jdbcType=VARCHAR},
</if>
<if test="actionId != null">
#{actionId,jdbcType=BIGINT},
</if>
<if test="dropOptionName != null">
#{dropOptionName,jdbcType=VARCHAR},
</if>
<if test="calculateScriptExpression != null">
#{calculateScriptExpression,jdbcType=LONGVARCHAR},
</if>
<if test="isActive != null">
#{isActive,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.meta.MdGoalsCalculateExpression">
<!--@mbg.generated-->
update ag_md_goals_calculate_expression
<set>
<if test="currentYear != null">
current_year = #{currentYear,jdbcType=INTEGER},
</if>
<if test="dropMasterId != null">
drop_master_id = #{dropMasterId,jdbcType=BIGINT},
</if>
<if test="dropMasterName != null">
drop_master_name = #{dropMasterName,jdbcType=VARCHAR},
</if>
<if test="actionId != null">
action_id = #{actionId,jdbcType=BIGINT},
</if>
<if test="dropOptionName != null">
drop_option_name = #{dropOptionName,jdbcType=VARCHAR},
</if>
<if test="calculateScriptExpression != null">
calculate_script_expression = #{calculateScriptExpression,jdbcType=LONGVARCHAR},
</if>
<if test="isActive != null">
is_active = #{isActive,jdbcType=INTEGER},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.meta.MdGoalsCalculateExpression">
<!--@mbg.generated-->
update ag_md_goals_calculate_expression
set current_year = #{currentYear,jdbcType=INTEGER},
drop_master_id = #{dropMasterId,jdbcType=BIGINT},
drop_master_name = #{dropMasterName,jdbcType=VARCHAR},
action_id = #{actionId,jdbcType=BIGINT},
drop_option_name = #{dropOptionName,jdbcType=VARCHAR},
calculate_script_expression = #{calculateScriptExpression,jdbcType=LONGVARCHAR},
is_active = #{isActive,jdbcType=INTEGER},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="findByMasterId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_md_goals_calculate_expression
where drop_master_id = #{masterId,jdbcType=BIGINT}
and is_active = 1
</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