AssistApplyBo
package com.qianhong.oa.bo.administration.assistadministration.assistapply;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* oa_adm_assist_apply 资产领用
* @author wusiyuan
*/
@ApiModel(value = "AssistApplyBo", description = "资产领用")
public class AssistApplyBo {
/**
* 主键id
*/
@ApiModelProperty(value = "主键ID(新增时前端页面不需要填写,后台生成)", required = false)
private String id;
/**
* 外键申请单id
*/
@ApiModelProperty(value = "外键申请单ID", required = false)
private String applyId;
/**
* 详情表编号
*/
@ApiModelProperty(value = "详情表编号", required = false)
private String mCode;
/**
* 详情表领用人id
*/
@ApiModelProperty(value = "详情表领用人ID", required = true)
private String useId;
/**
* 详情表领用数量
*/
@ApiModelProperty(value = "详情表领用数量", required = false)
private String countNum;
/**
* 外键id(资产表)
*/
@ApiModelProperty(value = "外键资产表id", required = true)
private String assistId;
/**
* 规格
*/
@ApiModelProperty(value = "资产表规格", required = true)
private String specification;
/**
* 父级id
*/
@ApiModelProperty(value = "父级ID", required = false)
private String parentId;
/**
* 外键,租户基本表tenant_base
*/
@ApiModelProperty(value = "外键租户表id", required = false)
private Long tenantId;
/**
* 外键,部门id
*/
@ApiModelProperty(value = "部门ID", required = false)
private Long deptId;
@ApiModelProperty(value = "公司ID", required = false)
private Long companyId;
/**
* 申请单主题
*/
@ApiModelProperty(value = "申请单主题", required = false)
private String name;
/**
* 编号
*/
@ApiModelProperty(value = "编号", required = false)
private String code;
/**
* 审核状态:1:保存;2:审核中;3:审核通过;4:审核未通过退回;5:废弃
*/
@ApiModelProperty(value = "审核状态:1:保存;2:审核中;3:审核通过;4:审核未通过退回;5:废弃", required = false)
private String checkStatus;
/**
* 申请人id
*/
@ApiModelProperty(value = "申请人id", required = false)
private Long applyPersonId;
/**
* 申请人姓名
*/
@ApiModelProperty(value = "申请人姓名", required = false)
private String applyPersonName;
/**
* 优先级:1:低;2:中;3:高
*/
@ApiModelProperty(value = "优先级:1:低;2:中;3:高", required = false)
private String proprity;
/**
* 申请单结束时间
*/
@ApiModelProperty(value = "申请单结束时间", required = false)
@JsonFormat(pattern = "yyyy-MM-dd")
private Date finallyTime;
/**
* 申请时间
*/
@ApiModelProperty(value = "申请时间", required = false)
@JsonFormat(pattern = "yyyy-MM-dd")
private Date applyTime;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间", required = false)
@JsonFormat(pattern = "yyyy-MM-dd hh-MM-ss")
private Date gmtCreated;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间", required = false)
@JsonFormat(pattern = "yyyy-MM-dd hh-MM-ss")
private Date gmtUpdated;
/**
* 备注
*/
@ApiModelProperty(value = "备注", required = false)
private String othComment;
/**
* 总领用件数
*/
@ApiModelProperty(value = "总领用件数", required = false)
private Integer sumNum;
//省略getter和setter
}
package com.qianhong.oa.dao.administration.assistadministration.assistapply;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface AssistApplyDao {
/**
* 根据id删除资产领用信息
* @param id
* @return
*/
int deleteByPrimaryKey(String applyId);
/**
* 批量删除资产领用信息
* @param id
* @return
*/
int deleteList(String[] applyId);
/**
* 根据主键id删除资产领用详情
* @param id
* @return
*/
int deleteItemById(String id);
int insert(AssistApplyBo record);
/**
* 添加资产领用信息
*/
int insertSelective(AssistApplyBo record);
/**
* 添加子表详情表的数据
* @param record
* @return
*/
int insertApplyItem(AssistApplyItemBo record);
/**
* 查询所有资产领用信息
* @param record
* @return
*/
List<AssistApplyPo> selectList(SelectAssistApplyBo record);
/**
* 查询出资产领用所对应的详情信息
* @param applyId
* @return
*/
List<AssistApplyItemPo> selectListByApplyId(String applyId);
/**
* 根据主键id查询资产领用的详情信息
* @param id 主键id
* @return
*/
AssistApplyItemPo selectItemById(String id);
/**
* 查询出所有资产的种类
* @return
*/
List<AssistListPo> selectTypeList(SelectAssistListBo record);
/**
* 根据id查询资产领用信息
* @param id
* @return
*/
AssistApplyPo selectByPrimaryKey(String id);
/**
* 修改资产领用信息
* @param record
* @return
*/
int updateByPrimaryKeySelective(AssistApplyBo record);
/**
* 根据主键id修改资产领用详情信息
* @param itemBo
* @return
*/
int updateItemById(AssistApplyItemBo itemBo);
}
<?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.qianhong.oa.dao.administration.assistadministration.assistapply.AssistApplyDao">
<resultMap id="BaseResultMap" type="com.qianhong.oa.po.administration.assistadministration.assistapply.AssistApplyPo">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="parent_id" jdbcType="VARCHAR" property="parentId" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="dept_id" jdbcType="BIGINT" property="deptId" />
<result column="company_id" jdbcType="BIGINT" property="companyId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="check_status" jdbcType="CHAR" property="checkStatus" />
<result column="apply_person_id" jdbcType="BIGINT" property="applyPersonId" />
<result column="apply_person_name" jdbcType="VARCHAR" property="applyPersonName" />
<result column="proprity" jdbcType="VARCHAR" property="proprity" />
<result column="finally_time" jdbcType="DATE" property="finallyTime" />
<result column="apply_time" jdbcType="DATE" property="applyTime" />
<result column="gmt_created" jdbcType="TIMESTAMP" property="gmtCreated" />
<result column="gmt_updated" jdbcType="TIMESTAMP" property="gmtUpdated" />
<result column="oth_comment" jdbcType="VARCHAR" property="othComment" />
<result column="sum_num" jdbcType="INTEGER" property="sumNum" />
</resultMap>
<resultMap type="com.qianhong.oa.po.administration.assistadministration.assistapply.AssistApplyItemPo" id="selectAssistItemList">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="apply_id" jdbcType="VARCHAR" property="applyId" />
<result column="code" jdbcType="BIGINT" property="code" />
<result column="ass_size" jdbcType="BIGINT" property="assSize" />
<result column="use_id" jdbcType="BIGINT" property="useId" />
<result column="count_num" jdbcType="VARCHAR" property="countNum" />
<result column="assist_id" jdbcType="VARCHAR" property="assistId" />
<result column="name" jdbcType="VARCHAR" property="name"/>
</resultMap>
<resultMap type="com.qianhong.oa.po.administration.assistadministration.assistlist.AssistListPo" id="selectAssistList">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="specification" jdbcType="VARCHAR" property="specification" />
</resultMap>
<sql id="Base_Column_List">
m.id, y.parent_id, y.tenant_id, y.dept_id, y.company_id, y.`name`, y.`code`, y.check_status, y.apply_person_id,
y.apply_person_name, y.proprity, y.finally_time, y.apply_time, y.gmt_created, y.gmt_updated,
y.oth_comment, y.sum_num,m.apply_id,m.code mCode,m.ass_size,m.use_id,m.count_num,m.assist_id,t.name tName,
specification,t.code tCode
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
y.*
from oa_adm_assist_apply y
where y.id = #{id,jdbcType=VARCHAR}
</select>
<select id="selectTypeList" parameterType="com.qianhong.oa.bo.administration.assistadministration.assistapply.SelectAssistListBo" resultMap="selectAssistList">
select id,name,code,specification from oa_adm_assist
<where>
<if test="name != null and name != ''">
AND name = #{name}
</if>
<if test="code != null and code != ''">
AND code = #{code}
</if>
</where>
</select>
<select id="selectListByApplyId" parameterType="java.lang.String" resultMap="selectAssistItemList">
select m.*,a.name
from oa_assist_apply_item m left join oa_adm_assist a on m.assist_id=a.id where apply_id=#{applyId}
</select>
<select id="selectItemById" parameterType="java.lang.String" resultMap="selectAssistItemList">
select m.id,m.apply_id,m.code,ass_size,m.use_id,m.count_num,m.assist_id,a.name
from oa_assist_apply_item m left join oa_adm_assist a on m.assist_id=a.id where m.id=#{id}
</select>
<select id="selectList" parameterType="com.qianhong.oa.bo.administration.assistadministration.assistapply.SelectAssistApplyBo" resultMap="BaseResultMap">
select
y.*
from oa_adm_assist_apply y
<where>
<if test="name != null and name != ''">
AND y.name = #{name}
</if>
<if test="code != null and code != ''">
AND y.code = #{code}
</if>
<if test="checkStatus != null and checkStatus != ''">
AND y.check_status = #{checkStatus}
</if>
<if test="applyPersonName != null and applyPersonName != ''">
AND y.apply_person_name = #{applyPersonName}
</if>
<if test="proprity != null and proprity != ''">
AND y.proprity = #{proprity}
</if>
<if test="othComment != null and othComment != ''">
AND y.oth_comment = #{othComment}
</if>
<if test="assSize != null and assSize != ''">
AND m.ass_size = #{assSize}
</if>
</where>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from oa_adm_assist_apply
where id = #{applyId,jdbcType=VARCHAR};
delete from oa_assist_apply_item where apply_id = #{applyId}
</delete>
<delete id="deleteList">
delete from oa_adm_assist_apply where id in
<foreach collection="array" item="applyId" open="(" close=")" separator=",">
#{applyId}
</foreach>;
delete from oa_assist_apply_item where apply_id in
<foreach collection="array" item="applyId" open="(" close=")" separator=",">
#{applyId}
</foreach>
</delete>
<delete id="deleteItemById" parameterType="java.lang.String">
delete from oa_assist_apply_item where id = #{id}
</delete>
<insert id="insert" parameterType="com.qianhong.oa.bo.administration.assistadministration.assistapply.AssistApplyBo" useGeneratedKeys="true">
insert into oa_adm_assist_apply (id,parent_id, tenant_id, dept_id,
company_id, `name`, code,
check_status, apply_person_id, apply_person_name,
proprity, finally_time, apply_time,
gmt_created, gmt_updated, oth_comment,
sum_num)
values (#{id},#{parentId,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deptId,jdbcType=BIGINT},
#{companyId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
#{checkStatus,jdbcType=CHAR}, #{applyPersonId,jdbcType=BIGINT}, #{applyPersonName,jdbcType=VARCHAR},
#{proprity,jdbcType=VARCHAR}, #{finallyTime,jdbcType=DATE}, #{applyTime,jdbcType=DATE},
#{gmtCreated,jdbcType=TIMESTAMP}, #{gmtUpdated,jdbcType=TIMESTAMP}, #{othComment,jdbcType=VARCHAR},
#{sumNum,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.qianhong.oa.bo.administration.assistadministration.assistapply.AssistApplyBo" useGeneratedKeys="true">
insert into oa_adm_assist_apply
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="applyId != null">
id,
</if>
<if test="parentId != null">
parent_id,
</if>
<if test="tenantId != null">
tenant_id,
</if>
<if test="deptId != null">
dept_id,
</if>
<if test="companyId != null">
company_id,
</if>
<if test="name != null">
`name`,
</if>
<if test="code != null">
code,
</if>
<if test="checkStatus != null">
check_status,
</if>
<if test="applyPersonId != null">
apply_person_id,
</if>
<if test="applyPersonName != null">
apply_person_name,
</if>
<if test="proprity != null">
proprity,
</if>
<if test="finallyTime != null">
finally_time,
</if>
<if test="applyTime != null">
apply_time,
</if>
<if test="gmtCreated != null">
gmt_created,
</if>
<if test="gmtUpdated != null">
gmt_updated,
</if>
<if test="othComment != null">
oth_comment,
</if>
<if test="sumNum != null">
sum_num
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="applyId != null">
#{applyId,jdbcType=VARCHAR},
</if>
<if test="parentId != null">
#{parentId,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
<if test="deptId != null">
#{deptId,jdbcType=BIGINT},
</if>
<if test="companyId != null">
#{companyId,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="checkStatus != null">
#{checkStatus,jdbcType=CHAR},
</if>
<if test="applyPersonId != null">
#{applyPersonId,jdbcType=BIGINT},
</if>
<if test="applyPersonName != null">
#{applyPersonName,jdbcType=VARCHAR},
</if>
<if test="proprity != null">
#{proprity,jdbcType=VARCHAR},
</if>
<if test="finallyTime != null">
#{finallyTime,jdbcType=DATE},
</if>
<if test="applyTime != null">
#{applyTime,jdbcType=DATE},
</if>
<if test="gmtCreated != null">
#{gmtCreated,jdbcType=TIMESTAMP},
</if>
<if test="gmtUpdated != null">
#{gmtUpdated,jdbcType=TIMESTAMP},
</if>
<if test="othComment != null">
#{othComment,jdbcType=VARCHAR},
</if>
<if test="sumNum != null">
#{sumNum,jdbcType=INTEGER}
</if>
</trim>
</insert>
<insert id="insertApplyItem" parameterType="com.qianhong.oa.bo.administration.assistadministration.assistapply.AssistApplyItemBo">
insert into oa_assist_apply_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="applyId != null">
apply_id,
</if>
<if test="code != null">
code,
</if>
<if test="assSize != null">
ass_size,
</if>
<if test="useId != null">
use_id,
</if>
<if test="countNum != null">
count_num,
</if>
<if test="assistId != null">
assist_id
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="applyId != null">
#{applyId,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code},
</if>
<if test="assSize != null">
#{assSize},
</if>
<if test="useId != null">
#{useId},
</if>
<if test="countNum != null">
#{countNum},
</if>
<if test="assistId != null">
#{assistId,jdbcType=VARCHAR}
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.qianhong.oa.bo.administration.assistadministration.assistapply.AssistApplyBo">
update oa_adm_assist_apply
<set>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="deptId != null">
dept_id = #{deptId,jdbcType=BIGINT},
</if>
<if test="companyId != null">
company_id = #{companyId,jdbcType=BIGINT},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="checkStatus != null">
check_status = #{checkStatus,jdbcType=CHAR},
</if>
<if test="applyPersonId != null">
apply_person_id = #{applyPersonId,jdbcType=BIGINT},
</if>
<if test="applyPersonName != null">
apply_person_name = #{applyPersonName,jdbcType=VARCHAR},
</if>
<if test="proprity != null">
proprity = #{proprity,jdbcType=VARCHAR},
</if>
<if test="finallyTime != null">
finally_time = #{finallyTime,jdbcType=DATE},
</if>
<if test="applyTime != null">
apply_time = #{applyTime,jdbcType=DATE},
</if>
<if test="gmtCreated != null">
gmt_created = #{gmtCreated,jdbcType=TIMESTAMP},
</if>
<if test="gmtUpdated != null">
gmt_updated = #{gmtUpdated,jdbcType=TIMESTAMP},
</if>
<if test="othComment != null">
oth_comment = #{othComment,jdbcType=VARCHAR},
</if>
<if test="sumNum != null">
sum_num = #{sumNum,jdbcType=INTEGER}
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateItemById" parameterType="com.qianhong.oa.bo.administration.assistadministration.assistapply.AssistApplyItemBo">
update oa_assist_apply_item
<set>
<if test="code != null">
code = #{code},
</if>
<if test="assSize != null">
ass_size = #{assSize},
</if>
<if test="useId != null">
use_id = #{useId},
</if>
<if test="countNum != null">
count_num = #{countNum},
</if>
<if test="assistId != null">
assist_id = #{assistId}
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateApplyItem" parameterType="com.qianhong.oa.bo.administration.assistadministration.assistapply.AssistApplyBo">
<if test="applyId != null">
apply_id = #{applyId},
</if>
<if test="specification != null">
ass_size = #{specification},
</if>
<if test="sCode != null">
code = #{sCode},
</if>
<if test="useId != null">
use_id = #{useId},
</if>
<if test="countNum != null">
count_num = #{countNum},
</if>
<if test="assistId != null">
assist_id = #{assistId}
</if>
where id=#{id}
</update>
<update id="updateByPrimaryKey" parameterType="com.qianhong.oa.bo.administration.assistadministration.assistapply.AssistApplyBo">
update oa_adm_assist_apply
set parent_id = #{parentId,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT},
dept_id = #{deptId,jdbcType=BIGINT},
company_id = #{companyId,jdbcType=BIGINT},
`name` = #{name,jdbcType=VARCHAR},
code = #{code,jdbcType=VARCHAR},
check_status = #{checkStatus,jdbcType=CHAR},
apply_person_id = #{applyPersonId,jdbcType=BIGINT},
apply_person_name = #{applyPersonName,jdbcType=VARCHAR},
proprity = #{proprity,jdbcType=VARCHAR},
finally_time = #{finallyTime,jdbcType=DATE},
apply_time = #{applyTime,jdbcType=DATE},
gmt_created = #{gmtCreated,jdbcType=TIMESTAMP},
gmt_updated = #{gmtUpdated,jdbcType=TIMESTAMP},
oth_comment = #{othComment,jdbcType=VARCHAR},
sum_num = #{sumNum,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>