goweb实战全家桶:gowebfactroy-v2重构,从java到go新人的快速成长

swagger

UML

配置参数

factroy:
  author: leijianming@163.com
  
  pkgNow: gitee.com/ichub/gowebfactroynew/mysql/
  pkgNew: gitee.com/ichub/gowebfactroynew/code/mysql/db/

开源代码:

git clone https://gitee.com/ichub/gowebfactroy-v2.git

测试代码


func Test001_makeMysql(t *testing.T) {
    var makeMysql = MakeMysql("employee")

    logrus.Info(makeMysql)
}

/*
 员工
 */
type Employee struct {

    basedto.BaseEntity `gorm:"-"`
    

    /*  员工编号  */
    Id int32 `gorm:"column:id;type:int(11);PRIMARY_KEY;comment:'员工编号'" json:"id"`
    /*  所属部门  */
    DepartmentId int32 `gorm:"column:department_id;type:int(11);comment:'所属部门';default:0" json:"department_id"`
    /*  员工姓名  */
    Name string `gorm:"column:name;type:varchar(16);comment:'员工姓名'" json:"name"`
    /*  性别  */
    Gender string `gorm:"column:gender;type:char(4);comment:'性别'" json:"gender"`
    /*  出生日期  */
    Birthday time.Time `gorm:"column:birthday;type:date;comment:'出生日期'" json:"birthday"`
    /*  身份证号  */
    IdCard string `gorm:"column:id_card;type:char(18);comment:'身份证号'" json:"id_card"`
    /*  婚姻状况  */
    Wedlock string `gorm:"column:wedlock;type:varchar(8);comment:'婚姻状况'" json:"wedlock"`
    /*  民族  */
    NationId int32 `gorm:"column:nation_id;type:int(8);comment:'民族'" json:"nation_id"`
    /*  籍贯  */
    NativePlace string `gorm:"column:native_place;type:varchar(20);comment:'籍贯'" json:"native_place"`
    /*  政治面貌  */
    PoliticId int32 `gorm:"column:politic_id;type:int(8);comment:'政治面貌'" json:"politic_id"`
    /*  邮箱  */
    Email string `gorm:"column:email;type:varchar(20);comment:'邮箱'" json:"email"`
    /*  电话号码  */
    Phone string `gorm:"column:phone;type:varchar(11);comment:'电话号码'" json:"phone"`
    /*  联系地址  */
    Address string `gorm:"column:address;type:varchar(64);comment:'联系地址'" json:"address"`
    /*  职称ID  */
    JobLevelId int32 `gorm:"column:job_level_id;type:int(11);comment:'职称ID'" json:"job_level_id"`
    /*  职位ID  */
    PosId int32 `gorm:"column:pos_id;type:int(11);comment:'职位ID'" json:"pos_id"`
    /*  聘用形式  */
    EngageForm string `gorm:"column:engage_form;type:varchar(8);comment:'聘用形式'" json:"engage_form"`
    /*  最高学历  */
    TiptopDegree string `gorm:"column:tiptop_degree;type:varchar(8);comment:'最高学历'" json:"tiptop_degree"`
    /*  所属专业  */
    Specialty string `gorm:"column:specialty;type:varchar(32);comment:'所属专业'" json:"specialty"`
    /*  毕业院校  */
    School string `gorm:"column:school;type:varchar(32);comment:'毕业院校'" json:"school"`
    /*  入职日期  */
    BeginDate time.Time `gorm:"column:begin_date;type:date;comment:'入职日期'" json:"begin_date"`
    /*  在职状态  */
    WorkState string `gorm:"column:work_state;type:varchar(8);comment:'在职状态';default:\'在职\'" json:"work_state"`
    /*  工号  */
    Code string `gorm:"column:code;type:varchar(8);comment:'工号'" json:"code"`
    /*  合同期限  */
    ContractTerm float64 `gorm:"column:contract_term;type:double;comment:'合同期限'" json:"contract_term"`
    /*  转正日期  */
    ConversionTime time.Time `gorm:"column:conversion_time;type:date;comment:'转正日期'" json:"conversion_time"`
    /*  离职日期  */
    NotWokDate time.Time `gorm:"column:not_wok_date;type:date;comment:'离职日期'" json:"not_wok_date"`
    /*  合同起始日期  */
    BeginContract time.Time `gorm:"column:begin_contract;type:date;comment:'合同起始日期'" json:"begin_contract"`
    /*  合同终止日期  */
    EndContract time.Time `gorm:"column:end_contract;type:date;comment:'合同终止日期'" json:"end_contract"`
    /*  工龄  */
    WorkAge int32 `gorm:"column:work_age;type:int(11);comment:'工龄'" json:"work_age"`
    /*    */
    WorkId string `gorm:"column:work_id;type:varchar(16);comment:''" json:"work_id"`

}


