移风店镇项目初始化
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.2 KiB

<?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.epmet.dao.stats.DimDepartmentDao">
<insert id="insertOne">
INSERT INTO dim_department(id, department_name, agency_id, customer_id, del_flag, revision, created_by, created_time,
updated_by, updated_time)
VALUE (#{id}, #{departmentName}, #{agencyId}, #{customerId}, #{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy}, #{updatedTime})
</insert>
<select id="getDepartmentListByCustomerId" resultType="com.epmet.entity.stats.DimDepartmentEntity">
SELECT
ID,
AGENCY_ID,
CUSTOMER_ID
FROM
dim_department
WHERE
DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
</select>
<select id="getLatestCreatedDimEntity" resultType="com.epmet.entity.stats.DimDepartmentEntity">
SELECT id,
department_name,
agency_id,
customer_id,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
FROM dim_department
ORDER BY CREATED_TIME DESC
LIMIT 1
</select>
<select id="getLatestUpdatedDimEntity" resultType="com.epmet.entity.stats.DimDepartmentEntity">
select
id,
department_name,
agency_id,
customer_id,
del_flag,
revision,
created_by,
created_time,
updated_by,
updated_time
from dim_department
order by UPDATED_TIME desc
limit 1
</select>
<select id="getDistrictDepByCustomer" resultType="com.epmet.dto.stats.DimDepartmentDTO">
SELECT
dd.ID,
dd.CUSTOMER_ID,
dd.AGENCY_ID
FROM
dim_department dd
INNER JOIN dim_agency da ON dd.AGENCY_ID = da.ID
WHERE
dd.CUSTOMER_ID = #{customerId}
</select>
</mapper>