Commit d6207295 authored by neo's avatar neo

[dev] fix oracle xml

parent d16cb20f
......@@ -107,7 +107,5 @@ public interface CellTemplateMapper extends MyMapper {
*/
int updateByPrimaryKey(CellTemplate record);
void batchInsert(List<CellTemplate> list);
void batchInsert2(List<CellTemplate> list);
}
\ No newline at end of file
......@@ -115,8 +115,6 @@ public interface OrganizationMapper extends MyMapper {
@Select("SELECT id, ParentID from Organization")
List<OrganizationDto> selectOnlyIdAndParentId();
Organization selectByPrimaryKeyWithAssociation(String id);
List<Organization> selectByExampleWithAssociation(OrganizationExample example);
List<OrganizationDto> selectIndBusiunitAreaOrgstrct(@Param("orgIsActive") Boolean orgIsActive);
......
<?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="pwc.taxtech.atms.dao.AreaRegionMapper">
<!-- User defined -->
<resultMap id="ResultMapWithAreaAndRegion" type="pwc.taxtech.atms.entity.AreaRegion">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="areaRegionAreaID" jdbcType="VARCHAR" property="areaID"/>
<result column="areaRegionRegionID" jdbcType="VARCHAR" property="regionID"/>
<association column="AreaID" javaType="pwc.taxtech.atms.entity.Area" property="area">
<id column="areaID" property="ID"/>
<result column="areaParentID" property="parentId"/>
<result column="areaName" property="name"/>
<result column="areaIsActive" property="isActive"/>
<result column="AREA_REGION_AREA_ID" jdbcType="VARCHAR" property="areaId"/>
<result column="AREA_REGION_REGION_ID" jdbcType="VARCHAR" property="regionId"/>
<association column="AREA_ID" javaType="pwc.taxtech.atms.entity.Area" property="area">
<id column="AREA_ID" property="ID"/>
<result column="AREA_PARENT_ID" property="parentId"/>
<result column="AREA_NAME" property="name"/>
<result column="AREA_IS_ACTIVE" property="isActive"/>
</association>
<association column="RegionID" javaType="pwc.taxtech.atms.entity.Region" property="region">
<id column="regionID" property="ID"/>
<result column="regionParentID" property="parentId"/>
<result column="regionName" property="name"/>
<result column="regionShortName" property="shortName"/>
<result column="regionMergerName" property="mergerName"/>
<result column="regionLevelType" property="levelType"/>
<result column="regionTelCode" property="telCode"/>
<result column="regionZipCode" property="zipCode"/>
<result column="regionPinYin" property="pinYin"/>
<result column="regionLongitude" property="longitude"/>
<result column="regionLatitude" property="latitude"/>
<result column="regionIsActive" property="isActive"/>
<association column="REGION_ID" javaType="pwc.taxtech.atms.entity.Region" property="region">
<id column="REGION_ID" property="ID"/>
<result column="REGION_PARENT_ID" property="parentId"/>
<result column="REGION_NAME" property="name"/>
<result column="REGION_SHORT_NAME" property="shortName"/>
<result column="REGION_MERGER_NAME" property="mergerName"/>
<result column="REGION_LEVEL_TYPE" property="levelType"/>
<result column="REGION_TEL_CODE" property="telCode"/>
<result column="REGION_ZIP_CODE" property="zipCode"/>
<result column="REGION_PIN_YIN" property="pinYin"/>
<result column="REGION_LONGITUDE" property="longitude"/>
<result column="REGION_LATITUDE" property="latitude"/>
<result column="REGION_IS_ACTIVE" property="isActive"/>
</association>
</resultMap>
<select id="selectAreaRegionByAreaId" parameterType="string" resultMap="ResultMapWithAreaAndRegion">
select
AreaRegion.ID, AreaRegion.AreaID as areaRegionAreaID, AreaRegion.RegionID as areaRegionRegionID
, Area.ID as areaID, Area.ParentID as areaParentID, Area.Name as areaName, Area.IsActive as areaIsActive
, Region.ID as regionID, Region.ParentID as regionParentID, Region.Name as regionName, Region.ShortName as
regionShortName, Region.MergerName as regionMergerName, Region.LevelType as regionLevelType, Region.TelCode as
regionTelCode, Region.ZipCode as regionZipCode, Region.PinYin as regionPinYin, Region.Longitude as
RegionLongitude, Region.Latitude as regionLatitude, Region.IsActive as regionIsActive
from
AreaRegion, Area, Region
where
AreaRegion.areaID = Area.ID
and AreaRegion.regionID = Region.ID
and AreaRegion.areaID = #{areaId}
order by regionID
SELECT
AREA_REGION.ID,
AREA_REGION.AREA_ID AS AREA_REGION_AREA_ID,
AREA_REGION.REGION_ID AS AREA_REGION_REGION_ID,
AREA.ID AS AREA_ID,
AREA.PARENT_ID AS AREA_PARENT_ID,
AREA.NAME AS AREA_NAME,
AREA.IS_ACTIVE AS AREA_IS_ACTIVE,
REGION.ID AS REGION_ID,
REGION.PARENT_ID AS REGION_PARENT_ID,
REGION.NAME AS REGION_NAME,
REGION.SHORT_NAME AS REGION_SHORT_NAME,
REGION.MERGER_NAME AS REGION_MERGER_NAME,
REGION.LEVEL_TYPE AS REGION_LEVEL_TYPE,
REGION.TEL_CODE AS REGION_TEL_CODE,
REGION.ZIP_CODE AS REGION_ZIP_CODE,
REGION.PIN_YIN AS REGION_PIN_YIN,
REGION.LONGITUDE AS REGION_LONGITUDE,
REGION.LATITUDE AS REGION_LATITUDE,
REGION.IS_ACTIVE AS REGION_IS_ACTIVE
FROM
AREA_REGION,
AREA,
REGION
WHERE
AREA_REGION.AREA_ID = AREA.ID
AND AREA_REGION.REGION_ID = REGION.ID
AND AREA_REGION.AREA_ID = #{areaId}
ORDER BY
REGION_ID
</select>
<resultMap id="resultMapAreaRegionDto" type="pwc.taxtech.atms.dto.arearegion.AreaRegionDto">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="AreaID" property="areaID"/>
<result column="RegionName" property="regionName"/>
<result column="RegionID" property="regionID"/>
<result column="AREA_ID" property="areaId"/>
<result column="REGION_NAME" property="regionName"/>
<result column="REGION_ID" property="regionId"/>
</resultMap>
<select id="selectByRegionLevelType" parameterType="map" resultMap="resultMapAreaRegionDto">
select areaRegionReal.AreaID as AreaID,
p.Name as RegionName,
p.ID as RegionID
from Region as p
left join AreaRegion as areaRegionReal
on p.ID = areaRegionReal.RegionID
where p.LevelType = #{regionLevelType}
SELECT
AREA_REGION_REAL.AREA_ID AS AREA_ID,
p.NAME AS REGION_NAME,
p.ID AS REGION_ID
FROM
REGION AS P
LEFT JOIN
AREA_REGION AS AREA_REGION_REAL
ON
p.ID = AREA_REGION_REAL.REGION_ID
WHERE
p.LEVEL_TYPE = #{regionLevelType}
</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="pwc.taxtech.atms.dao.BusinessUnitMapper">
<resultMap id="OrganizationDto" type="pwc.taxtech.atms.dpo.OrganizationDto">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="OrganizationName" jdbcType="VARCHAR" property="name"/>
<result column="IndustryName" jdbcType="VARCHAR" property="industryName"/>
<result column="BusinessUnitName" jdbcType="VARCHAR" property="businessUnitName"/>
<result column="BusinessUnitID" jdbcType="VARCHAR" property="businessUnitID"/>
<result column="OrgStructureName" jdbcType="VARCHAR" property="structureName"/>
<result column="IndustryID" jdbcType="VARCHAR" property="industryID"/>
<result column="RegionID" jdbcType="VARCHAR" property="regionID"/>
<result column="RegionName" jdbcType="VARCHAR" property="regionName"/>
<result column="OrgStructureID" jdbcType="VARCHAR" property="structureID"/>
<result column="AreaID" jdbcType="VARCHAR" property="areaID"/>
<result column="AreaName" jdbcType="VARCHAR" property="areaName"/>
<result column="ClientCode" jdbcType="VARCHAR" property="clientCode"/>
<result column="Code" jdbcType="VARCHAR" property="code"/>
<result column="ParentID" jdbcType="VARCHAR" property="parentId"/>
<result column="PLevel" jdbcType="INTEGER" property="pLevel"/>
<result column="TaxPayerNumber" jdbcType="VARCHAR" property="taxPayerNumber"/>
<result column="IsActive" jdbcType="SMALLINT" property="isActive"/>
<result column="ORGANIZATION_NAME" jdbcType="VARCHAR" property="name"/>
<result column="INDUSTRY_NAME" jdbcType="VARCHAR" property="industryName"/>
<result column="BUSINESS_UNIT_NAME" jdbcType="VARCHAR" property="businessUnitName"/>
<result column="BUSINESS_UNIT_ID" jdbcType="VARCHAR" property="businessUnitId"/>
<result column="ORG_STRUCTURE_NAME" jdbcType="VARCHAR" property="structureName"/>
<result column="INDUSTRY_ID" jdbcType="VARCHAR" property="industryId"/>
<result column="REGION_ID" jdbcType="VARCHAR" property="regionId"/>
<result column="REGION_NAME" jdbcType="VARCHAR" property="regionName"/>
<result column="ORG_STRUCTURE_ID" jdbcType="VARCHAR" property="structureId"/>
<result column="AREA_ID" jdbcType="VARCHAR" property="areaId"/>
<result column="AREA_NAME" jdbcType="VARCHAR" property="areaName"/>
<result column="CLIENT_CODE" jdbcType="VARCHAR" property="clientCode"/>
<result column="CODE" jdbcType="VARCHAR" property="code"/>
<result column="PARENT_ID" jdbcType="VARCHAR" property="parentId"/>
<result column="P_LEVEL" jdbcType="INTEGER" property="pLevel"/>
<result column="TAX_PAYER_NUMBER" jdbcType="VARCHAR" property="taxPayerNumber"/>
<result column="IS_ACTIVE" jdbcType="SMALLINT" property="isActive"/>
</resultMap>
<select id="getBusinessUnitListJoinResult" resultMap="OrganizationDto">
select Distinct org.ID as ID,
org.Name as OrganizationName,
ind.Name as IndustryName,
bu.Name as BusinessUnitName,
bu.ID as BusinessUnitID,
os.Name as OrgStructureName,
ind.ID as IndustryID,
org.RegionID as RegionID,
reg.Name as RegionName,
os.ID as OrgStructureID,
area.ID as AreaID,
area.Name as AreaName,
org.ClientCode as ClientCode,
org.Code as Code,
org.ParentID as ParentID,
org.PLevel as PLevel,
org.TaxPayerNumber as TaxPayerNumber
from BusinessUnit as bu
left join Organization as org on bu.ID = org.BusinessUnitID and org.IsActive = 1
left join Industry as ind on org.IndustryID = ind.ID
left join Area as area on org.AreaID = area.ID
left join OrganizationStructure as os on org.StructureID = os.ID
left join Region as reg on org.RegionID = reg.ID
where bu.IsActive = 1
SELECT DISTINCT
ORG.ID AS ID,
ORG.NAME AS ORGANIZATION_NAME,
IND.NAME AS INDUSTRY_NAME,
BU.NAME AS BUSINESS_UNIT_NAME,
BU.ID AS BUSINESS_UNIT_ID,
OS.NAME AS ORG_STRUCTURE_NAME,
IND.ID AS INDUSTRY_ID,
ORG.REGION_ID AS REGION_ID,
REG.NAME AS REGION_NAME,
OS.ID AS ORG_STRUCTURE_ID,
AREA.ID AS AREA_ID,
AREA.NAME AS AREA_NAME,
ORG.CLIENT_CODE AS CLIENT_CODE,
ORG.CODE AS CODE,
ORG.PARENT_ID AS PARENT_ID,
ORG.P_LEVEL AS P_LEVEL,
ORG.TAX_PAYER_NUMBER AS TAX_PAYER_NUMBER
FROM
BUSINESS_UNIT AS BU
LEFT JOIN
ORGANIZATION AS ORG
ON
BU.ID = ORG.BUSINESS_UNIT_ID
AND ORG.IS_ACTIVE = 1
LEFT JOIN
INDUSTRY AS IND
ON
ORG.INDUSTRY_ID = IND.ID
LEFT JOIN
AREA AS AREA
ON
ORG.AREA_ID = AREA.ID
LEFT JOIN
ORGANIZATION_STRUCTURE AS OS
ON
ORG.STRUCTURE_ID = OS.ID
LEFT JOIN
REGION AS REG
ON
ORG.REGION_ID = REG.ID
WHERE
BU.IS_ACTIVE = 1
</select>
</mapper>
\ No newline at end of file
......@@ -2,48 +2,54 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pwc.taxtech.atms.dao.CellTemplateConfigMapper">
<select id="getCellTemplateConfigByTemplateId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select b.* from cell_template a join cell_template_config b on a.id = b.cell_template_id where
a.report_template_id=#{templateID,jdbcType=VARCHAR}
SELECT
B.*
FROM
CELL_TEMPLATE A
JOIN
CELL_TEMPLATE_CONFIG B ON A.ID = B.CELL_TEMPLATE_ID
WHERE
A.REPORT_TEMPLATE_ID = #{TEMPLATEID,JDBCTYPE=VARCHAR}
</select>
<delete id="deleteCellTemplateConfigByCellTemplate" parameterType="java.lang.Long">
delete a.*
FROM
cell_template_config a
DELETE A . * FROM CELL_TEMPLATE_CONFIG A
WHERE
id IN (select id from(
SELECT
b.id
ID IN (SELECT
ID
FROM
cell_template_config b
INNER JOIN cell_template c ON b.cell_template_id = c.id
WHERE
c.report_template_id = #{templateDbID,jdbcType=VARCHAR}
) x)
(SELECT
B.ID
FROM
CELL_TEMPLATE_CONFIG B
INNER JOIN CELL_TEMPLATE C ON B.CELL_TEMPLATE_ID = C.ID
WHER
C.REPORT_TEMPLATE_ID = #{TEMPLATEDBID,JDBCTYPE=VARCHAR}) X)
</delete>
<insert id="batchInsert" parameterType="pwc.taxtech.atms.entity.CellTemplateConfig">
INSERT INTO tax_admin.cell_template_config
(id,
cell_template_id,
report_template_id,
data_source_type,
formula,
formula_description,
account_codes,
invoice_type,
tax_rate,
invoice_amount_type,
model_ids,
create_by,
create_time,
update_by,
update_time,
invoice_category,
formula_data_source,
validation,
validation_description,
voucher_keyword
INSERT INTO TAX_ADMIN.CELL_TEMPLATE_CONFIG
(ID,
CELL_TEMPLATE_ID,
REPORT_TEMPLATE_ID,
DATA_SOURCE_TYPE,
FORMULA,
FORMULA_DESCRIPTION,
ACCOUNT_CODES,
INVOICE_TYPE,
TAX_RATE,
INVOICE_AMOUNT_TYPE,
MODEL_IDS,
CREATE_BY,
CREATE_TIME,
UPDATE_BY,
UPDATE_TIME,
INVOICE_CATEGORY,
FORMULA_DATA_SOURCE,
VALIDATION,
VALIDATION_DESCRIPTION,
VOUCHER_KEYWORD
)
VALUES
<foreach collection="list" item="item" separator=",">
......@@ -210,27 +216,27 @@
</insert>
<insert id="batchInsert2" parameterType="pwc.taxtech.atms.entity.CellTemplateConfig">
INSERT INTO tax_admin.cell_template_config
(id,
cell_template_id,
report_template_id,
data_source_type,
formula,
formula_description,
account_codes,
invoice_type,
tax_rate,
invoice_amount_type,
model_ids,
create_by,
create_time,
update_by,
update_time,
invoice_category,
formula_data_source,
validation,
validation_description,
voucher_keyword
INSERT INTO TAX_ADMIN.CELL_TEMPLATE_CONFIG
(ID,
CELL_TEMPLATE_ID,
REPORT_TEMPLATE_ID,
DATA_SOURCE_TYPE,
FORMULA,
FORMULA_DESCRIPTION,
ACCOUNT_CODES,
INVOICE_TYPE,
TAX_RATE,
INVOICE_AMOUNT_TYPE,
MODEL_IDS,
CREATE_BY,
CREATE_TIME,
UPDATE_BY,
UPDATE_TIME,
INVOICE_CATEGORY,
FORMULA_DATA_SOURCE,
VALIDATION,
VALIDATION_DESCRIPTION,
VOUCHER_KEYWORD
)
VALUES
<foreach collection="list" item="item" separator=",">
......
<?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="pwc.taxtech.atms.dao.CellTemplateMapper">
<insert id="batchInsert">
insert into CellTemplate (ID, ReportTemplateID, RowIndex,
RowName, ColumnIndex, ColumnName,
Comment, CreateTime, UpdateTime,
CopyFromID, DataType, IsReadOnly
)
values
<foreach collection="list" item="item" separator=",">
(#{item.ID,jdbcType=VARCHAR}, #{item.reportTemplateID,jdbcType=VARCHAR}, #{item.rowIndex,jdbcType=INTEGER},
#{item.rowName,jdbcType=VARCHAR}, #{item.columnIndex,jdbcType=INTEGER}, #{item.columnName,jdbcType=VARCHAR},
#{item.comment,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
#{item.updateTime,jdbcType=TIMESTAMP},
#{item.copyFromID,jdbcType=VARCHAR}, #{item.dataType,jdbcType=INTEGER}, #{item.isReadOnly,jdbcType=INTEGER}
)
</foreach>
</insert>
<insert id="batchInsert2">
insert into cell_template (id, report_template_id, row_index,
row_name, column_index, column_name,
comment, create_time, update_time,
copy_from_id, data_type, is_read_only, create_by, update_by
INSERT INTO
CELL_TEMPLATE (
ID,
REPORT_TEMPLATE_ID,
ROW_INDEX,
ROW_NAME,
COLUMN_INDEX,
COLUMN_NAME,
COMMENT,
CREATE_TIME,
UPDATE_TIME,
COPY_FROM_ID,
DATA_TYPE,
IS_READ_ONLY,
CREATE_BY,
UPDATE_BY
)
values
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=INTEGER}, #{item.reportTemplateId,jdbcType=INTEGER}, #{item.rowIndex,jdbcType=INTEGER},
#{item.rowName,jdbcType=VARCHAR}, #{item.columnIndex,jdbcType=INTEGER}, #{item.columnName,jdbcType=VARCHAR},
#{item.comment,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
(
#{item.id,jdbcType=INTEGER},
#{item.reportTemplateId,jdbcType=INTEGER},
#{item.rowIndex,jdbcType=INTEGER},
#{item.rowName,jdbcType=VARCHAR},
#{item.columnIndex,jdbcType=INTEGER},
#{item.columnName,jdbcType=VARCHAR},
#{item.comment,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP},
#{item.updateTime,jdbcType=TIMESTAMP},
#{item.copyFromId,jdbcType=INTEGER}, #{item.dataType,jdbcType=INTEGER},
#{item.copyFromId,jdbcType=INTEGER},
#{item.dataType,jdbcType=INTEGER},
#{item.isReadOnly,jdbcType=SMALLINT},
#{item.createBy,jdbcType=VARCHAR}, #{item.updateBy,jdbcType=VARCHAR}
#{item.createBy,jdbcType=VARCHAR},
#{item.updateBy,jdbcType=VARCHAR}
)
</foreach>
</insert>
</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="pwc.taxtech.atms.dao.DimensionMapper">
<resultMap id="OrganizationDto" type="pwc.taxtech.atms.dpo.OrganizationDto">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="DimensionID" jdbcType="VARCHAR" property="dimensionId"/>
<result column="DimensionName" jdbcType="VARCHAR" property="dimensionName"/>
<result column="DimensionValueID" jdbcType="VARCHAR" property="dimensionValueID"/>
<result column="DimensionValueName" jdbcType="VARCHAR" property="dimensionValueName"/>
<result column="DIMENSION_ID" jdbcType="VARCHAR" property="dimensionId"/>
<result column="DIMENSION_NAME" jdbcType="VARCHAR" property="dimensionName"/>
<result column="DIMENSION_VALUE_ID" jdbcType="VARCHAR" property="dimensionValueId"/>
<result column="DIMENSION_VALUE_NAME" jdbcType="VARCHAR" property="dimensionValueName"/>
<!-- 注意! OrganizationName 对应 name-->
<result column="OrganizationName" jdbcType="VARCHAR" property="name"/>
<result column="AttributeID" jdbcType="VARCHAR" property="attributeId"/>
<result column="BusinessUnitID" jdbcType="VARCHAR" property="businessUnitID"/>
<result column="IndustryID" jdbcType="VARCHAR" property="industryID"/>
<result column="IndustryName" jdbcType="VARCHAR" property="industryName"/>
<result column="RegionID" jdbcType="VARCHAR" property="regionID"/>
<result column="RegionName" jdbcType="VARCHAR" property="regionName"/>
<result column="StructureID" jdbcType="VARCHAR" property="structureID"/>
<result column="AreaID" jdbcType="VARCHAR" property="areaID"/>
<result column="AreaName" jdbcType="VARCHAR" property="areaName"/>
<result column="BusinessUnitName" jdbcType="VARCHAR" property="businessUnitName"/>
<result column="ClientCode" jdbcType="VARCHAR" property="clientCode"/>
<result column="Code" jdbcType="VARCHAR" property="code"/>
<result column="ParentID" jdbcType="VARCHAR" property="parentId"/>
<result column="PLevel" jdbcType="INTEGER" property="pLevel"/>
<result column="ORGANIZATION_NAME" jdbcType="VARCHAR" property="name"/>
<result column="ATTRIBUTE_ID" jdbcType="VARCHAR" property="attributeId"/>
<result column="BUSINESS_UNIT_ID" jdbcType="VARCHAR" property="businessUnitId"/>
<result column="INDUSTRY_ID" jdbcType="VARCHAR" property="industryId"/>
<result column="INDUSTRY_NAME" jdbcType="VARCHAR" property="industryName"/>
<result column="REGION_ID" jdbcType="VARCHAR" property="regionId"/>
<result column="REGION_NAME" jdbcType="VARCHAR" property="regionName"/>
<result column="STRUCTURE_ID" jdbcType="VARCHAR" property="structureId"/>
<result column="AREA_ID" jdbcType="VARCHAR" property="areaId"/>
<result column="AREA_NAME" jdbcType="VARCHAR" property="areaName"/>
<result column="BUSINESS_UNIT_NAME" jdbcType="VARCHAR" property="businessUnitName"/>
<result column="CLIENT_CODE" jdbcType="VARCHAR" property="clientCode"/>
<result column="CODE" jdbcType="VARCHAR" property="code"/>
<result column="PARENT_ID" jdbcType="VARCHAR" property="parentId"/>
<result column="P_LEVEL" jdbcType="INTEGER" property="pLevel"/>
</resultMap>
<select id="getBusinessUnitListJoinDimensionResult" parameterType="map" resultMap="OrganizationDto">
select Distinct
org.ID as ID,
d.ID as DimensionID,
d.Name as DimensionName,
dv.ID as DimensionValueID,
dv.Name as DimensionValueName,
org.Name as OrganizationName,
d.AttributeID as AttributeID,
bu.ID as BusinessUnitID,
ind.ID as IndustryID,
ind.Name as IndustryName,
org.RegionID as RegionID,
reg.Name as RegionName,
os.ID as StructureID,
area.ID as AreaID,
area.Name as AreaName,
bu.Name as BusinessUnitName,
org.ClientCode as ClientCode,
org.Code as Code,
org.ParentID as ParentID,
org.PLevel as PLevel
from Dimension as d
join DimensionValue as dv on d.ID = dv.DimensionID and dv.IsActive = 1
left join DimensionValueOrg as dvg on dv.ID = dvg.DimensionValueID
left join Organization as org on org.ID = dvg.OrganizationID
<select id="getBusinessUnitListJoinDimensionResult" parameterType="map" resultMap="OrganizationDto">
SELECT DISTINCT
ORG.ID AS ID,
D.ID AS DIMENSION_ID,
D.NAME AS DIMENSION_NAME,
DV.ID AS DIMENSION_VALUE_ID,
DV.NAME AS DIMENSION_VALUE_NAME,
ORG.NAME AS ORGANIZATION_NAME,
D.ATTRIBUTE_ID AS ATTRIBUTE_ID,
BU.ID AS BUSINESS_UNIT_ID,
IND.ID AS INDUSTRY_ID,
IND.NAME AS INDUSTRY_NAME,
ORG.REGION_ID AS REGION_ID,
REG.NAME AS REGION_NAME,
OS.ID AS STRUCTURE_ID,
AREA.ID AS AREA_ID,
AREA.NAME AS AREA_NAME,
BU.NAME AS BUSINESS_UNIT_NAME,
ORG.CLIENT_CODE AS CLIENT_CODE,
ORG.CODE AS CODE,
ORG.PARENT_ID AS PARENT_ID,
ORG.P_LEVEL AS P_LEVEL
FROM
DIMENSION AS D
JOIN
DIMENSION_VALUE AS DV
ON
D.ID = DV.DIMENSION_ID
AND DV.IS_ACTIVE = 1
LEFT JOIN
DIMENSION_VALUE_ORG AS DVG
ON
DV.ID = DVG.DIMENSION_VALUE_ID
LEFT JOIN
ORGANIZATION AS ORG
ON
ORG.ID = DVG.ORGANIZATION_ID
<if test="orgIsActive != null and orgIsActive == true">
and org.IsActive = 1
AND ORG.IS_ACTIVE = 1
</if>
left join Industry as ind on org.IndustryID = ind.ID
left join BusinessUnit as bu on bu.ID = org.BusinessUnitID
left join Area as area on org.AreaID = area.ID
left join OrganizationStructure as os on org.StructureID = os.ID
left join Region as reg on org.RegionID = reg.ID
where d.IsActive = 1 AND d.ID = #{dimensionId}
LEFT JOIN
INDUSTRY AS IND
ON
ORG.INDUSTRY_ID = IND.ID
LEFT JOIN
BUSINESS_UNIT AS BU
ON
BU.ID = ORG.BUSINESS_UNIT_ID
LEFT JOIN
AREA AS AREA
ON
ORG.AREA_ID = AREA.ID
LEFT JOIN
ORGANIZATION_STRUCTURE AS OS
ON
ORG.STRUCTURE_ID = OS.ID
LEFT JOIN
REGION AS REG
ON
ORG.REGION_ID = REG.ID
WHERE
D.IS_ACTIVE = 1
AND D.ID = #{dimensionId}
</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="pwc.taxtech.atms.dao.DimensionValueMapper">
<select id="selectByIDIgnoreCase" parameterType="java.lang.String" resultMap="BaseResultMap">
<!-- select one record by ID ignore case -->
select
SELECT
<include refid="Base_Column_List"/>
from DimensionValue
where lower(ID) = lower(#{dimensionValueId})
FROM
DIMENSION_VALUE
WHERE
LOWER(ID) = LOWER( #{dimensionValueId})
</select>
<resultMap id="DimensionValueJoinDimensionDto" type="pwc.taxtech.atms.dto.dimension.DimensionValueJoinDimensionDto">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="DimensionName" jdbcType="VARCHAR" property="dimensionName"/>
<result column="DimensionValue" jdbcType="VARCHAR" property="dimensionValue"/>
<result column="DimensionValueID" jdbcType="VARCHAR" property="dimensionValueID"/>
<result column="DIMENSION_NAME" jdbcType="VARCHAR" property="dimensionName"/>
<result column="DIMENSION_VALUE" jdbcType="VARCHAR" property="dimensionValue"/>
<result column="DIMENSION_VALUE_ID" jdbcType="VARCHAR" property="dimensionValueId"/>
</resultMap>
<select id="selectDimensionValueJoinDimension" resultMap="DimensionValueJoinDimensionDto">
select q.Name as DimensionName,
p.Name as DimensionValue,
p.ID as DimensionValueID
from DimensionValue as p
join Dimension as q
on p.DimensionID = q.ID
SELECT
Q.NAME AS DIMENSION_NAME,
P.NAME AS DIMENSION_VALUE,
P.ID AS DIMENSION_VALUE_ID
FROM
DIMENSION_VALUE AS P
JOIN
DIMENSION AS Q
ON
P.DIMENSION_ID = Q.ID
</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="pwc.taxtech.atms.dao.DimensionValueOrgMapper">
<resultMap id="UnionDimensionValueOrg" type="pwc.taxtech.atms.dto.dimension.UnionDimensionValueOrg">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="DimensionValueID" jdbcType="VARCHAR" property="dimensionValueID"/>
<result column="OrganizationID" jdbcType="VARCHAR" property="organizationID"/>
<result column="DimensionID" jdbcType="VARCHAR" property="dimensionId"/>
<result column="DimensionValueName" jdbcType="VARCHAR" property="dimensionValueName"/>
<result column="DIMENSION_VALUE_ID" jdbcType="VARCHAR" property="dimensionValueId"/>
<result column="ORGANIZATION_ID" jdbcType="VARCHAR" property="organizationId"/>
<result column="DIMENSION_ID" jdbcType="VARCHAR" property="dimensionId"/>
<result column="DIMENSION_VALUE_NAME" jdbcType="VARCHAR" property="dimensionValueName"/>
</resultMap>
<select id="selectUnionDimensionValueOrgByDimension" parameterType="pwc.taxtech.atms.dto.DimensionParamDto"
resultMap="UnionDimensionValueOrg">
select * from
(select #{organizationStructureID} as ID, StructureID as DimensionValueID, ID as
OrganizationID from Organization
union
select #{businessUnitID} as ID, BusinessUnitID as DimensionValueID, ID as
OrganizationID from Organization
union
select #{areaID} as ID, AreaID as DimensionValueID, ID as OrganizationID
from Organization
union
select ID, DimensionValueID, OrganizationID from DimensionValueOrg) as q
join
(select ID as DimensionValueID, Name as DimensionValueName,
IsActive, #{organizationStructureID} as DimensionID, CreateTime, UpdateTime from
OrganizationStructure where IsActive=1
union
select ID as DimensionValueID, Name as DimensionValueName,
IsActive, #{businessUnitID} as DimensionID, CreateTime, UpdateTime from
BusinessUnit where IsActive=1
union
select ID as DimensionValueID, Name as DimensionValueName,
IsActive, #{areaID} as DimensionID, now() as CreateTime,
now() as UpdateTime from Area where IsActive=1
<select id="selectUnionDimensionValueOrgByDimension" parameterType="pwc.taxtech.atms.dto.DimensionParamDto" resultMap="UnionDimensionValueOrg">
SELECT
*
FROM
(
SELECT
#{organizationStructureID} AS ID,
STRUCTURE_ID AS DIMENSION_VALUE_ID,
ID AS ORGANIZATION_ID
FROM
ORGANIZATION
UNION
SELECT
#{businessUnitID} AS ID,
BUSINESS_UNIT_ID AS DIMENSION_VALUE_ID,
ID AS ORGANIZATION_ID
FROM
ORGANIZATION
UNION
SELECT
#{areaID} AS ID,
AREA_ID AS DIMENSION_VALUE_ID,
ID AS ORGANIZATION_ID
FROM
ORGANIZATION
UNION
SELECT
ID,
DimensionValueID,
OrganizationID
FROM
DIMENSION_VALUE_ORG
)
AS Q
JOIN
(
SELECT
ID AS DIMENSION_VALUE_ID,
Name AS DIMENSION_VALUE_NAME,
IS_ACTIVE,
#{organizationStructureID} AS DIMENSION_ID,
CREATE_TIME,
UPDATE_TIME
FROM
ORGANIZATION_STRUCTURE
WHERE
IS_ACTIVE=1
union
select ID as DimensionValueID, Name as DimensionValueName,
IsActive, DimensionID, CreateTime, UpdateTime from DimensionValue
where IsActive=1) as p
on p.DimensionValueID = q.DimensionValueID
join
Dimension as r on r.IsActive = 1 and p.DimensionID = r.ID
SELECT
ID AS DIMENSION_VALUE_ID,
NAME AS DIMENSION_VALUE_NAME,
IS_ACTIVE,
#{businessUnitID} AS DIMENSION_ID,
CREATE_TIME,
UPDATE_TIME
FROM
BUSINESS_UNIT
WHERE
IS_ACTIVE=1
UNION
SELECT
ID AS DIMENSION_VALUE_ID,
NAME AS DIMENSION_VALUE_NAME,
IS_ACTIVE,
#{areaID} AS DIMENSION_ID,
now (
)
AS CREATE_TIME,
now (
)
AS UPDATE_TIME
FROM
AREA
WHERE
IS_ACTIVE=1
UNION
SELECT
ID AS DIMENSION_VALUE_ID,
NAME AS DIMENSION_VALUE_NAME,
IS_ACTIVE,
DIMENSION_ID,
CREATE_TIME,
UPDATE_TIME
FROM
DIMENSION_VALUE
WHERE
IS_ACTIVE=1
)
AS P
on
p.DIMENSION_VALUE_ID = q.DIMENSION_VALUE_ID
JOIN
DIMENSION AS R
on
r.IS_ACTIVE = 1
AND P.DIMENSION_ID = r.ID
</select>
</mapper>
\ No newline at end of file
......@@ -3,35 +3,62 @@
<mapper namespace="pwc.taxtech.atms.dao.EnterpriseAccountMapper">
<select id="getDto" resultType="pwc.taxtech.atms.dpo.EnterpriseAccountDto">
SELECT ea.ID, ea.CODE as code, ea.NAME as name, ea.ParentCode as parentCode, ea.FullName as fullName
, ea.IsLeaf as isLeaf, ea.RuleType as ruleType, ea.AcctLevel as acctLevel, ea.AcctProp as acctProp, ea.Direction
as direction
, ea.IsActive as isActive
, CASE
WHEN am.StandardAccountCode = '0000' THEN am.StandardAccountCode
ELSE sa.CODE
END AS stdCode, sa.NAME AS stdName, sa.ParentCode AS stdParentCode, sa.Direction AS stdDirection, sa.AcctProp AS
stdAcctProp
, sa.FullName AS stdFullName
FROM (
SELECT *
FROM EnterpriseAccount
WHERE Enterpriseaccountsetid = #{epAccountSetID}
) ea
LEFT JOIN (
SELECT *
FROM AccountMapping
WHERE OrganizationID = #{orgId}
AND IndustryID = #{industryId}
AND EnterpriseAccountSetID = #{epAccountSetID}
) am
ON ea.CODE = am.EnterpriseAccountCode
LEFT JOIN (
SELECT *
FROM StandardAccount
WHERE IndustryID = #{industryId}
) sa
ON am.StandardAccountCode = sa.CODE
ORDER BY ea.CODE
SELECT
EA.ID,
ea.CODE AS CODE,
ea.NAME AS NAME,
ea.PARENT_CODE AS PARENT_CODE,
ea.FULL_NAME AS FULL_NAME,
ea.IS_LEAF AS IS_LEAF,
ea.RULE_TYPE AS RULE_TYPE,
ea.ACCT_LEVEL AS ACCT_LEVEL,
ea.ACCT_PROP AS ACCT_PROP,
ea.DIRECTION AS DIRECTION,
ea.IS_ACTIVE AS IS_ACTIVE,
CASE WHEN am.STANDARD_ACCOUNT_CODE = '0000' THEN am.STANDARD_ACCOUNT_CODE ELSE sa.CODE END AS STD_CODE,
sa.NAME AS STD_NAME,
sa.PARENT_CODE AS STD_PARENT_CODE,
sa.DIRECTION AS STD_DIRECTION,
sa.ACCT_PROP AS STD_ACCT_PROP,
sa.FULL_NAME AS STD_FULL_NAME
FROM
(
SELECT
*
FROM
ENTERPRISE_ACCOUNT
WHERE
ENTERPRISE_ACCOUNTSET_ID = #{epAccountSetID}
)
ea
LEFT JOIN
(
SELECT
*
FROM
ACCOUNT_MAPPING
WHERE
ORGANIZATION_ID = #{orgId}
AND INDUSTRY_ID = #{industryId}
AND ENTERPRISE_ACCOUNT_SET_ID = #{epAccountSetID}
)
am
ON
ea.CODE = am.ENTERPRISE_ACCOUNT_CODE
LEFT JOIN
(
SELECT
*
FROM
STANDARD_ACCOUNT
WHERE
IndustryID = #{industryId}
)
sa
ON
am.STANDARD_ACCOUNT_CODE = sa.CODE
ORDER BY
ea.CODE
</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="pwc.taxtech.atms.dao.EnterpriseAccountSetMapper">
<select id="getAccountDtoByOrgId" resultMap="BaseResultMap">
select ta.ID, ta.Code, ta.Name, ta.IsActive, ta.CreatorID, ta.CreateTime, ta.UpdateTime
from EnterpriseAccountSet ta
left outer join EnterpriseAccountSetOrg tb
on ta.ID = tb.EnterpriseAccountSetID
where tb.OrganizationID=#{orgId}
SELECT
TA.ID,
ta.CODE,
ta.NAME,
ta.IS_ACTIVE,
ta.CREATOR_ID,
ta.CREATE_TIME,
ta.UPDATE_TIME
FROM
ENTERPRISE_ACCOUNT_SET ta
left outer JOIN
ENTERPRISE_ACCOUNT_SET_ORG tb
on
ta.ID = tb.ENTERPRISE_ACCOUNT_SET_ID
where
tb.ORGANIZATION_ID_= #{orgId}
</select>
</mapper>
\ No newline at end of file
......@@ -8,37 +8,43 @@
</resultMap>
<select id="selectByExampleWithAssociation" parameterType="pwc.taxtech.atms.entity.EnterpriseAccountSetOrgExample"
resultMap="ResultMapWithAssociation">
select
SELECT
<if test="distinct">
distinct
DISTINCT
</if>
<include refid="Base_Column_List"/>
from EnterpriseAccountSetOrg
FROM ENTERPRISE_ACCOUNT_SET_ORG
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
ORDER BY ${orderByClause}
</if>
</select>
<resultMap id="EnterpriseAccountSetOrgDto" type="pwc.taxtech.atms.dpo.EnterpriseAccountSetOrgDto">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="EnterpriseAccountSetID" jdbcType="VARCHAR" property="enterpriseAccountSetID"/>
<result column="OrganizationID" jdbcType="VARCHAR" property="organizationID"/>
<result column="EffectiveDate" jdbcType="VARCHAR" property="effectiveDate"/>
<result column="ExpiredDate" jdbcType="VARCHAR" property="expiredDate"/>
<result column="EnterpriseAccountSetName" jdbcType="VARCHAR" property="enterpriseAccountSetName"/>
<result column="ENTERPRISE_ACCOUNT_SET_ID" jdbcType="VARCHAR" property="enterpriseAccountSetId"/>
<result column="ORGANIZATION_ID" jdbcType="VARCHAR" property="organizationId"/>
<result column="EFFECTIVE_DATE" jdbcType="VARCHAR" property="effectiveDate"/>
<result column="EXPIRED_DATE" jdbcType="VARCHAR" property="expiredDate"/>
<result column="ENTERPRISE_ACCOUNT_SET_NAME" jdbcType="VARCHAR" property="enterpriseAccountSetName"/>
</resultMap>
<select id="getSingleOrgByOrgIDToEASODto" parameterType="map" resultMap="EnterpriseAccountSetOrgDto">
select
m.ID as ID,
m.EnterpriseAccountSetID as EnterpriseAccountSetID,
m.OrganizationID as OrganizationID,
m.EffectiveDate as EffectiveDate,
m.ExpiredDate as ExpiredDate,
n.Name as EnterpriseAccountSetName
from EnterpriseAccountSetOrg as m
left join EnterpriseAccountSet as n on m.EnterpriseAccountSetID = n.ID
where m.OrganizationID = #{orgId}
SELECT
M.ID AS ID,
m.ENTERPRISE_ACCOUNT_SET_ID AS ENTERPRISE_ACCOUNT_SET_ID,
m.ORGANIZATION_ID AS ORGANIZATION_ID,
m.EFFECTIVE_DATE AS EFFECTIVE_DATE,
m.EXPIRED_DATE AS EXPIRED_DATE,
n.NAME AS ENTERPRISE_ACCOUNT_SET_NAME
FROM
ENTERPRISE_ACCOUNT_SET_ORG AS M
left JOIN
ENTERPRISE_ACCOUNT_SET AS N
on
m.ENTERPRISE_ACCOUNT_SET_ID = n.ID
WHERE
m.ORGANIZATION_ID = #{orgId}
</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="pwc.taxtech.atms.dao.IndustryMapper">
<select id="getAllAvailableIndustry" resultMap="BaseResultMap">
SELECT
*
FROM
Industry
INDUSTRY
WHERE
isActive = 1
AND Name IN ('通用行业' ,'房地产业', '资产管理', '银行及其他金融服务业')
AND NAME IN (
'通用行业',
'房地产业',
'资产管理',
'银行及其他金融服务业'
)
</select>
<resultMap id="TemplateGroup" type="pwc.taxtech.atms.entity.TemplateGroup">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="service_type_id" jdbcType="VARCHAR" property="serviceTypeId"/>
<result column="industry_ids" jdbcType="VARCHAR" property="industryIds"/>
<result column="pay_tax_type" jdbcType="INTEGER" property="payTaxType"/>
<result column="group_type" jdbcType="INTEGER" property="groupType"/>
<result column="copy_from" jdbcType="BIGINT" property="copyFrom"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="is_system_type" jdbcType="INTEGER" property="isSystemType"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. -->
<id column="ID" jdbcType="BIGINT" property="id"/>
<result column="NAME" jdbcType="VARCHAR" property="name"/>
<result column="SERVICE_TYPE_ID" jdbcType="VARCHAR" property="serviceTypeId"/>
<result column="INDUSTRY_IDS" jdbcType="VARCHAR" property="industryIds"/>
<result column="PAY_TAX_TYPE" jdbcType="INTEGER" property="payTaxType"/>
<result column="GROUP_TYPE" jdbcType="INTEGER" property="groupType"/>
<result column="COPY_FROM" jdbcType="BIGINT" property="copyFrom"/>
<result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
<result column="IS_SYSTEM_TYPE" jdbcType="INTEGER" property="isSystemType"/>
<result column="CREATE_BY" jdbcType="VARCHAR" property="createBy"/>
<result column="UPDATE_BY" jdbcType="VARCHAR" property="updateBy"/>
</resultMap>
<select id="getTemplateGroup" resultMap="TemplateGroup">
SELECT b.*
FROM Industry a
JOIN template_group b
ON a.ID = b.industry_ids
WHERE a.Name = '通用行业'
AND b.group_type = 2
LIMIT 1
SELECT
B.*
FROM
INDUSTRY a
JOIN
template_group b
ON
a.ID = b.industry_ids
WHERE
a.NAME = '通用行业'
AND B.group_type = 2 LIMIT 1
</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="pwc.taxtech.atms.dao.KeyValueConfigMapper">
<select id="selectKeyValueConfigsByOrderByCreateTime" resultMap="BaseResultMap">
SELECT KeyValueConfig.ID,
KeyValueConfig.KeyCode,
KeyValueConfig.Name,
KeyValueConfig.KeyValueType,
KeyValueConfig.Formula,
KeyValueConfig.IsConstant,
KeyValueConfig.CalculateStatus,
KeyValueConfig.ResultType,
KeyValueConfig.ServiceTypeIDs,
KeyValueConfig.IndustryIDs,
KeyValueConfig.Description,
KeyValueConfig.Creator,
KeyValueConfig.CreateTime,
KeyValueConfig.Updator,
KeyValueConfig.UpdateTime,
KeyValueConfig.DataSource
FROM tax_admin.KeyValueConfig order by KeyValueConfig.createtime
<mapper namespace="pwc.taxtech.atms.dao.KEY_VALUE_CONFIGMapper">
<select id="selectKEY_VALUE_CONFIGsByOrderByCreateTime" resultMap="BaseResultMap">
SELECT
KEY_VALUE_CONFIG.ID,
KEY_VALUE_CONFIG.KEY_CODE,
KEY_VALUE_CONFIG.NAME,
KEY_VALUE_CONFIG.KEY_VALUE_TYPE,
KEY_VALUE_CONFIG.FORMULA,
KEY_VALUE_CONFIG.IS_CONSTANT,
KEY_VALUE_CONFIG.CALCULATE_STATUS,
KEY_VALUE_CONFIG.RESULT_TYPE,
KEY_VALUE_CONFIG.SERVICE_TYPE_IDS,
KEY_VALUE_CONFIG.INDUSTRY_IDS,
KEY_VALUE_CONFIG.DESCRIPTION,
KEY_VALUE_CONFIG.CREATOR,
KEY_VALUE_CONFIG.CREATE_TIME,
KEY_VALUE_CONFIG.UPDATOR,
KEY_VALUE_CONFIG.UPDATE_TIME,
KEY_VALUE_CONFIG.DATA_SOURCE
FROM
TAX_ADMIN.KEY_VALUE_CONFIG
ORDER BY
KEY_VALUE_CONFIG.CREATETIME
</select>
</mapper>
\ No newline at end of file
......@@ -3,91 +3,132 @@
<mapper namespace="pwc.taxtech.atms.dao.KeyValueReferenceMapper">
<delete id="deleteKeyValueReferenceByCellTemplate" parameterType="java.lang.Long">
delete a.*
FROM
KeyValueReference a
delete
a.* FROM
KEY_VALUE_REFERENCE a
WHERE
ID IN (select ID from(
ID IN (
SELECT
ID
FROM
(
SELECT
b.ID
B.ID
FROM
KeyValueReference b
INNER JOIN cell_template c ON b.CellTemplateID = c.ID
KEY_VALUE_REFERENCE b
INNER JOIN
CELL_TEMPLATE c
ON
b.CELL_TEMPLATE_ID = c.ID
WHERE
c.report_template_id = #{templateDbID,jdbcType=VARCHAR}
) x)
c.REPORT_TEMPLATE_ID = #{templateDbID,jdbcType=VARCHAR}
)
x
)
</delete>
<resultMap id="financialStatementDetail" type="pwc.taxtech.atms.dpo.FinancialStatementDetail">
<id column="Name" jdbcType="VARCHAR" property="name"/>
<result column="Industry" jdbcType="VARCHAR" property="industry"/>
<result column="Row" jdbcType="INTEGER" property="row"/>
<result column="Column" jdbcType="INTEGER" property="column"/>
<result column="INDUSTRY" jdbcType="VARCHAR" property="industry"/>
<result column="ROW" jdbcType="INTEGER" property="row"/>
<result column="COLUMN" jdbcType="INTEGER" property="column"/>
</resultMap>
<select id="getFinancialStatementDetails" parameterType="java.lang.String" resultMap="financialStatementDetail">
SELECT DISTINCT
t.Name,
c.RowIndex,
c.ColumnIndex,
g.IndustryIDs
t.NAME,
c.ROW_INDEX,
c.COLUMN_INDEX,
g.INDUSTRY_IDS
FROM
KeyValueReference s
JOIN CellTemplate c ON s.CellTemplateID = c.ID
JOIN Template t ON c.ReportTemplateID = t.ID
JOIN TemplateGroup g ON t.TemplateGroupID = g.ID
KEY_VALUE_REFERENCE s
JOIN
CELL_TEMPLATE c
ON
s.CELL_TEMPLATE_ID = c.ID
JOIN
TEMPLATE t
ON
c.REPORT_TEMPLATE_ID = t.ID
JOIN
TEMPLATE_GROUP g
ON
t.TEMPLATE_GROUP_ID = g.ID
WHERE
s.Scope = 1 AND s.KeyValueConfigID = #{configurationID,jdbcType=VARCHAR}
s.SCOPE = 1
AND S.KEY_VALUE_CONFIG_ID = #{configurationID,jdbcType=VARCHAR}
</select>
<resultMap id="taxReturnDetail" type="pwc.taxtech.atms.dpo.TaxReturnDetail">
<id column="CellTemplateID" jdbcType="VARCHAR" property="cellTemplateID"/>
<result column="TemplateID" jdbcType="VARCHAR" property="templateID"/>
<result column="TemplateGroupID" jdbcType="VARCHAR" property="templateGroupID"/>
<result column="Category" jdbcType="VARCHAR" property="category"/>
<result column="PayTaxType" jdbcType="INTEGER" property="payTaxType"/>
<result column="TemplateGroupName" jdbcType="VARCHAR" property="templateGroupName"/>
<result column="Name" jdbcType="VARCHAR" property="name"/>
<result column="Industry" jdbcType="VARCHAR" property="industry"/>
<result column="Row" jdbcType="INTEGER" property="row"/>
<result column="Column" jdbcType="INTEGER" property="column"/>
<result column="TEMPLATE_ID" jdbcType="VARCHAR" property="templateId"/>
<result column="TEMPLATE_GROUP_ID" jdbcType="VARCHAR" property="templateGroupId"/>
<result column="CATEGORY" jdbcType="VARCHAR" property="category"/>
<result column="PAY_TAX_TYPE" jdbcType="INTEGER" property="payTaxType"/>
<result column="TEMPLATE_GROUP_NAME" jdbcType="VARCHAR" property="templateGroupName"/>
<result column="NAME" jdbcType="VARCHAR" property="name"/>
<result column="INDUSTRY" jdbcType="VARCHAR" property="industry"/>
<result column="ROW" jdbcType="INTEGER" property="row"/>
<result column="COLUMN" jdbcType="INTEGER" property="column"/>
</resultMap>
<select id="getTaxReturnDetails" parameterType="java.lang.String" resultMap="taxReturnDetail">
SELECT DISTINCT
t.ID,
'增值税纳税申报表' as Category,
g.PayTaxType,
g.ID as TemplateGroupID,
g.Name as TemplateGroupName,
t.Name as Name,
c.ID as CellTemplateID,
c.RowIndex as Row,
c.ColumnIndex as 'Column',
g.IndustryIDs as Industry
'增值税纳税申报表' AS CATEGORY,
g.PAY_TAX_TYPE,
g.ID AS TEMPLATE_GROUP_ID,
g.NAME AS TEMPLATE_GROUP_NAME,
t.NAME AS NAME,
c.ID AS CELL_TEMPLATE_ID,
c.ROW_INDEX AS ROW,
c.COLUMN_INDEX AS '_COLUMN_',
g.INDUSTRY_IDS AS INDUSTRY
FROM
KeyValueReference s
JOIN CellTemplate c ON s.CellTemplateID = c.ID
JOIN Template t ON c.ReportTemplateID = t.ID
JOIN TemplateGroup g ON t.TemplateGroupID = g.ID
KEY_VALUE_REFERENCE s
JOIN
CELL_TEMPLATE c
ON
s.CELL_TEMPLATE_ID = c.ID
JOIN
TEMPLATE t
ON
c.REPORT_TEMPLATE_ID = t.ID
JOIN
TEMPLATE_GROUP g
ON
t.TEMPLATE_GROUP_ID = g.ID
WHERE
s.Scope = 2 AND s.KeyValueConfigID = #{configurationID,jdbcType=VARCHAR}
s.SCOPE = 2
AND S.KEY_VALUE_CONFIG_ID = #{configurationID,jdbcType=VARCHAR}
</select>
<resultMap id="analyticsModelDetail" type="pwc.taxtech.atms.dpo.AnalyticsModelDetail">
<id column="ModelID" jdbcType="VARCHAR" property="modelID"/>
<result column="Code" jdbcType="VARCHAR" property="code"/>
<result column="Type" jdbcType="VARCHAR" property="type"/>
<result column="EntityID" jdbcType="VARCHAR" property="entityID"/>
<result column="Name" jdbcType="VARCHAR" property="name"/>
<result column="Industry" jdbcType="VARCHAR" property="industry"/>
<result column="CODE" jdbcType="VARCHAR" property="code"/>
<result column="TYPE" jdbcType="VARCHAR" property="type"/>
<result column="ENTITY_ID" jdbcType="VARCHAR" property="entityId"/>
<result column="NAME" jdbcType="VARCHAR" property="name"/>
<result column="INDUSTRY" jdbcType="VARCHAR" property="industry"/>
</resultMap>
<select id="getAnalyticsModelDetails" parameterType="java.lang.String" resultMap="analyticsModelDetail">
SELECT DISTINCT
m.ID as ModelID,
m.Code as Code,
m.Type as Type,
s.OrganizationID as EntityID,
m.Name as Name,
s.IndustryID as Industry
FROM tax_admin.KeyValueReference s
JOIN tax_admin.Model m
ON s.ModelID = m.ID
WHERE s.Scope = 3 AND s.KeyValueConfigID = #{configurationID,jdbcType=VARCHAR}
m.ID AS MODEL_ID,
m.CODE AS CODE,
m.TYPE AS TYPE,
s.ORGANIZATION_ID AS ENTITY_ID,
m.NAME AS NAME,
s.INDUSTRY_ID AS INDUSTRY
FROM
TAX_ADMIN.KEY_VALUE_REFERENCE s
JOIN
TAX_ADMIN.MODEL m
ON
s.MODEL_ID = m.ID
WHERE
s.SCOPE = 3
AND S.KEY_VALUE_CONFIG_ID = #{configurationID,jdbcType=VARCHAR}
</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="pwc.taxtech.atms.dao.ModelConfigMapper">
<resultMap id="getModelListByIndustryResult" type="pwc.taxtech.atms.dpo.ModelProfileDto">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="Name" jdbcType="VARCHAR" property="name"/>
<result column="CategoryID" jdbcType="VARCHAR" property="categoryID"/>
<result column="CategoryString" jdbcType="VARCHAR" property="categoryString"/>
<result column="OrgID" jdbcType="VARCHAR" property="orgID"/>
<result column="OrganizationName" jdbcType="VARCHAR" property="organizationName"/>
<result column="Type" jdbcType="INTEGER" property="type"/>
<result column="Feature" jdbcType="INTEGER" property="feature"/>
<result column="IsStatus" jdbcType="INTEGER" property="isStatus"/>
<result column="Code" jdbcType="VARCHAR" property="code"/>
<result column="IndustryId" jdbcType="VARCHAR" property="industryID"/>
<result column="IndustryName" jdbcType="VARCHAR" property="industryName"/>
<result column="Description" jdbcType="VARCHAR" property="description"/>
<result column="RuleType" jdbcType="INTEGER" property="ruleType"/>
<result column="IsFilter" jdbcType="INTEGER" property="isFilter"/>
<result column="ServiceTypeID" jdbcType="VARCHAR" property="serviceTypeID"/>
<result column="ServiceTypeName" jdbcType="VARCHAR" property="serviceTypeName"/>
<result column="NAME" jdbcType="VARCHAR" property="name"/>
<result column="CATEGORY_ID" jdbcType="VARCHAR" property="categoryId"/>
<result column="CATEGORY_STRING" jdbcType="VARCHAR" property="categoryString"/>
<result column="ORG_ID" jdbcType="VARCHAR" property="orgId"/>
<result column="ORGANIZATION_NAME" jdbcType="VARCHAR" property="organizationName"/>
<result column="TYPE" jdbcType="INTEGER" property="type"/>
<result column="FEATURE" jdbcType="INTEGER" property="feature"/>
<result column="IS_STATUS" jdbcType="INTEGER" property="isStatus"/>
<result column="CODE" jdbcType="VARCHAR" property="code"/>
<result column="INDUSTRY_ID" jdbcType="VARCHAR" property="industryId"/>
<result column="INDUSTRY_NAME" jdbcType="VARCHAR" property="industryName"/>
<result column="DESCRIPTION" jdbcType="VARCHAR" property="description"/>
<result column="RULE_TYPE" jdbcType="INTEGER" property="ruleType"/>
<result column="IS_FILTER" jdbcType="INTEGER" property="isFilter"/>
<result column="SERVICE_TYPE_ID" jdbcType="VARCHAR" property="serviceTypeId"/>
<result column="SERVICE_TYPE_NAME" jdbcType="VARCHAR" property="serviceTypeName"/>
</resultMap>
<select id="getModelListByIndustry" parameterType="map" resultMap="getModelListByIndustryResult">
SELECT
m.ID,
m.Name,
mc.CategoryID,
cat.Category AS CategoryString,
cat.OrganizationID AS OrgID,
org.Name AS OrganizationName,
m.Type,
m.Feature,
m.IsStatus,
m.Code,
org.IndustryID AS IndustryId,
i.Name AS IndustryName,
m.Description,
m.RuleType,
m.IsFilter,
msc.ServiceTypeID,
st.Name AS ServiceTypeName
M.ID,
m.NAME,
mc.CATEGORY_ID,
cat.CATEGORY AS CATEGORY_STRING,
cat.ORGANIZATION_ID AS ORG_ID,
org.NAME AS ORGANIZATION_NAME,
m.TYPE,
m.FEATURE,
m.IS_STATUS,
m.CODE,
org.INDUSTRY_ID AS INDUSTRY_ID,
i.NAME AS INDUSTRY_NAME,
m.DESCRIPTION,
m.RULE_TYPE,
m.IS_FILTER,
msc.SERVICE_TYPE_ID,
st.NAME AS SERVICE_TYPE_NAME
FROM
Model m
MODEL m
JOIN
ModelConfig mc ON m.ID = mc.ModelID
MODEL_CONFIG mc
ON
m.ID = mc.MODEL_ID
JOIN
ModelCategory cat ON mc.CategoryID = cat.ID
MODEL_CATEGORY cat
ON
mc.CATEGORY_ID = cat.ID
JOIN
Organization org ON cat.organizationID = org.ID
ORGANIZATION org
ON
cat.ORGANIZATION_ID = org.ID
JOIN
ModelServiceConfig msc ON m.ID = msc.ModelID
MODEL_SERVICE_CONFIG msc
ON
m.ID = msc.MODEL_ID
JOIN
ServiceType st ON msc.ServiceTypeID = st.ID
SERVICE_TYPE st
ON
msc.SERVICE_TYPE_ID = st.ID
JOIN
Industry i ON org.IndustryID = i.ID
WHERE org.IndustryID=#{industryID,jdbcType=VARCHAR} and st.ID = #{serviceTypeID,jdbcType=VARCHAR}
ORDER BY m.code
INDUSTRY i
ON
org.INDUSTRY_ID = i.ID
WHERE
org.INDUSTRY_ID_= #{industryID,jdbcType=VARCHAR}
AND ST.ID = #{serviceTypeID,jdbcType=VARCHAR}
ORDER BY
m.CODE
</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="pwc.taxtech.atms.dao.OrganizationServiceTemplateGroupMapper">
<resultMap id="OrganizationServiceTemplateGroupDto" type="pwc.taxtech.atms.dpo.OrganizationServiceTemplateGroupDto">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="ServiceTypeID" jdbcType="VARCHAR" property="serviceTypeID"/>
<result column="OrganizationID" jdbcType="VARCHAR" property="organizationID"/>
<result column="TemplateGroupID" jdbcType="VARCHAR" property="templateGroupID"/>
<result column="TemplateGroupName" jdbcType="VARCHAR" property="templateGroupName"/>
<result column="SERVICE_TYPE_ID" jdbcType="VARCHAR" property="serviceTypeId"/>
<result column="ORGANIZATION_ID" jdbcType="VARCHAR" property="organizationId"/>
<result column="TEMPLATE_GROUP_ID" jdbcType="VARCHAR" property="templateGroupId"/>
<result column="TEMPLATE_GROUP_NAME" jdbcType="VARCHAR" property="templateGroupName"/>
</resultMap>
<select id="getSingleOrgByOrgIDToOSTGDto" parameterType="map" resultMap="OrganizationServiceTemplateGroupDto">
SELECT
m.ID AS ID,
m.service_type_id AS ServiceTypeID,
m.organization_id AS OrganizationID,
m.template_group_id AS TemplateGroupID,
t.Name AS TemplateGroupName
M.ID AS ID,
M.SERVICE_TYPE_ID AS SERVICE_TYPE_ID,
M.ORGANIZATION_ID AS ORGANIZATION_ID,
M.TEMPLATE_GROUP_ID AS TEMPLATE_GROUP_ID,
T.NAME AS TEMPLATE_GROUP_NAME
FROM
organization_service_template_group AS m
ORGANIZATION_SERVICE_TEMPLATE_GROUP AS M
LEFT JOIN
template_group AS t ON m.template_group_id = t.ID
TEMPLATE_GROUP AS T
ON
M.TEMPLATE_GROUP_ID = T.ID
WHERE
m.organization_id = #{orgId}
order by m.service_type_id
M.ORGANIZATION_ID = #{ORGID}
ORDER BY
M.SERVICE_TYPE_ID
</select>
<select id="getOrgnizationServiceTemplateGroupOrgNames" parameterType="java.lang.Long"
resultType="java.lang.String">
<select id="getOrgnizationServiceTemplateGroupOrgNames" parameterType="java.lang.Long" resultType="java.lang.String">
SELECT
q.Name
Q.NAME
FROM
organization_service_template_group p
ORGANIZATION_SERVICE_TEMPLATE_GROUP P
LEFT JOIN
Organization q ON p.organization_id = q.ID
ORGANIZATION Q
ON
P.ORGANIZATION_ID = Q.ID
WHERE
p.template_group_id = #{templateGroupDtoID,jdbcType=VARCHAR} AND q.IsActive = 1
P.TEMPLATE_GROUP_ID = #{TEMPLATEGROUPDTOID,JDBCTYPE=VARCHAR}
AND Q.IS_ACTIVE = 1
</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="pwc.taxtech.atms.dao.OrganizationStructureMapper">
<!-- user defined -->
<insert id="bulkInsert" parameterType="java.util.List">
insert into OrganizationStructure (ID, "Name", IsActive,
CreateTime, UpdateTime)
values
INSERT INTO
ORGANIZATION_STRUCTURE (
ID,
"NAME",
IS_ACTIVE,
CREATE_TIME,
UPDATE_TIME
)
VALUES
<foreach collection="list" index="index" item="item" separator=",">
(#{item.ID,jdbcType=VARCHAR}, #{item.name,jdbcType=NVARCHAR}, #{item.isActive,jdbcType=SMALLINT},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateTime,jdbcType=TIMESTAMP})
(
#{item.ID,jdbcType=VARCHAR},
#{item.name,jdbcType=NVARCHAR},
#{item.isActive,jdbcType=SMALLINT},
#{item.createTime,jdbcType=TIMESTAMP},
#{item.updateTime,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
</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="pwc.taxtech.atms.dao.RolePermissionMapper">
<select id="selectByRoleId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from RolePermission
where RoleId = #{roleId,jdbcType=VARCHAR}
FROM
ROLE_PERMISSION
WHERE
ROLE_ID = #{roleId,jdbcType=VARCHAR}
</select>
<resultMap extends="BaseResultMap" id="ResultMapWithAssociation" type="pwc.taxtech.atms.entity.RolePermission">
<association column="roleID" javaType="pwc.taxtech.atms.entity.Role" property="role">
<id column="RoleID" property="ID"/>
<result column="RoleName" property="name"/>
<result column="RoleDescription" property="description"/>
<result column="RoleCategoryID" property="roleCategoryID"/>
<result column="RoleServiceType" property="serviceTypeID"/>
<result column="RoleCreateTime" property="createTime"/>
<result column="RoleUpdateTime" property="updateTime"/>
<association column="ROLE_ID" javaType="pwc.taxtech.atms.entity.Role" property="role">
<id column="ROLE_ID" property="ID"/>
<result column="ROLE_NAME" property="name"/>
<result column="ROLE_DESCRIPTION" property="description"/>
<result column="ROLE_CATEGORY_ID" property="roleCategoryId"/>
<result column="ROLE_SERVICE_TYPE" property="serviceTypeId"/>
<result column="ROLE_CREATE_TIME" property="createTime"/>
<result column="ROLE_UPDATE_TIME" property="updateTime"/>
</association>
<association column="permissionID" javaType="pwc.taxtech.atms.entity.Permission" property="permission">
<id column="PermissionID" property="ID"/>
<result column="PermissionName" property="name"/>
<result column="PermissionCode" property="code"/>
<result column="PermissionParentID" property="parentId"/>
<result column="PermissionIsActive" property="isActive"/>
<result column="PermissionPLevel" property="PLevel"/>
<result column="PermissionRelyOnCodes" property="relyOnCodes"/>
<result column="PermissionMenuID" property="menuID"/>
<result column="PermissionServiceTypeID" property="serviceTypeID"/>
<result column="PermissionCreateTime" property="createTime"/>
<result column="PermissionUpdateTime" property="updateTime"/>
<association column="PERMISSION_ID" javaType="pwc.taxtech.atms.entity.Permission" property="permission">
<id column="PERMISSION_ID" property="ID"/>
<result column="PERMISSION_NAME" property="name"/>
<result column="PERMISSION_CODE" property="code"/>
<result column="PERMISSION_PARENT_ID" property="parentId"/>
<result column="PERMISSION_IS_ACTIVE" property="isActive"/>
<result column="PERMISSION_P_LEVEL" property="pLevel"/>
<result column="PERMISSION_RELY_ON_CODES" property="relyOnCodes"/>
<result column="PERMISSION_MENU_ID" property="menuId"/>
<result column="PERMISSION_SERVICE_TYPE_ID" property="serviceTypeId"/>
<result column="PERMISSION_CREATE_TIME" property="createTime"/>
<result column="PERMISSION_UPDATE_TIME" property="updateTime"/>
</association>
</resultMap>
<select id="selectByRoleAndServiceTypeWithAssociation" resultMap="ResultMapWithAssociation">
select
rp.ID as ID, rp.RoleID, rp.PermissionID,
r.ID as RoleID, r.Name as RoleName, r.Description as RoleDescription, r.RoleCategoryID as RoleCategoryID,
r.ServiceTypeID as RoleServiceType, r.CreateTime as RoleCreateTime, r.UpdateTime as RoleUpdateTime,
p.ID as permissionID, p.Name as PermissionName, p.Code as PermissionCode, p.ParentID as PermissionParentID,
p.IsActive as PermissionIsActive,
p.PLevel as PermissionPLevel, p.RelyOnCodes as PermissionRelyOnCodes, p.MenuID as PermissionMenuID,
p.ServiceTypeID as PermissionServiceTypeID, p.CreateTime as PermissionCreateTime, p.UpdateTime as
PermissionUpdateTime
from RolePermission rp
join Role r on r.ID = rp.RoleID
join Permission p on p.ID = rp.PermissionID
where rp.RoleID=#{roleID,jdbcType=VARCHAR} and r.ServiceTypeID=#{serviceTypeID,jdbcType=VARCHAR}
SELECT
RP.ID AS ID,
rp.ROLE_ID,
rp.PERMISSION_ID,
r.ID AS ROLE_ID,
r.NAME AS ROLE_NAME,
r.DESCRIPTION AS ROLE_DESCRIPTION,
r.ROLE_CATEGORY_ID AS ROLE_CATEGORY_ID,
r.SERVICE_TYPE_ID AS ROLE_SERVICE_TYPE,
r.CREATE_TIME AS ROLE_CREATE_TIME,
r.UPDATE_TIME AS ROLE_UPDATE_TIME,
p.ID AS PERMISSION_ID,
p.NAME AS PERMISSION_NAME,
p.CODE AS PERMISSION_CODE,
p.PARENT_ID AS PERMISSION_PARENT_ID,
p.IS_ACTIVE AS PERMISSION_IS_ACTIVE,
p.P_LEVEL AS PERMISSION_P_LEVEL,
p.RELY_ON_CODES AS PERMISSION_RELY_ON_CODES,
p.MENU_ID AS PERMISSION_MENU_ID,
p.SERVICE_TYPE_ID AS PERMISSION_SERVICE_TYPE_ID,
p.CREATE_TIME AS PERMISSION_CREATE_TIME,
p.UPDATE_TIME AS PERMISSION_UPDATE_TIME
FROM
ROLE_PERMISSION rp
JOIN
ROLE r
on
r.ID = rp.ROLE_ID
JOIN
PERMISSION p
on
p.ID = rp.PERMISSION_ID
where
rp.ROLE_ID_= #{roleID,jdbcType=VARCHAR}
AND R.SERVICE_TYPE_ID_= #{serviceTypeID,jdbcType=VARCHAR}
</select>
<select id="selectByRoleListAndServiceTypeWithAssociation" resultMap="ResultMapWithAssociation">
select
rp.ID as ID, rp.RoleID, rp.PermissionID,
r.ID as RoleID, r.Name as RoleName, r.Description as RoleDescription, r.RoleCategoryID as RoleCategoryID,
r.ServiceTypeID as RoleServiceType, r.CreateTime as RoleCreateTime, r.UpdateTime as RoleUpdateTime,
p.ID as permissionID, p.Name as PermissionName, p.Code as PermissionCode, p.ParentID as PermissionParentID,
p.IsActive as PermissionIsActive,
p.PLevel as PermissionPLevel, p.RelyOnCodes as PermissionRelyOnCodes, p.MenuID as PermissionMenuID,
p.ServiceTypeID as PermissionServiceTypeID, p.CreateTime as PermissionCreateTime, p.UpdateTime as
PermissionUpdateTime
from RolePermission rp
join Role r on r.ID = rp.RoleID
join Permission p on p.ID = rp.PermissionID
where r.ServiceTypeID=#{serviceTypeID,jdbcType=VARCHAR} and rp.RoleID in
SELECT
RP.ID AS ID,
rp.ROLE_ID,
rp.PERMISSION_ID,
r.ID AS ROLE_ID,
r.NAME AS ROLE_NAME,
r.DESCRIPTION AS ROLE_DESCRIPTION,
r.ROLE_CATEGORY_ID AS ROLE_CATEGORY_ID,
r.SERVICE_TYPE_ID AS ROLE_SERVICE_TYPE,
r.CREATE_TIME AS ROLE_CREATE_TIME,
r.UPDATE_TIME AS ROLE_UPDATE_TIME,
p.ID AS PERMISSION_ID,
p.NAME AS PERMISSION_NAME,
p.CODE AS PERMISSION_CODE,
p.PARENT_ID AS PERMISSION_PARENT_ID,
p.IS_ACTIVE AS PERMISSION_IS_ACTIVE,
p.P_LEVEL AS PERMISSION_P_LEVEL,
p.RELY_ON_CODES AS PERMISSION_RELY_ON_CODES,
p.MENU_ID AS PERMISSION_MENU_ID,
p.SERVICE_TYPE_ID AS PERMISSION_SERVICE_TYPE_ID,
p.CREATE_TIME AS PERMISSION_CREATE_TIME,
p.UPDATE_TIME AS PERMISSION_UPDATE_TIME
FROM
ROLE_PERMISSION rp
JOIN
ROLE r
on
r.ID = rp.ROLE_ID
JOIN
PERMISSION p
on
p.ID = rp.PERMISSION_ID
where
r.SERVICE_TYPE_ID_= #{serviceTypeID,jdbcType=VARCHAR}
AND RP.ROLE_ID in
<foreach close=")" collection="roleList" index="index" item="roleID" open="(" separator=",">
#{roleID}
</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="pwc.taxtech.atms.dao.TemplateMapper">
<resultMap id="TemplateUniqDto" type="pwc.taxtech.atms.dto.TemplateUniqDto">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="order_index" jdbcType="INTEGER" property="orderIndex"/>
<result column="report_type" jdbcType="INTEGER" property="reportType"/>
<result column="template_group_id" jdbcType="VARCHAR" property="templateGroupId"/>
<result column="template_group_name" jdbcType="VARCHAR" property="templateGroupName"/>
<result column="parent_id" jdbcType="VARCHAR" property="parentId"/>
<result column="parent_name" jdbcType="VARCHAR" property="parentName"/>
<result column="pay_tax_type" jdbcType="INTEGER" property="payTaxType"/>
<result column="industry_ids" jdbcType="VARCHAR" property="industryIds"/>
<result column="service_type_id" jdbcType="VARCHAR" property="serviceTypeId"/>
<result column="is_active_association" jdbcType="INTEGER" property="isActiveAssociation"/>
<id column="ID" jdbcType="INTEGER" property="id"/>
<result column="CODE" jdbcType="VARCHAR" property="code"/>
<result column="NAME" jdbcType="VARCHAR" property="name"/>
<result column="ORDER_INDEX" jdbcType="INTEGER" property="orderIndex"/>
<result column="REPORT_TYPE" jdbcType="INTEGER" property="reportType"/>
<result column="TEMPLATE_GROUP_ID" jdbcType="VARCHAR" property="templateGroupId"/>
<result column="TEMPLATE_GROUP_NAME" jdbcType="VARCHAR" property="templateGroupName"/>
<result column="PARENT_ID" jdbcType="VARCHAR" property="parentId"/>
<result column="PARENT_NAME" jdbcType="VARCHAR" property="parentName"/>
<result column="PAY_TAX_TYPE" jdbcType="INTEGER" property="payTaxType"/>
<result column="INDUSTRY_IDS" jdbcType="VARCHAR" property="industryIds"/>
<result column="SERVICE_TYPE_ID" jdbcType="VARCHAR" property="serviceTypeId"/>
<result column="IS_ACTIVE_ASSOCIATION" jdbcType="INTEGER" property="isActiveAssociation"/>
</resultMap>
<select id="getTemplateUniqDtosByTemplateAndTemplateGroup" parameterType="map" resultMap="TemplateUniqDto">
SELECT p.id,p.code,p.name,p.report_type,q.id as template_group_id,q.name as
template_group_name,p.is_active_association
FROM template p join template_group q on p.template_group_id=q.id
SELECT
P.ID,
p.CODE,
p.NAME,
P.REPORT_TYPE,
Q.ID AS TEMPLATE_GROUP_ID,
Q.NAME AS TEMPLATE_GROUP_NAME,
P.IS_ACTIVE_ASSOCIATION
FROM
TEMPLATE P
JOIN
TEMPLATE_GROUP Q
ON
P.TEMPLATE_GROUP_ID=Q.ID
<where>
1=1
<if test="serviceTypeId!=null">
AND q.service_type_id=#{serviceTypeId,jdbcType=VARCHAR}
AND Q.service_type_id= #{serviceTypeId,jdbcType=VARCHAR}
</if>
<if test="payTaxType!=null">
AND q.pay_tax_type = #{payTaxType,jdbcType=INTEGER}
AND Q.pay_tax_type = #{payTaxType,jdbcType=INTEGER}
</if>
<if test="reportType!=null">
AND p.report_type =#{reportType,jdbcType=INTEGER}
AND P.report_type = #{reportType,jdbcType=INTEGER}
</if>
<if test="industryIds!=null">
AND q.industry_ids =#{industryID,jdbcType=VARCHAR}
AND Q.industry_ids = #{industryID,jdbcType=VARCHAR}
</if>
</where>
ORDER BY p.template_group_id, p.order_index
ORDER BY
P.TEMPLATE_GROUP_ID,
P.ORDER_INDEX
</select>
<resultMap id="TemplateAndGroupDbDto" type="pwc.taxtech.atms.dto.TemplateAndGroupDbDto">
<id column="id" jdbcType="VARCHAR" property="templateId"/>
<result column="template_group_id" jdbcType="VARCHAR" property="templateGroupId"/>
<result column="template_code" jdbcType="VARCHAR" property="templateCode"/>
<id column="ID" jdbcType="VARCHAR" property="templateId"/>
<result column="TEMPLATE_GROUP_ID" jdbcType="VARCHAR" property="templateGroupId"/>
<result column="TEMPLATE_CODE" jdbcType="VARCHAR" property="templateCode"/>
</resultMap>
<select id="getTemplateAndGroupByID" parameterType="java.lang.String" resultMap="TemplateAndGroupDbDto">
SELECT p.id as id,q.id as template_group_id,p.code as template_code FROM template p JOIN template_group q on
p.template_group_id=q.id WHERE p.id=#{id,jdbcType=VARCHAR} LIMIT 1
SELECT
P.ID AS ID,
Q.ID AS TEMPLATE_GROUP_ID,
P.CODE AS TEMPLATE_CODE
FROM
TEMPLATE P
JOIN
TEMPLATE_GROUP Q
ON
P.TEMPLATE_GROUP_ID=Q.ID
WHERE
p.ID_= #{id,jdbcType=VARCHAR} LIMIT 1
</select>
<select id="getCountOfTemplateAndGroupByTemplateName" parameterType="map" resultType="java.lang.Long">
SELECT COUNT(1) FROM template p join template_group q on p.template_group_id=q.id
SELECT
COUNT (
1
)
FROM
TEMPLATE P
JOIN
TEMPLATE_GROUP Q
ON
P.TEMPLATE_GROUP_ID=Q.ID
<where>
1=1
<if test="templateGroupId!=null">
AND q.id = #{templateGroupId,jdbcType=VARCHAR}
AND Q.ID = #{templateGroupId,jdbcType=VARCHAR}
</if>
<if test="templateId!=null">
AND p.id&lt;&gt;#{templateId,jdbcType=VARCHAR}
AND P.ID_&lt;&gt; #{templateId,jdbcType=VARCHAR}
</if>
<if test="templateName!=null">
AND p.Name= #{templateName,jdbcType=VARCHAR}
AND P.NAME_= #{templateName,jdbcType=VARCHAR}
</if>
</where>
</select>
<resultMap id="reportDto" type="pwc.taxtech.atms.dto.vatdto.ReportDto">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="period" jdbcType="INTEGER" property="period"/>
<result column="template_id" jdbcType="INTEGER" property="templateId"/>
<result column="template_name" jdbcType="VARCHAR" property="templateName"/>
<result column="template_code" jdbcType="VARCHAR" property="templateCode"/>
<id column="ID" jdbcType="VARCHAR" property="id"/>
<result column="PERIOD" jdbcType="INTEGER" property="period"/>
<result column="TEMPLATE_ID" jdbcType="INTEGER" property="templateId"/>
<result column="TEMPLATE_NAME" jdbcType="VARCHAR" property="templateName"/>
<result column="TEMPLATE_CODE" jdbcType="VARCHAR" property="templateCode"/>
</resultMap>
<select id="getTemplateLeftJoinReport" parameterType="map" resultMap="reportDto">
SELECT
d.id AS id,
d.period AS period,
c.id AS template_id,
c.name AS template_name,
c.code AS template_code
FROM (SELECT
a.id,
a.name,
a.code
FROM tax_admin.template a
WHERE a.template_group_id = #{templateGroupID,jdbcType=VARCHAR}
AND a.is_active_association = 1
ORDER BY a.order_index) c
LEFT JOIN (SELECT b.id,b.period,b.template_id
FROM ${dbName}.report b
WHERE b.period = #{period,jdbcType=INTEGER}
AND b.project_id = #{projectID,jdbcType=VARCHAR}) d
ON c.id = d.template_id
ORDER BY template_code
D.ID AS ID,
D.PERIOD AS PERIOD,
C.ID AS TEMPLATE_ID,
C.NAME AS TEMPLATE_NAME,
C.CODE AS TEMPLATE_CODE
FROM
(
SELECT
A.ID,
A.NAME,
A.CODE
FROM
TAX_ADMIN.TEMPLATE A
WHERE
A.TEMPLATE_GROUP_ID = #{templateGroupID,jdbcType=VARCHAR}
AND A.IS_ACTIVE_ASSOCIATION = 1
ORDER BY
A.ORDER_INDEX
)
C
LEFT JOIN
(
SELECT
B.ID,
B.PERIOD,
B.TEMPLATE_ID
FROM
${DB_NAME_}.REPORT b
WHERE
b.PERIOD = #{period,jdbcType=INTEGER}
AND B.PROJECT_ID = #{projectID,jdbcType=VARCHAR}
)
D
ON
C.ID = D.TEMPLATE_ID
ORDER BY
TEMPLATE_CODE
</select>
<select id="getIDsForExceptTemplate" resultType="java.lang.Long">
SELECT
a.id
A.ID
FROM
template a
JOIN template_group b ON a.template_group_id = b.id
TEMPLATE A
JOIN
TEMPLATE_GROUP B
ON
A.TEMPLATE_GROUP_ID = B.ID
WHERE
b.group_type = 2
AND b.service_type_id = 2
B.GROUP_TYPE = 2
AND B.SERVICE_TYPE_ID = 2
</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="pwc.taxtech.atms.dao.UserDimensionValueMapper">
<select id="getUserDimensionValueList" resultMap="BaseResultMap">
select
q.ID as ID,
q.UserID as UserID,
q.DimensionID as DimensionID,
q.DimensionValueID as DimensionValueID,
q.HasOriginalRole as HasOriginalRole,
q.IsAccessible as IsAccessible
from UserDimensionValue as q
join "USER" as u on q.UserID = u.ID and u.Status =1
<select id="getUserDimensionValueList" resultMap="BaseResultMap">
SELECT
Q.ID AS ID,
q.USER_ID AS USER_ID,
q.DIMENSION_ID AS DIMENSION_ID,
q.DIMENSION_VALUE_ID AS DIMENSION_VALUE_ID,
q.HAS_ORIGINAL_ROLE AS HAS_ORIGINAL_ROLE,
q.IS_ACCESSIBLE AS IS_ACCESSIBLE
FROM
USER_DIMENSION_VALUE AS Q
JOIN
"USER" AS U
on
q.USER_ID = u.ID
AND U.STATUS =1
</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="pwc.taxtech.atms.dao.UserDimensionValueRoleMapper">
<resultMap id="UserOrgRoleDto" type="pwc.taxtech.atms.dpo.UserOrgRoleDto">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="RoleID" jdbcType="VARCHAR" property="roleID"/>
<result column="RoleName" jdbcType="VARCHAR" property="roleName"/>
<result column="ROLE_ID" jdbcType="VARCHAR" property="roleId"/>
<result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName"/>
</resultMap>
<select id="getUserDimensionValueRoleList" resultMap="UserOrgRoleDto">
select
udv.UserDimensionValueID as ID,
udv.RoleID as RoleID,
r.Name as RoleName
from UserDimensionValueRole as udv
join Role as r on udv.RoleID = r.ID
<select id="getUserDimensionValueRoleList" resultMap="UserOrgRoleDto">
SELECT
UDV.USER_DIMENSION_VALUE_ID AS ID,
udv.ROLE_ID AS ROLE_ID,
r.NAME AS ROLE_NAME
FROM
USER_DIMENSION_VALUE_ROLE AS UDV
JOIN
ROLE AS R
on
udv.ROLE_ID = r.ID
</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="pwc.taxtech.atms.dao.UserMapper">
<select id="selectByUserName" parameterType="java.lang.String" resultMap="BaseResultMap">
<!-- select one record by user name -->
select
SELECT
<include refid="Base_Column_List"/>
from User
where UserName = #{userName,jdbcType=VARCHAR}
FROM
USER
WHERE
USER_NAME = #{userName,jdbcType=VARCHAR}
</select>
<select id="selectByUserNameIgnoreCase" parameterType="java.lang.String" resultMap="BaseResultMap">
<!-- select one record by user name -->
select
SELECT
<include refid="Base_Column_List"/>
from User
where lower(UserName) = lower(#{userName,jdbcType=VARCHAR})
FROM
USER
WHERE
LOWER (
USER_NAME
)
= LOWER (
#{userName,jdbcType=VARCHAR}
)
</select>
<select id="selectUserWithSameUserName" parameterType="pwc.taxtech.atms.dpo.UserDto" resultMap="BaseResultMap">
<!-- select one record by user name and different ID -->
select
SELECT
<include refid="Base_Column_List"/>
from User
where lower(UserName) = lower(#{userName})
and ID != #{ID}
FROM
USER
WHERE
LOWER (
USER_NAME
)
= LOWER (
#{userName}
)
AND ID != #{ID}
</select>
<select id="selectUserWithSameEmail" parameterType="pwc.taxtech.atms.dpo.UserDto" resultMap="BaseResultMap">
<!-- select one record by email and different ID -->
select
SELECT
<include refid="Base_Column_List"/>
from User
where lower(Email) = lower(#{email})
and ID != #{ID}
FROM
USER
WHERE
LOWER (
EMAIL
)
= LOWER (
#{email}
)
AND ID != #{ID}
</select>
<select id="selectByEmailIgnoreCase" parameterType="java.lang.String" resultMap="BaseResultMap">
<!-- select one record by email -->
select
SELECT
<include refid="Base_Column_List"/>
from User
where lower(Email) = lower(#{email})
FROM
USER
WHERE
LOWER (
EMAIL
)
= LOWER (
#{email}
)
</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="pwc.taxtech.atms.dao.UserOrganizationMapper">
<select id="getUserOrganizationList" resultMap="BaseResultMap">
select
q.ID as ID,
q.UserID as UserID,
q.OrganizationID as OrganizationID,
q.IsAccessible as IsAccessible,
q.HasOriginalRole as HasOriginalRole
from UserOrganization as q
join "USER" as u on q.UserID = u.ID
where u.Status =1
<select id="getUserOrganizationList" resultMap="BaseResultMap">
SELECT
Q.ID AS ID,
q.USER_ID AS USER_ID,
q.ORGANIZATION_ID AS ORGANIZATION_ID,
q.IS_ACCESSIBLE AS IS_ACCESSIBLE,
q.HAS_ORIGINAL_ROLE AS HAS_ORIGINAL_ROLE
FROM
USER_ORGANIZATION AS Q
JOIN
"USER" AS U
on
q.USER_ID = u.ID
where
u.STATUS =1
</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="pwc.taxtech.atms.dao.UserOrganizationRoleMapper">
<resultMap id="UserOrgRoleDto" type="pwc.taxtech.atms.dpo.UserOrgRoleDto">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="RoleID" jdbcType="VARCHAR" property="roleID"/>
<result column="RoleName" jdbcType="VARCHAR" property="roleName"/>
<result column="ROLE_ID" jdbcType="VARCHAR" property="roleId"/>
<result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName"/>
</resultMap>
<select id="getUserOrganizationRoleList" resultMap="UserOrgRoleDto">
select
q.UserOrganizationID as ID,
q.RoleID as RoleID,
r.Name as RoleName
from UserOrganizationRole as q
join Role as r on q.RoleID = r.ID
<select id="getUserOrganizationRoleList" resultMap="UserOrgRoleDto">
SELECT
Q.USER_ORGANIZATION_ID AS ID,
q.ROLE_ID AS ROLE_ID,
r.NAME AS ROLE_NAME
FROM
USER_ORGANIZATION_ROLE AS Q
JOIN
ROLE AS R
on
q.ROLE_ID = r.ID
</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="pwc.taxtech.atms.dao.UserRoleMapper">
<resultMap id="UserRoleQuery" type="pwc.taxtech.atms.dto.user.UserRoleQuery">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="UserID" jdbcType="VARCHAR" property="userID"/>
<result column="UserName" jdbcType="VARCHAR" property="userName"/>
<result column="RoleID" jdbcType="VARCHAR" property="roleID"/>
<result column="RoleName" jdbcType="VARCHAR" property="roleName"/>
<result column="ServiceTypeName" jdbcType="VARCHAR" property="serviceTypeName"/>
<result column="ServiceTypeID" jdbcType="VARCHAR" property="serviceTypeID"/>
<result column="RoleCategoryID" jdbcType="VARCHAR" property="roleCategoryID"/>
<result column="RoleCatetoryName" jdbcType="VARCHAR" property="roleCatetoryName"/>
<result column="OrgID" jdbcType="VARCHAR" property="orgID"/>
<result column="OrgName" jdbcType="VARCHAR" property="orgName"/>
<result column="Email" jdbcType="VARCHAR" property="email"/>
<result column="Status" jdbcType="INTEGER" property="status"/>
<result column="USER_ID" jdbcType="VARCHAR" property="userId"/>
<result column="USER_NAME" jdbcType="VARCHAR" property="userName"/>
<result column="ROLE_ID" jdbcType="VARCHAR" property="roleId"/>
<result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName"/>
<result column="SERVICE_TYPE_NAME" jdbcType="VARCHAR" property="serviceTypeName"/>
<result column="SERVICE_TYPE_ID" jdbcType="VARCHAR" property="serviceTypeId"/>
<result column="ROLE_CATEGORY_ID" jdbcType="VARCHAR" property="roleCategoryId"/>
<result column="ROLE_CATETORY_NAME" jdbcType="VARCHAR" property="roleCatetoryName"/>
<result column="ORG_ID" jdbcType="VARCHAR" property="orgId"/>
<result column="ORG_NAME" jdbcType="VARCHAR" property="orgName"/>
<result column="EMAIL" jdbcType="VARCHAR" property="email"/>
<result column="STATUS" jdbcType="INTEGER" property="status"/>
</resultMap>
<select id="selectUserRoleQueryByServiceTypeId" parameterType="java.lang.String" resultMap="UserRoleQuery">
select ur.ID as ID, u.ID as UserID, u.UserName as UserName, ur.RoleID as RoleID,
r.Name as RoleName, s.Name as ServiceTypeName, s.ID as ServiceTypeID, rc.ID as RoleCategoryID,
rc.Name as RoleCatetoryName, org.ID as OrgID, org.Name as OrgName, u.Email as Email, u.Status as Status from
User as u
left join UserRole as ur on u.ID = ur.UserID
left join Role as r on ur.RoleID = r.ID
left join ServiceType as s on s.ID = r.ServiceTypeID and s.IsActive = 1 and s.ID = #{serviceTypeID}
left join RoleCategory as rc on rc.ID = r.RoleCategoryID and rc.IsActive = 1
left join Organization as org on u.OrganizationID = org.ID
where u.Status = 1 and u.IsSuperAdmin = 0
order by UserName
SELECT UR
.ID AS ID,
u.ID AS USER_ID,
u.USER_NAME AS USER_NAME, ur
.ROLE_ID AS ROLE_ID,
r.NAME AS ROLE_NAME,
s.NAME AS SERVICE_TYPE_NAME,
s.ID AS SERVICE_TYPE_ID,
rc.ID AS ROLE_CATEGORY_ID,
rc.NAME AS ROLE_CATETORY_NAME,
org.ID AS ORG_ID,
org.NAME AS ORG_NAME,
u.EMAIL AS EMAIL,
u.STATUS AS STATUS
FROM
USER AS U
left JOIN
USER_ROLE AS UR
on
u.ID = ur
.USER_ID
left JOIN
ROLE AS R
on ur
.ROLE_ID = r.ID
left JOIN
SERVICE_TYPE AS S
on
s.ID = r.SERVICE_TYPE_ID
AND S.IS_ACTIVE = 1
AND S.ID = #{serviceTypeID}
left JOIN
ROLE_CATEGORY AS RC
on
rc.ID = r.ROLE_CATEGORY_ID
AND RC.IS_ACTIVE = 1
left JOIN
ORGANIZATION AS ORG
on
u.ORGANIZATION_ID = org.ID
where
u.STATUS = 1
AND U.IS_SUPER_ADMIN = 0
order by
UserName
</select>
<resultMap id="UserOrgRoleDto" type="pwc.taxtech.atms.dpo.UserOrgRoleDto">
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="UserID" jdbcType="VARCHAR" property="userID"/>
<result column="RoleID" jdbcType="VARCHAR" property="roleID"/>
<result column="RoleName" jdbcType="VARCHAR" property="roleName"/>
<result column="USER_ID" jdbcType="VARCHAR" property="userId"/>
<result column="ROLE_ID" jdbcType="VARCHAR" property="roleId"/>
<result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName"/>
</resultMap>
<select id="getOriginalRoleList" resultMap="UserOrgRoleDto">
select ur.UserID as UserID,
r.ID as RoleID, r.Name as RoleName
from UserRole as ur
join Role as r on ur.RoleID = r.ID
SELECT UR
.USER_ID AS USER_ID,
r.ID AS ROLE_ID,
r.NAME AS ROLE_NAME
FROM
USER_ROLE AS UR
JOIN
ROLE AS R
on ur
.ROLE_ID = r.ID
</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="pwc.taxtech.atms.vat.dao.BalanceMapper">
<select id="getSumOfBalance" resultType="java.math.BigDecimal">
SELECT IFNULL(SUM((IFNULL(a.DebitNet,0)-IFNULL(a.CreditNet,0))*#{direction,,jdbcType=INTEGER}),0) FROM Balance a
WHERE a.AcctCode=#{acctCode,jdbcType=VARCHAR}
SELECT
IFNULL (
SUM (
(
IFNULL (
a.DEBIT_NET,
0
)
-IFNULL (
a.CREDIT_NET,
0
)
)
* #{direction,,jdbcType=INTEGER}
)
,
0
)
FROM
BALANCE a
WHERE
a.ACCT_CODE_= #{acctCode,jdbcType=VARCHAR}
<if test="period!=99">
AND PeriodId=#{period,jdbcType=INTEGER}
AND PERIOD_ID_= #{period,jdbcType=INTEGER}
</if>
</select>
<select id="getFirstOfBalance" resultType="java.math.BigDecimal">
SELECT IFNULL(((IFNULL(a.DebitNet,0)-IFNULL(a.CreditNet,0))*#{direction,,jdbcType=INTEGER}),0) FROM Balance a
WHERE a.AcctCode=#{acctCode,jdbcType=VARCHAR} LIMIT 1
SELECT
IFNULL (
(
(
IFNULL (
a.DEBIT_NET,
0
)
-IFNULL (
a.CREDIT_NET,
0
)
)
* #{direction,,jdbcType=INTEGER}
)
,
0
)
FROM
BALANCE a
WHERE
a.ACCT_CODE_= #{acctCode,jdbcType=VARCHAR} LIMIT 1
<if test="period!=99">
AND PeriodId=#{period,jdbcType=INTEGER}
AND PERIOD_ID_= #{period,jdbcType=INTEGER}
</if>
</select>
<select id="getFirstWithDbNameAndAccountCodeAndPeriod" resultMap="BaseResultMap">
SELECT * FROM ${dbName}.Balance a WHERE a.AcctCode=${accountCode,jdbcType=VARCHAR} AND
a.PeriodId=${period,jdbcType=INTEGER} LIMIT 1
SELECT
*
FROM
$_{DB_NAME_}.BALANCE a
WHERE
a.ACCT_CODE_= ${accountCode,jdbcType=VARCHAR}
AND A.PERIOD_ID_= ${period,jdbcType=INTEGER} LIMIT 1
</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="pwc.taxtech.atms.vat.dao.BalanceStdManualMapper">
<select id="selectOneWithAccountCodeAndDBName" resultMap="BaseResultMap">
SELECT * FROM ${dbName}.BalanceStdManual a
SELECT
*
FROM
$_{DB_NAME_}.BALANCE_STD_MANUAL a
WHERE
a.AcctCode=#{accountCode,jdbcType=VARCHAR} AND a.PeriodID=#{period,jdbcType=INTEGER}
LIMIT 1
a.ACCT_CODE_= #{accountCode,jdbcType=VARCHAR}
AND A.PERIOD_ID_= #{period,jdbcType=INTEGER} LIMIT 1
</select>
<select id="selectOneWithAccountCode" resultMap="BaseResultMap">
SELECT * FROM BalanceStdManual a
SELECT
*
FROM
BALANCE_STD_MANUAL a
WHERE
a.AcctCode=#{accountCode,jdbcType=VARCHAR} AND a.PeriodID=#{period,jdbcType=INTEGER}
LIMIT 1
a.ACCT_CODE_= #{accountCode,jdbcType=VARCHAR}
AND A.PERIOD_ID_= #{period,jdbcType=INTEGER} LIMIT 1
</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="pwc.taxtech.atms.vat.dao.CompanyBalanceMapper">
<resultMap id="TrialBalanceDto" type="pwc.taxtech.atms.dto.vatdto.TrialBalanceDto">
<id column="BalanceId" jdbcType="VARCHAR" property="balanceId"/>
<result column="PeriodId" jdbcType="INTEGER" property="periodId"/>
<result column="AcctCode" jdbcType="VARCHAR" property="acctCode"/>
<result column="CustomerCode" jdbcType="VARCHAR" property="customerCode"/>
<result column="BegDebitBal" jdbcType="DECIMAL" property="begDebitBal"/>
<result column="BegCreditBal" jdbcType="DECIMAL" property="begCreditBal"/>
<result column="BegBal" jdbcType="DECIMAL" property="begBal"/>
<result column="EndBal" jdbcType="DECIMAL" property="endBal"/>
<result column="EndDebitBal" jdbcType="DECIMAL" property="endDebitBal"/>
<result column="EndCreditBal" jdbcType="DECIMAL" property="endCreditBal"/>
<result column="DebitBal" jdbcType="DECIMAL" property="debitBal"/>
<result column="CreditBal" jdbcType="DECIMAL" property="creditBal"/>
<result column="MonthId" jdbcType="INTEGER" property="monthId"/>
<result column="AccountName" jdbcType="VARCHAR" property="accountName"/>
<result column="PERIOD_ID" jdbcType="INTEGER" property="periodId"/>
<result column="ACCT_CODE" jdbcType="VARCHAR" property="acctCode"/>
<result column="CUSTOMER_CODE" jdbcType="VARCHAR" property="customerCode"/>
<result column="BEG_DEBIT_BAL" jdbcType="DECIMAL" property="begDebitBal"/>
<result column="BEG_CREDIT_BAL" jdbcType="DECIMAL" property="begCreditBal"/>
<result column="BEG_BAL" jdbcType="DECIMAL" property="begBal"/>
<result column="END_BAL" jdbcType="DECIMAL" property="endBal"/>
<result column="END_DEBIT_BAL" jdbcType="DECIMAL" property="endDebitBal"/>
<result column="END_CREDIT_BAL" jdbcType="DECIMAL" property="endCreditBal"/>
<result column="DEBIT_BAL" jdbcType="DECIMAL" property="debitBal"/>
<result column="CREDIT_BAL" jdbcType="DECIMAL" property="creditBal"/>
<result column="MONTH_ID" jdbcType="INTEGER" property="monthId"/>
<result column="ACCOUNT_NAME" jdbcType="VARCHAR" property="accountName"/>
</resultMap>
<select id="companyBalanceLeftJoinEnterpriseAccount" resultMap="TrialBalanceDto">
SELECT DISTINCT
b.BalanceId,
b.PeriodId,
b.AcctCode,
b.CustomerCode,
b.BegDebitBal,
b.BegCreditBal,
b.BegBal,
b.EndBal,
b.EndDebitBal,
b.EndCreditBal,
b.DebitBal,
b.CreditBal,
b.MonthId,
b.BALANCE_ID,
b.PERIOD_ID,
b.ACCT_CODE,
b.CUSTOMER_CODE,
b.BEG_DEBIT_BAL,
b.BEG_CREDIT_BAL,
b.BEG_BAL,
b.END_BAL,
b.END_DEBIT_BAL,
b.END_CREDIT_BAL,
b.DEBIT_BAL,
b.CREDIT_BAL,
b.MONTH_ID,
IF (
ISNULL(a.ParentCode) || a.ParentCode = '',
ISNULL (
a.PARENT_CODE
)
|| a.PARENT_CODE = '',
'0',
a.ParentCode
) AS ParentCode,
a.`Name` AS AccountName,
a.AcctProp,
a.Direction
a.PARENT_CODE
)
AS PARENT_CODE,
a.`_NAME_` AS ACCOUNT_NAME,
a.ACCT_PROP,
a.DIRECTION
FROM
CompanyBalance b
LEFT JOIN EnterpriseAccount a ON b.AcctCode = a.AcctCode
WHERE 1=1
COMPANY_BALANCE b
LEFT JOIN
ENTERPRISE_ACCOUNT a
ON
b.ACCT_CODE = a.ACCT_CODE
WHERE
1=1
<if test="fromMonth!=null">
AND b.PeriodID &gt;= #{fromMonth,jdbcType=VARCHAR}
AND B.PERIOD_ID &gt;= #{fromMonth,jdbcType=VARCHAR}
</if>
<if test="toMonth!=null">
AND b.PeriodID &lt;= #{toMonth,jdbcType=VARCHAR}
AND B.PERIOD_ID &lt;= #{toMonth,jdbcType=VARCHAR}
</if>
ORDER BY
b.PeriodID
b.PERIOD_ID
</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="pwc.taxtech.atms.vat.dao.PeriodFormulaBlockMapper">
<update id="updateReportId">
update period_formula_block
set report_id=#{reportId,jdbcType=BIGINT}
where period=#{period,jdbcType=INTEGER} and cell_template_id in
UPDATE
PERIOD_FORMULA_BLOCK
SET
REPORT_ID= #{reportId,jdbcType=BIGINT}
WHERE
PERIOD= #{period,jdbcType=INTEGER}
AND CELL_TEMPLATE_ID IN
<foreach collection="cellTemplateConfigIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</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="pwc.taxtech.atms.vat.dao.PeriodTaxRuleSettingMapper">
<select id="getTaxRuleSetting" resultMap="BaseResultMap">
SELECT
trs.is_default as is_default,
trs.tax_base as tax_base,
trs.tax_rate as tax_rate
FROM period_tax_rule_setting trs
LEFT JOIN period_tax_rule_setting_organization trso
ON trs.tax_rule_setting_id = trso.tax_setting_id
WHERE (trs.is_default = 1
OR trso.organization_id = #{organizationId,jdbcType=VARCHAR})
AND trs.name = #{taxName,jdbcType=VARCHAR}
AND trs.period = #{period,jdbcType=INTEGER}
TRS.IS_DEFAULT AS IS_DEFAULT,
TRS.TAX_BASE AS TAX_BASE,
TRS.TAX_RATE AS TAX_RATE
FROM
PERIOD_TAX_RULE_SETTING TRS
LEFT JOIN
PERIOD_TAX_RULE_SETTING_ORGANIZATION TRSO
ON
TRS.TAX_RULE_SETTING_ID = TRSO.TAX_SETTING_ID
WHERE
(
TRS.IS_DEFAULT = 1
OR TRSO.ORGANIZATION_ID = #{organizationId,jdbcType=VARCHAR}
)
AND TRS.NAME = #{taxName,jdbcType=VARCHAR}
AND TRS.PERIOD = #{period,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
package com.neo.mybatter;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
public class Format {
/** Format for just a space without newlines or blanks */
public static final Format SPACE = new Format(0, 0, 1);
/** Format for neither space nor newlines nor blanks */
public static final Format CLOSE_BY = new Format(0, 0, 0);
/** Number of line breaks to be written when writing this format */
@Getter
private final int newlineCount;
/** Number of indentions to add (+) or subtract (-) when writing this format */
@Getter
private final int indentionDelta;
/** Number of blanks to add (+) or substract (-) when writing this format */
@Getter
private final int blankCount;
/** Push indention after increasing or pop before decreasing it */
@Getter
private final boolean stackIndention;
public Format(int newlineCount, int indentionDelta, int blankCount) {
this(newlineCount, indentionDelta, blankCount, false);
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
package com.neo.mybatter;
enum TokenizerAction {
RETURN_PREVIOUS_TOKEN, CONSUME, CONSUME_AND_RECURSE_AND_RETURN_TOKEN, CONSUME_AND_RETURN_TOKEN
}
This diff is collapsed.
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