工单系统表的设计

  1. apps/user.py/model.py

    1. from django.contrib.auth.models import AbstractUser
      from django.db import models
      
      
      # Create your models here.
      
      # 用户表
      
      class User(AbstractUser):
          mobile = models.CharField(\'手机号\', max_length=32, null=True)
          email = models.CharField(\'电子邮箱\', max_length=50, null=True)
      
          class Meta:
              db_table = \'用户表\'
      
      
      # 中文角色名称
      class Role(models.Model):
          zh_name = models.CharField(\'中文角色名称\', max_length=32)
          name = models.CharField(\'角色名称\', max_length=32)
          description = models.TextField(\'描述\')
      
          class Meta:
              db_table = \'角色名称表\'
      
      
      # 用户角色表   关系关联表
      class UserRole(models.Model):
          user = models.ForeignKey(User, on_delete=models.CASCADE)
          roles = models.ForeignKey(Role, on_delete=models.CASCADE)
      
          class Meta:
              db_table = \'用户角色表\'
      
  2. apps/workflow.py/model.py

    1. from django.db import models
      
      # Create your models here.
      
      # 工单分类
      from user.models import User
      
      
      # 工单模板
      class FlowConf(models.Model):
          name = models.CharField(\'工作流名称\', max_length=32)
          customfield = models.TextField(\'自定义字段\')
          description = models.TextField(\'描述\', )
      
          class Meta:
              db_table = \'工单模板\'
      
      
      # 工单分类
      # class FlowType(models.Model):
      #     name = models.CharField(\'工作流名称\', max_length=50)
      #     description = models.TextField(\'描述\', )
      #     flowconf = models.ForeignKey(FlowConf, on_delete=models.CASCADE)
      
      
      # 配置审批流
      class NewFlowUserRoleActionConf(models.Model):
          flowconf = models.ForeignKey(FlowConf, on_delete=models.CASCADE)
          sequence = models.IntegerField(\'审批序号\', )
          approvetype = models.CharField(\'审批类型\', max_length=32, choices=((\'1\', \'user\'), (\'2\', \'role\')))
          approve_type_id = models.CharField(\'审批id\', max_length=32)
      
          class Meta:
              db_table = \'配置审批流\'
      
      # 自动化工单配置
      # class AutoActionConf(models.Model):
      #     flowconf = models.ManyToManyField(FlowConf)
      #     scriptpath = models.CharField(\'执行脚本路径\', max_length=50)
      #     url = models.CharField(\'自动化调用路径\', max_length=200)
      #     method = models.CharField(\'调用自动化接口\', max_length=32)
      #     timeout = models.CharField(\'自动化执行超时时间\', max_length=32)
      
      
  3. apps/workeorderpy/model.py

    1. from django.contrib.auth.models import AbstractUser
      from django.db import models
      
      
      # Create your models here.
      
      # 用户表
      
      class User(AbstractUser):
          mobile = models.CharField(\'手机号\', max_length=32, null=True)
          email = models.CharField(\'电子邮箱\', max_length=50, null=True)
      
          class Meta:
              db_table = \'用户表\'
      
      
      # 中文角色名称
      class Role(models.Model):
          zh_name = models.CharField(\'中文角色名称\', max_length=32)
          name = models.CharField(\'角色名称\', max_length=32)
          description = models.TextField(\'描述\')
      
          class Meta:
              db_table = \'角色名称表\'
      
      
      # 用户角色表   关系关联表
      class UserRole(models.Model):
          user = models.ForeignKey(User, on_delete=models.CASCADE)
          roles = models.ForeignKey(Role, on_delete=models.CASCADE)
      
          class Meta:
              db_table = \'用户角色表\'
      
      

版权声明:本文为wyx-zy原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/wyx-zy/p/14012835.html