BizSetOfBookMapper.xml 10.5 KB
<?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="cn.runsa.portal.base.dao.BizSetOfBookMapper">
	<resultMap id="BaseResultMap" type="cn.runsa.portal.base.entity.BizSetOfBook">
		<id column="bebId" property="id" jdbcType="INTEGER" />
		<result column="beId" property="beid" jdbcType="INTEGER" />
		<result column="bebCode" property="code" jdbcType="VARCHAR" />
		<result column="bebName" property="name" jdbcType="VARCHAR" />
		<result column="bebDesc" property="desc" jdbcType="VARCHAR" />
		<result column="ptRemark" property="remark" jdbcType="VARCHAR" />
		<result column="bebDefault" property="bebdefault" jdbcType="BIT" />
		<result column="bebSort" property="sort" jdbcType="INTEGER" />
		<result column="ptValid" property="valid" jdbcType="SMALLINT" />
		<result column="ptRemark1" property="remark1" jdbcType="VARCHAR" />
		<result column="ptRemark2" property="remark2" jdbcType="VARCHAR" />
		<result column="ptRemark3" property="remark3" jdbcType="VARCHAR" />
		<result column="ptUpTime" property="uptime" jdbcType="TIMESTAMP" />
		<result column="ptUpdater" property="updater" jdbcType="INTEGER" />
		<association property="bizEntity"
			javaType="cn.runsa.portal.base.entity.BizEntity">
			<id column="beId" property="id" />
			<result column="beName" property="name" jdbcType="VARCHAR" />
		</association>
	</resultMap>
	<sql id="Base_Column_List">
		bebId, beId, bebCode, bebName, bebDesc, ptRemark, ptValid,
		ptRemark1, ptRemark2,
		ptRemark3, ptUpTime, ptUpdater
	</sql>
	<select id="queryBizSetList" resultMap="BaseResultMap">
		select bebId, beId,
		bebCode, bebName, bebDesc from mtBizSetOfBook
	</select>
	<select id="findById" resultMap="BaseResultMap" parameterType="java.lang.Integer">
		SELECT
		t1.bebId,
		t1.beId,
		t1.bebCode,
		t1.bebName,
		t1.bebDesc,
		t1.ptRemark,
		t1.ptValid,
		t1.ptRemark1,
		t1.ptRemark2,
		t1.ptRemark3,
		t1.ptUpTime,
		t1.ptUpdater,
		t2.beName
		FROM
		mtBizSetOfBook t1
		LEFT JOIN mtbizentity t2 ON
		t1.beId = t2.beId
		WHERE
		bebId = #{id,jdbcType=INTEGER}
	</select>
	<select id="findByBeId" resultMap="BaseResultMap"
		parameterType="cn.runsa.portal.base.entity.BizSetOfBook">
		select
		<include refid="Base_Column_List" />
		from mtBizSetOfBook
		where beId = #{beid,jdbcType=INTEGER}
	</select>
	<select id="findSetByBeId" resultMap="BaseResultMap"
		parameterType="java.lang.Integer">
		select
		<include refid="Base_Column_List" />
		from mtBizSetOfBook
		where beId = #{beid,jdbcType=INTEGER} and ptValid=1
	</select>
	<select id="selectSetByBeId" resultMap="BaseResultMap"
		parameterType="java.lang.Integer">
		select
		<include refid="Base_Column_List" />
		from mtBizSetOfBook
		where beId = #{beid,jdbcType=INTEGER}
	</select>
	<delete id="delete" parameterType="java.lang.Integer">
		delete from mtBizSetOfBook
		where bebId = #{id,jdbcType=INTEGER}
	</delete>
	<!-- 插入开票信息 -->
	<insert id="insertInvoiceList">
		insert into mtBizInvoice (bebId, beiName, beiCode,
		beiTaxnum,
		beiTaxrate, ptPhone,
		ptAddr, cuId, ptRemark1,
		ptRemark2, ptUpTime,
		ptUpdater
		)
		values
		<foreach collection="bizInvoiceList" item="item" index="index"
			separator=",">
			(
			#{id,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},
			#{item.code,jdbcType=VARCHAR},
			#{item.taxnum,jdbcType=VARCHAR},
			#{item.taxrate,jdbcType=DECIMAL}, #{item.phone,jdbcType=VARCHAR},
			#{item.addr,jdbcType=VARCHAR}, #{item.cuid,jdbcType=INTEGER},
			#{item.remark1,jdbcType=VARCHAR},
			#{item.remark2,jdbcType=VARCHAR},
			now(), #{item.updater,jdbcType=INTEGER}
			)
		</foreach>
	</insert>
	<!-- 插入常用账户 -->
	<insert id="insertbizAccountList" useGeneratedKeys="true"
		keyProperty="id">
		insert into mtBizAccount (bebId, beaName, beaCode,
		beaAccount, beaRate,
		cuId,
		beaType, beaSource, ptRemark1,
		ptUpTime, ptUpdater)
		values
		<foreach collection="bizAccountList" item="item" index="index"
			separator=",">
			(#{id,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},
			#{item.code,jdbcType=VARCHAR},
			#{item.account,jdbcType=VARCHAR},
			#{item.rate,jdbcType=DECIMAL}, #{item.cuid,jdbcType=INTEGER},
			#{item.type,jdbcType=SMALLINT}, #{item.source,jdbcType=VARCHAR},
			#{item.remark1,jdbcType=VARCHAR},
			now(),
			#{item.updater,jdbcType=INTEGER})
		</foreach>
	</insert>

	<!-- 插入常用账户 -->
	<insert id="insertbizAccount" parameterType="cn.runsa.portal.base.entity.BizAccount">
		<selectKey resultType="java.lang.Integer" order="AFTER"
			keyProperty="id">
			SELECT LAST_INSERT_ID()
		</selectKey>
		insert into mtBizAccount (bebId, beaName, beaCode,beaAccount, beaRate,
		cuId, beaType, beaSource, ptRemark1, ptUpTime, ptUpdater)
		values
		(#{bebid,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
		#{code,jdbcType=VARCHAR},
		#{account,jdbcType=VARCHAR},
		#{rate,jdbcType=DECIMAL}, #{cuid,jdbcType=INTEGER},
		#{type,jdbcType=SMALLINT}, #{source,jdbcType=VARCHAR},
		#{remark1,jdbcType=VARCHAR},
		now(), #{updater,jdbcType=INTEGER})
	</insert>

	<!-- 插入收款方式 -->
	<insert id="insertbizPaywayList">
		insert into mtBizPayway (bebId, pwId,
		beaId, bepAccount, bepProceeds,
		bepPayee, bepIncome, bepPoint,
		piId,ptValid, ptRemark1,
		ptUpTime,
		ptUpdater)
		values
		<foreach collection="bizPaywayList" item="item" index="index"
			separator=",">
			(#{id,jdbcType=INTEGER}, #{item.pwid,jdbcType=INTEGER},
			#{item.beaid,jdbcType=INTEGER}, #{item.account,jdbcType=VARCHAR},
			#{item.proceeds,jdbcType=VARCHAR},
			#{item.payee,jdbcType=VARCHAR},
			#{item.income,jdbcType=BIT}, #{item.point,jdbcType=BIT},
			#{item.piid,jdbcType=INTEGER},#{item.valid,jdbcType=INTEGER},
			#{item.remark1,jdbcType=VARCHAR},
			now(),
			#{item.updater,jdbcType=INTEGER})
		</foreach>
	</insert>
	<insert id="insert" useGeneratedKeys="true" keyProperty="id"
		parameterType="cn.runsa.portal.base.entity.BizSetOfBook">
		insert into mtBizSetOfBook (beId, bebCode, bebName,
		bebDesc, bebDefault, bebSort, ptRemark, ptValid,
		ptRemark1, ptRemark2, ptRemark3,
		ptUpTime,
		ptUpdater)
		values (#{beid,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR},
		#{name,jdbcType=VARCHAR},
		#{desc,jdbcType=VARCHAR},
		#{bebdefault,jdbcType=BIT},
		#{sort,jdbcType=INTEGER},
		#{remark,jdbcType=VARCHAR}, #{valid,jdbcType=SMALLINT},
		#{remark1,jdbcType=VARCHAR}, #{remark2,jdbcType=VARCHAR},
		#{remark3,jdbcType=VARCHAR},
		now(), #{updater,jdbcType=INTEGER})
	</insert>
	<insert id="insertSelective" useGeneratedKeys="true"
		keyProperty="id" parameterType="cn.runsa.portal.base.entity.BizSetOfBook">
		insert into mtBizSetOfBook
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="beid != null">
				beId,
			</if>
			<if test="code != null">
				bebCode,
			</if>
			<if test="name != null">
				bebName,
			</if>
			<if test="desc != null">
				bebDesc,
			</if>
			<if test="remark != null">
				ptRemark,
			</if>
			<if test="valid != null">
				ptValid,
			</if>
			<if test="remark1 != null">
				ptRemark1,
			</if>
			<if test="remark2 != null">
				ptRemark2,
			</if>
			<if test="remark3 != null">
				ptRemark3,
			</if>
			<if test="uptime != null">
				ptUpTime,
			</if>
			<if test="updater != null">
				ptUpdater,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="beid != null">
				#{beid,jdbcType=INTEGER},
			</if>
			<if test="code != null">
				#{code,jdbcType=VARCHAR},
			</if>
			<if test="name != null">
				#{name,jdbcType=VARCHAR},
			</if>
			<if test="desc != null">
				#{desc,jdbcType=VARCHAR},
			</if>
			<if test="remark != null">
				#{remark,jdbcType=VARCHAR},
			</if>
			<if test="valid != null">
				#{valid,jdbcType=SMALLINT},
			</if>
			<if test="remark1 != null">
				#{remark1,jdbcType=VARCHAR},
			</if>
			<if test="remark2 != null">
				#{remark2,jdbcType=VARCHAR},
			</if>
			<if test="remark3 != null">
				#{remark3,jdbcType=VARCHAR},
			</if>
			<if test="uptime != null">
				now(),
			</if>
			<if test="updater != null">
				#{updater,jdbcType=INTEGER},
			</if>
		</trim>
	</insert>
	<update id="updateSelective" parameterType="cn.runsa.portal.base.entity.BizSetOfBook">
		update mtBizSetOfBook
		<set>
			<if test="beid != null">
				beId = #{beid,jdbcType=INTEGER},
			</if>
			<if test="code != null">
				bebCode = #{code,jdbcType=VARCHAR},
			</if>
			<if test="name != null">
				bebName = #{name,jdbcType=VARCHAR},
			</if>
			<if test="desc != null">
				bebDesc = #{desc,jdbcType=VARCHAR},
			</if>
			<if test="bebdefault != null">
				bebDefault = #{bebdefault,jdbcType=BIT},
			</if>
			<if test="sort != null">
				bebSort = #{sort,jdbcType=INTEGER},
			</if>
			<if test="remark != null">
				ptRemark = #{remark,jdbcType=VARCHAR},
			</if>
			<if test="valid != null">
				ptValid = #{valid,jdbcType=SMALLINT},
			</if>
			<if test="remark1 != null">
				ptRemark1 = #{remark1,jdbcType=VARCHAR},
			</if>
			<if test="remark2 != null">
				ptRemark2 = #{remark2,jdbcType=VARCHAR},
			</if>
			<if test="remark3 != null">
				ptRemark3 = #{remark3,jdbcType=VARCHAR},
			</if>
			<if test="uptime != null">
				now(),
			</if>
			<if test="updater != null">
				ptUpdater = #{updater,jdbcType=INTEGER},
			</if>
		</set>
		where bebId = #{id,jdbcType=INTEGER}
	</update>
	<update id="update" parameterType="cn.runsa.portal.base.entity.BizSetOfBook">
		update mtBizSetOfBook
		set
		beId = #{beid,jdbcType=INTEGER},
		bebCode = #{code,jdbcType=VARCHAR},
		bebName = #{name,jdbcType=VARCHAR},
		bebDesc = #{desc,jdbcType=VARCHAR},
		bebDefault = #{bebdefault,jdbcType=BIT},
		bebSort = #{sort,jdbcType=INTEGER},
		ptRemark = #{remark,jdbcType=VARCHAR},
		ptValid = #{valid,jdbcType=SMALLINT},
		ptRemark1 = #{remark1,jdbcType=VARCHAR},
		ptRemark2 = #{remark2,jdbcType=VARCHAR},
		ptRemark3 = #{remark3,jdbcType=VARCHAR},
		ptUpTime=now(),
		ptUpdater = #{updater,jdbcType=INTEGER}
		where bebId = #{id,jdbcType=INTEGER}
	</update>
	<!-- 校验结算主体等是否引用 -->
	<select id="exists" resultType="java.lang.Integer"
		parameterType="java.lang.Integer">
		select count(*) from mtBizSetOfBook where beId =
		#{id,jdbcType=INTEGER}
	</select>

	<select id="existsName" resultType="Boolean">
		select count(*)
		from
		mtBizSetOfBook
		where bebName=#{name}
	</select>
	<select id="findmaxsort" resultType="Integer">
		select max(bebSort)
		from
		mtBizSetOfBook
	</select>
	<select id="findSetByUserId" resultMap="BaseResultMap" parameterType="java.lang.Integer">
		select
		<include refid="Base_Column_List" />
		from mtBizSetOfBook where ptValid=1 AND bebId IN (SELECT DISTINCT t2.bebId FROM SMUSPERMISSION t1, MTSITE t2 WHERE t1.moId=t2.orId AND t1.usId=#{userId,jdbcType=INTEGER})
	</select>
</mapper>