<?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.warehouse.code.mapper.NumSeqMapper">
    
	<sql id="numSeqColumns">
		a.id AS "id",
		a.name AS "name",
		a.module AS "module",
		a.month AS "month",
		a.seq AS "seq"
	</sql>
	
	<sql id="numSeqJoins">
		
	</sql>
	
    
	<select id="get" resultType="NumSeq" >
		SELECT 
			<include refid="numSeqColumns"/>
		FROM t_num_seq a
		<include refid="numSeqJoins"/>
		WHERE a.id = #{id}
	</select>

	<select id="getbyModule" resultType="NumSeq" >
		SELECT
		<include refid="numSeqColumns"/>
		FROM t_num_seq a
		<include refid="numSeqJoins"/>
		WHERE a.module = #{module}
	</select>
	
	<select id="findList" resultType="NumSeq" >
		SELECT 
			<include refid="numSeqColumns"/>
		FROM t_num_seq a
		<include refid="numSeqJoins"/>
		<where>
			${dataScope}
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
			</otherwise>
		</choose>
	</select>
	
	<select id="findAllList" resultType="NumSeq" >
		SELECT 
			<include refid="numSeqColumns"/>
		FROM t_num_seq a
		<include refid="numSeqJoins"/>
		<where>
			
			${dataScope}
		</where>		
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
			</otherwise>
		</choose>
	</select>
	
	<insert id="insert">
		INSERT INTO t_num_seq(
			id,
			name,
			module,
			month,
			seq
		) VALUES (
			#{id},
			#{name},
			#{module},
			#{month},
			#{seq}
		)
	</insert>
	
	<update id="update">
		UPDATE t_num_seq SET
			name = #{name},
			module = #{module},
			month = #{month},
			seq = #{seq}
		WHERE id = #{id}
	</update>
	
	
	<!--物理删除-->
	<update id="delete">
		DELETE FROM t_num_seq
		WHERE id = #{id}
	</update>
	
	<!--逻辑删除-->
	<update id="deleteByLogic">
		UPDATE t_num_seq SET 
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
	
	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
	<select id="findUniqueByProperty" resultType="NumSeq" statementType="STATEMENT">
		select * FROM t_num_seq  where ${propertyName} = '${value}'
	</select>
	
</mapper>