代码生成XML中存在部分条件id不存在情况
This commit is contained in:
parent
71c5317711
commit
05c348cc2e
|
@ -282,4 +282,11 @@ public class BaseEntity implements Serializable {
|
|||
this.dataSourceCode = "master";
|
||||
}
|
||||
|
||||
public Long getSorts() {
|
||||
return sorts;
|
||||
}
|
||||
|
||||
public void setSorts(Long sorts) {
|
||||
this.sorts = sorts;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
,company_id
|
||||
</sql>
|
||||
<!-- 查询 采用==查询 -->
|
||||
<select id="entity_list_base" resultMap="get-SysRoleEntity-result" parameterType = "com.hzya.frame.sys.role.entity.SysRoleEntity">
|
||||
<select id="entity_list_base" resultMap="get-SysRoleEntity-result"
|
||||
parameterType="com.hzya.frame.sys.role.entity.SysRoleEntity">
|
||||
select
|
||||
<include refid="SysRoleEntity_Base_Column_List"/>
|
||||
from sys_role
|
||||
|
@ -78,7 +79,8 @@
|
|||
</select>
|
||||
|
||||
<!-- 分页查询列表 采用like格式 -->
|
||||
<select id="entity_list_like" resultMap="get-SysRoleEntity-result" parameterType = "com.hzya.frame.sys.role.entity.SysRoleEntity">
|
||||
<select id="entity_list_like" resultMap="get-SysRoleEntity-result"
|
||||
parameterType="com.hzya.frame.sys.role.entity.SysRoleEntity">
|
||||
select
|
||||
<include refid="SysRoleEntity_Base_Column_List"/>
|
||||
from sys_role
|
||||
|
@ -86,11 +88,16 @@
|
|||
<if test="id != null and id != ''">and id like concat('%',#{id},'%')</if>
|
||||
<if test="roleCode != null and roleCode != ''">and role_code like concat('%',#{roleCode},'%')</if>
|
||||
<if test="roleName != null and roleName != ''">and role_name like concat('%',#{roleName},'%')</if>
|
||||
<if test="description != null and description != ''"> and description like concat('%',#{description},'%') </if>
|
||||
<if test="description != null and description != ''">and description like concat('%',#{description},'%')
|
||||
</if>
|
||||
<if test="sorts != null">and sorts like concat('%',#{sorts},'%')</if>
|
||||
<if test="create_user_id != null and create_user_id != ''"> and create_user_id like concat('%',#{create_user_id},'%') </if>
|
||||
<if test="create_user_id != null and create_user_id != ''">and create_user_id like
|
||||
concat('%',#{create_user_id},'%')
|
||||
</if>
|
||||
<if test="create_time != null">and create_time like concat('%',#{create_time},'%')</if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''"> and modify_user_id like concat('%',#{modify_user_id},'%') </if>
|
||||
<if test="modify_user_id != null and modify_user_id != ''">and modify_user_id like
|
||||
concat('%',#{modify_user_id},'%')
|
||||
</if>
|
||||
<if test="modify_time != null">and modify_time like concat('%',#{modify_time},'%')</if>
|
||||
<if test="sts != null and sts != ''">and sts like concat('%',#{sts},'%')</if>
|
||||
<if test="org_id != null and org_id != ''">and org_id like concat('%',#{org_id},'%')</if>
|
||||
|
@ -102,7 +109,8 @@
|
|||
</select>
|
||||
|
||||
<!-- 查询列表 字段采用or格式 -->
|
||||
<select id="SysRoleentity_list_or" resultMap="get-SysRoleEntity-result" parameterType = "com.hzya.frame.sys.role.entity.SysRoleEntity">
|
||||
<select id="SysRoleentity_list_or" resultMap="get-SysRoleEntity-result"
|
||||
parameterType="com.hzya.frame.sys.role.entity.SysRoleEntity">
|
||||
select
|
||||
<include refid="SysRoleEntity_Base_Column_List"/>
|
||||
from sys_role
|
||||
|
@ -126,7 +134,8 @@
|
|||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="entity_insert" parameterType = "com.hzya.frame.sys.role.entity.SysRoleEntity" keyProperty="" useGeneratedKeys="true">
|
||||
<insert id="entity_insert" parameterType="com.hzya.frame.sys.role.entity.SysRoleEntity" keyProperty=""
|
||||
useGeneratedKeys="true">
|
||||
insert into sys_role(
|
||||
<trim suffix="" suffixOverrides=",">
|
||||
<if test="id != null and id != ''">id ,</if>
|
||||
|
@ -158,22 +167,27 @@
|
|||
<if test="sts != null and sts != ''">#{sts} ,</if>
|
||||
<if test="org_id != null and org_id != ''">#{org_id} ,</if>
|
||||
<if test="companyId != null and companyId != ''">#{companyId} ,</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_role a WHERE a.sts = 'Y' ),</if>
|
||||
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_role a WHERE a.sts = 'Y'
|
||||
),
|
||||
</if>
|
||||
<if test="sts == null ">'Y',</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
<!-- 批量新增 -->
|
||||
<insert id="entityInsertBatch" keyProperty="" useGeneratedKeys="true">
|
||||
insert into sys_role(id, role_code, role_name, description, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
|
||||
insert into sys_role(id, role_code, role_name, description, sorts, create_user_id, create_time, modify_user_id,
|
||||
modify_time, sts, org_id, company_id, sts)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.roleCode},#{entity.roleName},#{entity.description},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
|
||||
(#{entity.id},#{entity.roleCode},#{entity.roleName},#{entity.description},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId},
|
||||
'Y')
|
||||
</foreach>
|
||||
</insert>
|
||||
<!-- 批量新增或者修改-->
|
||||
<insert id="entityInsertOrUpdateBatch" keyProperty="" useGeneratedKeys="true">
|
||||
insert into sys_role(id, role_code, role_name, description, sorts, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
|
||||
insert into sys_role(id, role_code, role_name, description, sorts, create_user_id, create_time, modify_user_id,
|
||||
modify_time, sts, org_id, company_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.id},#{entity.roleCode},#{entity.roleName},#{entity.description},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
|
||||
|
@ -190,7 +204,8 @@
|
|||
modify_time = values(modify_time),
|
||||
sts = values(sts),
|
||||
org_id = values(org_id),
|
||||
company_id = values(company_id)</insert>
|
||||
company_id = values(company_id)
|
||||
</insert>
|
||||
<!--通过主键修改方法-->
|
||||
<update id="entity_update" parameterType="com.hzya.frame.sys.role.entity.SysRoleEntity">
|
||||
update sys_role set
|
||||
|
@ -208,12 +223,12 @@ update sys_role set
|
|||
<if test="org_id != null and org_id != ''">org_id = #{org_id},</if>
|
||||
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
|
||||
</trim>
|
||||
where = #{}
|
||||
where = #{id}
|
||||
</update>
|
||||
<!-- 逻辑删除 -->
|
||||
<update id="entity_logicDelete" parameterType="com.hzya.frame.sys.role.entity.SysRoleEntity">
|
||||
update sys_role set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
|
||||
where = #{}
|
||||
where = #{id}
|
||||
</update>
|
||||
<!-- 多条件逻辑删除 -->
|
||||
<update id="entity_logicDelete_Multi_Condition" parameterType="com.hzya.frame.sys.role.entity.SysRoleEntity">
|
||||
|
@ -231,7 +246,7 @@ update sys_role set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{m
|
|||
</update>
|
||||
<!--通过主键删除-->
|
||||
<delete id="entity_delete">
|
||||
delete from sys_role where = #{}
|
||||
delete from sys_role where = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue