平时使用sql的时候可以如下添加默认字段flag:

"select a.*,0 as flag from user_info a",

对于yii2框架则需要这样:

$query =(new \yii\db\Query())
        ->select([
   'r.real_name',
          new Expression("'身份证' id_no_type")
  ])
->from(['r' => $this->tableName()])
05-07 09:38