AskSpecialAgreement.java
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("AskSpecialAgreement")
@ApiModel
@JsonIgnoreProperties(value = {"handler"})
public class AskSpecialAgreement implements Serializable {
private Integer autoId = 0;
private String askNo;
private String BatchNo;
private LmSpecialAgreement LmSpecialAgreement;
private String PlanOther;
private String Hospital;
private String DateTime;
private Double PaymentLimit;
private Double DeductibleExcess;
private Double PaymentProportion;
private Double LimiteHospital;
private Double Quota;
private Double AnnualTotalLimit;
private Double PublicInsuranceTenThousand;
private Double LimitPaymentTenThousand;
private Double TotalTeamQuotaTenThousand;
private String InsuranceType;
private String Plan;
private Double BelowAnnualTotalInsuranceRate;
private Double YearBeforeDiscountRate;
private Double RefundRate;
private String Frequencies;
private String CountryOrRegion;
private String Location;
private Double AnnualAccomPayment;
private Double BasicInsuredAmount;
private String StandFlag1;
private String StandFlag2;
private String StandFlag3;
}
LmSpecialAgreement.java
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("LmSpecialAgreement")
@JsonIgnoreProperties(value = { "handler" })
public class LmSpecialAgreement implements Serializable{
private String agreementCode;
private String attribute;
private String direction;
private String agreementInfo;
}
Mapper接口
@Repository
@Mapper
public interface AskSpecialAgreementMapper {
AskSpecialAgreement getById(int autoId);
ArrayList<AskSpecialAgreement> getByAskNo(String askNo);
int insert(AskSpecialAgreement askSpecialAgreement);
int insertList(@Param("list") List<AskSpecialAgreement> askSpecialAgreementList);
int deleteById(int autoId);
int deleteByAskNo(String askNo);
int update(AskSpecialAgreement askSpecialAgreement);
}
Mapper.xml
···
<mapper namespace="cn.com.XXX.mapper.AskSpecialAgreementMapper">
<sql id="attr">
AUTOID, ASKNO, BATCHNO, SPECIALCODE, SPECIALTYPE, SPECIALWORDS, PLANOTHER, HOSPITAL, DATETIME, PAYMENTLIMIT, DEDUCTIBLEEXCESS,
PAYMENTPROPORTION, LIMITEHOSPITAL, QUOTA, ANNUALTOTALLIMIT, PUBLICINSURANCETENTHOUSAND, LIMITPAYMENTTENTHOUSAND,
TOTALTEAMQUOTATENTHOUSAND, INSURANCETYPE, PLAN, BELOWANNUALTOTALINSURANCERATE, YEARBEFOREDISCOUNTRATE, REFUNDRATE, FREQUENCIES,
CountryOrRegion,Location,AnnualAccomPayment,BasicInsuredAmount,StandFlag1,StandFlag2,StandFlag3
</sql>
<resultMap id="BaseMap" type="cn.com.XXX.entity.AskSpecialAgreement">
<id property="autoId" column="AUTOID"/>
<result property="askNo" column="ASKNO"/>
<result property="BatchNo" column="BATCHNO"/>
<result property="PlanOther" column="PLANOTHER"/>
<result property="Hospital" column="HOSPITAL"/>
<result property="DateTime" column="DATETIME"/>
<result property="PaymentLimit" column="PAYMENTLIMIT"/>
<result property="DeductibleExcess" column="DEDUCTIBLEEXCESS"/>
<result property="PaymentProportion" column="PAYMENTPROPORTION"/>
<result property="LimiteHospital" column="LIMITEHOSPITAL"/>
<result property="Quota" column="QUOTA"/>
<result property="AnnualTotalLimit" column="ANNUALTOTALLIMIT"/>
<result property="PublicInsuranceTenThousand" column="PUBLICINSURANCETENTHOUSAND"/>
<result property="LimitPaymentTenThousand" column="LIMITPAYMENTTENTHOUSAND"/>
<result property="TotalTeamQuotaTenThousand" column="TOTALTEAMQUOTATENTHOUSAND"/>
<result property="InsuranceType" column="INSURANCETYPE"/>
<result property="Plan" column="PLAN"/>
<result property="BelowAnnualTotalInsuranceRate" column="BELOWANNUALTOTALINSURANCERATE"/>
<result property="YearBeforeDiscountRate" column="YEARBEFOREDISCOUNTRATE"/>
<result property="RefundRate" column="REFUNDRATE"/>
<result property="Frequencies" column="FREQUENCIES"/>
<result property="CountryOrRegion" column="CountryOrRegion"/>
<result property="Location" column="Location"/>
<result property="AnnualAccomPayment" column="AnnualAccomPayment"/>
<result property="BasicInsuredAmount" column="BasicInsuredAmount"/>
<result property="StandFlag1" column="StandFlag1"/>
<result property="StandFlag2" column="StandFlag2"/>
<result property="StandFlag3" column="StandFlag3"/>
</resultMap>
<resultMap id="special" type="cn.com.XXX.entity.AskSpecialAgreement" extends="BaseMap">
<association property="LmSpecialAgreement" column="SpecialCode" fetchType="lazy"
javaType="cn.com.XXX.entity.LmSpecialAgreement"
select="cn.com.XXX.mapper.LmSpecialAgreementMapper.queryByCode">
</association>
</resultMap>
<insert id="insertList" timeout="2000" parameterType="cn.com.XXX.entity.AskSpecialAgreement">
insert all
<foreach collection="list" item="item" index="index" separator=" ">
into ASKSPECIALAGREEMENT(<include refid="attr"/>)
values(0, #{item.askNo,jdbcType=VARCHAR}, #{item.BatchNo,jdbcType=VARCHAR} ,#{item.LmSpecialAgreement.agreementCode,jdbcType=VARCHAR}, #{item.LmSpecialAgreement.direction,jdbcType=VARCHAR}, #{item.LmSpecialAgreement.agreementInfo,jdbcType=VARCHAR}, #{item.PlanOther,jdbcType=VARCHAR},#{item.Hospital,jdbcType=VARCHAR},
#{item.DateTime,jdbcType=VARCHAR},#{item.PaymentLimit, jdbcType=DOUBLE},#{item.DeductibleExcess, jdbcType=DOUBLE},#{item.PaymentProportion, jdbcType=DOUBLE},#{item.LimiteHospital, jdbcType=DOUBLE},#{item.Quota,jdbcType=VARCHAR},
#{item.AnnualTotalLimit, jdbcType=DOUBLE},#{item.PublicInsuranceTenThousand, jdbcType=DOUBLE},#{item.LimitPaymentTenThousand, jdbcType=DOUBLE},#{item.TotalTeamQuotaTenThousand, jdbcType=DOUBLE},
#{item.InsuranceType,jdbcType=VARCHAR},#{item.Plan,jdbcType=VARCHAR},#{item.BelowAnnualTotalInsuranceRate, jdbcType=DOUBLE},#{item.YearBeforeDiscountRate,jdbcType=DOUBLE},
#{item.RefundRate, jdbcType=DOUBLE},#{item.Frequencies, jdbcType=VARCHAR},
#{item.CountryOrRegion, jdbcType=VARCHAR},#{item.Location, jdbcType=VARCHAR},#{item.AnnualAccomPayment, jdbcType=DOUBLE},#{item.BasicInsuredAmount, jdbcType=DOUBLE},#{item.StandFlag1, jdbcType=VARCHAR},#{item.StandFlag2, jdbcType=VARCHAR},#{item.StandFlag3, jdbcType=VARCHAR}
)
</foreach>
select 1 from dual
</insert>
<insert id="insert" timeout="2000" parameterType="cn.com.XXX.entity.AskSpecialAgreement">
insert into ASKSPECIALAGREEMENT(<include refid="attr"/>)
values(0, #{askNo,jdbcType=VARCHAR}, #{BatchNo,jdbcType=VARCHAR} ,#{LmSpecialAgreement.agreementCode,jdbcType=VARCHAR}, #{LmSpecialAgreement.direction,jdbcType=VARCHAR}, #{LmSpecialAgreement.agreementInfo,jdbcType=VARCHAR}, #{PlanOther,jdbcType=VARCHAR},#{Hospital,jdbcType=VARCHAR},
#{DateTime,jdbcType=VARCHAR},#{PaymentLimit, jdbcType=DOUBLE},#{DeductibleExcess, jdbcType=DOUBLE},#{PaymentProportion, jdbcType=DOUBLE},#{LimiteHospital, jdbcType=DOUBLE},#{Quota,jdbcType=VARCHAR},
#{AnnualTotalLimit, jdbcType=DOUBLE},#{PublicInsuranceTenThousand, jdbcType=DOUBLE},#{LimitPaymentTenThousand, jdbcType=DOUBLE},#{TotalTeamQuotaTenThousand, jdbcType=DOUBLE},
#{InsuranceType,jdbcType=VARCHAR},#{Plan,jdbcType=VARCHAR},#{BelowAnnualTotalInsuranceRate, jdbcType=DOUBLE},#{YearBeforeDiscountRate,jdbcType=DOUBLE},
#{RefundRate, jdbcType=DOUBLE},#{Frequencies, jdbcType=VARCHAR},
#{item.CountryOrRegion, jdbcType=VARCHAR},#{item.Location, jdbcType=VARCHAR},#{item.AnnualAccomPayment, jdbcType=DOUBLE},#{item.BasicInsuredAmount, jdbcType=DOUBLE},#{item.StandFlag1, jdbcType=VARCHAR},#{item.StandFlag2, jdbcType=VARCHAR},#{item.StandFlag3, jdbcType=VARCHAR}
)
</insert>
<select id="getById" resultType="cn.com.XXX.entity.AskSpecialAgreement" resultMap="special">
select <include refid="attr"/> from ASKSPECIALAGREEMENT where autoId = #{autoId} order by autoId
</select>
<select id="getByAskNo" resultType="cn.com.XXX.entity.AskSpecialAgreement" resultMap="special">
select <include refid="attr"/> from ASKSPECIALAGREEMENT where askNo = #{askNo} order by autoId
</select>
<delete id="deleteById" parameterType="int">
delete from ASKSPECIALAGREEMENT where AUTOID=#{autoId}
</delete>
<delete id="deleteByAskNo">
delete from ASKSPECIALAGREEMENT where ASKNO=#{askNo}
</delete>
<update id="update" parameterType="cn.com.XXX.entity.AskSpecialAgreement">
update ASKSPECIALAGREEMENT set askNo=#{askNo,jdbcType=VARCHAR}, BatchNo=#{BatchNo,jdbcType=VARCHAR},
<if test="LmSpecialAgreement.agreementCode!=null and LmSpecialAgreement.agreementCode!=''">
SPECIALCODE=#{LmSpecialAgreement.agreementCode,jdbcType=VARCHAR},
SPECIALTYPE=#{LmSpecialAgreement.direction,jdbcType=VARCHAR},
SPECIALWORDS=#{LmSpecialAgreement.agreementInfo,jdbcType=VARCHAR},
</if>
PlanOther=#{PlanOther,jdbcType=VARCHAR}, Hospital=#{Hospital,jdbcType=VARCHAR},
DateTime=#{DateTime,jdbcType=VARCHAR}, PaymentLimit=#{PaymentLimit,jdbcType=DOUBLE}, DeductibleExcess=#{DeductibleExcess,jdbcType=DOUBLE},
PaymentProportion=#{PaymentProportion,jdbcType=DOUBLE}, LimiteHospital=#{LimiteHospital,jdbcType=DOUBLE} ,Quota=#{Quota,jdbcType=DOUBLE} ,
AnnualTotalLimit=#{AnnualTotalLimit,jdbcType=DOUBLE} , PublicInsuranceTenThousand=#{PublicInsuranceTenThousand,jdbcType=DOUBLE} ,
LimitPaymentTenThousand=#{LimitPaymentTenThousand,jdbcType=DOUBLE} , TotalTeamQuotaTenThousand=#{TotalTeamQuotaTenThousand,jdbcType=DOUBLE},
InsuranceType=#{InsuranceType,jdbcType=VARCHAR} , Plan=#{Plan,jdbcType=VARCHAR} , BelowAnnualTotalInsuranceRate=#{BelowAnnualTotalInsuranceRate,jdbcType=DOUBLE} ,
YearBeforeDiscountRate=#{YearBeforeDiscountRate,jdbcType=DOUBLE} , RefundRate=#{RefundRate,jdbcType=DOUBLE} ,Frequencies=#{Frequencies,jdbcType=VARCHAR},
CountryOrRegion=#{CountryOrRegion,jdbcType=VARCHAR},Location=#{Location,jdbcType=VARCHAR},AnnualAccomPayment=#{AnnualAccomPayment,jdbcType=DOUBLE},BasicInsuredAmount=#{BasicInsuredAmount,jdbcType=DOUBLE},
StandFlag1=#{StandFlag1,jdbcType=VARCHAR},StandFlag2=#{StandFlag2,jdbcType=VARCHAR},StandFlag3=#{StandFlag3,jdbcType=VARCHAR}
where autoId=#{autoId}
</update>
</mapper>
LmSpecialAgreementMapper接口
public interface LmSpecialAgreementMapper{
LmSpecialAgreement queryByCode(String agreementCode);
}
···
<mapper namespace="cn.com.XXX.mapper.LmSpecialAgreementMapper">
<select id="queryByCode" resultType="cn.com.XXX.entity.LmSpecialAgreement">
select agreementCode,attribute,direction,agreementInfo from lmspecialagreement where agreementcode = #{agreementcode}
</select>
</mapper>