|
@@ -1,29 +1,52 @@
|
|
|
-<?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" >
|
|
|
+<?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.management.platform.mapper.ContractBonusDetailMapper">
|
|
|
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
+ <resultMap id="BaseResultMap" type="com.management.platform.entity.ContractBonusDetail">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="company_id" property="companyId" />
|
|
|
+ <result column="user_id" property="userId" />
|
|
|
+ <result column="contract" property="contract" />
|
|
|
+ <result column="project_id" property="projectId" />
|
|
|
+ <result column="project_working_time" property="projectWorkingTime" />
|
|
|
+ <result column="bonus_type" property="bonusType" />
|
|
|
+ <result column="bonus_value" property="bonusValue" />
|
|
|
+ <result column="total_bonus_value" property="totalBonusValue" />
|
|
|
+ <result column="ym" property="ym" />
|
|
|
+ <result column="year" property="year" />
|
|
|
+ <result column="month" property="month" />
|
|
|
+ <result column="create_by" property="createBy" />
|
|
|
+ <result column="create_time" property="createTime" />
|
|
|
+ <result column="is_nagative" property="isNagative" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 通用查询结果列 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, company_id, user_id, contract, project_id, project_working_time, bonus_type, bonus_value, total_bonus_value, ym, year, month, create_by, create_time, is_nagative
|
|
|
+ </sql>
|
|
|
+
|
|
|
<insert id="batchInsert">
|
|
|
insert into contract_bonus_detail(company_id, user_id, contract, project_id,project_working_time, bonus_type, bonus_value
|
|
|
, total_bonus_value, ym, year, month, create_by, create_time)
|
|
|
VALUES
|
|
|
- <foreach collection="toAddList" item="detail" separator=",">
|
|
|
- (#{detail.companyId},#{detail.userId},#{detail.contract},#{detail.projectId},#{detail.projectWorkingTime},#{detail.bonusType}
|
|
|
- ,#{detail.bonusValue},#{detail.totalBonusValue},#{detail.ym},#{detail.year},null,#{detail.createBy},now())
|
|
|
- </foreach>
|
|
|
+ <foreach collection="toAddList" item="detail" separator=",">
|
|
|
+ (#{detail.companyId},#{detail.userId},#{detail.contract},#{detail.projectId},#{detail.projectWorkingTime},#{detail.bonusType}
|
|
|
+ ,#{detail.bonusValue},#{detail.totalBonusValue},#{detail.ym},#{detail.year},null,#{detail.createBy},now())
|
|
|
+ </foreach>
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
-<!-- <resultMap id="contractProjectBonus" type="com.management.platform.entity.vo.ContractProjectBonusVO">-->
|
|
|
-<!-- <result property="contract" column="contract"></result>-->
|
|
|
-<!-- <collection property="projectBonusList" ofType="com.management.platform.entity.vo.ProjectBonusVO">-->
|
|
|
-<!-- <result property="projectId" column="projectId"></result>-->
|
|
|
-<!-- <result property="projectName" column="projectName"></result>-->
|
|
|
-<!-- <result property="bonus" column="bonus"></result>-->
|
|
|
-<!-- <result property="bonusType" column="bonusType"></result>-->
|
|
|
-<!-- </collection>-->
|
|
|
-<!-- </resultMap>-->
|
|
|
+ <!-- <resultMap id="contractProjectBonus" type="com.management.platform.entity.vo.ContractProjectBonusVO">-->
|
|
|
+ <!-- <result property="contract" column="contract"></result>-->
|
|
|
+ <!-- <collection property="projectBonusList" ofType="com.management.platform.entity.vo.ProjectBonusVO">-->
|
|
|
+ <!-- <result property="projectId" column="projectId"></result>-->
|
|
|
+ <!-- <result property="projectName" column="projectName"></result>-->
|
|
|
+ <!-- <result property="bonus" column="bonus"></result>-->
|
|
|
+ <!-- <result property="bonusType" column="bonusType"></result>-->
|
|
|
+ <!-- </collection>-->
|
|
|
+ <!-- </resultMap>-->
|
|
|
|
|
|
<select id="getExportContractProjectBonusForSpecial" resultType="com.management.platform.entity.excel.ProjectContractBonusExcelHead">
|
|
|
select tmp1.*,p.project_name as projectName
|
|
@@ -31,12 +54,12 @@
|
|
|
(
|
|
|
select contract,project_id projectId,bonus_type bonusType,
|
|
|
max( case bonus_type when '第一季度奖' then bonus else 0 end) as firstSeasonBonus,
|
|
|
- max(case bonus_type when '第二季度奖' then bonus else 0 end )as secondSeasonBonus,
|
|
|
- max(case bonus_type when '第三季度奖' then bonus else 0 end) as thirdSeasonBonus,
|
|
|
- max(case bonus_type when '第四季度奖' then bonus else 0 end) as forthSeasonBonus,
|
|
|
- max(case bonus_type when '上半年奖' then bonus else 0 end) as soonerHalfYearBonus,
|
|
|
- max(case bonus_type when '下半年奖' then bonus else 0 end) as latterHalfYearBonus,
|
|
|
- max(case bonus_type when '全年奖' then bonus else 0 end) as yearBonus
|
|
|
+ max(case bonus_type when '第二季度奖' then bonus else 0 end )as secondSeasonBonus,
|
|
|
+ max(case bonus_type when '第三季度奖' then bonus else 0 end) as thirdSeasonBonus,
|
|
|
+ max(case bonus_type when '第四季度奖' then bonus else 0 end) as forthSeasonBonus,
|
|
|
+ max(case bonus_type when '上半年奖' then bonus else 0 end) as soonerHalfYearBonus,
|
|
|
+ max(case bonus_type when '下半年奖' then bonus else 0 end) as latterHalfYearBonus,
|
|
|
+ max(case bonus_type when '全年奖' then bonus else 0 end) as yearBonus
|
|
|
from (
|
|
|
select contract,bonus_type,project_id,sum(bonus_value) as bonus
|
|
|
from contract_bonus_detail
|
|
@@ -51,10 +74,11 @@
|
|
|
resultType="com.management.platform.entity.vo.ContractBonusDetailVO">
|
|
|
select cbd.id, cbd.company_id, cbd.user_id, cbd.contract, cbd.project_id, cbd.project_working_time, cbd.bonus_type
|
|
|
, cbd.bonus_value, cbd.total_bonus_value, cbd.ym, cbd.year, cbd.month, cbd.create_by, cbd.create_time
|
|
|
- ,u.name as userName,p.project_name
|
|
|
+ ,u.name as userName,p.project_name, cbd.is_nagative
|
|
|
from contract_bonus_detail cbd
|
|
|
left join user u on cbd.user_id = u.id
|
|
|
left join project p on cbd.project_id = p.id
|
|
|
where cbd.company_id = #{companyId} and cbd.year = #{year}
|
|
|
</select>
|
|
|
+
|
|
|
</mapper>
|