func NewEmployee() *Employee {
    var m = &Employee{}
    m.InitProxy(m)
    return m
}

type EmployeeParams struct {

    

    /*  员工编号  */
    Id *int32 `gorm:"column:id;type:int(11);PRIMARY_KEY;comment:'员工编号'" json:"id"`
    /*  所属部门  */
    DepartmentId *int32 `gorm:"column:department_id;type:int(11);comment:'所属部门';default:0" json:"department_id"`
    /*  员工姓名  */
    Name *string `gorm:"column:name;type:varchar(16);comment:'员工姓名'" json:"name"`
    /*  性别  */
    Gender *string `gorm:"column:gender;type:char(4);comment:'性别'" json:"gender"`
    /*  出生日期  */
    Birthday *time.Time `gorm:"column:birthday;type:date;comment:'出生日期'" json:"birthday"`
    /*  身份证号  */
    IdCard *string `gorm:"column:id_card;type:char(18);comment:'身份证号'" json:"id_card"`
    /*  婚姻状况  */
    Wedlock *string `gorm:"column:wedlock;type:varchar(8);comment:'婚姻状况'" json:"wedlock"`
    /*  民族  */
    NationId *int32 `gorm:"column:nation_id;type:int(8);comment:'民族'" json:"nation_id"`
    /*  籍贯  */
    NativePlace *string `gorm:"column:native_place;type:varchar(20);comment:'籍贯'" json:"native_place"`
    /*  政治面貌  */
    PoliticId *int32 `gorm:"column:politic_id;type:int(8);comment:'政治面貌'" json:"politic_id"`
    /*  邮箱  */
    Email *string `gorm:"column:email;type:varchar(20);comment:'邮箱'" json:"email"`
    /*  电话号码  */
    Phone *string `gorm:"column:phone;type:varchar(11);comment:'电话号码'" json:"phone"`
    /*  联系地址  */
    Address *string `gorm:"column:address;type:varchar(64);comment:'联系地址'" json:"address"`
    /*  职称ID  */
    JobLevelId *int32 `gorm:"column:job_level_id;type:int(11);comment:'职称ID'" json:"job_level_id"`
    /*  职位ID  */
    PosId *int32 `gorm:"column:pos_id;type:int(11);comment:'职位ID'" json:"pos_id"`
    /*  聘用形式  */
    EngageForm *string `gorm:"column:engage_form;type:varchar(8);comment:'聘用形式'" json:"engage_form"`
    /*  最高学历  */
    TiptopDegree *string `gorm:"column:tiptop_degree;type:varchar(8);comment:'最高学历'" json:"tiptop_degree"`
    /*  所属专业  */
    Specialty *string `gorm:"column:specialty;type:varchar(32);comment:'所属专业'" json:"specialty"`
    /*  毕业院校  */
    School *string `gorm:"column:school;type:varchar(32);comment:'毕业院校'" json:"school"`
    /*  入职日期  */
    BeginDate *time.Time `gorm:"column:begin_date;type:date;comment:'入职日期'" json:"begin_date"`
    /*  在职状态  */
    WorkState *string `gorm:"column:work_state;type:varchar(8);comment:'在职状态';default:\'在职\'" json:"work_state"`
    /*  工号  */
    Code *string `gorm:"column:code;type:varchar(8);comment:'工号'" json:"code"`
    /*  合同期限  */
    ContractTerm *float64 `gorm:"column:contract_term;type:double;comment:'合同期限'" json:"contract_term"`
    /*  转正日期  */
    ConversionTime *time.Time `gorm:"column:conversion_time;type:date;comment:'转正日期'" json:"conversion_time"`
    /*  离职日期  */
    NotWokDate *time.Time `gorm:"column:not_wok_date;type:date;comment:'离职日期'" json:"not_wok_date"`
    /*  合同起始日期  */
    BeginContract *time.Time `gorm:"column:begin_contract;type:date;comment:'合同起始日期'" json:"begin_contract"`
    /*  合同终止日期  */
    EndContract *time.Time `gorm:"column:end_contract;type:date;comment:'合同终止日期'" json:"end_contract"`
    /*  工龄  */
    WorkAge *int32 `gorm:"column:work_age;type:int(11);comment:'工龄'" json:"work_age"`
    /*    */
    WorkId *string `gorm:"column:work_id;type:varchar(16);comment:''" json:"work_id"`

}
  • 18
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

leijmdas

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值