| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?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.siwei.apply.mapper.TdhyhsMapper">
- <resultMap id="BaseResultMap" type="com.siwei.apply.domain.Tdhyhs">
- <id property="id" column="id"/>
- <result property="projectId" column="project_id"/>
- <result property="ydwz" column="ydwz"/>
- <result property="hgzh" column="hgzh"/>
- <result property="fzjg" column="fzjg"/>
- <result property="fzDate" column="fz_date"/>
- <result property="jsdw" column="jsdw"/>
- <result property="gljsgcghxkh" column="gljsgcghxkh"/>
- <result property="hasOnchain" column="has_onchain"/>
- <result property="creatorId" column="creator_id"/>
- <result property="createdAt" column="created_at"/>
- <result property="updatedAt" column="updated_at"/>
- <result property="hyyj" column="hyyj"/>
- <result property="sourceId" column="source_id"/>
- <result property="bz" column="bz"/>
- </resultMap>
- <select id="isExit" resultType="Boolean">
- SELECT COUNT(1) > 0
- FROM t_tdhyhs
- WHERE project_id = #{projectId}
- </select>
- <!-- 添加记录 -->
- <insert id="add" parameterType="com.siwei.apply.domain.Tdhyhs">
- INSERT INTO t_tdhyhs (id, project_id, ydwz, hgzh, fzjg, fz_date,
- jsdw, gljsgcghxkh,hyyj,
- bz, has_onchain, creator_id,
- created_at, updated_at, source_id)
- VALUES (#{id}, #{projectId}, #{ydwz}, #{hgzh}, #{fzjg}, #{fzDate},
- #{jsdw}, #{gljsgcghxkh},#{hyyj},
- #{bz}, false, #{creatorId},
- now(), now(), #{sourceId})
- </insert>
- <!-- 根据项目ID获取记录(返回全部,按创建时间升序) -->
- <select id="get" resultMap="BaseResultMap" parameterType="String">
- SELECT *
- FROM t_tdhyhs
- WHERE project_id = #{projectId}
- ORDER BY created_at ASC
- </select>
- <!-- 新增:根据主键ID获取单条记录 -->
- <select id="getById" resultMap="BaseResultMap" parameterType="String">
- SELECT *
- FROM t_tdhyhs
- WHERE id = #{id}
- </select>
- <!-- 更新记录 -->
- <update id="update" parameterType="com.siwei.apply.domain.vo.TdhyhsUpdateVo">
- UPDATE t_tdhyhs
- <set>
- <if test="projectId != null">project_id = #{projectId},</if>
- <if test="ydwz != null">ydwz = #{ydwz},</if>
- <if test="hgzh != null">hgzh = #{hgzh},</if>
- <if test="fzjg != null">fzjg = #{fzjg},</if>
- <if test="fzDate != null">fz_date = #{fzDate},</if>
- <if test="jsdw != null">jsdw = #{jsdw},</if>
- <if test="gljsgcghxkh != null">gljsgcghxkh = #{gljsgcghxkh},</if>
- <if test="hyyj != null">hyyj = #{hyyj},</if>
- <if test="bz != null">bz = #{bz},</if>
- <if test="hasOnchain != null">has_onchain = #{hasOnchain},</if>
- <if test="sourceId != null">source_id = #{sourceId},</if>
- updated_at = now()
- </set>
- WHERE id = #{id}
- </update>
- <!-- 更新has_onchain字段 -->
- <update id="updateHasOnchain">
- UPDATE t_tdhyhs
- SET has_onchain = #{hasOnchain}, updated_at = now()
- WHERE id = #{id}
- </update>
- </mapper>
|