Browse Source

输变电工程分部结算dao.xml

user7 5 năm trước cách đây
mục cha
commit
73acfb9e06

+ 205 - 0
src/main/resources/mappings/modules/workcontent/WorkContentBranchAccountDao.xml

@@ -0,0 +1,205 @@
+<?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.jeeplus.modules.workcontent.dao.WorkContentBranchAccountDao">
+    
+	<sql id="workContentBranchAccountColumns">
+		a.id AS "id",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.project_id AS "projectId",
+		a.content_id AS "contentId",
+		a.account_name AS "accountName",
+		a.contract_account AS "contractAccount",
+		a.submit_account AS "submitAccount",
+		a.set_account AS "setAccount",
+		a.business_add AS "businessAdd",
+		a.business_reduce AS "businessReduce",
+		a.business_rate AS "businessRate",
+		a.type AS "type"
+	</sql>
+	
+    
+	<select id="get" resultType="WorkContentBranchAccount" >
+		SELECT 
+			<include refid="workContentBranchAccountColumns"/>
+		FROM work_content_branchaccount a
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="WorkContentBranchAccount" >
+		SELECT 
+			<include refid="workContentBranchAccountColumns"/>
+		FROM work_content_branchaccount a
+		<where>
+            <if test="projectId!=null and projectId !=''">
+                AND a.project_id = #{projectId}
+            </if>
+            <if test="contentId!=null and contentId !=''">
+                AND a.content_id = #{contentId}
+            </if>
+			AND a.del_flag = #{DEL_FLAG_NORMAL}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="WorkContentBranchAccount" >
+		SELECT 
+			<include refid="workContentBranchAccountColumns"/>
+		FROM work_content_branchaccount a
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.update_date DESC
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert">
+		INSERT INTO work_content_branchaccount(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			project_id,
+			content_id,
+			account_name,
+			contract_account,
+			submit_account,
+			set_account,
+			business_add,
+			business_reduce,
+			business_rate,
+			type
+		) VALUES (
+			#{id},
+			#{createBy.id},
+			#{createDate},
+			#{updateBy.id},
+			#{updateDate},
+			#{remarks},
+			#{delFlag},
+			#{projectId},
+			#{contentId},
+            #{accountName},
+            #{contractAccount},
+            #{submitAccount},
+            #{setAccount},
+            #{businessAdd},
+            #{businessReduce},
+            #{businessRate},
+            #{type}
+		)
+	</insert>
+
+    <insert id="batchInsert" parameterType="java.util.List">
+		INSERT INTO work_content_branchaccount(
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			remarks,
+			del_flag,
+			project_id,
+			content_id,
+			account_name,
+			contract_account,
+			submit_account,
+			set_account,
+			business_add,
+			business_reduce,
+			business_rate,
+			type
+		) VALUES
+		<foreach collection="list" item="item" separator=",">
+            ( #{item.id},
+            #{item.createBy.id},
+            #{item.createDate},
+            #{item.updateBy.id},
+            #{item.updateDate},
+            #{item.remarks},
+            #{item.delFlag},
+            #{item.projectId},
+            #{item.contentId},
+             #{item.accountName},
+            #{item.contractAccount},
+            #{item.submitAccount},
+            #{item.setAccount},
+            #{item.businessAdd},
+            #{item.businessReduce},
+            #{item.businessRate},
+            #{item.type}
+            )
+        </foreach>
+	</insert>
+	
+	<update id="update">
+		UPDATE work_content_branchaccount SET
+			update_by = #{updateBy.id},
+			update_date = #{updateDate},
+			remarks = #{remarks},
+			project_id = #{projectId},
+			content_id = #{contentId},
+			account_name = #{accountName},
+			contract_account = #{contractAccount},
+			submit_account = #{submitAccount},
+			set_account = #{setAccount},
+			business_add = #{businessAdd},
+			business_reduce = #{businessReduce},
+			business_rate = #{businessRate},
+			type = #{type}
+		WHERE id = #{id}
+	</update>
+	
+	
+	<!--物理删除-->
+	<update id="delete">
+		DELETE FROM work_content_branchaccount
+		WHERE id = #{id}
+	</update>
+	
+	<!--逻辑删除-->
+	<update id="deleteByLogic">
+		UPDATE work_content_branchaccount SET
+			del_flag = #{DEL_FLAG_DELETE}
+		WHERE id = #{id}
+	</update>
+
+	<delete id="deleteByContentId">
+		DELETE FROM work_content_branchaccount
+		WHERE content_id = #{id}
+	</delete>
+	
+	
+	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
+	<select id="findUniqueByProperty" resultType="WorkContentBranchAccount" statementType="STATEMENT">
+		select * FROM work_content_branchaccount  where ${propertyName} = '${value}'
+	</select>
+
+	<select id="getTableType" resultType="java.lang.String">
+		select a.type from(
+		select DISTINCT(wwpic.type) as type from work_content_branchaccount wwpic where wwpic.del_flag = 0 and wwpic.content_id = #{contentId}
+		) a
+	</select>
+
+	
+</mapper>